From 3a053c6cd348be5984edcf5c776d5becbca61047 Mon Sep 17 00:00:00 2001 From: John Holiver Date: Fri, 31 Dec 2010 02:23:29 -0200 Subject: [PATCH] Scripts/Trial of the Crusader: 1) Fix Leeching Swarm damage and create spell difficulty links to code. Closes issue #4909 . 2) Fix Valkyr's Touch. Closes issue #4553 . 3) Fix Permafrost aura difficulty check. 4) Reduce Slime Pool damage range. 5) Avoid Shaman Champion Heroism spam using 5 minutes (CD) as timer. 6) Fix many spell target selection to only select players (no more totens or pets). 7) Fix Anub'arak Spike being able to receibe the permafrost aura in order to cast spike fail, hopefully. --- sql/base/world_database.sql | 5 ++++ .../10910_world_spell_script_names.sql | 6 +++++ src/server/game/Entities/Unit/Unit.h | 1 + .../game/Spells/Auras/SpellAuraEffects.cpp | 23 ++++++++++++------- .../boss_anubarak_trial.cpp | 4 ++-- .../boss_faction_champions.cpp | 2 +- .../TrialOfTheCrusader/boss_lord_jaraxxus.cpp | 8 +++---- .../boss_northrend_beasts.cpp | 2 +- .../TrialOfTheCrusader/boss_twin_valkyr.cpp | 2 +- src/server/scripts/Spells/spell_generic.cpp | 22 +++++++++--------- 10 files changed, 47 insertions(+), 28 deletions(-) create mode 100644 sql/updates/10910_world_spell_script_names.sql diff --git a/sql/base/world_database.sql b/sql/base/world_database.sql index d1ec9c6068..dae6a24446 100644 --- a/sql/base/world_database.sql +++ b/sql/base/world_database.sql @@ -26878,6 +26878,11 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES ( 71900, 'spell_blood_queen_bloodbolt'), ( 71901, 'spell_blood_queen_bloodbolt'), ( 71902, 'spell_blood_queen_bloodbolt'), +-- Trial of Crusader +( 66118, 'spell_gen_leeching_swarm'), +( 67630, 'spell_gen_leeching_swarm'), +( 68646, 'spell_gen_leeching_swarm'), +( 68647, 'spell_gen_leeching_swarm'), -- Ulduar ( 62717, 'spell_ignis_slag_pot'), ( 63477, 'spell_ignis_slag_pot'), diff --git a/sql/updates/10910_world_spell_script_names.sql b/sql/updates/10910_world_spell_script_names.sql new file mode 100644 index 0000000000..46e1ff570e --- /dev/null +++ b/sql/updates/10910_world_spell_script_names.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` IN ( 66118, 67630, 68646, 68647 ); +INSERT INTO `spell_script_names` VALUES +(66118, 'spell_gen_leeching_swarm'), +(67630, 'spell_gen_leeching_swarm'), +(68646, 'spell_gen_leeching_swarm'), +(68647, 'spell_gen_leeching_swarm'); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 3c9de3197c..0fb06acc4f 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1255,6 +1255,7 @@ class Unit : public WorldObject inline bool HealthAbovePct(int32 pct) const { return GetHealth() * (uint64)100 > GetMaxHealth() * (uint64)pct; } inline float GetHealthPct() const { return GetMaxHealth() ? 100.f * GetHealth() / GetMaxHealth() : 0.0f; } inline uint32 CountPctFromMaxHealth(int32 pct) const { return CalculatePctN(GetMaxHealth(), pct); } + inline uint32 CountPctFromCurHealth(int32 pct) const { return CalculatePctN(GetHealth(), pct); } void SetHealth(uint32 val); void SetMaxHealth(uint32 val); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 3afd452044..275a7d38ab 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2362,16 +2362,23 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const case 65920: case 65922: case 65923: - if (caster->HasAura(66193)) { - if (Unit *permafrostCaster = caster->GetAura(66193)->GetCaster()) + Unit *permafrostCaster = NULL; + if (caster->HasAura(66193)) permafrostCaster = caster->GetAura(66193)->GetCaster(); + if (caster->HasAura(67855)) permafrostCaster = caster->GetAura(67855)->GetCaster(); + if (caster->HasAura(67856)) permafrostCaster = caster->GetAura(67856)->GetCaster(); + if (caster->HasAura(67857)) permafrostCaster = caster->GetAura(67857)->GetCaster(); + + if (permafrostCaster) + { if (Creature *permafrostCasterAsCreature = permafrostCaster->ToCreature()) permafrostCasterAsCreature->ForcedDespawn(3000); - - caster->CastSpell(caster, 66181, false); - caster->RemoveAllAuras(); - if (Creature *casterAsCreature = caster->ToCreature()) - casterAsCreature->DisappearAndDie(); + + caster->CastSpell(caster, 66181, false); + caster->RemoveAllAuras(); + if (Creature *casterAsCreature = caster->ToCreature()) + casterAsCreature->DisappearAndDie(); + } } break; // Mana Tide @@ -2387,7 +2394,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const case 54362: // Slime Pool (Dreadscale & Acidmaw) case 66882: - target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)((((float)m_tickNumber / 60) * 0.9f + 0.1f) * 10000), NULL, true, NULL, this); + target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)((((float)m_tickNumber / 60) * 0.9f + 0.1f) * 10000 * 2 / 3), NULL, true, NULL, this); return; // Beacon of Light case 53563: diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index ce60df4fdc..c84f0ae102 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -222,7 +222,7 @@ public: void JustSummoned(Creature* pSummoned) { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM); + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true); switch (pSummoned->GetEntry()) { case NPC_BURROW: @@ -658,7 +658,7 @@ public: void Reset() { // For an unknown reason this npc isn't recognize the Aura of Permafrost with this flags =/ - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); m_uiTargetGUID = 0; } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 5b73b39910..6fbd449366 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -601,7 +601,7 @@ public: else if (!me->HasAura(AURA_SATED)) DoCastAOE(SPELL_BLOODLUST); - m_uiHeroismOrBloodlustTimer = urand(30*IN_MILLISECONDS, 60*IN_MILLISECONDS); + m_uiHeroismOrBloodlustTimer = 300*IN_MILLISECONDS; } else m_uiHeroismOrBloodlustTimer -= uiDiff; if (m_uiHexTimer <= uiDiff) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 4dd334ed32..1fcca917b7 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -209,7 +209,7 @@ public: if (m_uiIncinerateFleshTimer <= uiDiff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1)) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true)) { DoScriptText(EMOTE_INCINERATE, me, pTarget); DoScriptText(SAY_INCINERATE, me); @@ -226,7 +226,7 @@ public: if (m_uiLegionFlameTimer <= uiDiff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1)) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true)) { DoScriptText(EMOTE_LEGION_FLAME, me, pTarget); DoCast(pTarget, SPELL_LEGION_FLAME); @@ -534,14 +534,14 @@ public: if (m_uiSpinningStrikeTimer <= uiDiff) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) DoCast(pTarget, SPELL_SPINNING_STRIKE); m_uiSpinningStrikeTimer = 30*IN_MILLISECONDS; } else m_uiSpinningStrikeTimer -= uiDiff; if (IsHeroic() && m_uiMistressKissTimer <= uiDiff) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) DoCast(pTarget, SPELL_MISTRESS_KISS); m_uiMistressKissTimer = 30*IN_MILLISECONDS; } else m_uiMistressKissTimer -= uiDiff; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index b2c0830133..e5a6705b0e 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -843,7 +843,7 @@ public: m_uiStage = 2; break; case 2: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) { m_uiTrampleTargetGUID = pTarget->GetGUID(); me->SetUInt64Value(UNIT_FIELD_TARGET, m_uiTrampleTargetGUID); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 4e14a2208f..80e168b3de 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -389,7 +389,7 @@ struct boss_twin_baseAI : public ScriptedAI if (IsHeroic() && m_uiTouchTimer <= uiDiff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true, m_uiOtherEssenceSpellId)) - DoCast(pTarget, m_uiTouchSpellId); + me->CastCustomSpell(m_uiTouchSpellId, SPELLVALUE_MAX_TARGETS, 1, pTarget, false); m_uiTouchTimer = urand(10, 15)*IN_MILLISECONDS; } m_uiTouchTimer -= uiDiff; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 0f664c3d82..1d35ebf59d 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -281,17 +281,17 @@ public: void HandleEffectPeriodic(AuraEffect const * aurEff) { - Unit* pTarget = GetTarget(); - if (Unit* pCaster = GetCaster()) - { - int32 lifeLeeched = pTarget->CountPctFromMaxHealth(aurEff->GetAmount()); - if (lifeLeeched < 250) - lifeLeeched = 250; - // Damage - pCaster->CastCustomSpell(pTarget, SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, false); - // Heal - pCaster->CastCustomSpell(pCaster, SPELL_LEECHING_SWARM_HEAL, &lifeLeeched, 0, 0, false); - } + if (Unit* pTarget = GetTarget()) + if (Unit* pCaster = GetCaster()) + { + int32 lifeLeeched = pTarget->CountPctFromCurHealth(aurEff->GetAmount()); + if (lifeLeeched < 250) + lifeLeeched = 250; + // Damage + pCaster->CastCustomSpell(pTarget, SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, false); + // Heal + pCaster->CastCustomSpell(pCaster, SPELL_LEECHING_SWARM_HEAL, &lifeLeeched, 0, 0, false); + } } void Register()