[7280] Implement 287 SPELL_AURA_DEFLECT_SPELLS aura Author: DiSlord
--HG-- branch : trunk
This commit is contained in:
@@ -328,7 +328,11 @@ enum AuraType
|
||||
SPELL_AURA_MOD_HONOR_GAIN_PCT = 281,
|
||||
SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
|
||||
SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells
|
||||
TOTAL_AURAS = 284
|
||||
SPELL_AURA_284,
|
||||
SPELL_AURA_285,
|
||||
SPELL_AURA_286,
|
||||
SPELL_AURA_DEFLECT_SPELLS,
|
||||
TOTAL_AURAS = 288
|
||||
};
|
||||
|
||||
enum AreaAuraType
|
||||
|
||||
@@ -337,7 +337,11 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
|
||||
&Aura::HandleNoImmediateEffect, //280 SPELL_AURA_MOD_WEAPONTYPE_IGNORE_TARGET_RESISTANCE
|
||||
&Aura::HandleNoImmediateEffect, //281 SPELL_AURA_MOD_HONOR_GAIN_PCT implemented in Player::RewardHonor
|
||||
&Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
|
||||
&Aura::HandleNoImmediateEffect //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
|
||||
&Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
|
||||
&Aura::HandleNULL, //284
|
||||
&Aura::HandleNULL, //285
|
||||
&Aura::HandleNULL, //286
|
||||
&Aura::HandleNULL, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
|
||||
};
|
||||
|
||||
Aura::Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem) :
|
||||
|
||||
+25
-2
@@ -2621,9 +2621,19 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
||||
if (spell->Attributes & SPELL_ATTR_IMPOSSIBLE_DODGE_PARRY_BLOCK)
|
||||
return SPELL_MISS_NONE;
|
||||
|
||||
// Ranged attack cannot be parry/dodge
|
||||
// Ranged attack cannot be parry/dodge only deflect
|
||||
if (attType == RANGED_ATTACK)
|
||||
{
|
||||
// only if in front
|
||||
if (pVictim->HasInArc(M_PI,this))
|
||||
{
|
||||
int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS)*100;
|
||||
tmp+=deflect_chance;
|
||||
if (roll < tmp)
|
||||
return SPELL_MISS_DEFLECT;
|
||||
}
|
||||
return SPELL_MISS_NONE;
|
||||
}
|
||||
|
||||
// Check for attack from behind
|
||||
if (!pVictim->HasInArc(M_PI,this))
|
||||
@@ -2756,9 +2766,22 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
||||
if (HitChance < 100) HitChance = 100;
|
||||
if (HitChance > 9900) HitChance = 9900;
|
||||
|
||||
int32 tmp = 10000 - HitChance;
|
||||
|
||||
uint32 rand = urand(0,10000);
|
||||
if (rand > HitChance)
|
||||
|
||||
if (rand < tmp)
|
||||
return SPELL_MISS_RESIST;
|
||||
|
||||
// cast by caster in front of victim
|
||||
if (pVictim->HasInArc(M_PI,this))
|
||||
{
|
||||
int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS)*100;
|
||||
tmp+=deflect_chance;
|
||||
if (rand < tmp)
|
||||
return SPELL_MISS_DEFLECT;
|
||||
}
|
||||
|
||||
return SPELL_MISS_NONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7279"
|
||||
#define REVISION_NR "7280"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
||||
Reference in New Issue
Block a user