UW2_PRC8/_haks/poa_exp_spells/x0_s0_ether.nss

114 lines
3.8 KiB
Plaintext
Raw Normal View History

//::///////////////////////////////////////////////
//:: Etherealness
//:: x0_s0_ether.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Like sanctuary except almost always guaranteed
to work.
Lasts one turn per level.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Jan 7, 2002
//:://////////////////////////////////////////////
//:: altered by mr_bumpkin Dec 4, 2003 for prc stuff
#include "prc_inc_spells"
#include "prc_add_spell_dc"
#include "prc_inc_teleport"
void main()
{
//Spell Time Lock duration (in seconds, use float values)
float iLockTimer = 240.0;
//Defining time variables
float f120togo = ( 120 - iLockTimer ) * -1;
float f60togo = ( 60 - iLockTimer ) * -1;
float f10togo = ( 10 - iLockTimer ) * -1;
//Checking spell's caster
object oTarget = PRCGetSpellTargetObject();
//Checking if he used GS recently
int iTimer = GetLocalInt(oTarget, "GSTimer");
if (iTimer == 0) //teste
{
SetLocalInt(oTarget, "GSTimer", 1);
//Change: Checking target's area
object oArea = GetArea(oTarget);
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
SetLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_TRANSMUTATION);
/*
Spellcast Hook Code
Added 2003-06-20 by Georg
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 = PRCGetSpellTargetObject();
effect eVis = EffectVisualEffect(VFX_DUR_SANCTUARY);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
effect eSanc = EffectEthereal();
effect eLink = EffectLinkEffects(eVis, eSanc);
eLink = EffectLinkEffects(eLink, eDur);
int CasterLvl = PRCGetCasterLevel(OBJECT_SELF);
int nDuration = CasterLvl/10; //nerfei a duracao aqui
//Enter Metamagic conditions
int nMetaMagic = PRCGetMetaMagicFeat();
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EXTEND))
{
nDuration = nDuration *2; //Duration is +100%
}
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_ETHEREALNESS, FALSE));
// Make a check to see nothing is preventing extra-dimensional movement
if(GetCanTeleport(oTarget, GetLocation(oTarget), FALSE, TRUE))
{
//Apply the VFX impact and effects
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, TurnsToSeconds(nDuration),TRUE,-1,CasterLvl/10); //casterlvl/10 aqui antes era so casterlvl
}
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
// Erasing the variable used to store the spell's spell school
SendMessageToAllDMs("Player "+ObjectToString(oTarget)+" has just cast Greater Sanctuary. He is currently in "+ObjectToString(oArea)+".");
SendMessageToPC(oTarget, "Greater Sanctuary has a timer of "+FloatToString(iLockTimer, 3, 1)+" seconds. You may not use GS again for this period of time. Attempting to do so will spend the spell while producing no effect.");
DelayCommand(f120togo, SendMessageToPC(oTarget, "You have two minutes left on your Greater Sanctuary Lock Timer."));
DelayCommand(f60togo, SendMessageToPC(oTarget, "You have one minute left on your Greater Sanctuary Lock Timer."));
DelayCommand(f10togo, SendMessageToPC(oTarget, "You have 10 seconds left on your Greater Sanctuary Lock Timer."));
DelayCommand(iLockTimer, SendMessageToPC(oTarget, "Greater Sanctuary is once again available for use."));
DelayCommand(iLockTimer, SetLocalInt(oTarget, "GSTimer", 0));
}
else
{
SendMessageToPC(oTarget, "You have used Greater Sanctuary too recently, the effect has been cancelled");
}
}