138 lines
4.7 KiB
Plaintext
138 lines
4.7 KiB
Plaintext
#include "nw_i0_spells"
|
|
#include "prc_inc_spells"
|
|
|
|
|
|
void DoPrismatic(object oTarget, object oCaster);
|
|
int ApplyPrismaticEffect(int nEffect, object oTarget, object oCaster);
|
|
|
|
void main()
|
|
{
|
|
object oTarget = GetEnteringObject();
|
|
object oCaster = GetAreaOfEffectCreator();
|
|
|
|
if ( oTarget == oCaster )
|
|
return;
|
|
|
|
if ( GetIsEnemy(oTarget,oCaster) )
|
|
{
|
|
DoPrismatic(oTarget,oCaster);
|
|
}
|
|
|
|
}
|
|
|
|
void DoPrismatic(object oTarget, object oCaster)
|
|
{
|
|
float fDelay = 0.0;
|
|
int nCasterLevel = GetHitDice(oCaster);
|
|
int nHD = GetHitDice(oTarget);
|
|
int nVisual = 0;
|
|
effect eVisual;
|
|
if (nHD <= 8)
|
|
{
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectBlindness(), oTarget, RoundsToSeconds(nCasterLevel));
|
|
}
|
|
//Determine if 1 or 2 effects are going to be applied
|
|
int nRandom = d8();
|
|
if(nRandom == 8)
|
|
{
|
|
//Get the visual effect
|
|
nVisual = ApplyPrismaticEffect(Random(7) + 1, oTarget,oCaster);
|
|
nVisual = ApplyPrismaticEffect(Random(7) + 1, oTarget,oCaster);
|
|
}
|
|
else
|
|
{
|
|
//Get the visual effect
|
|
nVisual = ApplyPrismaticEffect(nRandom, oTarget,oCaster);
|
|
}
|
|
//Set the visual effect
|
|
if(nVisual != 0)
|
|
{
|
|
eVisual = EffectVisualEffect(nVisual);
|
|
//Apply the visual effect
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oTarget));
|
|
}
|
|
}
|
|
|
|
int ApplyPrismaticEffect(int nEffect, object oTarget, object oCaster)
|
|
{
|
|
int nDC = 49;
|
|
int nDamage;
|
|
effect ePrism;
|
|
effect eVis;
|
|
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
|
|
effect eLink;
|
|
int nVis;
|
|
float fDelay = 0.0;
|
|
//Based on the random number passed in, apply the appropriate effect and set the visual to
|
|
//the correct constant
|
|
switch(nEffect)
|
|
{
|
|
case 1://fire
|
|
nDamage = 20;
|
|
nVis = VFX_IMP_FLAME_S;
|
|
nDamage = PRCGetReflexAdjustedDamage(nDamage, oTarget, nDC,SAVING_THROW_TYPE_FIRE,oCaster);
|
|
ePrism = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, ePrism, oTarget));
|
|
break;
|
|
case 2: //Acid
|
|
nDamage = 40;
|
|
nVis = VFX_IMP_ACID_L;
|
|
nDamage = PRCGetReflexAdjustedDamage(nDamage, oTarget, nDC,SAVING_THROW_TYPE_ACID,oCaster);
|
|
ePrism = EffectDamage(nDamage, DAMAGE_TYPE_ACID);
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, ePrism, oTarget));
|
|
break;
|
|
case 3: //Electricity
|
|
nDamage = 80;
|
|
nVis = VFX_IMP_LIGHTNING_S;
|
|
nDamage = PRCGetReflexAdjustedDamage(nDamage, oTarget, nDC,SAVING_THROW_TYPE_ELECTRICITY,oCaster);
|
|
ePrism = EffectDamage(nDamage, DAMAGE_TYPE_ELECTRICAL);
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, ePrism, oTarget));
|
|
break;
|
|
case 4: //Poison
|
|
{
|
|
effect ePoison = EffectPoison(POISON_BEBILITH_VENOM);
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, ePoison, oTarget));
|
|
}
|
|
break;
|
|
case 5: //Paralyze
|
|
{
|
|
effect eDur2 = EffectVisualEffect(VFX_DUR_PARALYZED);
|
|
if (PRCMySavingThrow(SAVING_THROW_FORT, oTarget, nDC,SAVING_THROW_TYPE_NONE,oCaster) == 0)
|
|
{
|
|
ePrism = EffectParalyze();
|
|
eLink = EffectLinkEffects(eDur, ePrism);
|
|
eLink = EffectLinkEffects(eLink, eDur2);
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(10)));
|
|
}
|
|
}
|
|
break;
|
|
case 6: //Confusion
|
|
{
|
|
effect eMind = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_DISABLED);
|
|
ePrism = EffectConfused();
|
|
eLink = EffectLinkEffects(eMind, ePrism);
|
|
eLink = EffectLinkEffects(eLink, eDur);
|
|
|
|
if (!/*Will Save*/ PRCMySavingThrow(SAVING_THROW_WILL, oTarget, nDC, SAVING_THROW_TYPE_MIND_SPELLS, oCaster, fDelay))
|
|
{
|
|
nVis = VFX_IMP_CONFUSION_S;
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(10)));
|
|
}
|
|
}
|
|
break;
|
|
case 7: //Death
|
|
{
|
|
if (!/*Will Save*/ PRCMySavingThrow(SAVING_THROW_WILL, oTarget, nDC, SAVING_THROW_TYPE_DEATH, oCaster, fDelay))
|
|
{
|
|
//nVis = VFX_IMP_DEATH;
|
|
ePrism = EffectDeath();
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, ePrism, oTarget));
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
return nVis;
|
|
}
|
|
|
|
|