2026/01/08 Update

Hexblade shouldn't get Medium Armor prof.
Weapon Specialization Whip isn't a Warblade bonus feat.
Reorganized packages.2da.
Fixed potential issue with SetCompositeBonusT().
Added materials iprops to material based crafting.
Fixed bug w/ DoTrip().
Added heartbeat script to Monk to properly handle monk sizes.
Cleaned up PRCGetCreatureSize().
Set Shielded Casting to use TagItemProperty().
Archivist now has a Lore check to learn spells from scrolls.
Set Dragonfire Strike to use TagItemProperty().
Setup Forsaker to use TagItemProperty().
Fixed distance mismatch with Necrocarnum Shroud.
Added too much debugging for the unarmed stuff.
Cloudkill now obeys Mastery of Shapes.
This commit is contained in:
Jaysyn904
2026-01-08 20:31:11 -05:00
parent 6ca160ca26
commit 6420e5dbb8
28 changed files with 1707 additions and 1117 deletions

View File

@@ -1,20 +1,236 @@
//::///////////////////////////////////////////////
//:: Dragonfire Strike
//:: prc_dragfire_atk.nss
//::///////////////////////////////////////////////
/*
Handles converting the damage on Dragonfire Strike
and similar feats
*/
//:://////////////////////////////////////////////
//:: Created By: Fox
//:: Created On: Nov 23, 2007
//:://////////////////////////////////////////////
//::///////////////////////////////////////////////
//:: Dragonfire Strike
//:: prc_dragfire_atk.nss
//::///////////////////////////////////////////////
/*
Handles converting the damage on Dragonfire Strike
and similar feats
*/
//:://////////////////////////////////////////////
//:: Created By: Fox
//:: Created On: Nov 23, 2007
//::
//:: Updated by: Jaysyn
//:: Updated on: 2026-01-08 10:03:33
//::
//:: Added ItemProperty tagging and constants.
//:://////////////////////////////////////////////
#include "prc_inc_combat"
#include "prc_inc_sneak"
// Constants
const float DRAGONFIRE_DURATION = 99999.0;
const string DRAGONFIRE_TAG = "DragonfireStrike";
// Helper function for consistent weapon detection
int IsDragonfireWeapon(object oItem, object oPC)
{
return (oItem == GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC) ||
(oItem == GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC) && !GetIsShield(oItem)) ||
GetWeaponRanged(oItem));
}
// Helper function to safely add properties to ammo
void AddAmmoProperties(object oPC, int nPropertyType, int nPropertyParam1)
{
if (!GetWeaponRanged(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC)))
return; // Only add ammo for ranged weapons
object oAmmo;
oAmmo = GetItemInSlot(INVENTORY_SLOT_BOLTS, oPC);
if (GetIsObjectValid(oAmmo))
{
itemproperty ip = ItemPropertyOnHitCastSpell(nPropertyType, nPropertyParam1);
ip = TagItemProperty(ip, DRAGONFIRE_TAG);
IPSafeAddItemProperty(oAmmo, ip, DRAGONFIRE_DURATION, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, FALSE);
}
oAmmo = GetItemInSlot(INVENTORY_SLOT_BULLETS, oPC);
if (GetIsObjectValid(oAmmo))
{
itemproperty ip = ItemPropertyOnHitCastSpell(nPropertyType, nPropertyParam1);
ip = TagItemProperty(ip, DRAGONFIRE_TAG);
IPSafeAddItemProperty(oAmmo, ip, DRAGONFIRE_DURATION, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, FALSE);
}
oAmmo = GetItemInSlot(INVENTORY_SLOT_ARROWS, oPC);
if (GetIsObjectValid(oAmmo))
{
itemproperty ip = ItemPropertyOnHitCastSpell(nPropertyType, nPropertyParam1);
ip = TagItemProperty(ip, DRAGONFIRE_TAG);
IPSafeAddItemProperty(oAmmo, ip, DRAGONFIRE_DURATION, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, FALSE);
}
}
// Helper function to safely remove properties from ammo
void RemoveAmmoProperties(object oPC)
{
object oAmmo;
oAmmo = GetItemInSlot(INVENTORY_SLOT_BOLTS, oPC);
if (GetIsObjectValid(oAmmo))
{
itemproperty ipCheck = GetFirstItemProperty(oAmmo);
while (GetIsItemPropertyValid(ipCheck))
{
if (GetItemPropertyTag(ipCheck) == DRAGONFIRE_TAG)
{
RemoveItemProperty(oAmmo, ipCheck);
}
ipCheck = GetNextItemProperty(oAmmo);
}
}
oAmmo = GetItemInSlot(INVENTORY_SLOT_BULLETS, oPC);
if (GetIsObjectValid(oAmmo))
{
itemproperty ipCheck = GetFirstItemProperty(oAmmo);
while (GetIsItemPropertyValid(ipCheck))
{
if (GetItemPropertyTag(ipCheck) == DRAGONFIRE_TAG)
{
RemoveItemProperty(oAmmo, ipCheck);
}
ipCheck = GetNextItemProperty(oAmmo);
}
}
oAmmo = GetItemInSlot(INVENTORY_SLOT_ARROWS, oPC);
if (GetIsObjectValid(oAmmo))
{
itemproperty ipCheck = GetFirstItemProperty(oAmmo);
while (GetIsItemPropertyValid(ipCheck))
{
if (GetItemPropertyTag(ipCheck) == DRAGONFIRE_TAG)
{
RemoveItemProperty(oAmmo, ipCheck);
}
ipCheck = GetNextItemProperty(oAmmo);
}
}
}
// Helper function to add Dragonfire property to weapon
void AddDragonfireProperty(object oItem)
{
itemproperty ip = ItemPropertyOnHitCastSpell(IP_CONST_ONHIT_CASTSPELL_ONHIT_UNIQUEPOWER, 1);
ip = TagItemProperty(ip, DRAGONFIRE_TAG);
IPSafeAddItemProperty(oItem, ip, DRAGONFIRE_DURATION, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, FALSE);
}
// Helper function to remove Dragonfire property from weapon
void RemoveDragonfireProperty(object oItem)
{
itemproperty ipCheck = GetFirstItemProperty(oItem);
while (GetIsItemPropertyValid(ipCheck))
{
if (GetItemPropertyTag(ipCheck) == DRAGONFIRE_TAG)
{
RemoveItemProperty(oItem, ipCheck);
}
ipCheck = GetNextItemProperty(oItem);
}
}
void DoDragonfireSneak(object oPC, object oTarget, object oWeapon)
{
if(DEBUG) DoDebug("Performing Strike");
effect eStrike;
int nType = GetDragonfireDamageType(oPC);
int nDice = GetTotalSneakAttackDice(oPC);
int nSneakDamage = GetSneakAttackDamage(nDice);
int nDamage = nSneakDamage;
struct DamageReducers drTotalReduced = GetTotalReduction(oPC, oTarget, oWeapon);
nDamage = nDamage * (100 - drTotalReduced.nPercentReductions) / 100;
nDamage -= drTotalReduced.nStaticReductions;
if(nDamage < 0) nDamage = 0;
effect eHealed = EffectHeal(nDamage);
if(GetHasFeat(FEAT_DRAGONFIRE_STRIKE, oPC) && GetLocalInt(oPC, "DragonFireOn"))
nSneakDamage += d6();
if(GetHasFeat(FEAT_IMP_DRAGONFIRE_STRIKE, oPC) && GetLocalInt(oPC, "DragonFireOn"))
nSneakDamage += nDice;
effect eSneakDamage = EffectDamage(nSneakDamage, nType);
if(!GetIsImmune(oTarget, IMMUNITY_TYPE_CRITICAL_HIT))
eStrike = EffectLinkEffects(eSneakDamage, eHealed);
else
eStrike = eSneakDamage;
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eStrike, oTarget);
}
void main()
{
int nEvent = GetRunningEvent();
if(DEBUG) DoDebug("prc_dragfire_atk running, event: " + IntToString(nEvent));
object oPC;
switch(nEvent)
{
case EVENT_ONPLAYEREQUIPITEM: oPC = GetItemLastEquippedBy(); break;
case EVENT_ONPLAYERUNEQUIPITEM: oPC = GetItemLastUnequippedBy(); break;
default: oPC = OBJECT_SELF;
}
object oItem;
if(nEvent == EVENT_ONPLAYEREQUIPITEM)
{
oItem = GetItemLastEquipped();
if(DEBUG) DoDebug("prc_dragfire_atk - OnEquip");
if(IsDragonfireWeapon(oItem, oPC))
{
// Add eventhook to the item
AddEventScript(oItem, EVENT_ITEM_ONHIT, "prc_dragfire_atk", TRUE, FALSE);
// Add the OnHitCastSpell: Unique needed to trigger the event
AddDragonfireProperty(oItem);
// Add properties to ammo only for ranged weapons
AddAmmoProperties(oPC, IP_CONST_ONHIT_CASTSPELL_ONHIT_UNIQUEPOWER, 1);
}
}
else if(nEvent == EVENT_ONPLAYERUNEQUIPITEM)
{
oItem = GetItemLastUnequipped();
if(DEBUG) DoDebug("prc_dragfire_atk - OnUnEquip");
if(IsDragonfireWeapon(oItem, oPC))
{
// Remove eventhook from the item
RemoveEventScript(oItem, EVENT_ITEM_ONHIT, "prc_dragfire_atk", TRUE, FALSE);
// Remove the temporary OnHitCastSpell: Unique
RemoveDragonfireProperty(oItem);
// Remove properties from ammo
RemoveAmmoProperties(oPC);
}
}
else if(nEvent == EVENT_ITEM_ONHIT)
{
object oTarget = PRCGetSpellTargetObject();
oItem = GetSpellCastItem();
if(!IsDragonfireWeapon(oItem, oPC))
return;
if(DEBUG) DoDebug("Weapon Used: " + GetName(oItem));
if(DEBUG) DoDebug("CanSneakAttack: " + IntToString(GetCanSneakAttack(oTarget, oPC)));
if(DEBUG) DoDebug("Dice: " + IntToString(GetTotalSneakAttackDice(oPC)));
if(GetCanSneakAttack(oTarget, oPC)
&& GetTotalSneakAttackDice(oPC)
&& GetLocalInt(oPC, "DragonFireOn"))
DoDragonfireSneak(oPC, oTarget, oItem);
}
}
#include "prc_inc_combat"
#include "prc_inc_sneak"
void DoDragonfireSneak(object oPC, object oTarget, object oWeapon)
/* void DoDragonfireSneak(object oPC, object oTarget, object oWeapon)
{
if(DEBUG) DoDebug("Performing Strike");
effect eStrike;
@@ -132,4 +348,4 @@ void main()
&& GetLocalInt(oPC, "DragonFireOn"))
DoDragonfireSneak(oPC, oTarget, oItem);
}
}
} */