TrinityCore
winter_veil.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 "Containers.h"
20#include "CreatureAIImpl.h"
21#include "Player.h"
22#include "SpellAuraEffects.h"
23#include "SpellScript.h"
24
26{
30};
31
32// 26218 - Mistletoe
34{
35 bool Validate(SpellInfo const* /*spell*/) override
36 {
37 return ValidateSpellInfo(
38 {
42 });
43 }
44
45 void HandleScript(SpellEffIndex /*effIndex*/)
46 {
47 if (Player* target = GetHitPlayer())
48 {
50 GetCaster()->CastSpell(target, spellId, true);
51 }
52 }
53
54 void Register() override
55 {
57 }
58};
59
61{
66};
67
68std::array<uint32, 4> const WonderboltTransformSpells =
69{
74};
75
76// 26275 - PX-238 Winter Wondervolt TRAP
78{
79 bool Validate(SpellInfo const* /*spellInfo*/) override
80 {
82 }
83
85 {
87
88 if (Unit* target = GetHitUnit())
89 {
91 if (target->HasAura(spell))
92 return;
93
95 }
96 }
97
98 void Register() override
99 {
101 }
102};
103
105{
111};
112
113// 25860 - Reindeer Transformation
115{
116 bool Validate(SpellInfo const* /*spell*/) override
117 {
118 return ValidateSpellInfo(
119 {
125 });
126 }
127
128 void HandleDummy(SpellEffIndex /* effIndex */)
129 {
130 Unit* caster = GetCaster();
131 if (caster->HasAuraType(SPELL_AURA_MOUNTED))
132 {
133 float flyspeed = caster->GetSpeedRate(MOVE_FLIGHT);
134 float speed = caster->GetSpeedRate(MOVE_RUN);
135
137 //5 different spells used depending on mounted speed and if mount can fly or not
138
139 if (flyspeed >= 4.1f)
140 // Flying Reindeer
141 caster->CastSpell(caster, SPELL_FLYING_REINDEER_310, true); //310% flying Reindeer
142 else if (flyspeed >= 3.8f)
143 // Flying Reindeer
144 caster->CastSpell(caster, SPELL_FLYING_REINDEER_280, true); //280% flying Reindeer
145 else if (flyspeed >= 1.6f)
146 // Flying Reindeer
147 caster->CastSpell(caster, SPELL_FLYING_REINDEER_60, true); //60% flying Reindeer
148 else if (speed >= 2.0f)
149 // Reindeer
150 caster->CastSpell(caster, SPELL_REINDEER_100, true); //100% ground Reindeer
151 else
152 // Reindeer
153 caster->CastSpell(caster, SPELL_REINDEER_60, true); //60% ground Reindeer
154 }
155 }
156
157 void Register() override
158 {
160 }
161};
162
164{
168}
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition: Define.h:142
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_AURA_MOUNTED
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
@ MOVE_FLIGHT
Definition: UnitDefines.h:123
@ MOVE_RUN
Definition: UnitDefines.h:118
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Player * GetHitPlayer() const
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
Definition: Unit.h:627
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3812
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4674
float GetSpeedRate(UnitMoveType mtype) const
Definition: Unit.h:1644
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool Validate(SpellInfo const *) override
Definition: winter_veil.cpp:35
void HandleScript(SpellEffIndex)
Definition: winter_veil.cpp:45
void HandleScript(SpellEffIndex effIndex)
Definition: winter_veil.cpp:84
bool Validate(SpellInfo const *) override
Definition: winter_veil.cpp:79
bool Validate(SpellInfo const *) override
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:109
void AddSC_event_winter_veil()
ReindeerTransformation
@ SPELL_REINDEER_60
@ SPELL_REINDEER_100
@ SPELL_FLYING_REINDEER_280
@ SPELL_FLYING_REINDEER_310
@ SPELL_FLYING_REINDEER_60
PX238WinterWondervolt
Definition: winter_veil.cpp:61
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_1
Definition: winter_veil.cpp:62
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_2
Definition: winter_veil.cpp:63
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_3
Definition: winter_veil.cpp:64
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_4
Definition: winter_veil.cpp:65
std::array< uint32, 4 > const WonderboltTransformSpells
Definition: winter_veil.cpp:68
Mistletoe
Definition: winter_veil.cpp:26
@ SPELL_CREATE_HOLLY
Definition: winter_veil.cpp:28
@ SPELL_CREATE_SNOWFLAKES
Definition: winter_veil.cpp:29
@ SPELL_CREATE_MISTLETOE
Definition: winter_veil.cpp:27