[11510] Implement SPELL_AURA_MOD_PARRY_FROM_BEHIND_PERCENT (288) and related spell 19263.

Original patchs provided by KAPATEJIb and Roshnak.
This commit is contained in:
VladimirMangos 2011-05-19 03:46:28 +04:00
parent b7cc436571
commit 0564b622c2
6 changed files with 48 additions and 22 deletions

View file

@ -3037,8 +3037,11 @@ void Spell::cast(bool skipCheck)
break;
case SPELLFAMILY_HUNTER:
{
// Deterrence
if (m_spellInfo->Id == 19263)
AddPrecastSpell(67801);
// Kill Command
if (m_spellInfo->Id == 34026)
else if (m_spellInfo->Id == 34026)
{
if (m_caster->HasAura(37483)) // Improved Kill Command - Item set bonus
m_caster->CastSpell(m_caster, 37482, true);// Exploited Weakness

View file

@ -323,7 +323,7 @@ enum AuraType
SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR = 285,
SPELL_AURA_ABILITY_PERIODIC_CRIT = 286,
SPELL_AURA_DEFLECT_SPELLS = 287,
SPELL_AURA_288 = 288,
SPELL_AURA_MOD_PARRY_FROM_BEHIND_PERCENT = 288,
SPELL_AURA_289 = 289,
SPELL_AURA_MOD_ALL_CRIT_CHANCE = 290,
SPELL_AURA_MOD_QUEST_XP_PCT = 291,

View file

@ -338,7 +338,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleAuraModAttackPowerOfArmor, //285 SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR implemented in Player::UpdateAttackPowerAndDamage
&Aura::HandleNoImmediateEffect, //286 SPELL_AURA_ABILITY_PERIODIC_CRIT implemented in Aura::IsCritFromAbilityAura called from Aura::PeriodicTick
&Aura::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
&Aura::HandleNULL, //288 increase parry/deflect, prevent attack (single spell used 67801)
&Aura::HandleNoImmediateEffect, //288 SPELL_AURA_MOD_PARRY_FROM_BEHIND_PERCENT percent from normal parry/deflect applied to from behind attack case (single spell used 67801, also look 4.1.0 spell 97574)
&Aura::HandleUnused, //289 unused (3.2.2a)
&Aura::HandleAuraModAllCritChance, //290 SPELL_AURA_MOD_ALL_CRIT_CHANCE
&Aura::HandleNoImmediateEffect, //291 SPELL_AURA_MOD_QUEST_XP_PCT implemented in Player::GiveXP

View file

@ -2210,6 +2210,10 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
((spellInfo_2->SpellFamilyFlags & UI64LIT(0x4)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x00000004000))))
return false;
// Deterrence
if (spellInfo_1->SpellIconID == 83 && spellInfo_2->SpellIconID == 83)
return false;
// Bestial Wrath
if (spellInfo_1->SpellIconID == 1680 && spellInfo_2->SpellIconID == 1680)
return false;

View file

@ -2678,8 +2678,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
}
// parry chances
// check if attack comes from behind, nobody can parry or block if attacker is behind
if (!from_behind)
// check if attack comes from behind, nobody can parry or block if attacker is behind if not have
if (!from_behind || pVictim->HasAuraType(SPELL_AURA_MOD_PARRY_FROM_BEHIND_PERCENT))
{
// Reduce parry chance by attacker expertise rating
if (GetTypeId() == TYPEID_PLAYER)
@ -2687,14 +2687,17 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
else
parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE)*25;
if(pVictim->GetTypeId()==TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY) )
if (parry_chance > 0 && (pVictim->GetTypeId()==TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY)))
{
int32 tmp2 = int32(parry_chance);
if ( (tmp2 > 0) // check if unit _can_ parry
&& ((tmp2 -= skillBonus) > 0)
&& (roll < (sum += tmp2)))
parry_chance -= skillBonus;
//if (from_behind) -- only 100% currently and not 100% sure way value apply
// parry_chance = int32(parry_chance * (pVictim->GetTotalAuraMultiplier(SPELL_AURA_MOD_PARRY_FROM_BEHIND_PERCENT) - 1);
if (parry_chance > 0 && // check if unit _can_ parry
(roll < (sum += parry_chance)))
{
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum);
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum - parry_chance, sum);
return MELEE_HIT_PARRY;
}
}
@ -2987,13 +2990,19 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
if (spell->Attributes & SPELL_ATTR_IMPOSSIBLE_DODGE_PARRY_BLOCK)
return SPELL_MISS_NONE;
bool from_behind = !pVictim->HasInArc(M_PI_F,this);
// Ranged attack cannot be parry/dodge only deflect
if (attType == RANGED_ATTACK)
{
// only if in front
if (pVictim->HasInArc(M_PI_F,this))
// only if in front or special ability
if (!from_behind || pVictim->HasAuraType(SPELL_AURA_MOD_PARRY_FROM_BEHIND_PERCENT))
{
int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS)*100;
//if (from_behind) -- only 100% currently and not 100% sure way value apply
// deflect_chance = int32(deflect_chance * (pVictim->GetTotalAuraMultiplier(SPELL_AURA_MOD_PARRY_FROM_BEHIND_PERCENT) - 1);
tmp += deflect_chance;
if (roll < tmp)
return SPELL_MISS_DEFLECT;
@ -3002,12 +3011,13 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
}
// Check for attack from behind
if (!pVictim->HasInArc(M_PI_F,this))
if (from_behind)
{
// Can`t dodge from behind in PvP (but its possible in PvE)
if (GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
canDodge = false;
// Can`t parry
// Can`t parry without special ability
if (!pVictim->HasAuraType(SPELL_AURA_MOD_PARRY_FROM_BEHIND_PERCENT))
canParry = false;
}
// Check creatures flags_extra for disable parry
@ -3065,6 +3075,9 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
if (parryChance < 0)
parryChance = 0;
//if (from_behind) -- only 100% currently and not 100% sure way value apply
// parryChance = int32(parryChance * (pVictim->GetTotalAuraMultiplier(SPELL_AURA_MOD_PARRY_FROM_BEHIND_PERCENT) - 1));
tmp += parryChance;
if (roll < tmp)
return SPELL_MISS_PARRY;
@ -3142,10 +3155,16 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
if (rand < tmp)
return SPELL_MISS_MISS;
// cast by caster in front of victim
if (pVictim->HasInArc(M_PI_F,this))
bool from_behind = !pVictim->HasInArc(M_PI_F,this);
// cast by caster in front of victim or behind with special ability
if (!from_behind || pVictim->HasAuraType(SPELL_AURA_MOD_PARRY_FROM_BEHIND_PERCENT))
{
int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS)*100;
//if (from_behind) -- only 100% currently and not 100% sure way value apply
// deflect_chance = int32(deflect_chance * (pVictim->GetTotalAuraMultiplier(SPELL_AURA_MOD_PARRY_FROM_BEHIND_PERCENT)) - 1);
tmp += deflect_chance;
if (rand < tmp)
return SPELL_MISS_DEFLECT;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11509"
#define REVISION_NR "11510"
#endif // __REVISION_NR_H__