//:://///////////////////////////////////////////// //:: Dalto (Blizzard) //:: dalto.nss //:: Copyright (c) 2025 WizardryEE Project //::////////////////////////////////////////////// /* Causes 6d6 (6-36) points of cold damage to a monster group. Level 4 Mage spell. In Wizardry: Proving Grounds of the Mad Overlord, this is a Level 4 Mage attack spell that targets a monster group. */ //::////////////////////////////////////////////// //:: Created By: WizardryEE Project //:: Created On: April 26, 2025 //::////////////////////////////////////////////// #include "prc_inc_spells" #include "prc_inc_sp_tch" #include "prc_add_spell_dc" void main() { // Spell implementation for WizardryEE // Core functionality: Deal 6d6 acid damage to a monster group // Spellcast Hook Code if (!X2PreSpellCastCode()) return; // Set spell school for proper record keeping PRCSetSchool(SPELL_SCHOOL_CONJURATION); // Declare major variables object oCaster = OBJECT_SELF; object oTarget = PRCGetSpellTargetObject(); int nCasterLevel = PRCGetCasterLevel(oCaster); int nMetaMagic = PRCGetMetaMagicFeat(); int nPenetr = nCasterLevel + SPGetPenetr(); // Get the elemental damage type (default to acid) int EleDmg = ChangedElementalDamage(oCaster, DAMAGE_TYPE_ACID); // Create the acid arrow visual effect effect eArrow = EffectVisualEffect(VFX_DUR_MIRV_ACID); // Apply the arrow visual effect SPApplyEffectToObject(DURATION_TYPE_INSTANT, eArrow, oTarget); // Check if target is valid and is an enemy if (GetIsObjectValid(oTarget) && !GetIsReactionTypeFriendly(oTarget, oCaster)) { // Signal spell cast at event SignalEvent(oTarget, EventSpellCastAt(oCaster, GetSpellId())); // Make a ranged touch attack int iAttackRoll = PRCDoRangedTouchAttack(oTarget); if (iAttackRoll > 0) { // Calculate delay based on distance float fDelay = GetDistanceToObject(oTarget) / 25.0f; // Make SR check if (!PRCDoResistSpell(oCaster, oTarget, nPenetr, fDelay)) { // Setup VFX effect eVis = EffectVisualEffect(VFX_IMP_ACID_L); effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE); // Set the VFX to be non dispelable, because the acid is not magic eDur = ExtraordinaryEffect(eDur); // Calculate damage - 6d6 acid damage int nDamage = d6(6); if (CheckMetaMagic(nMetaMagic, METAMAGIC_MAXIMIZE)) nDamage = 36; // 6 * 6 = 36 (maximum damage) if (CheckMetaMagic(nMetaMagic, METAMAGIC_EMPOWER)) nDamage += nDamage / 2; // +50% damage // Add bonus damage per die nDamage += SpellDamagePerDice(oCaster, 6); // Apply the VFX and damage DelayCommand(fDelay, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget)); DelayCommand(fDelay, ApplyTouchAttackDamage(oCaster, oTarget, iAttackRoll, nDamage, EleDmg)); // Apply any bonus damage effects DelayCommand(fDelay, PRCBonusDamage(oTarget)); // Notify damage DelayCommand(fDelay, FloatingTextStringOnCreature("DALTO: " + IntToString(nDamage) + " acid damage to " + GetName(oTarget), oCaster, TRUE)); // Create a lingering acid effect for 2 rounds int nDuration = 2; if (CheckMetaMagic(nMetaMagic, METAMAGIC_EXTEND)) nDuration *= 2; // Apply lingering acid effect DelayCommand(fDelay, SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, oTarget, RoundsToSeconds(nDuration), FALSE)); // Calculate secondary damage for lingering effect int nSecondaryDamage = d6(3); // Half damage for lingering effect if (CheckMetaMagic(nMetaMagic, METAMAGIC_MAXIMIZE)) nSecondaryDamage = 18; // 3 * 6 = 18 (maximum damage) if (CheckMetaMagic(nMetaMagic, METAMAGIC_EMPOWER)) nSecondaryDamage += nSecondaryDamage / 2; // +50% damage // Add bonus damage per die nSecondaryDamage += SpellDamagePerDice(oCaster, 3); // Apply lingering damage after 6 seconds effect eSecondaryVis = EffectVisualEffect(VFX_IMP_ACID_S); effect eSecondaryDam = PRCEffectDamage(oTarget, nSecondaryDamage, EleDmg); eSecondaryDam = EffectLinkEffects(eSecondaryVis, eSecondaryDam); DelayCommand(fDelay + 6.0f, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eSecondaryDam, oTarget)); DelayCommand(fDelay + 6.0f, FloatingTextStringOnCreature("DALTO: " + IntToString(nSecondaryDamage) + " lingering acid damage to " + GetName(oTarget), oCaster, TRUE)); } else { // Indicate Failure effect eSmoke = EffectVisualEffect(VFX_IMP_REFLEX_SAVE_THROW_USE); DelayCommand(fDelay + 0.1f, ApplyEffectToObject(DURATION_TYPE_INSTANT, eSmoke, oTarget)); // Notify resistance DelayCommand(fDelay, FloatingTextStringOnCreature("DALTO: " + GetName(oTarget) + " resisted the spell!", oCaster, TRUE)); } } else { // Notify miss FloatingTextStringOnCreature("DALTO: Missed " + GetName(oTarget) + "!", oCaster, TRUE); } } else { // Notify if no valid target FloatingTextStringOnCreature("DALTO: No valid target found", oCaster, TRUE); } // Clean up spell school variable PRCSetSchool(); }