46 lines
1.3 KiB
Plaintext
46 lines
1.3 KiB
Plaintext
// Cockatrice Bite - Item Unique OnHit Script
|
|
//
|
|
// CON based petrification attack
|
|
//
|
|
//
|
|
|
|
#include "prc_inc_spells"
|
|
//#include "x2_inc_spellhook"
|
|
#include "x2_inc_switches"
|
|
|
|
|
|
void main()
|
|
{
|
|
//:: Declare major variables
|
|
object oNPC = OBJECT_SELF;
|
|
object oItem = PRCGetSpellCastItem();
|
|
object oTarget = PRCGetSpellTargetObject();
|
|
|
|
int oFort = GetFortitudeSavingThrow(oTarget);
|
|
int nDC = 10 + (GetHitDice(oNPC) / 2) + GetAbilityModifier(ABILITY_CONSTITUTION, oNPC);
|
|
int bImmune = GetHasFeat(FEAT_IMMUNE_PETRIFICATION, oTarget);
|
|
|
|
effect ePetrify = EffectPetrify();
|
|
effect ePetrifyVis = EffectVisualEffect(VFX_IMP_FORTITUDE_SAVING_THROW_USE);
|
|
effect eImmune = EffectVisualEffect(VFX_IMP_MAGIC_RESISTANCE_USE);
|
|
|
|
//:: Respect Immunity to Petrification
|
|
if (bImmune)
|
|
{
|
|
//SendMessageToPC(OBJECT_SELF, "This creatrure is immune to petrification");
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eImmune, oTarget);
|
|
return;
|
|
}
|
|
|
|
//:: Cockatrice's are immune to their own petrification attack.
|
|
if (GetName(OBJECT_SELF) == GetName(oTarget))
|
|
return;
|
|
|
|
//:: See if the petrification is resisted.
|
|
if (!FortitudeSave(oTarget, nDC, SAVING_THROW_TYPE_ALL, oTarget))
|
|
{
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, ePetrifyVis, oTarget);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePetrify, oTarget);
|
|
}
|
|
|
|
} |