Files
Anphillia_PRC8/_removed/nw_s0_masheal.nss
Jaysyn904 28cdb617b3 Initial commit
Adding all of the current content for Anphillia Unlimited.
2024-01-04 07:49:38 -05:00

121 lines
4.3 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Mass Heal
//:: [NW_S0_MasHeal.nss]
//:: Copyright (c) 2000 Bioware Corp.
//:://////////////////////////////////////////////
//:: Heals all friendly targets within 10ft to full
//:: unless they are undead.
//:: If undead they reduced to 1d4 HP.
/*
Anphillia Changes
This spell now does heals/damages for 10/Caster Level , up to a maximum of
200, but never as much Damage as to kill the target.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: April 11, 2001
//:://////////////////////////////////////////////
#include "NW_I0_SPELLS"
#include "x2_inc_spellhook"
void main()
{
/*
Spellcast Hook Code
Added 2003-06-23 by GeorgZ
If you want to make changes to all spells,
check x2_inc_spellhook.nss to find out more
*/
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
// End of Spell Cast Hook
//Declare major variables
int nCasterLvl = GetCasterLevel(OBJECT_SELF);
// Limit caster level to 15
if (nCasterLvl > 20)
nCasterLvl = 20;
effect eKill;
effect eVis = EffectVisualEffect(VFX_IMP_SUNSTRIKE);
effect eHeal;
effect eVis2 = EffectVisualEffect(VFX_IMP_HEALING_G);
effect eStrike = EffectVisualEffect(VFX_FNF_LOS_HOLY_10);
int nTouch, nModify, nDamage, nHeal;
int nMetaMagic = GetMetaMagicFeat();
float fDelay;
location lLoc = GetSpellTargetLocation();
//Apply VFX area impact
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eStrike, lLoc);
//Get first target in spell area
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, lLoc);
while(GetIsObjectValid(oTarget))
{
fDelay = GetRandomDelay();
//Check to see if the target is an undead
if (GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD && !GetIsReactionTypeFriendly(oTarget))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_MASS_HEAL));
//Make a touch attack
nTouch = TouchAttackRanged(oTarget);
if (nTouch > 0)
{
if(!GetIsReactionTypeFriendly(oTarget))
{
//Make an SR check
if (!MyResistSpell(OBJECT_SELF, oTarget, fDelay))
{
//Roll damage
nDamage = 10 * nCasterLvl;
// Will Save for half damage
if (MySavingThrow(SAVING_THROW_WILL, oTarget, GetSpellSaveDC()))
nDamage = nDamage/2;
// Prevent killing the enemy
int nCurrentHP = GetCurrentHitPoints(oTarget);
if (nDamage > nCurrentHP)
nDamage = nCurrentHP - 1;
//Set the damage effect
eKill = EffectDamage(nDamage, DAMAGE_TYPE_POSITIVE);
//Apply the VFX impact and damage effect
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eKill, oTarget));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
}
}
}
}
else
{
//Make a faction check
if(GetRacialType(oTarget) != RACIAL_TYPE_UNDEAD &&
(GetIsFriend(oTarget) ||
(GetIsNeutral(oTarget) && (GetIsPC(oTarget) || GetIsPC(GetMaster(oTarget))) && !GetIsDM(oTarget))))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_MASS_HEAL, FALSE));
//Determine amount to heal
nHeal = 10 * nCasterLvl;
//Set the damage effect
eHeal = EffectHeal(nHeal);
//Apply the VFX impact and heal effect
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis2, oTarget));
}
}
//Get next target in the spell area
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, lLoc);
}
}