mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 21:56:22 +00:00
Using TC structure allowing easier patches importing
This commit is contained in:
28
src/server/scripts/Spells/CMakeLists.txt
Normal file
28
src/server/scripts/Spells/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
# Copyright (C)
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
set(scripts_STAT_SRCS
|
||||
${scripts_STAT_SRCS}
|
||||
Spells/spell_shaman.cpp
|
||||
Spells/spell_hunter.cpp
|
||||
Spells/spell_rogue.cpp
|
||||
Spells/spell_druid.cpp
|
||||
Spells/spell_dk.cpp
|
||||
Spells/spell_quest.cpp
|
||||
Spells/spell_warrior.cpp
|
||||
Spells/spell_generic.cpp
|
||||
Spells/spell_warlock.cpp
|
||||
Spells/spell_priest.cpp
|
||||
Spells/spell_mage.cpp
|
||||
Spells/spell_paladin.cpp
|
||||
Spells/spell_item.cpp
|
||||
)
|
||||
|
||||
message(" -> Prepared: Spells")
|
||||
2597
src/server/scripts/Spells/spell_dk.cpp
Normal file
2597
src/server/scripts/Spells/spell_dk.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1405
src/server/scripts/Spells/spell_druid.cpp
Normal file
1405
src/server/scripts/Spells/spell_druid.cpp
Normal file
File diff suppressed because it is too large
Load Diff
5051
src/server/scripts/Spells/spell_generic.cpp
Normal file
5051
src/server/scripts/Spells/spell_generic.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1202
src/server/scripts/Spells/spell_hunter.cpp
Normal file
1202
src/server/scripts/Spells/spell_hunter.cpp
Normal file
File diff suppressed because it is too large
Load Diff
3988
src/server/scripts/Spells/spell_item.cpp
Normal file
3988
src/server/scripts/Spells/spell_item.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1107
src/server/scripts/Spells/spell_mage.cpp
Normal file
1107
src/server/scripts/Spells/spell_mage.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1366
src/server/scripts/Spells/spell_paladin.cpp
Normal file
1366
src/server/scripts/Spells/spell_paladin.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1001
src/server/scripts/Spells/spell_priest.cpp
Normal file
1001
src/server/scripts/Spells/spell_priest.cpp
Normal file
File diff suppressed because it is too large
Load Diff
3123
src/server/scripts/Spells/spell_quest.cpp
Normal file
3123
src/server/scripts/Spells/spell_quest.cpp
Normal file
File diff suppressed because it is too large
Load Diff
821
src/server/scripts/Spells/spell_rogue.cpp
Normal file
821
src/server/scripts/Spells/spell_rogue.cpp
Normal file
@@ -0,0 +1,821 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: http://github.com/azerothcore/azerothcore-wotlk/LICENSE-GPL2
|
||||
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Scripts for spells with SPELLFAMILY_ROGUE and SPELLFAMILY_GENERIC spells used by rogue players.
|
||||
* Ordered alphabetically using scriptname.
|
||||
* Scriptnames of files in this file should be prefixed with "spell_rog_".
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "CellImpl.h"
|
||||
|
||||
enum RogueSpells
|
||||
{
|
||||
SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK = 22482,
|
||||
SPELL_ROGUE_CHEAT_DEATH_COOLDOWN = 31231,
|
||||
SPELL_ROGUE_CHEATING_DEATH = 45182,
|
||||
SPELL_ROGUE_GLYPH_OF_PREPARATION = 56819,
|
||||
SPELL_ROGUE_KILLING_SPREE = 51690,
|
||||
SPELL_ROGUE_KILLING_SPREE_TELEPORT = 57840,
|
||||
SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG = 57841,
|
||||
SPELL_ROGUE_KILLING_SPREE_DMG_BUFF = 61851,
|
||||
SPELL_ROGUE_PREY_ON_THE_WEAK = 58670,
|
||||
SPELL_ROGUE_SHIV_TRIGGERED = 5940,
|
||||
SPELL_ROGUE_TRICKS_OF_THE_TRADE_DMG_BOOST = 57933,
|
||||
SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC = 59628,
|
||||
};
|
||||
|
||||
// Ours
|
||||
class spell_rog_savage_combat : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_savage_combat() : SpellScriptLoader("spell_rog_savage_combat") { }
|
||||
|
||||
class spell_rog_savage_combat_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_savage_combat_AuraScript);
|
||||
|
||||
void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude)
|
||||
{
|
||||
isPeriodic = true;
|
||||
amplitude = 1000;
|
||||
}
|
||||
|
||||
void Update(AuraEffect* /*auraEffect*/)
|
||||
{
|
||||
Unit::AuraApplicationMap const& auras = GetUnitOwner()->GetAppliedAuras();
|
||||
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||
if (itr->second->GetBase()->GetCasterGUID() == this->GetCasterGUID() && itr->second->GetBase()->GetSpellInfo()->Dispel == DISPEL_POISON)
|
||||
return;
|
||||
|
||||
SetDuration(0);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_rog_savage_combat_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
|
||||
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_rog_savage_combat_AuraScript::Update, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_savage_combat_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_rog_combat_potency : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_combat_potency() : SpellScriptLoader("spell_rog_combat_potency") { }
|
||||
|
||||
class spell_rog_combat_potency_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_combat_potency_AuraScript);
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
return eventInfo.GetTypeMask() & PROC_FLAG_DONE_MELEE_AUTO_ATTACK;
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_rog_combat_potency_AuraScript::CheckProc);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_combat_potency_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Theirs
|
||||
// 13877, 33735, (check 51211, 65956) - Blade Flurry
|
||||
class spell_rog_blade_flurry : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_blade_flurry() : SpellScriptLoader("spell_rog_blade_flurry") { }
|
||||
|
||||
class spell_rog_blade_flurry_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_blade_flurry_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
_procTargetGUID = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
Unit* _procTarget = eventInfo.GetActor()->SelectNearbyTarget(eventInfo.GetProcTarget());
|
||||
if (_procTarget)
|
||||
_procTargetGUID = _procTarget->GetGUID();
|
||||
return _procTarget;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
// Xinef: no _procTarget but checkproc passed??
|
||||
// Unit::CalculateAOEDamageReduction (this=0x0, damage=4118, schoolMask=1, caster=0x7ffdad089000)
|
||||
Unit* procTarget = ObjectAccessor::GetUnit(*GetTarget(), _procTargetGUID);
|
||||
if (procTarget && eventInfo.GetDamageInfo())
|
||||
{
|
||||
int32 damage = eventInfo.GetDamageInfo()->GetDamage();
|
||||
// Xinef: Include AOE Damage Reduction auras
|
||||
damage = procTarget->CalculateAOEDamageReduction(damage, SPELL_SCHOOL_MASK_NORMAL, GetTarget());
|
||||
|
||||
CustomSpellValues values;
|
||||
values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage);
|
||||
values.AddSpellMod(SPELLVALUE_FORCED_CRIT_RESULT, int32(eventInfo.GetHitMask() & PROC_EX_CRITICAL_HIT));
|
||||
GetTarget()->CastCustomSpell(SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK, values, procTarget, TRIGGERED_FULL_MASK, NULL, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_rog_blade_flurry_AuraScript::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_rog_blade_flurry_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_MOD_MELEE_HASTE);
|
||||
}
|
||||
|
||||
private:
|
||||
uint64 _procTargetGUID;
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_blade_flurry_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -31228 - Cheat Death
|
||||
class spell_rog_cheat_death : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_cheat_death() : SpellScriptLoader("spell_rog_cheat_death") { }
|
||||
|
||||
class spell_rog_cheat_death_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_cheat_death_AuraScript);
|
||||
|
||||
uint32 absorbChance;
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
absorbChance = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
|
||||
return GetUnitOwner()->ToPlayer();
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
|
||||
{
|
||||
// Set absorbtion amount to unlimited
|
||||
amount = -1;
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Player* target = GetTarget()->ToPlayer();
|
||||
if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance))
|
||||
return;
|
||||
|
||||
target->CastSpell(target, SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, true);
|
||||
target->CastSpell(target, SPELL_ROGUE_CHEATING_DEATH, true);
|
||||
target->AddSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, 0, MINUTE*IN_MILLISECONDS);
|
||||
|
||||
uint32 health10 = target->CountPctFromMaxHealth(10);
|
||||
|
||||
// hp > 10% - absorb hp till 10%
|
||||
if (target->GetHealth() > health10)
|
||||
absorbAmount = dmgInfo.GetDamage() - target->GetHealth() + health10;
|
||||
// hp lower than 10% - absorb everything
|
||||
else
|
||||
absorbAmount = dmgInfo.GetDamage();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_cheat_death_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_cheat_death_AuraScript::Absorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_cheat_death_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -2818 - Deadly Poison
|
||||
class spell_rog_deadly_poison : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_deadly_poison() : SpellScriptLoader("spell_rog_deadly_poison") { }
|
||||
|
||||
class spell_rog_deadly_poison_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_rog_deadly_poison_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
_stackAmount = 0;
|
||||
// at this point CastItem must already be initialized
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem();
|
||||
}
|
||||
|
||||
void HandleBeforeHit()
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
// Deadly Poison
|
||||
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID()))
|
||||
_stackAmount = aurEff->GetBase()->GetStackAmount();
|
||||
}
|
||||
|
||||
void HandleAfterHit()
|
||||
{
|
||||
if (_stackAmount < 5)
|
||||
return;
|
||||
|
||||
Player* player = GetCaster()->ToPlayer();
|
||||
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
|
||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||
|
||||
if (item == GetCastItem())
|
||||
item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
// item combat enchantments
|
||||
for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
|
||||
{
|
||||
SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(EnchantmentSlot(slot)));
|
||||
if (!enchant)
|
||||
continue;
|
||||
|
||||
for (uint8 s = 0; s < 3; ++s)
|
||||
{
|
||||
if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
|
||||
continue;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog->outError("Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Proc only rogue poisons
|
||||
if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON)
|
||||
continue;
|
||||
|
||||
// Do not reproc deadly
|
||||
if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0))
|
||||
continue;
|
||||
|
||||
if (spellInfo->IsPositive())
|
||||
player->CastSpell(player, enchant->spellid[s], true, item);
|
||||
else
|
||||
player->CastSpell(target, enchant->spellid[s], true, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
BeforeHit += SpellHitFn(spell_rog_deadly_poison_SpellScript::HandleBeforeHit);
|
||||
AfterHit += SpellHitFn(spell_rog_deadly_poison_SpellScript::HandleAfterHit);
|
||||
}
|
||||
|
||||
uint8 _stackAmount;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_rog_deadly_poison_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 51690 - Killing Spree
|
||||
#define KillingSpreeScriptName "spell_rog_killing_spree"
|
||||
class spell_rog_killing_spree : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_killing_spree() : SpellScriptLoader(KillingSpreeScriptName) { }
|
||||
|
||||
class spell_rog_killing_spree_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_rog_killing_spree_SpellScript);
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
// Kologarn area, Killing Spree should not work
|
||||
if (GetCaster()->GetMapId() == 603 /*Ulduar*/ && GetCaster()->GetDistance2d(1766.936f, -24.748f) < 50.0f)
|
||||
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (targets.empty() || GetCaster()->GetVehicleBase() || GetCaster()->HasUnitState(UNIT_STATE_ROOT))
|
||||
FinishCast(SPELL_FAILED_OUT_OF_RANGE);
|
||||
else
|
||||
{
|
||||
// Added attribute not breaking stealth, removes auras here
|
||||
GetCaster()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
|
||||
GetCaster()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Aura* aura = GetCaster()->GetAura(SPELL_ROGUE_KILLING_SPREE))
|
||||
{
|
||||
if (spell_rog_killing_spree_AuraScript* script = dynamic_cast<spell_rog_killing_spree_AuraScript*>(aura->GetScriptByName(KillingSpreeScriptName)))
|
||||
script->AddTarget(GetHitUnit());
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_rog_killing_spree_SpellScript::CheckCast);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rog_killing_spree_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_rog_killing_spree_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_rog_killing_spree_SpellScript();
|
||||
}
|
||||
|
||||
class spell_rog_killing_spree_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_killing_spree_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_TELEPORT)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_DMG_BUFF))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_ROGUE_KILLING_SPREE_DMG_BUFF, true);
|
||||
}
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
while (!_targets.empty())
|
||||
{
|
||||
uint64 guid = Trinity::Containers::SelectRandomContainerElement(_targets);
|
||||
if (Unit* target = ObjectAccessor::GetUnit(*GetTarget(), guid))
|
||||
{
|
||||
// xinef: target may be no longer valid
|
||||
if (!GetTarget()->IsValidAttackTarget(target))
|
||||
{
|
||||
_targets.remove(guid);
|
||||
continue;
|
||||
}
|
||||
|
||||
GetTarget()->CastSpell(target, SPELL_ROGUE_KILLING_SPREE_TELEPORT, true);
|
||||
|
||||
// xinef: ensure fast coordinates switch, dont wait for client to send opcode
|
||||
WorldLocation const& dest = GetTarget()->ToPlayer()->GetTeleportDest();
|
||||
GetTarget()->ToPlayer()->UpdatePosition(dest, true);
|
||||
|
||||
GetTarget()->CastSpell(target, SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_DONT_REPORT_CAST_ERROR));
|
||||
break;
|
||||
}
|
||||
else
|
||||
_targets.remove(guid);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
GetTarget()->RemoveAurasDueToSpell(SPELL_ROGUE_KILLING_SPREE_DMG_BUFF);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_rog_killing_spree_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_killing_spree_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_rog_killing_spree_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
|
||||
public:
|
||||
void AddTarget(Unit* target)
|
||||
{
|
||||
_targets.push_back(target->GetGUID());
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<uint64> _targets;
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_killing_spree_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -31130 - Nerves of Steel
|
||||
class spell_rog_nerves_of_steel : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { }
|
||||
|
||||
class spell_rog_nerves_of_steel_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_nerves_of_steel_AuraScript);
|
||||
|
||||
uint32 absorbPct;
|
||||
|
||||
bool Load()
|
||||
{
|
||||
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
|
||||
return true;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
|
||||
{
|
||||
// Set absorbtion amount to unlimited
|
||||
amount = -1;
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
// reduces all damage taken while stun or fear
|
||||
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
|
||||
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_nerves_of_steel_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_nerves_of_steel_AuraScript::Absorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_nerves_of_steel_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 14185 - Preparation
|
||||
class spell_rog_preparation : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_preparation() : SpellScriptLoader("spell_rog_preparation") { }
|
||||
|
||||
class spell_rog_preparation_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_rog_preparation_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_GLYPH_OF_PREPARATION))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
//immediately finishes the cooldown on certain Rogue abilities
|
||||
|
||||
bool hasGlyph = caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION);
|
||||
PlayerSpellMap const& spellMap = caster->GetSpellMap();
|
||||
for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
|
||||
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
|
||||
{
|
||||
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep
|
||||
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint
|
||||
{
|
||||
SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id);
|
||||
if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient)
|
||||
caster->RemoveSpellCooldown(spellInfo->Id, true);
|
||||
else
|
||||
caster->RemoveSpellCooldown(spellInfo->Id, false);
|
||||
}
|
||||
else if (hasGlyph)
|
||||
{
|
||||
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle
|
||||
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick
|
||||
(spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry
|
||||
spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY))
|
||||
{
|
||||
SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id);
|
||||
if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient)
|
||||
caster->RemoveSpellCooldown(spellInfo->Id, true);
|
||||
else
|
||||
caster->RemoveSpellCooldown(spellInfo->Id, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_rog_preparation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_rog_preparation_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -51685 - Prey on the Weak
|
||||
class spell_rog_prey_on_the_weak : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_prey_on_the_weak() : SpellScriptLoader("spell_rog_prey_on_the_weak") { }
|
||||
|
||||
class spell_rog_prey_on_the_weak_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_PREY_ON_THE_WEAK))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
Unit* victim = target->GetVictim();
|
||||
if (!victim && target->GetTypeId() == TYPEID_PLAYER)
|
||||
victim = target->ToPlayer()->GetSelectedUnit();
|
||||
|
||||
if (victim && (target->GetHealthPct() > victim->GetHealthPct()))
|
||||
{
|
||||
if (!target->HasAura(SPELL_ROGUE_PREY_ON_THE_WEAK))
|
||||
{
|
||||
int32 bp = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
|
||||
target->CastCustomSpell(target, SPELL_ROGUE_PREY_ON_THE_WEAK, &bp, 0, 0, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
target->RemoveAurasDueToSpell(SPELL_ROGUE_PREY_ON_THE_WEAK);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_prey_on_the_weak_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_prey_on_the_weak_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -1943 - Rupture
|
||||
class spell_rog_rupture : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_rupture() : SpellScriptLoader("spell_rog_rupture") { }
|
||||
|
||||
class spell_rog_rupture_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_rupture_AuraScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
return caster && caster->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
canBeRecalculated = false;
|
||||
|
||||
float const attackpowerPerCombo[6] =
|
||||
{
|
||||
0.0f,
|
||||
0.015f, // 1 point: ${($m1 + $b1*1 + 0.015 * $AP) * 4} damage over 8 secs
|
||||
0.024f, // 2 points: ${($m1 + $b1*2 + 0.024 * $AP) * 5} damage over 10 secs
|
||||
0.03f, // 3 points: ${($m1 + $b1*3 + 0.03 * $AP) * 6} damage over 12 secs
|
||||
0.03428571f, // 4 points: ${($m1 + $b1*4 + 0.03428571 * $AP) * 7} damage over 14 secs
|
||||
0.0375f // 5 points: ${($m1 + $b1*5 + 0.0375 * $AP) * 8} damage over 16 secs
|
||||
};
|
||||
|
||||
uint8 cp = caster->ToPlayer()->GetComboPoints();
|
||||
if (cp > 5)
|
||||
cp = 5;
|
||||
|
||||
amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * attackpowerPerCombo[cp]);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_rupture_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_rupture_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 5938 - Shiv
|
||||
class spell_rog_shiv : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_shiv() : SpellScriptLoader("spell_rog_shiv") { }
|
||||
|
||||
class spell_rog_shiv_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_rog_shiv_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_SHIV_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
caster->CastSpell(unitTarget, SPELL_ROGUE_SHIV_TRIGGERED, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_rog_shiv_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 57934 - Tricks of the Trade
|
||||
class spell_rog_tricks_of_the_trade : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_tricks_of_the_trade() : SpellScriptLoader("spell_rog_tricks_of_the_trade") { }
|
||||
|
||||
class spell_rog_tricks_of_the_trade_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_tricks_of_the_trade_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_TRICKS_OF_THE_TRADE_DMG_BOOST))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
_redirectTarget = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT)
|
||||
GetTarget()->ResetRedirectThreat();
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo& /*eventInfo*/)
|
||||
{
|
||||
_redirectTarget = GetTarget()->GetRedirectThreatTarget();
|
||||
return _redirectTarget;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit* target = GetTarget();
|
||||
target->CastSpell(_redirectTarget, SPELL_ROGUE_TRICKS_OF_THE_TRADE_DMG_BOOST, true);
|
||||
target->CastSpell(target, SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC, true);
|
||||
Remove(AURA_REMOVE_BY_DEFAULT); // maybe handle by proc charges
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_rog_tricks_of_the_trade_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
DoCheckProc += AuraCheckProcFn(spell_rog_tricks_of_the_trade_AuraScript::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_rog_tricks_of_the_trade_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_DUMMY);
|
||||
}
|
||||
|
||||
private:
|
||||
Unit* _redirectTarget;
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_tricks_of_the_trade_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 59628 - Tricks of the Trade (Proc)
|
||||
class spell_rog_tricks_of_the_trade_proc : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_tricks_of_the_trade_proc() : SpellScriptLoader("spell_rog_tricks_of_the_trade_proc") { }
|
||||
|
||||
class spell_rog_tricks_of_the_trade_proc_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_tricks_of_the_trade_proc_AuraScript);
|
||||
|
||||
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
GetTarget()->ResetRedirectThreat();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_rog_tricks_of_the_trade_proc_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_tricks_of_the_trade_proc_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_rogue_spell_scripts()
|
||||
{
|
||||
// Ours
|
||||
new spell_rog_savage_combat();
|
||||
new spell_rog_combat_potency();
|
||||
|
||||
// Theirs
|
||||
new spell_rog_blade_flurry();
|
||||
new spell_rog_cheat_death();
|
||||
new spell_rog_deadly_poison();
|
||||
new spell_rog_killing_spree();
|
||||
new spell_rog_nerves_of_steel();
|
||||
new spell_rog_preparation();
|
||||
new spell_rog_prey_on_the_weak();
|
||||
new spell_rog_rupture();
|
||||
new spell_rog_shiv();
|
||||
new spell_rog_tricks_of_the_trade();
|
||||
new spell_rog_tricks_of_the_trade_proc();
|
||||
}
|
||||
1382
src/server/scripts/Spells/spell_shaman.cpp
Normal file
1382
src/server/scripts/Spells/spell_shaman.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1416
src/server/scripts/Spells/spell_warlock.cpp
Normal file
1416
src/server/scripts/Spells/spell_warlock.cpp
Normal file
File diff suppressed because it is too large
Load Diff
997
src/server/scripts/Spells/spell_warrior.cpp
Normal file
997
src/server/scripts/Spells/spell_warrior.cpp
Normal file
@@ -0,0 +1,997 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: http://github.com/azerothcore/azerothcore-wotlk/LICENSE-GPL2
|
||||
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 "ScriptMgr.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "Player.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
enum WarriorSpells
|
||||
{
|
||||
// Ours
|
||||
SPELL_WARRIOR_INTERVENE_TRIGGER = 59667,
|
||||
SPELL_WARRIOR_SPELL_REFLECTION = 23920,
|
||||
SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER = 59725,
|
||||
|
||||
// Theirs
|
||||
SPELL_WARRIOR_BLOODTHIRST = 23885,
|
||||
SPELL_WARRIOR_BLOODTHIRST_DAMAGE = 23881,
|
||||
SPELL_WARRIOR_CHARGE = 34846,
|
||||
SPELL_WARRIOR_DAMAGE_SHIELD_DAMAGE = 59653,
|
||||
SPELL_WARRIOR_DEEP_WOUNDS_RANK_1 = 12162,
|
||||
SPELL_WARRIOR_DEEP_WOUNDS_RANK_2 = 12850,
|
||||
SPELL_WARRIOR_DEEP_WOUNDS_RANK_3 = 12868,
|
||||
SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC = 12721,
|
||||
SPELL_WARRIOR_EXECUTE = 20647,
|
||||
SPELL_WARRIOR_GLYPH_OF_EXECUTION = 58367,
|
||||
SPELL_WARRIOR_GLYPH_OF_VIGILANCE = 63326,
|
||||
SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_BUFF = 65156,
|
||||
SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_TALENT = 64976,
|
||||
SPELL_WARRIOR_LAST_STAND_TRIGGERED = 12976,
|
||||
SPELL_WARRIOR_RETALIATION_DAMAGE = 22858,
|
||||
SPELL_WARRIOR_SLAM = 50783,
|
||||
SPELL_WARRIOR_SUNDER_ARMOR = 58567,
|
||||
SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK = 26654,
|
||||
SPELL_WARRIOR_TAUNT = 355,
|
||||
SPELL_WARRIOR_UNRELENTING_ASSAULT_RANK_1 = 46859,
|
||||
SPELL_WARRIOR_UNRELENTING_ASSAULT_RANK_2 = 46860,
|
||||
SPELL_WARRIOR_UNRELENTING_ASSAULT_TRIGGER_1 = 64849,
|
||||
SPELL_WARRIOR_UNRELENTING_ASSAULT_TRIGGER_2 = 64850,
|
||||
SPELL_WARRIOR_VIGILANCE_PROC = 50725,
|
||||
SPELL_WARRIOR_VIGILANCE_REDIRECT_THREAT = 59665
|
||||
};
|
||||
|
||||
enum WarriorSpellIcons
|
||||
{
|
||||
WARRIOR_ICON_ID_SUDDEN_DEATH = 1989
|
||||
};
|
||||
|
||||
enum MiscSpells
|
||||
{
|
||||
SPELL_PALADIN_BLESSING_OF_SANCTUARY = 20911,
|
||||
SPELL_PALADIN_GREATER_BLESSING_OF_SANCTUARY = 25899,
|
||||
SPELL_PRIEST_RENEWED_HOPE = 63944,
|
||||
SPELL_GEN_DAMAGE_REDUCTION_AURA = 68066,
|
||||
};
|
||||
|
||||
// Ours
|
||||
class spell_warr_mocking_blow : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_mocking_blow() : SpellScriptLoader("spell_warr_mocking_blow") { }
|
||||
|
||||
class spell_warr_mocking_blow_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_mocking_blow_SpellScript);
|
||||
|
||||
void HandleOnHit()
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (target->IsImmunedToSpellEffect(GetSpellInfo(), EFFECT_1))
|
||||
SetHitDamage(0);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnHit += SpellHitFn(spell_warr_mocking_blow_SpellScript::HandleOnHit);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_mocking_blow_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_warr_intervene : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_intervene() : SpellScriptLoader("spell_warr_intervene") { }
|
||||
|
||||
class spell_warr_intervene_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_intervene_SpellScript);
|
||||
|
||||
void HandleApplyAura(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
target->CastSpell((Unit*)NULL, SPELL_WARRIOR_INTERVENE_TRIGGER, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_intervene_SpellScript::HandleApplyAura, EFFECT_1, SPELL_EFFECT_APPLY_AURA);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_intervene_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_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warr_improved_spell_reflection_AuraScript);
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
return eventInfo.GetDamageInfo()->GetSpellInfo() && eventInfo.GetDamageInfo()->GetSpellInfo()->Id == SPELL_WARRIOR_SPELL_REFLECTION;
|
||||
}
|
||||
|
||||
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
CustomSpellValues values;
|
||||
values.AddSpellMod(SPELLVALUE_MAX_TARGETS, aurEff->GetAmount());
|
||||
values.AddSpellMod(SPELLVALUE_RADIUS_MOD, 2000); // Base range = 100, final range = 20 value / 10000.0f = 0.2f
|
||||
eventInfo.GetActor()->CastCustomSpell(SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER, values, eventInfo.GetActor(), TRIGGERED_FULL_MASK, NULL);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_warr_improved_spell_reflection_AuraScript::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_warr_improved_spell_reflection_AuraScript::OnProc, EFFECT_1, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_warr_improved_spell_reflection_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_warr_improved_spell_reflection_trigger : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_improved_spell_reflection_trigger() : SpellScriptLoader("spell_warr_improved_spell_reflection_trigger") { }
|
||||
|
||||
class spell_warr_improved_spell_reflection_trigger_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_improved_spell_reflection_trigger_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
GetCaster()->RemoveAurasDueToSpell(SPELL_WARRIOR_SPELL_REFLECTION);
|
||||
unitList.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
|
||||
while (unitList.size() > GetSpellValue()->MaxAffectedTargets)
|
||||
unitList.pop_back();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warr_improved_spell_reflection_trigger_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_improved_spell_reflection_trigger_SpellScript();
|
||||
}
|
||||
|
||||
class spell_warr_improved_spell_reflection_trigger_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warr_improved_spell_reflection_trigger_AuraScript);
|
||||
|
||||
|
||||
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (!IsExpired())
|
||||
{
|
||||
// aura remove - remove auras from all party members
|
||||
std::list<Unit*> PartyMembers;
|
||||
GetUnitOwner()->GetPartyMembers(PartyMembers);
|
||||
for (std::list<Unit*>::iterator itr = PartyMembers.begin(); itr != PartyMembers.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->GetGUID() != GetOwner()->GetGUID())
|
||||
if (Aura* aur = (*itr)->GetAura(59725, GetCasterGUID()))
|
||||
{
|
||||
aur->SetDuration(0);
|
||||
aur->Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_warr_improved_spell_reflection_trigger_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_REFLECT_SPELLS, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_warr_improved_spell_reflection_trigger_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Theirs
|
||||
// 12975 - Last Stand
|
||||
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(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_LAST_STAND_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(GetEffectValue()));
|
||||
caster->CastCustomSpell(caster, SPELL_WARRIOR_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_warr_last_stand_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_last_stand_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -12162 - Deep Wounds
|
||||
class spell_warr_deep_wounds : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_deep_wounds() : SpellScriptLoader("spell_warr_deep_wounds") { }
|
||||
|
||||
class spell_warr_deep_wounds_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_deep_wounds_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_1) || !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_2) || !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_3))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
int32 damage = std::max(GetEffectValue(), 0);
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
// include target dependant auras
|
||||
damage = target->MeleeDamageBonusTaken(caster, damage, BASE_ATTACK, GetSpellInfo());
|
||||
// apply percent damage mods
|
||||
ApplyPct(damage, 16.0f * GetSpellInfo()->GetRank() / 6.0f);
|
||||
target->CastDelayedSpellWithPeriodicAmount(caster, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, SPELL_AURA_PERIODIC_DAMAGE, damage, EFFECT_0);
|
||||
|
||||
//caster->CastCustomSpell(target, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_deep_wounds_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_deep_wounds_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -100 - Charge
|
||||
class spell_warr_charge : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_charge() : SpellScriptLoader("spell_warr_charge") { }
|
||||
|
||||
class spell_warr_charge_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_charge_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_TALENT) || !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_BUFF) || !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_CHARGE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
int32 chargeBasePoints0 = GetEffectValue();
|
||||
Unit* caster = GetCaster();
|
||||
caster->CastCustomSpell(caster, SPELL_WARRIOR_CHARGE, &chargeBasePoints0, NULL, NULL, true);
|
||||
|
||||
// Juggernaut crit bonus
|
||||
if (caster->HasAura(SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_TALENT))
|
||||
caster->CastSpell(caster, SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_BUFF, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_charge_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_charge_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -1464 - Slam
|
||||
class spell_warr_slam : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_slam() : SpellScriptLoader("spell_warr_slam") { }
|
||||
|
||||
class spell_warr_slam_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_slam_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_SLAM))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (GetHitUnit())
|
||||
GetCaster()->CastCustomSpell(SPELL_WARRIOR_SLAM, SPELLVALUE_BASE_POINT0, GetEffectValue(), GetHitUnit(), TRIGGERED_FULL_MASK);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_slam_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_slam_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -58872 - Damage Shield
|
||||
class spell_warr_damage_shield : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_damage_shield() : SpellScriptLoader("spell_warr_damage_shield") { }
|
||||
|
||||
class spell_warr_damage_shield_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warr_damage_shield_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DAMAGE_SHIELD_DAMAGE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
// % of amount blocked
|
||||
int32 damage = CalculatePct(int32(GetTarget()->GetShieldBlockValue()), aurEff->GetAmount());
|
||||
GetTarget()->CastCustomSpell(SPELL_WARRIOR_DAMAGE_SHIELD_DAMAGE, SPELLVALUE_BASE_POINT0, damage, eventInfo.GetProcTarget(), true, NULL, aurEff);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectProc += AuraEffectProcFn(spell_warr_damage_shield_AuraScript::OnProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_warr_damage_shield_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -5308 - Execute
|
||||
class spell_warr_execute : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_execute() : SpellScriptLoader("spell_warr_execute") { }
|
||||
|
||||
class spell_warr_execute_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_execute_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_EXECUTE) || !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_GLYPH_OF_EXECUTION))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
SpellInfo const* spellInfo = GetSpellInfo();
|
||||
int32 rageUsed = std::min<int32>(300 - spellInfo->CalcPowerCost(caster, SpellSchoolMask(spellInfo->SchoolMask)), caster->GetPower(POWER_RAGE));
|
||||
int32 newRage = std::max<int32>(0, caster->GetPower(POWER_RAGE) - rageUsed);
|
||||
|
||||
// Sudden Death rage save
|
||||
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, WARRIOR_ICON_ID_SUDDEN_DEATH, EFFECT_0))
|
||||
{
|
||||
int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10;
|
||||
newRage = std::max(newRage, ragesave);
|
||||
}
|
||||
|
||||
caster->SetPower(POWER_RAGE, uint32(newRage));
|
||||
// Glyph of Execution bonus
|
||||
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_WARRIOR_GLYPH_OF_EXECUTION, EFFECT_0))
|
||||
rageUsed += aurEff->GetAmount() * 10;
|
||||
|
||||
|
||||
int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
|
||||
caster->CastCustomSpell(target, SPELL_WARRIOR_EXECUTE, &bp, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_execute_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_execute_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 12809 - Concussion Blow
|
||||
class spell_warr_concussion_blow : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_concussion_blow() : SpellScriptLoader("spell_warr_concussion_blow") { }
|
||||
|
||||
class spell_warr_concussion_blow_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_concussion_blow_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
SetHitDamage(CalculatePct(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue()));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_concussion_blow_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_concussion_blow_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 23881 - Bloodthirst
|
||||
class spell_warr_bloodthirst : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_bloodthirst() : SpellScriptLoader("spell_warr_bloodthirst") { }
|
||||
|
||||
class spell_warr_bloodthirst_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_bloodthirst_SpellScript);
|
||||
|
||||
void HandleDamage(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
ApplyPct(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK));
|
||||
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
damage = GetCaster()->SpellDamageBonusDone(target, GetSpellInfo(), uint32(damage), SPELL_DIRECT_DAMAGE);
|
||||
damage = target->SpellDamageBonusTaken(GetCaster(), GetSpellInfo(), uint32(damage), SPELL_DIRECT_DAMAGE);
|
||||
}
|
||||
SetHitDamage(damage);
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
GetCaster()->CastCustomSpell(GetCaster(), SPELL_WARRIOR_BLOODTHIRST, &damage, NULL, NULL, true, NULL);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
OnEffectHit += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_bloodthirst_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 23880 - Bloodthirst (Heal)
|
||||
class spell_warr_bloodthirst_heal : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_bloodthirst_heal() : SpellScriptLoader("spell_warr_bloodthirst_heal") { }
|
||||
|
||||
class spell_warr_bloodthirst_heal_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_bloodthirst_heal_SpellScript);
|
||||
|
||||
void HandleHeal(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_WARRIOR_BLOODTHIRST_DAMAGE))
|
||||
SetHitHeal(GetCaster()->CountPctFromMaxHealth(spellInfo->Effects[EFFECT_1].CalcValue(GetCaster())));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_bloodthirst_heal_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 7384, 7887, 11584, 11585 - Overpower
|
||||
class spell_warr_overpower : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_overpower() : SpellScriptLoader("spell_warr_overpower") { }
|
||||
|
||||
class spell_warr_overpower_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_overpower_SpellScript);
|
||||
|
||||
void HandleEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
uint32 spellId = 0;
|
||||
if (GetCaster()->HasAura(SPELL_WARRIOR_UNRELENTING_ASSAULT_RANK_1))
|
||||
spellId = SPELL_WARRIOR_UNRELENTING_ASSAULT_TRIGGER_1;
|
||||
else if (GetCaster()->HasAura(SPELL_WARRIOR_UNRELENTING_ASSAULT_RANK_2))
|
||||
spellId = SPELL_WARRIOR_UNRELENTING_ASSAULT_TRIGGER_2;
|
||||
|
||||
if (!spellId)
|
||||
return;
|
||||
|
||||
if (Player* target = GetHitPlayer())
|
||||
if (target->HasUnitState(UNIT_STATE_CASTING))
|
||||
target->CastSpell(target, spellId, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_overpower_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_ANY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_overpower_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 5246 - Intimidating Shout
|
||||
class spell_warr_intimidating_shout : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_intimidating_shout() : SpellScriptLoader("spell_warr_intimidating_shout") { }
|
||||
|
||||
class spell_warr_intimidating_shout_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_intimidating_shout_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
unitList.remove(GetExplTargetWorldObject());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warr_intimidating_shout_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warr_intimidating_shout_SpellScript::FilterTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_intimidating_shout_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -772 - Rend
|
||||
class spell_warr_rend : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_rend() : SpellScriptLoader("spell_warr_rend") { }
|
||||
|
||||
class spell_warr_rend_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warr_rend_AuraScript);
|
||||
|
||||
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
canBeRecalculated = false;
|
||||
|
||||
// $0.2 * (($MWB + $mwb) / 2 + $AP / 14 * $MWS) bonus per tick
|
||||
float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK);
|
||||
int32 mws = caster->GetAttackTime(BASE_ATTACK);
|
||||
float mwbMin = caster->GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE);
|
||||
float mwbMax = caster->GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE);
|
||||
float mwb = ((mwbMin + mwbMax) / 2 + ap * mws / 14000) * 0.2f;
|
||||
amount += int32(caster->ApplyEffectModifiers(GetSpellInfo(), aurEff->GetEffIndex(), mwb));
|
||||
|
||||
// "If used while your target is above 75% health, Rend does 35% more damage."
|
||||
// as for 3.1.3 only ranks above 9 (wrong tooltip?)
|
||||
if (GetSpellInfo()->GetRank() >= 9)
|
||||
{
|
||||
if (GetUnitOwner()->HasAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, GetSpellInfo(), caster))
|
||||
AddPct(amount, GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warr_rend_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_warr_rend_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 64380, 65941 - Shattering Throw
|
||||
class spell_warr_shattering_throw : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_shattering_throw() : SpellScriptLoader("spell_warr_shattering_throw") { }
|
||||
|
||||
class spell_warr_shattering_throw_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_shattering_throw_SpellScript);
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
|
||||
// remove shields, will still display immune to damage part
|
||||
if (Unit* target = GetHitUnit())
|
||||
target->RemoveAurasWithMechanic(1 << MECHANIC_IMMUNE_SHIELD, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_shattering_throw_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_shattering_throw_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 12328, 18765, 35429 - Sweeping Strikes
|
||||
class spell_warr_sweeping_strikes : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_sweeping_strikes() : SpellScriptLoader("spell_warr_sweeping_strikes") { }
|
||||
|
||||
class spell_warr_sweeping_strikes_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warr_sweeping_strikes_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
_procTarget = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
_procTarget = eventInfo.GetActor()->SelectNearbyNoTotemTarget(eventInfo.GetProcTarget());
|
||||
return _procTarget && !eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
int32 damage = eventInfo.GetDamageInfo()->GetDamage();
|
||||
GetTarget()->CastCustomSpell(_procTarget, SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK, &damage, 0, 0, true, NULL, aurEff);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_warr_sweeping_strikes_AuraScript::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_warr_sweeping_strikes_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
|
||||
private:
|
||||
Unit* _procTarget;
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_warr_sweeping_strikes_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 50720 - Vigilance
|
||||
class spell_warr_vigilance : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_vigilance() : SpellScriptLoader("spell_warr_vigilance") { }
|
||||
|
||||
class spell_warr_vigilance_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warr_vigilance_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_GLYPH_OF_VIGILANCE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_VIGILANCE_PROC))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_VIGILANCE_REDIRECT_THREAT))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_GEN_DAMAGE_REDUCTION_AURA))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
_procTarget = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->CastSpell(target, SPELL_GEN_DAMAGE_REDUCTION_AURA, true);
|
||||
|
||||
if (Unit* caster = GetCaster())
|
||||
target->CastSpell(caster, SPELL_WARRIOR_VIGILANCE_REDIRECT_THREAT, true);
|
||||
}
|
||||
|
||||
void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
//! WORKAROUND
|
||||
//! this glyph is a proc
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
if (AuraEffect const* glyph = caster->GetAuraEffect(SPELL_WARRIOR_GLYPH_OF_VIGILANCE, EFFECT_0))
|
||||
GetTarget()->ModifyRedirectThreat(glyph->GetAmount());
|
||||
}
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (target->HasAura(SPELL_GEN_DAMAGE_REDUCTION_AURA) &&
|
||||
!(target->HasAura(SPELL_PALADIN_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_PALADIN_GREATER_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_PRIEST_RENEWED_HOPE)))
|
||||
{
|
||||
target->RemoveAurasDueToSpell(SPELL_GEN_DAMAGE_REDUCTION_AURA);
|
||||
}
|
||||
|
||||
target->ResetRedirectThreat();
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo& /*eventInfo*/)
|
||||
{
|
||||
_procTarget = GetCaster();
|
||||
return _procTarget;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget()->CastSpell(_procTarget, SPELL_WARRIOR_VIGILANCE_PROC, true, NULL, aurEff);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_warr_vigilance_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_warr_vigilance_AuraScript::HandleAfterApply, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_warr_vigilance_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
DoCheckProc += AuraCheckProcFn(spell_warr_vigilance_AuraScript::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_warr_vigilance_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
|
||||
}
|
||||
|
||||
private:
|
||||
Unit* _procTarget;
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_warr_vigilance_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 50725 - Vigilance
|
||||
class spell_warr_vigilance_trigger : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_vigilance_trigger() : SpellScriptLoader("spell_warr_vigilance_trigger") { }
|
||||
|
||||
class spell_warr_vigilance_trigger_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_vigilance_trigger_SpellScript);
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
|
||||
// Remove Taunt cooldown
|
||||
if (Player* target = GetHitPlayer())
|
||||
target->RemoveSpellCooldown(SPELL_WARRIOR_TAUNT, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_vigilance_trigger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_vigilance_trigger_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 58387 - Glyph of Sunder Armor
|
||||
class spell_warr_glyph_of_sunder_armor : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_glyph_of_sunder_armor() : SpellScriptLoader("spell_warr_glyph_of_sunder_armor") { }
|
||||
|
||||
class spell_warr_glyph_of_sunder_armor_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warr_glyph_of_sunder_armor_AuraScript);
|
||||
|
||||
void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)
|
||||
{
|
||||
if (!spellMod)
|
||||
{
|
||||
spellMod = new SpellModifier(aurEff->GetBase());
|
||||
spellMod->op = SpellModOp(aurEff->GetMiscValue());
|
||||
spellMod->type = SPELLMOD_FLAT;
|
||||
spellMod->spellId = GetId();
|
||||
spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask;
|
||||
}
|
||||
|
||||
spellMod->value = aurEff->GetAmount();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_warr_glyph_of_sunder_armor_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_warr_glyph_of_sunder_armor_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 20230 - Retaliation
|
||||
class spell_warr_retaliation : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_retaliation() : SpellScriptLoader("spell_warr_retaliation") { }
|
||||
|
||||
class spell_warr_retaliation_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warr_retaliation_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_RETALIATION_DAMAGE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
// check attack comes not from behind and warrior is not stunned
|
||||
return GetTarget()->isInFront(eventInfo.GetActor(), M_PI) && !GetTarget()->HasUnitState(UNIT_STATE_STUNNED);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARRIOR_RETALIATION_DAMAGE, true, NULL, aurEff);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_warr_retaliation_AuraScript::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_warr_retaliation_AuraScript::HandleEffectProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_warr_retaliation_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_warrior_spell_scripts()
|
||||
{
|
||||
// Ours
|
||||
new spell_warr_mocking_blow();
|
||||
new spell_warr_intervene();
|
||||
new spell_warr_improved_spell_reflection();
|
||||
new spell_warr_improved_spell_reflection_trigger();
|
||||
|
||||
// Theirs
|
||||
new spell_warr_bloodthirst();
|
||||
new spell_warr_bloodthirst_heal();
|
||||
new spell_warr_charge();
|
||||
new spell_warr_concussion_blow();
|
||||
new spell_warr_damage_shield();
|
||||
new spell_warr_deep_wounds();
|
||||
new spell_warr_execute();
|
||||
new spell_warr_glyph_of_sunder_armor();
|
||||
new spell_warr_intimidating_shout();
|
||||
new spell_warr_last_stand();
|
||||
new spell_warr_overpower();
|
||||
new spell_warr_rend();
|
||||
new spell_warr_retaliation();
|
||||
new spell_warr_shattering_throw();
|
||||
new spell_warr_slam();
|
||||
new spell_warr_sweeping_strikes();
|
||||
new spell_warr_vigilance();
|
||||
new spell_warr_vigilance_trigger();
|
||||
}
|
||||
Reference in New Issue
Block a user