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
55
63
71
72// 26275 - PX-238 Winter Wondervolt TRAP
74{
75 bool Validate(SpellInfo const* /*spellInfo*/) override
76 {
78 }
79
80 void HandleScript(SpellEffIndex /*effIndex*/)
81 {
82 Unit* target = GetHitUnit();
83
85 if (target->HasAura(spell))
86 return;
87
89 }
90
95};
96
105
106// 25860 - Reindeer Transformation
108{
109 bool Validate(SpellInfo const* /*spell*/) override
110 {
111 return ValidateSpellInfo(
112 {
118 });
119 }
120
121 void HandleDummy(SpellEffIndex /* effIndex */)
122 {
123 Unit* caster = GetCaster();
124 if (caster->HasAuraType(SPELL_AURA_MOUNTED))
125 {
126 float flyspeed = caster->GetSpeedRate(MOVE_FLIGHT);
127 float speed = caster->GetSpeedRate(MOVE_RUN);
128
130 //5 different spells used depending on mounted speed and if mount can fly or not
131
132 if (flyspeed >= 4.1f)
133 // Flying Reindeer
134 caster->CastSpell(caster, SPELL_FLYING_REINDEER_310, true); //310% flying Reindeer
135 else if (flyspeed >= 3.8f)
136 // Flying Reindeer
137 caster->CastSpell(caster, SPELL_FLYING_REINDEER_280, true); //280% flying Reindeer
138 else if (flyspeed >= 1.6f)
139 // Flying Reindeer
140 caster->CastSpell(caster, SPELL_FLYING_REINDEER_60, true); //60% flying Reindeer
141 else if (speed >= 2.0f)
142 // Reindeer
143 caster->CastSpell(caster, SPELL_REINDEER_100, true); //100% ground Reindeer
144 else
145 // Reindeer
146 caster->CastSpell(caster, SPELL_REINDEER_60, true); //60% ground Reindeer
147 }
148 }
149
154};
155
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)
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition Unit.h:647
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3973
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4832
float GetSpeedRate(UnitMoveType mtype) const
Definition Unit.h:1734
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4822
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
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