Added Mine & Caverns raise & lower functionality
Added Mine & Caverns raise & lower functionality. Revamped Level 1 events to match PnP. Updated Level 1: Core. Added new Footcatcher trap type. Added Underwater heartbeat to Glop Lake Underwater. Full compile.
This commit is contained in:
67
_module/nss/lw_trap_ondisarm.nss
Normal file
67
_module/nss/lw_trap_ondisarm.nss
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
OnDisarm
|
||||
|
||||
Awards XP for disarming traps
|
||||
|
||||
For nonmagical harmless traps set the trap type to "minor entangle trap"
|
||||
For magical traps, use the local int TRAP_DAMAGE_OVERRIDE
|
||||
*/
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastDisarmed();
|
||||
|
||||
if (GetIsPC(oPC) )
|
||||
{
|
||||
int nTrapCR = 0;
|
||||
int nDisarmDC = GetTrapDisarmDC(OBJECT_SELF);
|
||||
int nDetectDC = GetTrapDetectDC(OBJECT_SELF);
|
||||
int nRow, nDam, nDamOvr;
|
||||
|
||||
// Modify the CR based on the Disarm DC
|
||||
if (nDisarmDC > 30)
|
||||
{
|
||||
nTrapCR = nTrapCR + 2;
|
||||
}
|
||||
else if (nDisarmDC > 15)
|
||||
{
|
||||
nTrapCR = nTrapCR + 1;
|
||||
}
|
||||
|
||||
// Modify the CR based on the Detect DC
|
||||
if (nDetectDC > 30)
|
||||
{
|
||||
nTrapCR = nTrapCR + 2;
|
||||
}
|
||||
else if (nDetectDC > 15)
|
||||
{
|
||||
nTrapCR = nTrapCR + 1;
|
||||
}
|
||||
|
||||
// Determine the average amount of damage to use in the final CR calculation
|
||||
nDamOvr = GetLocalInt(OBJECT_SELF, "TRAP_DAMAGE_OVERRIDE");
|
||||
if (!nDamOvr)
|
||||
{
|
||||
nRow = GetTrapBaseType(OBJECT_SELF);
|
||||
nDam = StringToInt(Get2DAString("traps.2da", "MedianDamage", nRow));
|
||||
}
|
||||
else
|
||||
{
|
||||
nDam = nDamOvr;
|
||||
}
|
||||
|
||||
// Calculate the total Trap CR
|
||||
nTrapCR = nTrapCR + (nDam /7);
|
||||
|
||||
// Calculate the final award - PC only
|
||||
int nLevel = GetHitDice(oPC);
|
||||
int nXPScale = GetModuleXPScale();
|
||||
float fAward = (300.00 / IntToFloat(nXPScale)) * IntToFloat(nLevel) * pow(2.0, (IntToFloat(nTrapCR)-IntToFloat(nLevel)) * 0.5);
|
||||
|
||||
// Award some XP
|
||||
if (fAward > 0.0)
|
||||
{
|
||||
GiveXPToCreature(oPC, FloatToInt(fAward));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user