PDA

View Full Version : Warryor 4.3.4 Spellfixxes (Not sure if is that correct)



Dr.Core
13-07-13, 05:13 PM
File: \src\server\scripts\Spells\spell_warrior.cpp
Version: 4.3.4

enum WarriorSpells
{


SPELL_WARRIOR_VICTORY_RUSH = 34428,
SPELL_WARRIOR_CLEAVE = 845,


// Victory Rush
// Spell Id: 34428
class spell_warr_victory_rush : public SpellScriptLoader
{
public:
spell_warr_victory_rush() : SpellScriptLoader("spell_warr_victory_rush") { }


class spell_warr_victory_rush_SpellScript : public SpellScript
{
PrepareSpellScript(spell_warr_victory_rush_SpellSc ript);


bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_VICTORY_RUSH))
return false;
return true;
}


void CalculateDamage(SpellEffIndex /*effect*/)
{
// Formula: AttackPower * BasePoints / 100
if (Unit* caster = GetCaster())
SetHitDamage(int32(GetHitDamage() * caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100));
}


void HandleAfterHit()
{
if (Unit* caster = GetCaster())
caster->RemoveAurasDueToSpell(32216); // Remove Victorious aura
}


void Register()
{
AfterHit += SpellHitFn(spell_warr_victory_rush::spell_warr_vic tory_rush_SpellScript::HandleAfterHit);
OnEffectHitTarget += SpellEffectFn(spell_warr_victory_rush::spell_warr_ victory_rush_SpellScript::CalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};


SpellScript* GetSpellScript() const
{
return new spell_warr_victory_rush_SpellScript();
}
};




// Cleave
// Spell Id: 845
class spell_warr_cleave : public SpellScriptLoader
{
public:
spell_warr_cleave() : SpellScriptLoader("spell_warr_cleave") { }


class spell_warr_cleave_SpellScript : public SpellScript
{
PrepareSpellScript(spell_warr_cleave_SpellScript);


bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_CLEAVE))
return false;
return true;
}


void CalculateDamage(SpellEffIndex /*effect*/)
{
if (Unit* caster = GetCaster())
SetHitDamage(int32(6 + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.45f));
}


void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_warr_cleave::spell_warr_cleave _SpellScript::CalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};


SpellScript* GetSpellScript() const
{
return new spell_warr_cleave_SpellScript();
}
};


In end of Script declare Spell

C++ Code



void AddSC_warrior_spell_scripts(){
......
new spell_warr_victory_rush();
new spell_warr_cleave();



Database Part



INSERT INTO `spell_script_names` VALUES ('845', 'spell_warr_cleave');
INSERT INTO `spell_script_names` VALUES ('34428', 'spell_warr_victory_rush');


I have test it and for me works fine !!!