Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Server/Spells: Implement SPELL_EFFECT_DODGE.
Browse files Browse the repository at this point in the history
Signed-off-by: AriDEV <aridev666@gmail.com>
  • Loading branch information
AriDEV committed Nov 4, 2019
1 parent 3bdcec2 commit b40e14d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
9 changes: 9 additions & 0 deletions src/server/game/Entities/Player/Player.cpp
Expand Up @@ -25735,6 +25735,15 @@ void Player::UpdateUnderwaterState(Map* m, float x, float y, float z)
}
}

void Player::SetCanDodge(bool value)
{
if (m_canDodge == value)
return;

m_canDodge = value;
UpdateDodgePercentage();
}

void Player::SetCanParry(bool value)
{
if (m_canParry == value)
Expand Down
14 changes: 6 additions & 8 deletions src/server/game/Entities/Player/Player.h
Expand Up @@ -2662,16 +2662,13 @@ class Player : public Unit, public GridObject<Player>
void SendCorpseReclaimDelay(bool load = false);

uint32 GetBlockPercent() const override { return GetUInt32Value(PLAYER_FIELD_SHIELD_BLOCK); }
bool CanParry() const
{
return m_canParry;
}
bool CanDodge() const { return m_canDodge; }
void SetCanDodge(bool value);
bool CanParry() const { return m_canParry; }
void SetCanParry(bool value);
bool CanBlock() const
{
return m_canBlock;
}
bool CanBlock() const { return m_canBlock; }
void SetCanBlock(bool value);

bool CanTitanGrip() const
{
return m_canTitanGrip;
Expand Down Expand Up @@ -3504,6 +3501,7 @@ class Player : public Unit, public GridObject<Player>

uint32 m_WeaponProficiency;
uint32 m_ArmorProficiency;
bool m_canDodge;
bool m_canParry;
bool m_canBlock;
bool m_canTitanGrip;
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Spells/Spell.h
Expand Up @@ -291,6 +291,7 @@ class Spell
void EffectEnchantHeldItem(SpellEffIndex effIndex);
void EffectSummonObject(SpellEffIndex effIndex);
void EffectResurrect(SpellEffIndex effIndex);
void EffectDodge(SpellEffIndex effIndex);
void EffectParry(SpellEffIndex effIndex);
void EffectBlock(SpellEffIndex effIndex);
void EffectLeap(SpellEffIndex effIndex);
Expand Down
10 changes: 9 additions & 1 deletion src/server/game/Spells/SpellEffects.cpp
Expand Up @@ -91,7 +91,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectWeaponDmg, // 17 SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL
&Spell::EffectResurrect, // 18 SPELL_EFFECT_RESURRECT
&Spell::EffectAddExtraAttacks, // 19 SPELL_EFFECT_ADD_EXTRA_ATTACKS
&Spell::EffectUnused, // 20 SPELL_EFFECT_DODGE one spell: Dodge
&Spell::EffectDodge, // 20 SPELL_EFFECT_DODGE
&Spell::EffectUnused, // 21 SPELL_EFFECT_EVADE one spell: Evade (DND)
&Spell::EffectParry, // 22 SPELL_EFFECT_PARRY
&Spell::EffectBlock, // 23 SPELL_EFFECT_BLOCK one spell: Block
Expand Down Expand Up @@ -4589,6 +4589,14 @@ void Spell::EffectAddExtraAttacks(SpellEffIndex effIndex)

ExecuteLogEffectExtraAttacks(effIndex, unitTarget->GetVictim(), damage);
}
void Spell::EffectDodge(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;

if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetCanDodge(true);
}

void Spell::EffectParry(SpellEffIndex /*effIndex*/)
{
Expand Down

0 comments on commit b40e14d

Please sign in to comment.