Battledale_PRC8/_module/nss/jw_trap_funct.nss
Jaysyn904 7b9e44ebbb Initial upload
Initial upload.  PRC8 has been added.  Module compiles, PRC's default AI & treasure scripts have been integrated.  Started work on top hak for SLA / Ability / Scripting modifications.
2024-03-11 23:44:08 -04:00

231 lines
2.7 KiB
Plaintext

// Returns f,s,a,e,n,c,o or b at random
string GetRandomTrapType();
// Returns the DC of the trap based on sDiff
// Used in TRAP scripts
int getdifficulty(string sDiff);
// Returns the damage type of the trap based on sType
// Eg DAMAGE_TYPE_ACID etc
// Used in TRAP scripts
int getdamtype(string sType);
// Returns the first visual effect of the trap
// This is set off at the trap location. Eg VFX_IMP_SONIC etc
// Used in TRAP scripts
int getfirstvis(string sType);
// Returns the second visual effect of the trap.
// This is set off on the PC
// Used in TRAP scripts
int getsecondvis(string sType);
int getdifficulty (string sDiff)
{
int nDC;
if (sDiff=="1")
{
nDC=15;
}
if (sDiff=="2")
{
nDC=20;
}
if (sDiff=="3")
{
nDC=30;
}
if (sDiff=="4")
{
nDC=35;
}
if (sDiff=="5")
{
nDC=40;
}
return nDC;
}
int getdamtype (string sType)
{
int nDamType;
if (sType=="f")
{
nDamType=DAMAGE_TYPE_FIRE;
}
if (sType=="s")
{
nDamType=DAMAGE_TYPE_PIERCING;
}
if (sType=="a")
{
nDamType=DAMAGE_TYPE_ACID;
}
if (sType=="e")
{
nDamType=DAMAGE_TYPE_ELECTRICAL;
}
if (sType=="n")
{
nDamType=DAMAGE_TYPE_NEGATIVE;
}
if (sType=="c")
{
nDamType=DAMAGE_TYPE_COLD;
}
if (sType=="o")
{
nDamType=DAMAGE_TYPE_SONIC;
}
if (sType=="b")
{
nDamType=DAMAGE_TYPE_SLASHING;
}
return nDamType;
}
int getfirstvis (string sType)
{
int nDamType;
if (sType=="f")
{
nDamType=VFX_IMP_FLAME_M;
}
if (sType=="s")
{
nDamType=VFX_IMP_SPIKE_TRAP;
}
if (sType=="a")
{
nDamType=VFX_IMP_ACID_L;
}
if (sType=="e")
{
nDamType=VFX_IMP_LIGHTNING_M;
}
if (sType=="n")
{
nDamType=VFX_IMP_NEGATIVE_ENERGY;
}
if (sType=="c")
{
nDamType=VFX_IMP_FROST_L;
}
if (sType=="o")
{
nDamType=VFX_IMP_SONIC;
}
if (sType=="b")
{
nDamType=VFX_FNF_SWINGING_BLADE;
}
return nDamType;
}
int getsecondvis (string sType)
{
int nDamType;
if (sType=="f")
{
nDamType=VFX_COM_HIT_FIRE;
}
if (sType=="s")
{
nDamType=VFX_COM_SPARKS_PARRY;
}
if (sType=="a")
{
nDamType=VFX_COM_HIT_ACID;
}
if (sType=="e")
{
nDamType=VFX_COM_HIT_ELECTRICAL;
}
if (sType=="n")
{
nDamType=VFX_COM_HIT_NEGATIVE;
}
if (sType=="c")
{
nDamType=VFX_COM_HIT_FROST;
}
if (sType=="o")
{
nDamType=VFX_COM_HIT_SONIC;
}
if (sType=="b")
{
nDamType=VFX_COM_CHUNK_RED_MEDIUM;
}
return nDamType;
}
// Returns f,s,a,e,n,c,o or b at random
string GetRandomTrapType()
{
string sReturn="b";
int nRandom=d8();
switch (nRandom)
{
case 1: sReturn="f";
break;
case 2: sReturn="s";
break;
case 3: sReturn="a";
break;
case 4: sReturn="e";
break;
case 5: sReturn="n";
break;
case 6: sReturn="c";
break;
case 7: sReturn="o";
break;
case 8: sReturn="b";
break;
}
return sReturn;
}