Core/Spells: spell effect handling improvements

* Call spell effect handlers in 4 modes:
   - SPELL_EFFECT_HANDLE_LAUNCH - called when spell is launched (cast just finished)
   - SPELL_EFFECT_HANDLE_LAUNCH_TARGET - called when spell is launched for each target in spell target map
   - SPELL_EFFECT_HANDLE_HIT - called when spell hits its destination
   - SPELL_EFFECT_HANDLE_HIT_TARGET - called when spell hits it's target from spell target map
*Correctly implement SPELL_EFFECT_TRIGGER_SPELL, SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE, SPELL_EFFECT_TRIGGER_MISSILE_SPELL_WITH_VALUE, SPELL_EFFECT_TRIGGER_MISSILE_SPELL
*Remove spell system hacks which became obsolete with this commit
Core/SpellScripts:
add OnEffectLaunch, OnEffectLaunchTarget, OnEffectHit, OnEffectHitTarget hooks for new effect handle modes and remove OnEffect hook.
A generic rule of thumb how to update your scripts (will work for nearly all cases) for spell system noobs:
if your spell script used GetHitXXXX function, you need to use OnEffectHitTarget, otherwise use
OnEffectHit
This commit is contained in:
QAston committed 2011-09-25 13:29:50 +02:00
1 parent b07cc3751f
commit e949ad3adb
50 files changed
+1057 -738

No files matched your search

+9 -40
View File
@@ -2905,11 +2905,6 @@ void SpellMgr::LoadDbcDataCorrections()
if (!spellInfo->speed && !spellInfo->SpellFamilyName)
spellInfo->speed = SPEED_CHARGE;
break;
case SPELL_EFFECT_TRIGGER_SPELL:
if (SpellImplicitTargetInfo::IsPosition(spellInfo->EffectImplicitTargetA[j]) ||
spellInfo->Targets & (TARGET_FLAG_SOURCE_LOCATION | TARGET_FLAG_DEST_LOCATION))
spellInfo->Effect[j] = SPELL_EFFECT_TRIGGER_MISSILE;
break;
}
}
@@ -2956,10 +2951,6 @@ void SpellMgr::LoadDbcDataCorrections()
case 59372: // Energize Cores
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_SRC_AREA_ENEMY;
break;
case 3286: // Bind
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ENEMY;
spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ENEMY;
break;
case 8494: // Mana Shield (rank 2)
// because of bug in dbc
spellInfo->procChance = 0;
@@ -2977,14 +2968,6 @@ void SpellMgr::LoadDbcDataCorrections()
// Entries were not updated after spell effect change, we have to do that manually :/
spellInfo->AttributesEx3 |= SPELL_ATTR3_CAN_PROC_WITH_TRIGGERED;
break;
case 16007: // Draco-Incarcinatrix 900
// was 46, but effect is aura effect
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_NEARBY_ENTRY;
spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_NEARBY_ENTRY;
break;
case 19465: // Improved Stings, only rank 2 of this spell has target for effect 2 = TARGET_DST_DB
spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_CASTER;
break;
case 59725: // Improved Spell Reflection - aoe aura
// Target entry seems to be wrong for this spell :/
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER_AREA_PARTY;
@@ -3007,13 +2990,8 @@ void SpellMgr::LoadDbcDataCorrections()
case 42611: // Shoot
case 62374: // Pursued
case 61588: // Blazing Harpoon
spellInfo->MaxAffectedTargets = 1;
break;
case 52479: // Gift of the Harvester
spellInfo->MaxAffectedTargets = 1;
// a trap always has dst = src?
spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_CASTER;
spellInfo->EffectImplicitTargetA[1] = TARGET_DEST_CASTER;
break;
case 41376: // Spite
case 39992: // Needle Spine
@@ -3091,15 +3069,10 @@ void SpellMgr::LoadDbcDataCorrections()
// add corruption to affected spells
spellInfo->EffectSpellClassMask[1][0] |= 2;
break;
case 49305: // Teleport to Boss 1 DND
case 64981: // Summon Random Vanquished Tentacle
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_CASTER;
break;
case 51852: // The Eye of Acherus (no spawn in phase 2 in db)
spellInfo->EffectMiscValue[0] |= 1;
break;
case 18541: // Ritual of Doom Effect (temp hack, current targeting system requires implicit targets to be set. Was target_dest_caster)
case 51904: // Summon Ghouls On Scarlet Crusade (core does not know the triggered spell is summon spell)
case 51904: // Summon Ghouls On Scarlet Crusade (this should use conditions table, script for this spell needs to be fixed)
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
break;
case 29809: // Desecration Arm - 36 instead of 37 - typo? :/
@@ -3151,10 +3124,6 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ALLY;
spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_SRC_AREA_ALLY;
break;
case 31687: // Summon Water Elemental
// 322-330 switch - effect changed to dummy, target entry not changed in client:(
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
break;
case 57994: // Wind Shear - improper data for EFFECT_1 in 3.3.5 DBC, but is correct in 4.x
spellInfo->Effect[EFFECT_1] = SPELL_EFFECT_MODIFY_THREAT_PERCENT;
spellInfo->EffectBasePoints[EFFECT_1] = -6; // -5%
@@ -3173,12 +3142,12 @@ void SpellMgr::LoadDbcDataCorrections()
case 53246: // Marked for Death (Rank 5)
spellInfo->EffectSpellClassMask[0] = flag96(423937, 276955137, 2049);
break;
case 70728: // Exploit Weakness
case 70840: // Devious Minds
case 70728: // Exploit Weakness (needs target selection script)
case 70840: // Devious Minds (needs target selection script)
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_PET;
break;
case 70893: // Culling The Herd
case 70893: // Culling The Herd (needs target selection script)
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_MASTER;
break;
@@ -3310,10 +3279,10 @@ void SpellMgr::LoadDbcDataCorrections()
case 72507: // Mutated Plague (Professor Putricide)
spellInfo->EffectRadiusIndex[0] = 28; // 50000yd
break;
case 70911: // Unbound Plague (Professor Putricide)
case 72854: // Unbound Plague (Professor Putricide)
case 72855: // Unbound Plague (Professor Putricide)
case 72856: // Unbound Plague (Professor Putricide)
case 70911: // Unbound Plague (Professor Putricide) (needs target selection script)
case 72854: // Unbound Plague (Professor Putricide) (needs target selection script)
case 72855: // Unbound Plague (Professor Putricide) (needs target selection script)
case 72856: // Unbound Plague (Professor Putricide) (needs target selection script)
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ENEMY;
break;
case 71518: // Unholy Infusion Quest Credit (Professor Putricide)
@@ -3340,7 +3309,7 @@ void SpellMgr::LoadDbcDataCorrections()
case 71085: // Mana Void (periodic aura)
spellInfo->DurationIndex = 9; // 30 seconds (missing)
break;
case 70936: // Summon Suppressor
case 70936: // Summon Suppressor (needs target selection script)
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY;
spellInfo->EffectImplicitTargetB[0] = 0;
break;