generated from Jaysyn/ModuleTemplate
321 lines
12 KiB
Plaintext
321 lines
12 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: x2_s1_beholdatt
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Beholder Eye Rays:
|
|
|
|
The Beholders new eye rays script(s), includes "qn_inc_beholder" that
|
|
contains all the eye rays. Each eye ray now has a VFX_BEAM assigned
|
|
to it as well as a "body node".
|
|
|
|
There is a special check if they target a Sorcerer/Wizard, the
|
|
Beholder will fire only Disintegrate and not random between
|
|
their Charm Person/Animal, Fear or Sleep rays, which would be
|
|
intended for "melee" PCs.
|
|
|
|
As for basic AI, it is now all random. It fires an eye ray, then fires
|
|
3 more getting the first/next object in a spell cone. There is a chance
|
|
of the Beholder's Eye Rays all hitting one person.
|
|
|
|
Eye Ray DCs = 10 + Spell Level + Charisma Modifier.
|
|
|
|
Important Notes:
|
|
* Constructs are not targeted.
|
|
* Undead are only targted buy Disintegrate and Petrify.
|
|
* Use body nodes (BODY_NODE_MONSTER_#); 0, 1, 3, and 4.
|
|
* Don't fire more than four rays at a time.
|
|
* Don't fire two VFX_BEAMs of the same type at the same time (below).
|
|
* Each VFX_BEAM type goes as follows:
|
|
------------------------------------------
|
|
VFX_BEAM_MIND = Charm, Fear & Sleep
|
|
Special (447) = Disintegrate
|
|
VFX_BEAM_BLACK = Finger of Death
|
|
VFX_BEAM_HOLY = Stone to Flesh
|
|
VFX_BEAM_EVIL = Inflict Moderate Wounds
|
|
VFX_BEAM_ODD = Slow & Telekensis
|
|
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Q-Necron
|
|
//:://////////////////////////////////////////////
|
|
#include "qn_inc_beholder"
|
|
|
|
void main()
|
|
{
|
|
//Declare Major Varibles
|
|
object oTarget = GetSpellTargetObject();
|
|
int bDamage = FALSE;
|
|
int nCharisma = GetAbilityModifier(ABILITY_CHARISMA, OBJECT_SELF);
|
|
int nCount;
|
|
int nDamage;
|
|
int Dis_Damage1 = d6(26);
|
|
int Dis_Damage2 = d6(5);
|
|
int nDC;
|
|
int nLevel;
|
|
int nRandom = d2(1);
|
|
int nSave;
|
|
int nSpell = d3(1);
|
|
int nType;
|
|
int nUnitCount = UnitCount(oTarget);
|
|
effect eBeam;
|
|
effect eEye;
|
|
effect eDur;
|
|
effect eVis;
|
|
effect eLink;
|
|
float fDuration;
|
|
float f2nd = GetRandomDelay(0.3f, 0.9f);
|
|
float f3rd = GetRandomDelay(0.7f, 1.3f);
|
|
float f4th = GetRandomDelay(1.1f, 1.7f);
|
|
|
|
//Mages & Undead
|
|
if(GetLevelByClass(CLASS_TYPE_WIZARD, oTarget) > 5 ||
|
|
GetLevelByClass(CLASS_TYPE_SORCERER, oTarget) > 5 ||
|
|
GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD)
|
|
{
|
|
//Determine random eye ray (Disintegrate).
|
|
switch(nSpell)
|
|
{
|
|
case 1:
|
|
case 2:
|
|
case 3:
|
|
bDamage = TRUE;
|
|
nDamage = Dis_Damage1;
|
|
nLevel = 6;
|
|
nSave = SAVING_THROW_FORT;
|
|
nType = SAVING_THROW_TYPE_ALL;
|
|
eVis = EffectVisualEffect(VFX_IMP_ACID_S);
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//Determine random eye ray (Charm, Fear or Sleep).
|
|
switch(nSpell)
|
|
{
|
|
case 1:
|
|
nLevel = 1;
|
|
nSave = SAVING_THROW_WILL;
|
|
nType = SAVING_THROW_TYPE_MIND_SPELLS;
|
|
eEye = EffectConfused();
|
|
eDur = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_DOMINATED);
|
|
eVis = EffectVisualEffect(VFX_IMP_CHARM);
|
|
fDuration = TurnsToSeconds(13);
|
|
break;
|
|
|
|
case 2:
|
|
nLevel = 4;
|
|
nSave = SAVING_THROW_WILL;
|
|
nType = SAVING_THROW_TYPE_MIND_SPELLS;
|
|
eEye = EffectFrightened();
|
|
eDur = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_FEAR);
|
|
fDuration = RoundsToSeconds(13);
|
|
break;
|
|
|
|
case 3:
|
|
nLevel = 1;
|
|
nSave = SAVING_THROW_WILL;
|
|
nType = SAVING_THROW_TYPE_MIND_SPELLS;
|
|
eEye = EffectSleep();
|
|
eDur = EffectVisualEffect(VFX_IMP_SLEEP);
|
|
fDuration = RoundsToSeconds(13);
|
|
break;
|
|
}
|
|
}
|
|
|
|
//Determine DC.
|
|
nDC = 10 + nLevel + GetAbilityModifier(ABILITY_CHARISMA, OBJECT_SELF);
|
|
|
|
//Eye ray.
|
|
if(TouchAttackRanged(oTarget) > 0)
|
|
{
|
|
if(bDamage == TRUE)
|
|
{
|
|
//Make Save
|
|
if(MySavingThrow(nSave, oTarget, nDC, nType) == 1)
|
|
{
|
|
nDamage = Dis_Damage2;
|
|
}
|
|
|
|
eEye = EffectDamage(nDamage);
|
|
|
|
//Link effects.
|
|
eLink = EffectLinkEffects(eEye, eDur);
|
|
eLink = EffectLinkEffects(eVis, eLink);
|
|
|
|
//Apply effects.
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, fDuration);
|
|
|
|
//Beam
|
|
eBeam = eBeam_Disintegrate;
|
|
}
|
|
else
|
|
{
|
|
//Link effects.
|
|
eLink = EffectLinkEffects(eEye, eDur);
|
|
eLink = EffectLinkEffects(eVis, eLink);
|
|
|
|
//Make Save
|
|
if(MySavingThrow(nSave, oTarget, nDC, nType) == 0)
|
|
{
|
|
//Apply effects.
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, fDuration);
|
|
}
|
|
|
|
//Beam
|
|
eBeam = eBeam_Mind;
|
|
}
|
|
}
|
|
//Apply effects.
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oTarget, 1.7f);
|
|
|
|
//Additonal eye rays.
|
|
if(bDamage == TRUE)
|
|
{
|
|
if(nUnitCount == 0)
|
|
{
|
|
//Fall back...
|
|
DelayCommand(f2nd, Ray_Mind(oTarget, (11 + nCharisma), 1, EffectConfused(), VFX_DUR_MIND_AFFECTING_NEGATIVE, VFX_IMP_CONFUSION_S, RoundsToSeconds(13)));
|
|
DelayCommand(f3rd, Ray_Inflict(oTarget, (12 + nCharisma), 1));
|
|
DelayCommand(f4th, Ray_Slow(oTarget, (13 + nCharisma), 1));
|
|
}
|
|
if(nUnitCount == 1)
|
|
{
|
|
//1 Target
|
|
if(d2(1) == 1)
|
|
{
|
|
DelayCommand(f2nd, Ray_Mind(oTarget, (11 + nCharisma), 1, EffectFrightened(), VFX_DUR_MIND_AFFECTING_NEGATIVE, VFX_IMP_CONFUSION_S, RoundsToSeconds(13)));
|
|
DelayCommand(f3rd, Ray_Inflict(oTarget, (12 + nCharisma), 1));
|
|
DelayCommand(f4th, Ray_Slow(oTarget, (13 + nCharisma), 1));
|
|
}
|
|
else
|
|
{
|
|
DelayCommand(f2nd, Ray_Mind(oTarget, (14 + nCharisma), 1, EffectConfused(), VFX_DUR_MIND_AFFECTING_FEAR, VFX_IMP_FEAR_S, RoundsToSeconds(13)));
|
|
DelayCommand(f3rd, Ray_Stone(oTarget, (16 + nCharisma), 1));
|
|
DelayCommand(f4th, Ray_Telekensis(oTarget, (15 + nCharisma), 1));
|
|
}
|
|
}
|
|
if(nUnitCount == 2)
|
|
{
|
|
//2 Targets
|
|
if(d2(1) == 1)
|
|
{
|
|
DelayCommand(f2nd, Ray_Mind(oTarget, (14 + nCharisma), d2(1), EffectSleep(), VFX_DUR_MIND_AFFECTING_FEAR, VFX_IMP_FEAR_S, RoundsToSeconds(13)));
|
|
DelayCommand(f3rd, Ray_Stone(oTarget, (16 + nCharisma), d2(1)));
|
|
DelayCommand(f4th, Ray_Telekensis(oTarget, (15 + nCharisma), d2(1)));
|
|
}
|
|
else
|
|
{
|
|
DelayCommand(f2nd, Ray_Mind(oTarget, (11 + nCharisma), d2(1), EffectConfused(), VFX_DUR_MIND_AFFECTING_NEGATIVE, VFX_IMP_CONFUSION_S, RoundsToSeconds(13)));
|
|
DelayCommand(f3rd, Ray_Inflict(oTarget, (12 + nCharisma), d2(1)));
|
|
DelayCommand(f4th, Ray_Slow(oTarget, (13 + nCharisma), d2(1)));
|
|
}
|
|
}
|
|
if(nUnitCount == 3)
|
|
{
|
|
//3 Targets
|
|
if(d2(1) == 1)
|
|
{
|
|
DelayCommand(f2nd, Ray_Mind(oTarget, (13 + nCharisma), d3(1), EffectFrightened(), VFX_DUR_MIND_AFFECTING_DISABLED, VFX_IMP_SLEEP, TurnsToSeconds(13)));
|
|
DelayCommand(f3rd, Ray_Inflict(oTarget, (12 + nCharisma), d3(1)));
|
|
DelayCommand(f4th, Ray_Slow(oTarget, (13 + nCharisma), d3(1)));
|
|
}
|
|
else
|
|
{
|
|
DelayCommand(f2nd, Ray_Mind(oTarget, (14 + nCharisma), d3(1), EffectConfused(), VFX_DUR_MIND_AFFECTING_FEAR, VFX_IMP_FEAR_S, RoundsToSeconds(13)));
|
|
DelayCommand(f3rd, Ray_Stone(oTarget, (16 + nCharisma), d3(1)));
|
|
DelayCommand(f4th, Ray_Telekensis(oTarget, (15 + nCharisma), d3(1)));
|
|
}
|
|
}
|
|
if(nUnitCount >= 4)
|
|
{
|
|
//4 Targets
|
|
if(d2(1) == 1)
|
|
{
|
|
DelayCommand(f2nd, Ray_Mind(oTarget, (11 + nCharisma), d4(1), EffectSleep(), VFX_DUR_MIND_AFFECTING_NEGATIVE, VFX_IMP_CONFUSION_S, RoundsToSeconds(13)));
|
|
DelayCommand(f3rd, Ray_Stone(oTarget, (16 + nCharisma), d4(1)));
|
|
DelayCommand(f4th, Ray_Telekensis(oTarget, (15 + nCharisma), d4(1)));
|
|
}
|
|
else
|
|
{
|
|
DelayCommand(f2nd, Ray_Mind(oTarget, (13 + nCharisma), d4(1), EffectConfused(), VFX_DUR_MIND_AFFECTING_DISABLED, VFX_IMP_SLEEP, TurnsToSeconds(13)));
|
|
DelayCommand(f3rd, Ray_Inflict(oTarget, (12 + nCharisma), d4(1)));
|
|
DelayCommand(f4th, Ray_Slow(oTarget, (13 + nCharisma), d4(1)));
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(nUnitCount == 0)
|
|
{
|
|
//Fall back...
|
|
DelayCommand(f2nd, Ray_Disintegrate(oTarget, (16 + nCharisma), 1));
|
|
DelayCommand(f3rd, Ray_Inflict(oTarget, (12 + nCharisma), 1));
|
|
DelayCommand(f4th, Ray_Slow(oTarget, (13 + nCharisma), 1));
|
|
}
|
|
if(nUnitCount == 1)
|
|
{
|
|
//1 Target
|
|
if(d2(1) == 1)
|
|
{
|
|
DelayCommand(f2nd, Ray_Disintegrate(oTarget, (16 + nCharisma), 1));
|
|
DelayCommand(f3rd, Ray_Inflict(oTarget, (12 + nCharisma), 1));
|
|
DelayCommand(f4th, Ray_Slow(oTarget, (13 + nCharisma), 1));
|
|
}
|
|
else
|
|
{
|
|
DelayCommand(f2nd, Ray_Death(oTarget, (17 + nCharisma), 1));
|
|
DelayCommand(f3rd, Ray_Stone(oTarget, (16 + nCharisma), 1));
|
|
DelayCommand(f4th, Ray_Telekensis(oTarget, (15 + nCharisma), 1));
|
|
}
|
|
}
|
|
if(nUnitCount == 2)
|
|
{
|
|
//2 Targets
|
|
if(d2(1) == 1)
|
|
{
|
|
DelayCommand(f2nd, Ray_Death(oTarget, (17 + nCharisma), d2(1)));
|
|
DelayCommand(f3rd, Ray_Stone(oTarget, (16 + nCharisma), d2(1)));
|
|
DelayCommand(f4th, Ray_Telekensis(oTarget, (15 + nCharisma), d2(1)));
|
|
}
|
|
else
|
|
{
|
|
DelayCommand(f2nd, Ray_Disintegrate(oTarget, (16 + nCharisma), d2(1)));
|
|
DelayCommand(f3rd, Ray_Inflict(oTarget, (12 + nCharisma), d2(1)));
|
|
DelayCommand(f4th, Ray_Slow(oTarget, (13 + nCharisma), d2(1)));
|
|
}
|
|
}
|
|
if(nUnitCount == 3)
|
|
{
|
|
//3 Targets
|
|
if(d2(1) == 1)
|
|
{
|
|
DelayCommand(f2nd, Ray_Disintegrate(oTarget, (16 + nCharisma), d3(1)));
|
|
DelayCommand(f3rd, Ray_Inflict(oTarget, (12 + nCharisma), d3(1)));
|
|
DelayCommand(f4th, Ray_Slow(oTarget, (13 + nCharisma), d3(1)));
|
|
}
|
|
else
|
|
{
|
|
DelayCommand(f2nd, Ray_Death(oTarget, (17 + nCharisma), d3(1)));
|
|
DelayCommand(f3rd, Ray_Stone(oTarget, (16 + nCharisma), d3(1)));
|
|
DelayCommand(f4th, Ray_Telekensis(oTarget, (15 + nCharisma), d3(1)));
|
|
}
|
|
}
|
|
if(nUnitCount >= 4)
|
|
{
|
|
//4 Targets
|
|
if(d2(1) == 1)
|
|
{
|
|
DelayCommand(f2nd, Ray_Death(oTarget, (17 + nCharisma), d4(1)));
|
|
DelayCommand(f3rd, Ray_Stone(oTarget, (16 + nCharisma), d4(1)));
|
|
DelayCommand(f4th, Ray_Telekensis(oTarget, (15 + nCharisma), d4(1)));
|
|
}
|
|
else
|
|
{
|
|
DelayCommand(f2nd, Ray_Disintegrate(oTarget, (16 + nCharisma), d4(1)));
|
|
DelayCommand(f3rd, Ray_Inflict(oTarget, (12 + nCharisma), d4(1)));
|
|
DelayCommand(f4th, Ray_Slow(oTarget, (13 + nCharisma), d4(1)));
|
|
}
|
|
}
|
|
}
|
|
}
|