59 lines
2.4 KiB
Plaintext
59 lines
2.4 KiB
Plaintext
#include "nwnx_weapon"
|
|
#include "nwnx_damage"
|
|
|
|
void main ()
|
|
{
|
|
//if (!GetIsPC(OBJECT_SELF)) return; // again, only for PCs, up to you
|
|
struct NWNX_Damage_AttackEventData data = NWNX_Damage_GetAttackEventData();
|
|
// if local var "devcrit" is > 0 (set in the on devcrit event script) and the current attack is a crit
|
|
if (GetLocalInt(OBJECT_SELF, "devcrit") && data.iAttackResult == 3) // 3 : critical hit
|
|
{
|
|
SetLocalInt(OBJECT_SELF, "devcrit", GetLocalInt(OBJECT_SELF, "devcrit") - 1);
|
|
//int nDC = 10 + GetHitDice(OBJECT_SELF) / 2 + GetAbilityModifier(ABILITY_STRENGTH, OBJECT_SELF);
|
|
//int nFort = GetFortitudeSavingThrow(data.oTarget);
|
|
//int nRoll = d20();
|
|
//int nFortSave = nFort + nRoll;
|
|
//if (nFortSave < nDC)
|
|
//{
|
|
//SendMessageToPC(OBJECT_SELF, GetName(data.oTarget)+" : Fortitude Save : *failure* : ("+IntToString(nRoll)+" + "+IntToString(nFort)+" = "+IntToString(nFortSave)+" vs. DC: "+IntToString(nDC)+")");
|
|
|
|
/* if (GetIsPC(data.oTarget)) SendMessageToPC(data.oTarget, "Devastating Critical Hit : Fortitude Save : *failure* : ("+IntToString(nRoll)+" + "+IntToString(nFort)+" = "+IntToString(nFortSave)+" vs. DC: "+IntToString(nDC)+")"); */
|
|
|
|
if (GetIsPC(data.oTarget))
|
|
{
|
|
SendMessageToPC(data.oTarget, "Devastating Critical Hit: 10x damage!");
|
|
}
|
|
|
|
data.iAttackResult = 10; // 10 : dev crit
|
|
|
|
// do your stuff here
|
|
|
|
// if damage is going to kill the target set local var "devcrit" to 0 so there is no devcrit "queued up" for the next target
|
|
int nTotalDamage =
|
|
data.iBase * 10 +
|
|
data.iSlash +
|
|
data.iPierce +
|
|
data.iBludgeoning +
|
|
data.iFire +
|
|
data.iAcid +
|
|
data.iCold +
|
|
data.iElectrical +
|
|
data.iSonic +
|
|
data.iMagical +
|
|
data.iDivine +
|
|
data.iNegative +
|
|
data.iPositive;
|
|
|
|
if (nTotalDamage >= GetCurrentHitPoints(data.oTarget))
|
|
{
|
|
SetLocalInt(OBJECT_SELF, "devcrit", 0);
|
|
}
|
|
|
|
//}
|
|
/* else
|
|
{
|
|
SendMessageToPC(OBJECT_SELF, "Devastating Critical Hit on "+GetName(data.oTarget)+" failed. Fortitude Save : *success* : ("+IntToString(nRoll)+" + "+IntToString(nFort)+" = "+IntToString(nFortSave)+" vs. DC: "+IntToString(nDC)+")");
|
|
if (GetIsPC(data.oTarget)) SendMessageToPC(data.oTarget, "Devastating Critical Hit : Fortitude Save : *success* : ("+IntToString(nRoll)+" + "+IntToString(nFort)+" = "+IntToString(nFortSave)+" vs. DC: "+IntToString(nDC)+")");
|
|
} */
|
|
}
|
|
} |