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 "ScriptedCreature.h"
23#include "SpellAuraEffects.h"
24#include "SpellScript.h"
25
32
33// 26218 - Mistletoe
58
66
74
75// 26275 - PX-238 Winter Wondervolt TRAP
101
110
111// 25860 - Reindeer Transformation
113{
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:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_AURA_MOUNTED
#define SpellEffectFn(F, I, N)
@ MOVE_FLIGHT
@ MOVE_RUN
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition Unit.h:769
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3765
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4542
float GetSpeedRate(UnitMoveType mtype) const
Definition Unit.h:1654
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_winter_veil_mistletoe)
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
bool Validate(SpellInfo const *) override
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
@ 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