From e2b90f8dc0b312d3ba31c2a1f6c62d92d55e3fb8 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 22 Nov 2008 14:28:11 -0600 Subject: *Make disarm also works on creatures. (Please check if visual effect is correct, i.e., equipments are removed, if not, please report) --HG-- branch : trunk --- src/game/SpellAuras.cpp | 25 +++++++++++++++---------- src/game/StatSystem.cpp | 8 +++++++- 2 files changed, 22 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 874b9236fc1..46842bc3ced 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3147,18 +3147,23 @@ void Aura::HandleAuraModDisarm(bool apply, bool Real) else m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED); - // only at real add/remove aura - if (m_target->GetTypeId() != TYPEID_PLAYER) - return; - - // main-hand attack speed already set to special value for feral form already and don't must change and reset at remove. - if (((Player *)m_target)->IsInFeralForm()) - return; + if (m_target->GetTypeId() == TYPEID_PLAYER) + { + // main-hand attack speed already set to special value for feral form already and don't must change and reset at remove. + if (((Player *)m_target)->IsInFeralForm()) + return; - if (apply) - m_target->SetAttackTime(BASE_ATTACK,BASE_ATTACK_TIME); + if (apply) + m_target->SetAttackTime(BASE_ATTACK,BASE_ATTACK_TIME); + else + ((Player *)m_target)->SetRegularAttackTime(); + } else - ((Player *)m_target)->SetRegularAttackTime(); + { + // creature does not have equipment + if(apply && !((Creature*)m_target)->GetCurrentEquipmentId()) + return; + } m_target->UpdateDamagePhysical(BASE_ATTACK); } diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index 84e49485e5e..64bad232994 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -752,7 +752,13 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType) float base_pct = GetModifierValue(unitMod, BASE_PCT); float total_value = GetModifierValue(unitMod, TOTAL_VALUE); float total_pct = GetModifierValue(unitMod, TOTAL_PCT); - + + if(attType == BASE_ATTACK && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED)) + { + weapon_mindamage = 0; + weapon_maxdamage = 0; + } + float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct ; float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct ; -- cgit v1.2.3