Make ResistSpell aware of the level_override nerf

This commit is contained in:
Michael Cook (mackal) 2015-05-29 14:39:09 -04:00
parent a41fd122bc
commit 0348c0817d
2 changed files with 17 additions and 15 deletions

View File

@ -211,7 +211,8 @@ public:
virtual int32 GetActSpellDuration(uint16 spell_id, int32 duration); virtual int32 GetActSpellDuration(uint16 spell_id, int32 duration);
virtual int32 GetActSpellCasttime(uint16 spell_id, int32 casttime); virtual int32 GetActSpellCasttime(uint16 spell_id, int32 casttime);
float ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override = false, float ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override = false,
int resist_override = 0, bool CharismaCheck = false, bool CharmTick = false, bool IsRoot = false); int resist_override = 0, bool CharismaCheck = false, bool CharmTick = false, bool IsRoot = false,
int level_override = -1);
int ResistPhysical(int level_diff, uint8 caster_level); int ResistPhysical(int level_diff, uint8 caster_level);
uint16 GetSpecializeSkillValue(uint16 spell_id) const; uint16 GetSpecializeSkillValue(uint16 spell_id) const;
void SendSpellBarDisable(); void SendSpellBarDisable();

View File

@ -3665,9 +3665,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r
if(IsResistableSpell(spell_id)) if(IsResistableSpell(spell_id))
{ {
if (IsCharmSpell(spell_id) || IsMezSpell(spell_id) || IsFearSpell(spell_id)) if (IsCharmSpell(spell_id) || IsMezSpell(spell_id) || IsFearSpell(spell_id))
spell_effectiveness = spelltar->ResistSpell(spells[spell_id].resisttype, spell_id, this, use_resist_adjust, resist_adjust,true); spell_effectiveness = spelltar->ResistSpell(spells[spell_id].resisttype, spell_id, this, use_resist_adjust, resist_adjust, true, false, false, level_override);
else else
spell_effectiveness = spelltar->ResistSpell(spells[spell_id].resisttype, spell_id, this, use_resist_adjust, resist_adjust); spell_effectiveness = spelltar->ResistSpell(spells[spell_id].resisttype, spell_id, this, use_resist_adjust, resist_adjust, false, false, false, level_override);
if(spell_effectiveness < 100) if(spell_effectiveness < 100)
{ {
@ -4208,7 +4208,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster)
// pvp_resist_base // pvp_resist_base
// pvp_resist_calc // pvp_resist_calc
// pvp_resist_cap // pvp_resist_cap
float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override, int resist_override, bool CharismaCheck, bool CharmTick, bool IsRoot) float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override, int resist_override, bool CharismaCheck, bool CharmTick, bool IsRoot, int level_override)
{ {
if(!caster) if(!caster)
@ -4351,18 +4351,19 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
int level_mod = 0; int level_mod = 0;
//Adjust our resist chance based on level modifiers //Adjust our resist chance based on level modifiers
int temp_level_diff = GetLevel() - caster->GetLevel(); uint8 caster_level = level_override > 0 ? level_override : caster->GetLevel();
int temp_level_diff = GetLevel() - caster_level;
//Physical Resists are calclated using their own formula derived from extensive parsing. //Physical Resists are calclated using their own formula derived from extensive parsing.
if (resist_type == RESIST_PHYSICAL) { if (resist_type == RESIST_PHYSICAL) {
level_mod = ResistPhysical(temp_level_diff, caster->GetLevel()); level_mod = ResistPhysical(temp_level_diff, caster_level);
} }
else { else {
if(IsNPC() && GetLevel() >= RuleI(Casting,ResistFalloff)) if(IsNPC() && GetLevel() >= RuleI(Casting,ResistFalloff))
{ {
int a = (RuleI(Casting,ResistFalloff)-1) - caster->GetLevel(); int a = (RuleI(Casting,ResistFalloff)-1) - caster_level;
if(a > 0) if(a > 0)
{ {
temp_level_diff = a; temp_level_diff = a;
@ -4389,7 +4390,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
level_mod = -level_mod; level_mod = -level_mod;
} }
if(IsNPC() && (caster->GetLevel() - GetLevel()) < -20) if(IsNPC() && (caster_level - GetLevel()) < -20)
{ {
level_mod = 1000; level_mod = 1000;
} }
@ -4400,7 +4401,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
int level_diff; int level_diff;
if(GetLevel() >= RuleI(Casting,ResistFalloff)) if(GetLevel() >= RuleI(Casting,ResistFalloff))
{ {
level_diff = (RuleI(Casting,ResistFalloff)-1) - caster->GetLevel(); level_diff = (RuleI(Casting,ResistFalloff)-1) - caster_level;
if(level_diff < 0) if(level_diff < 0)
{ {
level_diff = 0; level_diff = 0;
@ -4408,7 +4409,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
} }
else else
{ {
level_diff = GetLevel() - caster->GetLevel(); level_diff = GetLevel() - caster_level;
} }
level_mod += (2 * level_diff); level_mod += (2 * level_diff);
} }
@ -4519,14 +4520,14 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
if(IsNPC()) if(IsNPC())
{ {
if(GetLevel() > caster->GetLevel() && GetLevel() >= 17 && caster->GetLevel() <= 50) if(GetLevel() > caster_level && GetLevel() >= 17 && caster_level <= 50)
{ {
partial_modifier += 5; partial_modifier += 5;
} }
if(GetLevel() >= 30 && caster->GetLevel() < 50) if(GetLevel() >= 30 && caster_level < 50)
{ {
partial_modifier += (caster->GetLevel() - 25); partial_modifier += (caster_level - 25);
} }
if(GetLevel() < 15) if(GetLevel() < 15)
@ -4537,9 +4538,9 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
if(caster->IsNPC()) if(caster->IsNPC())
{ {
if((GetLevel() - caster->GetLevel()) >= 20) if((GetLevel() - caster_level) >= 20)
{ {
partial_modifier += (GetLevel() - caster->GetLevel()) * 1.5; partial_modifier += (GetLevel() - caster_level) * 1.5;
} }
} }