WizardryEE/Content/spells/tiltowait.nss
2025-04-30 12:23:15 -04:00

136 lines
4.8 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Tiltowait (Explosion)
//:: tiltowait.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Causes 10d15 (10-150) points of damage to all
monsters.
Level 7 Mage spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 7 Mage attack spell that targets
all monsters.
*/
//:://////////////////////////////////////////////
//:: Created By: WizardryEE Project
//:: Created On: April 26, 2025
//:://////////////////////////////////////////////
#include "prc_inc_spells"
#include "prc_add_spell_dc"
void main()
{
// Spell implementation for WizardryEE
// Core functionality: Deal massive damage to all monsters
// Spellcast Hook Code
if (!X2PreSpellCastCode()) return;
// Set spell school for proper record keeping
PRCSetSchool(SPELL_SCHOOL_EVOCATION);
// Declare major variables
object oCaster = OBJECT_SELF;
int nCasterLevel = PRCGetCasterLevel(oCaster);
int nMetaMagic = PRCGetMetaMagicFeat();
int nPenetr = nCasterLevel + SPGetPenetr();
int nDamage;
float fDelay;
int nAffected = 0;
// Get the elemental damage type (default to fire)
int EleDmg = ChangedElementalDamage(oCaster, DAMAGE_TYPE_FIRE);
// Create the meteor swarm visual effect
effect eMeteor = EffectVisualEffect(VFX_FNF_METEOR_SWARM);
effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M);
// Apply the meteor swarm VFX area impact
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eMeteor, GetLocation(oCaster));
// Get first object in the spell area (colossal radius - entire area)
object oTarget = MyFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(oCaster));
// Process all targets in the area
while (GetIsObjectValid(oTarget))
{
// Check if target is a valid enemy
if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, oCaster) && oTarget != oCaster)
{
// Random delay for visual effect
fDelay = PRCGetRandomDelay();
// Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(oCaster, GetSpellId()));
// Make SR check
if (!PRCDoResistSpell(oCaster, oTarget, nPenetr, fDelay))
{
// Calculate damage - 10d15 (custom die size for TILTOWAIT)
// Implemented as 30d5 for similar effect with standard dice
if (CheckMetaMagic(nMetaMagic, METAMAGIC_MAXIMIZE))
{
nDamage = 150; // 10 * 15 = 150 (maximum damage)
}
else
{
// Simulate 10d15 using 30d5
nDamage = d6(30) * 5 / 6; // Approximately 10d15
}
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EMPOWER))
{
nDamage += nDamage / 2; // +50% damage
}
// Add bonus damage per die
nDamage += SpellDamagePerDice(oCaster, 30);
// Adjust the damage based on the Reflex Save, Evasion and Improved Evasion
nDamage = PRCGetReflexAdjustedDamage(nDamage, oTarget, PRCGetSaveDC(oTarget, oCaster), SAVING_THROW_TYPE_FIRE);
if (nDamage > 0)
{
// Set the damage effect
effect eFire = PRCEffectDamage(oTarget, nDamage, EleDmg);
// Apply damage effect and VFX impact with delay
DelayCommand(fDelay, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eFire, oTarget));
DelayCommand(fDelay, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
// Apply any bonus damage effects
PRCBonusDamage(oTarget);
// Notify damage with delay
DelayCommand(fDelay, FloatingTextStringOnCreature("TILTOWAIT: " + IntToString(nDamage) + " damage to " + GetName(oTarget), oCaster, TRUE));
// Increment affected count
nAffected++;
}
}
else
{
// Notify resistance
DelayCommand(fDelay, FloatingTextStringOnCreature(GetName(oTarget) + " resisted TILTOWAIT!", oCaster, TRUE));
}
}
// Get next target in the spell area
oTarget = MyNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(oCaster));
}
// Final notification
if (nAffected > 0)
{
FloatingTextStringOnCreature("TILTOWAIT: Hit " + IntToString(nAffected) + " enemies!", oCaster, TRUE);
}
else
{
FloatingTextStringOnCreature("TILTOWAIT: No enemies affected", oCaster, TRUE);
}
// Clean up spell school variable
PRCSetSchool();
}