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

199 lines
6.8 KiB
Plaintext

//::///////////////////////////////////////////////
//:: x1_s2_hailarrow
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
One arrow per arcane archer level at all targets
GZ SEPTEMBER 2003
Added damage penetration
*/
//:://////////////////////////////////////////////
//:: Created By:
//:: Created On:
//:://////////////////////////////////////////////
// GZ: 2003-07-23 fixed criticals not being honored
#include "X0_I0_SPELLS"
void main()
{
object oCaster = OBJECT_SELF;
int nCasterLvl = GetLevelByClass(CLASS_TYPE_ARCANE_ARCHER,oCaster);
nCasterLvl = nCasterLvl +10;
object oTarget;
oTarget = oCaster;
AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_MASS_HEAL, oTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
int nBonus = 0;
nBonus = ArcaneArcherCalculateBonus() ;
oTarget = GetSpellTargetObject();
if (GetIsObjectValid(oTarget) == TRUE)
{
int nDamage = ArcaneArcherDamageDoneByBow() *2;
if (nDamage > 0)
{
effect ePhysical = EffectDamage(nDamage, DAMAGE_TYPE_PIERCING,IPGetDamagePowerConstantFromNumber(nBonus));
effect eMagic = EffectDamage(nBonus, DAMAGE_TYPE_MAGICAL);
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, 601));
ApplyEffectToObject(DURATION_TYPE_INSTANT, ePhysical, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eMagic, oTarget);
// *** trying to merge chainlightning ***
int nDamage2 = d6(nCasterLvl)+30;
nDamage2 = nDamage2*3;
if ( nCasterLvl > 19 )
{
nDamage2 = (nDamage2*3)/2;
}
if ( nCasterLvl > 29 )
{
nDamage2 = (nDamage2*3)/2;
}
int nDamStrike;
int nNumAffected = 0;
int nMetaMagic = GetMetaMagicFeat();
//Declare lightning effect connected the casters hands
effect eLightning = EffectBeam(VFX_BEAM_LIGHTNING, OBJECT_SELF, BODY_NODE_HAND);;
effect eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_S);
effect eDamage;
object oFirstTarget = GetSpellTargetObject();
object oHolder;
object oTarget;
location lSpellLocation;
//Damage the initial target
if (spellsIsTarget(oFirstTarget, SPELL_TARGET_SELECTIVEHOSTILE, OBJECT_SELF))
{
//Fire cast spell at event for the specified target
SignalEvent(oFirstTarget, EventSpellCastAt(OBJECT_SELF, SPELL_CHAIN_LIGHTNING));
//Make an SR Check
if (!MyResistSpell(OBJECT_SELF, oFirstTarget))
{
//Adjust damage via Reflex Save or Evasion or Improved Evasion
nDamStrike = GetReflexAdjustedDamage(nDamage2, oFirstTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_ELECTRICITY);
//Set the damage effect for the first target
eDamage = EffectDamage(nDamStrike, DAMAGE_TYPE_ELECTRICAL);
//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_LIGHTNING, oFirstTarget, BODY_NODE_CHEST);
float fDelay = 0.2;
int nCnt = 0;
// *
// * Secondary Targets
// *
//Get the first target in the spell shape
oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, GetLocation(oFirstTarget), TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
while (GetIsObjectValid(oTarget) && nCnt < nCasterLvl)
{
//Make sure the caster's faction is not hit and the first target is not hit
if (oTarget != oFirstTarget && spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, OBJECT_SELF) && 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 (!MyResistSpell(OBJECT_SELF, oTarget, fDelay))
{
int nDamage2 = d6(nCasterLvl)+30;
nDamage2 = nDamage2*3;
if ( nCasterLvl > 19 )
{
nDamage2 = (nDamage2*3)/2;
}
if ( nCasterLvl > 29 )
{
nDamage2 = (nDamage2*3)/2;
}
//Adjust damage via Reflex Save or Evasion or Improved Evasion
nDamStrike = GetReflexAdjustedDamage(nDamage2, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_ELECTRICITY);
//Apply the damage and VFX impact to the current target
eDamage = EffectDamage(nDamStrike /2, DAMAGE_TYPE_ELECTRICAL);
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
if (GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
{
eLightning = EffectBeam(VFX_BEAM_LIGHTNING, oHolder, BODY_NODE_CHEST);
}
else
{
// * April 2003 trying to make sure beams originate correctly
effect eNewLightning = EffectBeam(VFX_BEAM_LIGHTNING, oHolder, BODY_NODE_CHEST);
if(GetIsEffectValid(eNewLightning))
{
eLightning = eNewLightning;
}
}
fDelay = fDelay + 0.1f;
}
//Count the number of targets that have been hit.
if(GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
{
nCnt++;
}
// April 2003: Setting the new origin for the beam
// oFirstTarget = oTarget;
//Get the next target in the shape.
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_GARGANTUAN, GetLocation(oFirstTarget), TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
}
// *** END mergin ***
}
}
}