TrinityCore
Loading...
Searching...
No Matches
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
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
58};
59
67
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
102};
103
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
161};
162
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition Define.h:154
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_AURA_MOUNTED
#define SpellEffectFn(F, I, N)
@ MOVE_FLIGHT
@ MOVE_RUN
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Player * GetHitPlayer() const
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition Unit.h:635
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3955
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4814
float GetSpeedRate(UnitMoveType mtype) const
Definition Unit.h:1707
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
void HandleScript(SpellEffIndex effIndex)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
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
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_1
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_2
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_3
@ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_4
std::array< uint32, 4 > const WonderboltTransformSpells
Mistletoe
@ SPELL_CREATE_HOLLY
@ SPELL_CREATE_SNOWFLAKES
@ SPELL_CREATE_MISTLETOE