Alangara_PRC8/_removed/NW_S0_HEAL.nss
Jaysyn904 86feb9ca6f Initial commit
Initial commit.
2024-06-05 21:21:06 -04:00

193 lines
8.1 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Heal
//:: [NW_S0_Heal.nss]
//:: Copyright (c) 2000 Bioware Corp.
//:://////////////////////////////////////////////
#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
object oTarget = GetSpellTargetObject();
effect eKill, eHeal;
int nDamage, nHeal, nModify, nMetaMagic, nTouch;
int nCasterLvl = ( GetCasterLevel(OBJECT_SELF)*20)+100;
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
nModify = d4();
nMetaMagic = GetMetaMagicFeat();
//Make metamagic check
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nModify = 1;
}
//Figure out the amount of damage to inflict
nDamage = nCasterLvl;
// nDamage = GetCurrentHitPoints(oTarget) - nModify;
//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 = GetMaxHitPoints(oTarget);
// Activating Tarashon's unique healing system for "Alangara - New Dawn" !
nHeal = nCasterLvl;
// *** Setting the various class modifications to all healing *** //
// * SINGLE CLASS Fighters gain + 30 % healing *
if ( GetLevelByClass(CLASS_TYPE_BARBARIAN, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_BARD, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_CLERIC, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_DRUID, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_MONK, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_PALADIN, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_RANGER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_ROGUE, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_SORCERER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_WIZARD, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_ARCANE_ARCHER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_ASSASSIN, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_BLACKGUARD, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_DIVINE_CHAMPION, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_DWARVEN_DEFENDER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_HARPER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_PALE_MASTER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_PURPLE_DRAGON_KNIGHT, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_DRAGON_DISCIPLE, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_SHADOWDANCER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_SHIFTER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_WEAPON_MASTER, oTarget) == 0 )
{
nHeal = (nHeal*1300)/1000;
}
// * SINGLE CLASS Barbarians gain + 50 % healing *
else if ( GetLevelByClass(CLASS_TYPE_FIGHTER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_BARD, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_CLERIC, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_DRUID, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_MONK, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_PALADIN, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_RANGER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_ROGUE, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_SORCERER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_WIZARD, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_ARCANE_ARCHER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_ASSASSIN, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_BLACKGUARD, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_DIVINE_CHAMPION, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_DWARVEN_DEFENDER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_HARPER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_PALE_MASTER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_PURPLE_DRAGON_KNIGHT, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_DRAGON_DISCIPLE, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_SHADOWDANCER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_SHIFTER, oTarget) == 0 &&
GetLevelByClass(CLASS_TYPE_WEAPON_MASTER, oTarget) == 0 )
{
nHeal = (nHeal*1500)/1000;
}
// * Any character having Barbarian levels gain + 20 % healing *
else if ( GetLevelByClass(CLASS_TYPE_BARBARIAN, oTarget) > 0 )
{
nHeal = (nHeal*1200)/1000;
}
// * Any character having Fighter levels gain + 15 % healing *
else if ( GetLevelByClass(CLASS_TYPE_FIGHTER, oTarget) > 0 )
{
nHeal = (nHeal*1150)/1000;
}
// * Any character having Ranger or Paladin levels get + 10% healing. *
else if ( GetLevelByClass(CLASS_TYPE_RANGER, oTarget) > 0 ||
GetLevelByClass(CLASS_TYPE_PALADIN, oTarget) > 0 )
{
nHeal = (nHeal*1100)/1000;
}
// *** End of Tarashons healing system modifiers *** //
// *** New factor making sure the big bad monsters actually fully heal themself as intented *** //
if ( GetRacialType(oTarget) != RACIAL_TYPE_DWARF &&
GetRacialType(oTarget) != RACIAL_TYPE_ELF &&
GetRacialType(oTarget) != RACIAL_TYPE_GNOME &&
GetRacialType(oTarget) != RACIAL_TYPE_HALFLING &&
GetRacialType(oTarget) != RACIAL_TYPE_HALFELF &&
GetRacialType(oTarget) != RACIAL_TYPE_HALFORC &&
GetRacialType(oTarget) != RACIAL_TYPE_HUMAN )
{
nHeal = 10000;
}
// *** End of NPC heal modifier *** //
//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);
}
}