113 lines
4.1 KiB
Plaintext
113 lines
4.1 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Dragon Breath Gas Cloud
|
|
//:: NW_S1_DragGas
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Calculates the proper damage and DC Save for the
|
|
breath weapon based on the HD of the dragon.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Preston Watamaniuk
|
|
//:: Created On: May 9, 2001
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Patch 1.70
|
|
|
|
- wrong target check (could affect other NPCs)
|
|
- damage was the same for all creatures in AoE
|
|
- old evasion behaviour (now that evasion is applied will appear in log)
|
|
> breath weapon damage and DC calculation changed in order to allow higher values
|
|
for custom content dragons with 40+ HD. DC calculation is now 10+1/2 dragon's HD+
|
|
dragon's constitution modifier.
|
|
*/
|
|
|
|
#include "70_inc_dragons"
|
|
#include "x0_i0_spells"
|
|
|
|
void main()
|
|
{
|
|
//Declare major variables
|
|
int nDamage = GetDragonBreathNumDice();
|
|
int nDC = GetDragonBreathDC();
|
|
|
|
//When used by a dragon disciple, calculate DC and damage based on their DD levels
|
|
if (GetLocalInt(OBJECT_SELF, "ddbreath") == 1 )
|
|
{
|
|
int nLevel = GetLevelByClass(CLASS_TYPE_DRAGONDISCIPLE, OBJECT_SELF);
|
|
nDamage = 2*nLevel / 3;
|
|
//if (nLevel == 29) nDamage = 25;
|
|
//if (nLevel == 30) nDamage = 30;
|
|
|
|
switch (nLevel)
|
|
{
|
|
case 1: nDC = 15; break;
|
|
case 2: nDC = 15; break;
|
|
case 3: nDC = 15; break;
|
|
case 4: nDC = 15; break;
|
|
case 5: nDC = 16; break;
|
|
case 6: nDC = 16; break;
|
|
case 7: nDC = 17; break;
|
|
case 8: nDC = 17; break;
|
|
case 9: nDC = 18; break;
|
|
case 10: nDC = 18; break;
|
|
case 11: nDC = 19; break;
|
|
case 12: nDC = 20; break;
|
|
case 13: nDC = 21; break;
|
|
case 14: nDC = 22; break;
|
|
case 15: nDC = 23; break;
|
|
case 16: nDC = 24; break;
|
|
case 17: nDC = 25; break;
|
|
case 18: nDC = 26; break;
|
|
case 19: nDC = 27; break;
|
|
case 20: nDC = 28; break;
|
|
case 21: nDC = 29; break;
|
|
case 22: nDC = 30; break;
|
|
case 23: nDC = 31; break;
|
|
case 24: nDC = 32; break;
|
|
case 25: nDC = 33; break;
|
|
case 26: nDC = 34; break;
|
|
case 27: nDC = 35; break;
|
|
case 28: nDC = 36; break;
|
|
case 29: nDC = 37; break;
|
|
case 30: nDC = 38; break;
|
|
}
|
|
}
|
|
//Done
|
|
|
|
int nDamStrike;
|
|
float fDelay;
|
|
effect eVis = EffectVisualEffect(VFX_IMP_POISON_L);
|
|
effect eBreath;
|
|
|
|
if (GetLocalInt(OBJECT_SELF, "ddbreath") == 0 ) PlayDragonBattleCry();
|
|
//Get first target in spell area
|
|
object oTarget = GetFirstObjectInShape(SHAPE_SPELLCONE, 14.0, GetSpellTargetLocation(), TRUE);
|
|
while(GetIsObjectValid(oTarget))
|
|
{
|
|
if(oTarget != OBJECT_SELF && spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF))
|
|
{
|
|
//Fire cast spell at event for the specified target
|
|
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELLABILITY_DRAGON_BREATH_GAS));
|
|
//randomize damage for each creature in AoE
|
|
nDamStrike = d10(nDamage);
|
|
if (GetLocalInt(OBJECT_SELF, "ddbreath") == 0 ) nDamStrike = d6(nDamage);
|
|
//Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
|
|
nDamStrike = GetReflexAdjustedDamage(nDamStrike, oTarget, nDC, SAVING_THROW_TYPE_ACID, OBJECT_SELF);
|
|
if (nDamStrike > 0)
|
|
{
|
|
//Set Damage and VFX
|
|
eBreath = EffectDamage(nDamStrike, DAMAGE_TYPE_ACID);
|
|
//Determine effect delay
|
|
fDelay = GetDistanceBetween(OBJECT_SELF, oTarget)/20;
|
|
//Apply the VFX impact and effects
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eBreath, oTarget));
|
|
}
|
|
}
|
|
//Get next target in spell area
|
|
oTarget = GetNextObjectInShape(SHAPE_SPELLCONE, 14.0, GetSpellTargetLocation(), TRUE);
|
|
}
|
|
SetLocalInt(OBJECT_SELF, "ddbreath", 0);
|
|
}
|