TrinityCore
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 "ScriptedCreature.h"
23#include "SpellAuraEffects.h"
24#include "SpellScript.h"
25
27{
31};
32
33// 26218 - Mistletoe
35{
37
38 bool Validate(SpellInfo const* /*spell*/) override
39 {
40 return ValidateSpellInfo(
41 {
45 });
46 }
47
48 void HandleScript(SpellEffIndex /*effIndex*/)
49 {
50 if (Player* target = GetHitPlayer())
51 {
53 GetCaster()->CastSpell(target, spellId, true);
54 }
55 }
56
57 void Register() override
58 {
60 }
61};
62
64{
69};
70
71std::array<uint32, 4> const WonderboltTransformSpells =
72{
77};
78
79// 26275 - PX-238 Winter Wondervolt TRAP
81{
83
84 bool Validate(SpellInfo const* /*spellInfo*/) override
85 {
87 }
88
90 {
92
93 if (Unit* target = GetHitUnit())
94 {
96 if (target->HasAura(spell))
97 return;
98
100 }
101 }
102
103 void Register() override
104 {
106 }
107};
108
110{
116};
117
118// 25860 - Reindeer Transformation
120{
122
123 bool Validate(SpellInfo const* /*spell*/) override
124 {
125 return ValidateSpellInfo(
126 {
132 });
133 }
134
135 void HandleDummy(SpellEffIndex /* effIndex */)
136 {
137 Unit* caster = GetCaster();
138 if (caster->HasAuraType(SPELL_AURA_MOUNTED))
139 {
140 float flyspeed = caster->GetSpeedRate(MOVE_FLIGHT);
141 float speed = caster->GetSpeedRate(MOVE_RUN);
142
144 //5 different spells used depending on mounted speed and if mount can fly or not
145
146 if (flyspeed >= 4.1f)
147 // Flying Reindeer
148 caster->CastSpell(caster, SPELL_FLYING_REINDEER_310, true); //310% flying Reindeer
149 else if (flyspeed >= 3.8f)
150 // Flying Reindeer
151 caster->CastSpell(caster, SPELL_FLYING_REINDEER_280, true); //280% flying Reindeer
152 else if (flyspeed >= 1.6f)
153 // Flying Reindeer
154 caster->CastSpell(caster, SPELL_FLYING_REINDEER_60, true); //60% flying Reindeer
155 else if (speed >= 2.0f)
156 // Reindeer
157 caster->CastSpell(caster, SPELL_REINDEER_100, true); //100% ground Reindeer
158 else
159 // Reindeer
160 caster->CastSpell(caster, SPELL_REINDEER_60, true); //60% ground Reindeer
161 }
162 }
163
164 void Register() override
165 {
167 }
168};
169
171{
175}
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition: Define.h:133
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1129
SpellEffIndex
Definition: SharedDefines.h:30
@ EFFECT_0
Definition: SharedDefines.h:31
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_AURA_MOUNTED
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:384
@ MOVE_FLIGHT
Definition: UnitDefines.h:352
@ MOVE_RUN
Definition: UnitDefines.h:347
Definition: Player.h:915
Player * GetHitPlayer() const
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:381
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:382
Definition: Unit.h:769
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3761
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4538
float GetSpeedRate(UnitMoveType mtype) const
Definition: Unit.h:1654
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2831
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:145
PrepareSpellScript(spell_winter_veil_mistletoe)
bool Validate(SpellInfo const *) override
Definition: winter_veil.cpp:38
void HandleScript(SpellEffIndex)
Definition: winter_veil.cpp:48
void HandleScript(SpellEffIndex effIndex)
Definition: winter_veil.cpp:89
bool Validate(SpellInfo const *) override
Definition: winter_veil.cpp:84
PrepareSpellScript(spell_winter_veil_px_238_winter_wondervolt)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_winter_veil_reindeer_transformation)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:108
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:64
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_1
Definition: winter_veil.cpp:65
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_2
Definition: winter_veil.cpp:66
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_3
Definition: winter_veil.cpp:67
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_4
Definition: winter_veil.cpp:68
std::array< uint32, 4 > const WonderboltTransformSpells
Definition: winter_veil.cpp:71
Mistletoe
Definition: winter_veil.cpp:27
@ SPELL_CREATE_HOLLY
Definition: winter_veil.cpp:29
@ SPELL_CREATE_SNOWFLAKES
Definition: winter_veil.cpp:30
@ SPELL_CREATE_MISTLETOE
Definition: winter_veil.cpp:28