diff options
author | Shauren <none@none> | 2010-11-10 12:18:43 +0100 |
---|---|---|
committer | Shauren <none@none> | 2010-11-10 12:18:43 +0100 |
commit | e3d4b36a6bcdd011dafe5745c86d30b326532a3a (patch) | |
tree | 9356d28aca53ac5d4c245c84526194fa94b9dcd2 /src | |
parent | cc220ca7b6550b9f86643b9e6c082475e5d904ae (diff) |
Scripts/Icecrown Citadel: Fixed Vengeful Shade despawning after it casts Vengeful Blast (Lady Deathwhisper)
Core/Auras: Implemented SPELL_AURA_SET_VEHICLE_ID (296)
Core/Scripts: Moved DefaultTargetSelector class into header file
--HG--
branch : trunk
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/AI/CoreAI/UnitAI.cpp | 49 | ||||
-rwxr-xr-x | src/server/game/AI/CoreAI/UnitAI.h | 49 | ||||
-rwxr-xr-x | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 32 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.h | 1 | ||||
-rwxr-xr-x | src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp | 15 |
5 files changed, 94 insertions, 52 deletions
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 9800bf88ca1..17f87003dfc 100755 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -80,55 +80,6 @@ bool UnitAI::DoSpellAttackIfReady(uint32 spell) return true; } -// default predicate function to select target based on distance, player and/or aura criteria -struct DefaultTargetSelector : public std::unary_function<Unit *, bool> -{ - const Unit *me; - float m_dist; - bool m_playerOnly; - int32 m_aura; - - // pUnit: the reference unit - // dist: if 0: ignored, if > 0: maximum distance to the reference unit, if < 0: minimum distance to the reference unit - // playerOnly: self explaining - // aura: if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura - DefaultTargetSelector(const Unit *pUnit, float dist, bool playerOnly, int32 aura) : me(pUnit), m_dist(dist), m_playerOnly(playerOnly), m_aura(aura) {} - - bool operator() (const Unit *pTarget) - { - if (!me) - return false; - - if (!pTarget) - return false; - - if (m_playerOnly && (pTarget->GetTypeId() != TYPEID_PLAYER)) - return false; - - if (m_dist > 0.0f && !me->IsWithinCombatRange(pTarget, m_dist)) - return false; - - if (m_dist < 0.0f && me->IsWithinCombatRange(pTarget, -m_dist)) - return false; - - if (m_aura) - { - if (m_aura > 0) - { - if (!pTarget->HasAura(m_aura)) - return false; - } - else - { - if (pTarget->HasAura(-m_aura)) - return false; - } - } - - return true; - } -}; - Unit* UnitAI::SelectTarget(SelectAggroTarget targetType, uint32 position, float dist, bool playerOnly, int32 aura) { return SelectTarget(targetType, position, DefaultTargetSelector(me, dist, playerOnly, aura)); diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index e2d5fae6473..dfdce670dd3 100755 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -48,6 +48,55 @@ enum SelectAggroTarget SELECT_TARGET_FARTHEST, }; +// default predicate function to select target based on distance, player and/or aura criteria +struct DefaultTargetSelector : public std::unary_function<Unit *, bool> +{ + const Unit *me; + float m_dist; + bool m_playerOnly; + int32 m_aura; + + // pUnit: the reference unit + // dist: if 0: ignored, if > 0: maximum distance to the reference unit, if < 0: minimum distance to the reference unit + // playerOnly: self explaining + // aura: if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura + DefaultTargetSelector(const Unit *pUnit, float dist, bool playerOnly, int32 aura) : me(pUnit), m_dist(dist), m_playerOnly(playerOnly), m_aura(aura) {} + + bool operator() (const Unit *pTarget) + { + if (!me) + return false; + + if (!pTarget) + return false; + + if (m_playerOnly && (pTarget->GetTypeId() != TYPEID_PLAYER)) + return false; + + if (m_dist > 0.0f && !me->IsWithinCombatRange(pTarget, m_dist)) + return false; + + if (m_dist < 0.0f && me->IsWithinCombatRange(pTarget, -m_dist)) + return false; + + if (m_aura) + { + if (m_aura > 0) + { + if (!pTarget->HasAura(m_aura)) + return false; + } + else + { + if (pTarget->HasAura(-m_aura)) + return false; + } + } + + return true; + } +}; + class UnitAI { protected: diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index a18d9d30941..790cb8485ec 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -6348,3 +6348,35 @@ void AuraEffect::HandleAuraOpenStable(AuraApplication const * aurApp, uint8 mode // client auto close stable dialog at !apply aura } + +void AuraEffect::HandleAuraSetVehicle(AuraApplication const * aurApp, uint8 mode, bool apply) const +{ + if (!(mode & AURA_EFFECT_HANDLE_REAL)) + return; + + Unit * target = aurApp->GetTarget(); + + if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld()) + return; + + uint32 vehicleId = GetMiscValue(); + + if (apply) + { + if (!target->CreateVehicleKit(vehicleId)) + return; + } + else if (target->GetVehicleKit()) + target->RemoveVehicleKit(); + + WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, target->GetPackGUID().size()+4); + data.appendPackGUID(target->GetGUID()); + data << uint32(apply ? vehicleId : 0); + target->SendMessageToSet(&data, true); + + if (apply) + { + data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0); + target->ToPlayer()->GetSession()->SendPacket(&data); + } +} diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index cafe9fa5fb8..0673bee0185 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -256,6 +256,7 @@ class AuraEffect void HandleAuraConvertRune(AuraApplication const * aurApp, uint8 mode, bool apply) const; void HandleAuraLinked(AuraApplication const * aurApp, uint8 mode, bool apply) const; void HandleAuraOpenStable(AuraApplication const * aurApp, uint8 mode, bool apply) const; + void HandleAuraSetVehicle(AuraApplication const * aurApp, uint8 mode, bool apply) const; }; #endif
\ No newline at end of file diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 628c5eb3312..79e2f04b766 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -295,8 +295,8 @@ class boss_lady_deathwhisper : public CreatureScript DoScriptText(SAY_PHASE_2, me); DoScriptText(SAY_PHASE_2_EMOTE, me); DoStartMovement(me->getVictim()); - me->SetPower(POWER_MANA, 0); uiDamage -= me->GetPower(POWER_MANA); + me->SetPower(POWER_MANA, 0); me->RemoveAurasDueToSpell(SPELL_MANA_BARRIER); events.SetPhase(PHASE_TWO); events.ScheduleEvent(EVENT_P2_FROSTBOLT, urand(10000, 12000), 0, PHASE_TWO); @@ -736,8 +736,17 @@ class npc_vengeful_shade : public CreatureScript void SpellHitTarget(Unit * /*pTarget*/, const SpellEntry * spell) { - if (spell->Id == SPELL_VENGEFUL_BLAST) - me->Kill(me); + switch (spell->Id) + { + case SPELL_VENGEFUL_BLAST: + case 72010: + case 72011: + case 72012: + me->Kill(me); + break; + default: + break; + } } }; |