//:://///////////////////////////////////////////// //:: Temple Cast Heal //:: NW_D1_TEMPLEHEAL.nss //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Fakes the effects of a greater restorations spell on the PC and any associates. */ //::////////////////////////////////////////////// //:: Created By: Aidan //:: Created On: May29,2002 //::////////////////////////////////////////////// void FakeRestore(object oTarget); #include "faction_inc" #include "prc_inc_spells" void main() { object oPC = GetPCSpeaker(); object oHenchman = GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oPC); object oAnimal = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION,oPC); object oFamiliar = GetAssociate(ASSOCIATE_TYPE_FAMILIAR,oPC); object oDominated = GetAssociate(ASSOCIATE_TYPE_DOMINATED,oPC); object oSummoned = GetAssociate(ASSOCIATE_TYPE_SUMMONED,oPC); ActionPauseConversation(); int nFaction = fctn_GetFaction(oPC); if (fctn_Pay(nFaction, 1, "magic")) { ActionCastSpellAtObject(SPELL_GREATER_RESTORATION, oPC, METAMAGIC_ANY, TRUE); ActionDoCommand(FakeRestore(oPC)); ActionDoCommand(FakeRestore(oHenchman)); ActionDoCommand(FakeRestore(oAnimal)); ActionDoCommand(FakeRestore(oFamiliar)); ActionDoCommand(FakeRestore(oDominated)); ActionDoCommand(FakeRestore(oSummoned)); } else { fctn_SendMessageToFaction(color_ConvertString("Your faction's magic reserves have been depleted.", COLOR_RED), nFaction); ActionSpeakString("I'm sorry, I'm all out of spells at the moment.."); } ActionResumeConversation(); } void FakeRestore(object oTarget) { if (!GetIsObjectValid(oTarget)) return; effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION_GREATER); effect eBad = GetFirstEffect(oTarget); //Search for negative effects while(GetIsEffectValid(eBad)) { if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS || GetEffectType(eBad) == EFFECT_TYPE_DEAF || GetEffectType(eBad) == EFFECT_TYPE_CURSE || GetEffectType(eBad) == EFFECT_TYPE_DISEASE || GetEffectType(eBad) == EFFECT_TYPE_POISON || GetEffectType(eBad) == EFFECT_TYPE_PARALYZE || GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL) { //Remove effect if it is negative. if (GetEffectSubType(eBad) != SUBTYPE_SUPERNATURAL) RemoveEffect(oTarget, eBad); } eBad = GetNextEffect(oTarget); } if(MyPRCGetRacialType(oTarget) != RACIAL_TYPE_UNDEAD) { //Apply the VFX impact and effects int nHeal = GetMaxHitPoints(oTarget) - GetCurrentHitPoints(oTarget); effect eHeal = EffectHeal(nHeal); if (nHeal > 0) ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget); } ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oTarget); }