Battledale_PRC8/_module/nss/jw_firemonster_u.nss
Jaysyn904 e5b3f6ad61 Finished PRC8 integration
Finished PRC8 integration.  Moved creature abilities to top hak.  Setup tooling.  Created release archive
2024-03-12 21:27:23 -04:00

401 lines
15 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Custom User Defined Event
//:: FileName
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
*/
//:://////////////////////////////////////////////
//:: Created By:
//:: Created On:
//:://////////////////////////////////////////////
#include "jw_custom_spells"
#include "NW_I0_GENERIC"
#include "jw_privates_inc"
#include "prc_inc_spells"
// do the custom firesstorm effect
void firestorm();
// do wall of fire
void wallfire();
// do lesser cascade
void lessercascade();
// do lesser fireball
void lesserfireball();
// do fire effect on targets
void ZapTargets();
void main()
{
int nUser = GetUserDefinedEventNumber();
if(nUser == 1001) //HEARTBEAT
{
}
else if(nUser == 1002) // PERCEIVE
{
}
else if(nUser == 1003) // END OF COMBAT
{
// one in three chance of doing a special attack
ZapTargets();
if (d3()!=1)
{
return;
}
int nRandom=Random(6);
int nInt=GetLocalInt(OBJECT_SELF,"spelllist");
if (nInt==0)
{
firestorm();
}
else if (nInt==1)
{
wallfire();
}
else if (nInt==2)
{
lessercascade();
}
else
{
switch (nRandom)
{
case 0: case 1: case 2: lesserfireball(); break;
case 3: firestorm(); break;
case 4: wallfire(); break;
case 5: lessercascade(); break;
}
}
nInt=nInt+1;
SetLocalInt(OBJECT_SELF,"spelllist",nInt);
}
else if(nUser == 1004) // ON DIALOGUE
{
}
else if(nUser == 1005) // ATTACKED
{
}
else if(nUser == 1006) // DAMAGED
{
}
else if(nUser == 1007) // DEATH
{
int nRandom=d6();
string sString;
switch (nRandom)
{
case 1: sString="jw_si_tok_fire"; break;
case 2: sString="jw_si_tok_acid"; break;
case 3: sString="jw_si_tok_ice"; break;
case 4: sString="jw_si_tok_sonic"; break;
case 5: sString="jw_si_tok_death"; break;
case 6: sString="jw_si_tok_light"; break;
}
CreateItemOnObject(sString,OBJECT_SELF,1);
}
else if(nUser == 1008) // DISTURBED
{
}
}
void firestorm()
{
//Declare major variables
int nMetaMagic;
int nDamage;
int nDamage2;
int nCasterLevel = 2;
if(nCasterLevel > 20)
{
nCasterLevel == 20;
}
effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M);
effect eFireStorm = EffectVisualEffect(VFX_FNF_FIRESTORM);
float fDelay;
//Apply Fire and Forget Visual in the area;
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eFireStorm, GetLocation(OBJECT_SELF));
//Declare the spell shape, size and the location. Capture the first target object in the shape.
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF), OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
//Cycle through the targets within the spell shape until an invalid object is captured.
while(GetIsObjectValid(oTarget))
{
//This spell smites everyone who is more than 2 meters away from the caster.
//if (GetDistanceBetween(oTarget, OBJECT_SELF) > 2.0)
//{
if(!GetIsReactionTypeFriendly(oTarget) && !GetIsFriend(oTarget) && oTarget != OBJECT_SELF)
{
fDelay = GetRandomDelay(1.5, 2.5);
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_FIRE_STORM));
//Make SR check, and appropriate saving throw(s).
if (!PRCDoResistSpell(OBJECT_SELF, oTarget, FloatToInt(fDelay)))
{
//Roll Damage
nDamage = d6(nCasterLevel);
//Enter Metamagic conditions
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nDamage = 6 * nCasterLevel;//Damage is at max
}
else if (nMetaMagic == METAMAGIC_EMPOWER)
{
nDamage = nDamage + (nDamage/2);//Damage/Healing is +50%
}
//Save versus both holy and fire damage
nDamage = PRCGetReflexAdjustedDamage(nDamage/2, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_FIRE);
nDamage2 = PRCGetReflexAdjustedDamage(nDamage/2, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_DIVINE);
if(nDamage > 0)
{
// Apply effects to the currently selected target. For this spell we have used
//both Divine and Fire damage.
effect eDivine = EffectDamage(nDamage2, DAMAGE_TYPE_DIVINE);
effect eFire = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eFire, oTarget));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDivine, oTarget));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
}
}
//}
}
//Select the next target within the spell shape.
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF), OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
}
}
void wallfire()
{
//Declare Area of Effect object using the appropriate constant
effect eAOE = EffectAreaOfEffect(AOE_PER_WALLFIRE,"NW_S0_WallFireA","jw_empty_script","jw_empty_script");
//Get the location where the wall is to be placed.
location lTarget = GetLocation(GetVictim());
int nDuration = 10;
if(nDuration == 0)
{
nDuration = 1;
}
int nMetaMagic = PRCGetMetaMagicFeat();
//Check fort metamagic
if (nMetaMagic == METAMAGIC_EXTEND)
{
nDuration = nDuration *2; //Duration is +100%
}
//Create the Area of Effect Object declared above.
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, lTarget, RoundsToSeconds(nDuration));
}
void lessercascade()
{
object oTarget=GetVictim();
//Declare major variables
int nCasterLevel = 2;
int nDamage = d6(nCasterLevel);
int nDamStrike;
int nNumAffected = 0;
//Declare lightning effect connected the casters hands
effect eLightning = EffectBeam(VFX_BEAM_FIRE, OBJECT_SELF, BODY_NODE_HAND);;
effect eVis = EffectVisualEffect(VFX_IMP_FLAME_S);
effect eDamage;
object oFirstTarget = oTarget;
object oHolder;
location lSpellLocation;
//Damage the initial target
if(!GetIsReactionTypeFriendly(oFirstTarget,OBJECT_SELF))
{
//Fire cast spell at event for the specified target
SignalEvent(oFirstTarget, EventSpellCastAt(OBJECT_SELF, SPELL_CHAIN_LIGHTNING));
//Make an SR Check
if (!ScrollResist(OBJECT_SELF, oFirstTarget))
{
//Adjust damage via Reflex Save or Evasion or Improved Evasion
nDamStrike = PRCGetReflexAdjustedDamage(nDamage, oFirstTarget, 24, SAVING_THROW_TYPE_FIRE);
//Set the damage effect for the first target
eDamage = EffectDamage(nDamStrike, DAMAGE_TYPE_FIRE);
//Apply damage to the first target and the VFX impact.
if(nDamStrike > 0)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,eDamage,oFirstTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVis,oFirstTarget);
}
}
}
//Apply the lightning stream effect to the first target, connecting it with the caster
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eLightning,oFirstTarget,0.5);
//Reinitialize the lightning effect so that it travels from the first target to the next target
eLightning = EffectBeam(VFX_BEAM_FIRE, oFirstTarget, BODY_NODE_CHEST);
//Halve the damage for all secondary targets beyond the first.
// eDamage = EffectDamage(nDamage/2, DAMAGE_TYPE_ELECTRICAL);
float fDelay = 0.2;
int nCnt;
//Get the first target in the spell shape
oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(oFirstTarget), TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
while (GetIsObjectValid(oTarget) && nCnt < nCasterLevel)
{
//Make sure the caster's faction is not hit and the first target is not hit
if (oTarget != oFirstTarget && !GetIsReactionTypeFriendly(oTarget) && oTarget != OBJECT_SELF)
{
//Connect the new lightning stream to the older target and the new target
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eLightning,oTarget,0.5));
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_CHAIN_LIGHTNING));
//Do an SR check
if (!ScrollResist(OBJECT_SELF, oTarget, fDelay))
{
nDamage = d6(nCasterLevel);
//Adjust damage via Reflex Save or Evasion or Improved Evasion
nDamStrike = PRCGetReflexAdjustedDamage(nDamage, oTarget, 24, SAVING_THROW_TYPE_FIRE);
//Apply the damage and VFX impact to the current target
eDamage = EffectDamage(nDamStrike, DAMAGE_TYPE_FIRE);
if(nDamStrike > 0) //age > 0)
{
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT,eDamage,oTarget));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT,eVis,oTarget));
}
}
oHolder = oTarget;
//change the currect holder of the lightning stream to the current target
eLightning = EffectBeam(VFX_BEAM_FIRE, oHolder, BODY_NODE_CHEST);
fDelay = fDelay + 0.1f;
}
//Count the number of targets that have been hit.
if(GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
{
nCnt++;
}
//Get the next target in the shape.
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(oFirstTarget), TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
}
}
void lesserfireball()
{
//Get the spell target location as opposed to the spell target.
location lTarget = GetLocation(GetVictim());
object oCaster = OBJECT_SELF;
object oTarget;
//Declare major variables
int nCasterLvl = 2;
int nMetaMagic = PRCGetMetaMagicFeat();
int nDamage;
float fDelay;
effect eExplode = EffectVisualEffect(VFX_FNF_FIREBALL);
effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M);
effect eDam;
//Limit Caster level for the purposes of damage
if (nCasterLvl > 10)
{
nCasterLvl = 10;
}
//Apply the fireball explosion at the location captured above.
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lTarget);
//Declare the spell shape, size and the location. Capture the first target object in the shape.
oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
//Cycle through the targets within the spell shape until an invalid object is captured.
while (GetIsObjectValid(oTarget))
{
if(!GetIsReactionTypeFriendly(oTarget))
{
if((PRCGetSpellId() == 341 && !GetIsFriend(oTarget)) || PRCGetSpellId() == 58)
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_FIREBALL));
//Get the distance between the explosion and the target to calculate delay
fDelay = GetDistanceBetweenLocations(lTarget, GetLocation(oTarget))/20;
if (!PRCDoResistSpell(OBJECT_SELF, oTarget, FloatToInt(fDelay)))
{
//Roll damage for each target
nDamage = d6(nCasterLvl);
//Resolve metamagic
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nDamage = 6 * nCasterLvl;
}
else if (nMetaMagic == METAMAGIC_EMPOWER)
{
nDamage = nDamage + nDamage / 2;
}
//Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
nDamage = PRCGetReflexAdjustedDamage(nDamage, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_FIRE);
//Set the damage effect
eDam = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
if(nDamage > 0)
{
// Apply effects to the currently selected target.
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
//This visual effect is applied to the target object not the location as above. This visual effect
//represents the flame that erupts on the target not on the ground.
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
}
}
}
}
//Select the next target within the spell shape.
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
}
}
void ZapTargets()
{
effect e = EffectBeam(VFX_BEAM_FIRE_LASH, OBJECT_SELF, BODY_NODE_HAND);
effect eDam;
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF), TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
int nDamage;
int nSave;
while (GetIsObjectValid(oTarget))
{
if (!GetPlotFlag(oTarget)&&(!GetIsFriend(oTarget)))
{
nSave=FortitudeSave(oTarget,18,SAVING_THROW_TYPE_FIRE);
if (nSave==0)
{
nDamage = d3(1)+1;
eDam = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
}
else
{
nDamage==0;
}
if(nDamage > 0 )
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, e, oTarget, 1.0);
}
}
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF), TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
}
}