//:://///////////////////////////////////////////// //:: Mahalito (Big Fire) //:: mahalito.nss //:: Copyright (c) 2025 WizardryEE Project //::////////////////////////////////////////////// /* Causes 4d6 (4-24) points of fire damage to a monster group. Level 3 Mage spell. In Wizardry: Proving Grounds of the Mad Overlord, this is a Level 3 Mage attack spell that targets a monster group. */ //::////////////////////////////////////////////// //:: 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 4d6 fire damage to a monster group // 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; // Get the target location location lTarget = PRCGetSpellTargetLocation(); // Create the fireball explosion at the location effect eExplode = EffectVisualEffect(VFX_FNF_FIREBALL); effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M); // Apply the fireball explosion at the location ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lTarget); // Declare the spell shape, size and the location object oTarget = MyFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, lTarget, TRUE, OBJECT_TYPE_CREATURE); // Track affected targets int nAffected = 0; // Cycle through the targets within the spell shape while (GetIsObjectValid(oTarget)) { if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, oCaster)) { // Fire cast spell at event for the specified target SignalEvent(oTarget, EventSpellCastAt(oCaster, GetSpellId())); // Get the distance between the explosion and the target to calculate delay fDelay = GetDistanceBetweenLocations(lTarget, GetLocation(oTarget))/20; // Make SR check if (!PRCDoResistSpell(oCaster, oTarget, nPenetr, fDelay)) { // Calculate damage - 4d6 fire damage if (CheckMetaMagic(nMetaMagic, METAMAGIC_MAXIMIZE)) nDamage = 24; // 4 * 6 = 24 (maximum damage) else nDamage = d6(4); if (CheckMetaMagic(nMetaMagic, METAMAGIC_EMPOWER)) nDamage += nDamage / 2; // +50% damage // Add bonus damage per die nDamage += SpellDamagePerDice(oCaster, 4); // 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 eDam = PRCEffectDamage(oTarget, nDamage, DAMAGE_TYPE_FIRE); // Apply effects to the currently selected target DelayCommand(fDelay, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget)); DelayCommand(fDelay, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget)); // Apply any bonus damage effects PRCBonusDamage(oTarget); // Notify damage DelayCommand(fDelay, FloatingTextStringOnCreature("MAHALITO: " + IntToString(nDamage) + " fire damage to " + GetName(oTarget), oCaster, TRUE)); // Increment affected count nAffected++; } } } // Select the next target within the spell shape oTarget = MyNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, lTarget, TRUE, OBJECT_TYPE_CREATURE); } // Final notification if (nAffected > 0) { FloatingTextStringOnCreature("MAHALITO: Hit " + IntToString(nAffected) + " enemies!", oCaster, TRUE); } else { FloatingTextStringOnCreature("MAHALITO: No enemies affected", oCaster, TRUE); } // Clean up spell school variable PRCSetSchool(); }