TrinityCore
zone_dustwallow_marsh.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "Player.h"
20#include "SpellInfo.h"
21#include "SpellScript.h"
22
24{
28};
29
30// 42489 - Cast Ooze Zap When Energized
32{
33 bool Validate(SpellInfo const* spellInfo) override
34 {
35 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } })
37 }
38
40 {
41 if (!GetCaster()->HasAura(GetEffectInfo(EFFECT_1).CalcValue()))
42 return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
43
44 if (!GetExplTargetUnit())
46
47 return SPELL_CAST_OK;
48 }
49
51 {
53 if (GetHitUnit())
55 }
56
57 void Register() override
58 {
61 }
62};
63
64// 42485 - End of Ooze Channel
66{
67 bool Validate(SpellInfo const* /*spellInfo*/) override
68 {
70 }
71
73 {
75 if (Player* player = GetCaster()->ToPlayer())
76 player->CastSpell(player, SPELL_OOZE_CHANNEL_CREDIT, true);
78 }
79
80 void Register() override
81 {
83 }
84};
85
86// 42492 - Cast Energized
88{
89 bool Validate(SpellInfo const* /*spellInfo*/) override
90 {
92 }
93
94 void FilterTargets(std::list<WorldObject*>& targets)
95 {
96 for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
97 {
98 if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetEffectInfo(EFFECT_1).CalcValue()) == QUEST_STATUS_INCOMPLETE)
99 ++itr;
100 else
101 targets.erase(itr++);
102 }
103 targets.push_back(GetCaster());
104 }
105
107 {
108 PreventHitDefaultEffect(effIndex);
110 }
111
112 void Register() override
113 {
117 }
118};
119
120/*######
121## Quest 11140: Recover the Cargo!
122######*/
123
125{
129
130// 42287 - Salvage Wreckage
132{
133 bool Validate(SpellInfo const* /*spellInfo*/) override
134 {
136 }
137
138 void HandleDummy(SpellEffIndex /*effIndex*/)
139 {
141 }
142
143 void Register() override
144 {
146 }
147};
148
150{
155}
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:145
bool roll_chance_i(int chance)
Definition: Random.h:59
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ENTRY
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
SpellCastResult
@ SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW
@ SPELL_FAILED_BAD_TARGETS
@ SPELL_CAST_OK
#define SpellCheckCastFn(F)
Definition: SpellScript.h:830
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
uint32 const Id
Definition: SpellInfo.h:325
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
Definition: SpellScript.h:173
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:829
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Unit * GetHitUnit() const
int32 GetEffectValue() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
Unit * GetExplTargetUnit() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.h:921
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
void HandleScript(SpellEffIndex effIndex)
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex effIndex)
bool Validate(SpellInfo const *) override
void Register() override
void HandleDummy(SpellEffIndex effIndex)
bool Validate(SpellInfo const *spellInfo) override
SpellCastResult CheckRequirement()
@ SPELL_OOZE_ZAP
@ SPELL_ENERGIZED
@ SPELL_OOZE_CHANNEL_CREDIT
void AddSC_dustwallow_marsh()
@ SPELL_SUMMON_BURROWER
@ SPELL_SUMMON_LOCKBOX