forked from TrinityCore/TrinityCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspell_warrior.cpp
More file actions
96 lines (81 loc) · 3.22 KB
/
spell_warrior.cpp
File metadata and controls
96 lines (81 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Scripts for spells with SPELLFAMILY_WARRIOR and SPELLFAMILY_GENERIC spells used by warrior players.
* Ordered alphabetically using scriptname.
* Scriptnames of files in this file should be prefixed with "spell_warr_".
*/
#include "ScriptPCH.h"
enum WarriorSpells
{
WARRIOR_SPELL_LAST_STAND_TRIGGERED = 12976,
};
class spell_warr_last_stand : public SpellScriptLoader
{
public:
spell_warr_last_stand() : SpellScriptLoader("spell_warr_last_stand") { }
class spell_warr_last_stand_SpellScript : public SpellScript
{
PrepareSpellScript(spell_warr_last_stand_SpellScript);
bool Validate(SpellEntry const* /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(WARRIOR_SPELL_LAST_STAND_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
int32 healthModSpellBasePoints0 = int32(GetCaster()->CountPctFromMaxHealth(30));
GetCaster()->CastCustomSpell(GetCaster(), WARRIOR_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
}
void Register()
{
// add dummy effect spell handler to Last Stand
OnEffect += SpellEffectFn(spell_warr_last_stand_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript() const
{
return new spell_warr_last_stand_SpellScript();
}
};
class spell_warr_improved_spell_reflection : public SpellScriptLoader
{
public:
spell_warr_improved_spell_reflection() : SpellScriptLoader("spell_warr_improved_spell_reflection") { }
class spell_warr_improved_spell_reflection_SpellScript : public SpellScript
{
PrepareSpellScript(spell_warr_improved_spell_reflection_SpellScript);
void FilterTargets(std::list<Unit*>& unitList)
{
unitList.remove(GetCaster());
}
void Register()
{
OnUnitTargetSelect += SpellUnitTargetFn(spell_warr_improved_spell_reflection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_PARTY_CASTER);
}
};
SpellScript *GetSpellScript() const
{
return new spell_warr_improved_spell_reflection_SpellScript();
}
};
void AddSC_warrior_spell_scripts()
{
new spell_warr_last_stand();
new spell_warr_improved_spell_reflection();
}