aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorVincent-Michael <Vincent_Michael@gmx.de>2012-06-20 18:06:29 +0200
committerVincent-Michael <Vincent_Michael@gmx.de>2012-06-20 18:06:29 +0200
commitef4d9dd4ae188aeabe19388f0cad7543dae3c907 (patch)
treef77583ebba76b8d4d7ddbbab39b1de12897bec8e /src/server/scripts
parentab3430762d965f84717fdf7a18e2cbc2271c436a (diff)
Core/Spells:
* Fix bloodthirst Heal * Move bloodthirst damage calculation in Spell script * Fix some codestyle
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp2
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp59
2 files changed, 40 insertions, 21 deletions
diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp
index 78bdbb7f127..7830d46260c 100644
--- a/src/server/scripts/Spells/spell_pet.cpp
+++ b/src/server/scripts/Spells/spell_pet.cpp
@@ -1,4 +1,4 @@
- /*
+/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index f1276c24a75..463b9b2fb97 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -397,7 +397,20 @@ class spell_warr_bloodthirst : public SpellScriptLoader
{
PrepareSpellScript(spell_warr_bloodthirst_SpellScript);
- void HandleDummy(SpellEffIndex /* effIndex */)
+ void HandleDamage(SpellEffIndex /*effIndex*/)
+ {
+ int32 damage = GetEffectValue();
+ ApplyPctF(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_BLOODTHIRST, &damage, NULL, NULL, true, NULL);
@@ -405,6 +418,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader
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);
}
};
@@ -415,31 +429,36 @@ class spell_warr_bloodthirst : public SpellScriptLoader
}
};
-class spell_warr_bloodthirst_heal : public SpellScriptLoader
+enum BloodthirstHeal
{
-public:
- spell_warr_bloodthirst_heal() : SpellScriptLoader("spell_warr_bloodthirst_heal") { }
+ SPELL_BLOODTHIRST_DAMAGE = 23881,
+};
- class spell_warr_bloodthirst_heal_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_warr_bloodthirst_heal_SpellScript);
+class spell_warr_bloodthirst_heal : public SpellScriptLoader
+{
+ public:
+ spell_warr_bloodthirst_heal() : SpellScriptLoader("spell_warr_bloodthirst_heal") { }
- void HandleHeal(SpellEffIndex /* effIndex */)
+ class spell_warr_bloodthirst_heal_SpellScript : public SpellScript
{
- if (GetTriggeringSpell())
- SetHitHeal(CalculatePctN(GetCaster()->GetMaxHealth(),GetTriggeringSpell()->Effects[EFFECT_1].CalcValue()));
- }
+ PrepareSpellScript(spell_warr_bloodthirst_heal_SpellScript);
- void Register()
+ void HandleHeal(SpellEffIndex /*effIndex*/)
+ {
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_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
{
- OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL);
+ return new spell_warr_bloodthirst_heal_SpellScript();
}
- };
-
- SpellScript* GetSpellScript() const
- {
- return new spell_warr_bloodthirst_heal_SpellScript();
- }
};
enum Overpower
@@ -498,6 +517,6 @@ void AddSC_warrior_spell_scripts()
new spell_warr_execute();
new spell_warr_concussion_blow();
new spell_warr_bloodthirst();
- new spell_warr_overpower();
new spell_warr_bloodthirst_heal();
+ new spell_warr_overpower();
}