249 lines
8.4 KiB
Plaintext
249 lines
8.4 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Combust
|
|
//:: X2_S0_Combust
|
|
//:: Copyright (c) 2000 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
The initial eruption of flame causes 2d6 fire damage +1
|
|
point per caster level(maximum +10)
|
|
with no saving throw.
|
|
|
|
Further, the creature must make
|
|
a Reflex save or catch fire taking a further 1d6 points
|
|
of damage. This will continue until the Reflex save is
|
|
made.
|
|
|
|
There is an undocumented artificial limit of
|
|
10 + casterlevel rounds on this spell to prevent
|
|
it from running indefinitly when used against
|
|
fire resistant creatures with bad saving throws
|
|
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
// Created: 2003/09/05 Georg Zoeller
|
|
//:://////////////////////////////////////////////
|
|
|
|
#include "ke_spell_factor"
|
|
|
|
#include "x2_I0_SPELLS"
|
|
#include "x2_inc_toollib"
|
|
#include "x2_inc_spellhook"
|
|
|
|
void RunCombustImpact(object oTarget, object oCaster, int nLevel, int nMetaMagic);
|
|
|
|
void main()
|
|
{
|
|
|
|
object oTarget = GetSpellTargetObject();
|
|
object oCaster = OBJECT_SELF;
|
|
|
|
//--------------------------------------------------------------------------
|
|
// 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())
|
|
{
|
|
return;
|
|
}
|
|
// End of Spell Cast Hook
|
|
|
|
//--------------------------------------------------------------------------
|
|
// Calculate the save DC
|
|
//--------------------------------------------------------------------------
|
|
int nDC = GetSpellSaveDC();
|
|
int nLevel = GetCasterLevel(OBJECT_SELF);
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
// Calculate the damage, 2d6 + casterlevel, capped at +10
|
|
//--------------------------------------------------------------------------
|
|
int nDamage = nLevel;
|
|
|
|
|
|
|
|
|
|
if (nDamage > 1)
|
|
{
|
|
nDamage = d4(nLevel)+20;
|
|
// nDamage = 10;
|
|
}
|
|
int nMetaMagic = GetMetaMagicFeat();
|
|
if (nMetaMagic == METAMAGIC_MAXIMIZE)
|
|
{
|
|
// nDamage += 12;//Damage is at max
|
|
nDamage = (4 * nLevel)+20;
|
|
}
|
|
else
|
|
{
|
|
nDamage = d4(nLevel);
|
|
if (nMetaMagic == METAMAGIC_EMPOWER)
|
|
{
|
|
nDamage = (nDamage + (nDamage/2))+20;//Damage/Healing is +50%
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------
|
|
// Calculate the duration (we need a duration or bad things would happen
|
|
// if someone is immune to fire but fails his safe all the time)
|
|
//--------------------------------------------------------------------------
|
|
int nDuration = 10 + GetCasterLevel(OBJECT_SELF);
|
|
if (nDuration < 1)
|
|
{
|
|
nDuration = 10;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------
|
|
// Setup Effects
|
|
//--------------------------------------------------------------------------
|
|
|
|
//starting the grand circus of importing and converting back and forth //
|
|
|
|
float fDamage = IntToFloat(nDamage);
|
|
|
|
// multiplaying damage with fFactor //
|
|
|
|
float fFactor = CalculateFactor();
|
|
|
|
fDamage = fDamage * fFactor;
|
|
|
|
// converting the float damage back to INT damage so we can use it again //
|
|
|
|
int nDamage2 = FloatToInt(fDamage);
|
|
|
|
// Done and remember to change nDamage with nDamage2 below :) //
|
|
|
|
|
|
|
|
|
|
|
|
effect eDam = EffectDamage(nDamage2, DAMAGE_TYPE_FIRE);
|
|
effect eDur = EffectVisualEffect(498);
|
|
|
|
if(!GetIsReactionTypeFriendly(oTarget))
|
|
{
|
|
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId()));
|
|
|
|
//-----------------------------------------------------------------------
|
|
// Check SR
|
|
//-----------------------------------------------------------------------
|
|
if(!MyResistSpell(OBJECT_SELF, oTarget))
|
|
{
|
|
|
|
//-------------------------------------------------------------------
|
|
// Apply VFX
|
|
//-------------------------------------------------------------------
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
|
|
TLVFXPillar(VFX_IMP_FLAME_M, GetLocation(oTarget), 5, 0.1f,0.0f, 2.0f);
|
|
|
|
//------------------------------------------------------------------
|
|
// This spell no longer stacks. If there is one of that type,
|
|
// that's enough
|
|
//------------------------------------------------------------------
|
|
if (GetHasSpellEffect(GetSpellId(),oTarget) || GetHasSpellEffect(SPELL_INFERNO,oTarget) )
|
|
{
|
|
FloatingTextStrRefOnCreature(100775,OBJECT_SELF,FALSE);
|
|
return;
|
|
}
|
|
|
|
//------------------------------------------------------------------
|
|
// Apply the VFX that is used to track the spells duration
|
|
//------------------------------------------------------------------
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, oTarget, RoundsToSeconds(nDuration));
|
|
|
|
//------------------------------------------------------------------
|
|
// Save the spell save DC as a variable for later retrieval
|
|
//------------------------------------------------------------------
|
|
SetLocalInt(oTarget,"XP2_L_SPELL_SAVE_DC_" + IntToString (SPELL_COMBUST), nDC);
|
|
|
|
//------------------------------------------------------------------
|
|
// Tick damage after 6 seconds again
|
|
//------------------------------------------------------------------
|
|
DelayCommand(6.0, RunCombustImpact(oTarget,oCaster,nLevel, nMetaMagic));
|
|
}
|
|
}
|
|
}
|
|
|
|
void RunCombustImpact(object oTarget, object oCaster, int nLevel, int nMetaMagic)
|
|
{
|
|
//--------------------------------------------------------------------------
|
|
// Check if the spell has expired (check also removes effects)
|
|
//--------------------------------------------------------------------------
|
|
if (GZGetDelayedSpellEffectsExpired(SPELL_COMBUST,oTarget,oCaster))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (GetIsDead(oTarget) == FALSE)
|
|
{
|
|
|
|
int nDC = GetLocalInt(oTarget,"XP2_L_SPELL_SAVE_DC_" + IntToString (SPELL_COMBUST));
|
|
|
|
if(!MySavingThrow(SAVING_THROW_REFLEX, oTarget, nDC, SAVING_THROW_TYPE_FIRE))
|
|
{
|
|
//------------------------------------------------------------------
|
|
// Calculate the damage, 1d6 + casterlevel, capped at +10
|
|
//------------------------------------------------------------------
|
|
int nDamage = d4(nLevel);
|
|
if (nDamage > 1)
|
|
{
|
|
nDamage = d4(nLevel);
|
|
}
|
|
if (nMetaMagic == METAMAGIC_MAXIMIZE)
|
|
{
|
|
nDamage = d4(nLevel);
|
|
}
|
|
else
|
|
{
|
|
nDamage = d4(nLevel);
|
|
if (nMetaMagic == METAMAGIC_EMPOWER)
|
|
{
|
|
nDamage = d4(nLevel);
|
|
}
|
|
}
|
|
|
|
//starting the grand circus of importing and converting back and forth //
|
|
|
|
float fDamage = IntToFloat(nDamage);
|
|
|
|
// multiplaying damage with fFactor //
|
|
|
|
float fFactor = CalculateFactor();
|
|
|
|
fDamage = fDamage * fFactor;
|
|
|
|
// converting the float damage back to INT damage so we can use it again //
|
|
|
|
int nDamage3 = FloatToInt(fDamage);
|
|
|
|
// Done and remember to change nDamage with nDamage2 below :) //
|
|
|
|
|
|
|
|
effect eDmg = EffectDamage(nDamage3,DAMAGE_TYPE_FIRE);
|
|
effect eVFX = EffectVisualEffect(VFX_IMP_FLAME_S);
|
|
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,eDmg,oTarget);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVFX,oTarget);
|
|
|
|
//------------------------------------------------------------------
|
|
// After six seconds (1 round), check damage again
|
|
//------------------------------------------------------------------
|
|
DelayCommand(6.0f,RunCombustImpact(oTarget,oCaster, nLevel,nMetaMagic));
|
|
}
|
|
else
|
|
{
|
|
DeleteLocalInt(oTarget,"XP2_L_SPELL_SAVE_DC_" + IntToString (SPELL_COMBUST));
|
|
GZRemoveSpellEffects(SPELL_COMBUST, oTarget);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|