TrinityCore
Loading...
Searching...
No Matches
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
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).CalcValueAsInt()))
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
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
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).CalcValueAsInt()) == 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
118};
119
120/*######
121## Quest 11140: Recover the Cargo!
122######*/
123
129
130// 42287 - Salvage Wreckage
148
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:150
bool roll_chance(T chance)
Definition Random.h:55
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ 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)
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
HookList< CheckCastHandler > OnCheckCast
Unit * GetCaster() const
int32 GetEffectValueAsInt() const
HookList< EffectHandler > OnEffectHit
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
Unit * GetExplTargetUnit() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition Unit.h:936
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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_CHANNEL_CREDIT
void AddSC_dustwallow_marsh()
@ SPELL_SUMMON_BURROWER
@ SPELL_SUMMON_LOCKBOX