RATDOG/_module/nss/entropic_blade.nss
Jaysyn904 df709d33fc Horsefly Swamp update
Creatures & encounter tables to support Horsefly swamp expansion.
2023-08-13 17:21:44 -04:00

92 lines
2.8 KiB
Plaintext

#include "NW_I0_SPELLS"
#include "prc_inc_spells"
void DoWisDamage(object oTarget)
{
effect eWis = EffectAbilityDecrease(ABILITY_WISDOM,1);
eWis = SupernaturalEffect(eWis);
effect eVis2 = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eWis,oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVis2,oTarget);
int nKillEm = FALSE;
if ( (!GetIsPC( oTarget ) ) || ( GetGameDifficulty() >= GAME_DIFFICULTY_CORE_RULES ) )
{
nKillEm = 1;
}
int nTargetAbility = GetAbilityScore(oTarget, ABILITY_WISDOM);
if ( ( (nTargetAbility - 1) < 3) && nKillEm )
{
int nHitPoints = GetCurrentHitPoints(oTarget);
effect eVis = EffectVisualEffect(VFX_IMP_DEATH);
effect eHitDamage = EffectDamage(nHitPoints, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_TWENTY);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVis,oTarget);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eHitDamage, oTarget);
}
}
int DoEntropic(object oTarget, float fDelay)
{
effect eGlow = EffectVisualEffect(408+Random(16));
effect eConfuse = EffectConfused();
effect eMiss = EffectMissChance(50);
effect ePenalty = EffectAttackDecrease(4);
effect eSpell = EffectSpellFailure(100);
effect eLink = EffectLinkEffects(eSpell,ePenalty);
eLink = EffectLinkEffects(eLink,eMiss);
eLink = EffectLinkEffects(eLink,eConfuse);
int nRoll = d20() + GetAbilityModifier(ABILITY_CHARISMA,oTarget);
if ( nRoll <= 21 )
{
DelayCommand(fDelay,SendMessageToPC(oTarget,"Charisma Check to recover from Entropic Blade: " + IntToString(nRoll) + " Fail!"));
DelayCommand(fDelay,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eLink,oTarget,6.0));
DelayCommand(fDelay,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eGlow,oTarget,6.0));
DelayCommand(fDelay,DoWisDamage(oTarget));
return TRUE;
}
else
{
DelayCommand(fDelay,SendMessageToPC(oTarget,"Charisma Check to recover from Entropic Blade: " + IntToString(nRoll) + " Success!"));
DelayCommand(fDelay,SetLocalInt(oTarget,"Entropic",0));
return FALSE;
}
return FALSE;
}
void main()
{
object oOrigin = OBJECT_SELF ; // Where the spell came from
object oTarget = PRCGetSpellTargetObject(); // What the spell is aimed at
if ( GetLocalInt(oTarget,"Entropic") )
{
SendMessageToPC(oOrigin,"Creature already has this effect.");
return;
}
int nDelay = 0;
if ( PRCMySavingThrow(SAVING_THROW_FORT,oTarget,21) )
return;
SetLocalInt(oTarget,"Entropic",1);
effect eVis = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVis,oTarget);
while ( DoEntropic(oTarget,RoundsToSeconds(nDelay)) && nDelay < 10 )
{
nDelay++;
}
}