#include "nw_i0_generic"
#include "nw_i0_plot"
// * Applies an XP and GP penalty
// * to the player respawning
void ApplyPenalty(object oDead)
{
int nXP = GetXP(oDead);
int nPenalty = 50 * GetHitDice(oDead);
int nHD = GetHitDice(oDead);
// * You can not lose a level with this respawning
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;
int nNewXP = nXP - nPenalty;
if (nNewXP < nMin)
nNewXP = nMin;
SetXP(oDead, nNewXP);
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
// * a cap of 10 000gp taken from you
if (nGoldToTake > 10000)
{
nGoldToTake = 10000;
}
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
}
void main()
{
object oTargetHeaven = GetWaypointByTag("WP_HEAVEN");
location lTargetHeaven = GetLocation(oTargetHeaven);
object oTargetHell = GetWaypointByTag("WP_HELL");
location lTargetHell = GetLocation(oTargetHell);
object oTargetPurg = GetWaypointByTag("WP_PURG");
location lTargetPurg = GetLocation(oTargetPurg);
effect eRespawnHell = EffectVisualEffect(VFX_FNF_SUMMON_GATE);
effect eRespawnPurg = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
effect eRespawnHeaven = EffectVisualEffect(VFX_FNF_SUMMON_CELESTIAL);
object oRespawner = GetLastRespawnButtonPresser();
if (GetGoodEvilValue(oRespawner) <= 29)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRespawnHell, oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
AssignCommand(oRespawner, JumpToLocation(lTargetHell));
}
else if ((GetGoodEvilValue(oRespawner) >= 30) && (GetGoodEvilValue(oRespawner) <= 70))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRespawnPurg, oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
AssignCommand(oRespawner, JumpToLocation(lTargetPurg));
}
else if (GetGoodEvilValue(oRespawner) >= 71)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRespawnHeaven, oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
AssignCommand(oRespawner, JumpToLocation(lTargetHeaven));
}
}