//:://///////////////////////////////////////////// //:: Heal //:: [NW_S0_Heal.nss] //:: Copyright (c) 2000 Bioware Corp. //::////////////////////////////////////////////// //:: Heals the target 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 150, but never as much Damage as to kill the target. */ //::////////////////////////////////////////////// //:: Created By: Preston Watamaniuk //:: Created On: Jan 12, 2001 //::////////////////////////////////////////////// //:: Update Pass By: Preston W, On: Aug 1, 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 > 15) nCasterLvl = 15; object oTarget = GetSpellTargetObject(); effect eKill, eHeal; int nDamage, nHeal, nModify, nMetaMagic, nTouch; effect eSun = EffectVisualEffect(VFX_IMP_SUNSTRIKE); effect eHealVis = EffectVisualEffect(VFX_IMP_HEALING_X); //Check to see if the target is an undead if (GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD) { if(!GetIsReactionTypeFriendly(oTarget)) { //Fire cast spell at event for the specified target SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_HEAL)); //Make a touch attack if (TouchAttackMelee(oTarget)) { //Make SR check if (!MyResistSpell(OBJECT_SELF, oTarget)) { //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 damage eKill = EffectDamage(nDamage, DAMAGE_TYPE_POSITIVE); //Apply damage effect and VFX impact ApplyEffectToObject(DURATION_TYPE_INSTANT, eKill, oTarget); ApplyEffectToObject(DURATION_TYPE_INSTANT, eSun, oTarget); } } } } else { //Fire cast spell at event for the specified target SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_HEAL, FALSE)); //Figure out how much to heal nHeal = 10 * nCasterLvl; //Set the heal effect eHeal = EffectHeal(nHeal); //Apply the heal effect and the VFX impact ApplyEffectToObject(DURATION_TYPE_INSTANT, eHealVis, oTarget); ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget); } }