fix(Core/GO): failed attempt (#4036)

Co-authored-by: Yehonal <yehonal.azeroth@gmail.com>
This commit is contained in:
Stefano Borzì
2020-12-28 11:05:37 +01:00
committed by GitHub
parent 76840a3590
commit e7dc6df31e

View File

@@ -5925,12 +5925,6 @@ SpellCastResult Spell::CheckCast(bool strict)
if (ReqValue > skillValue)
return SPELL_FAILED_LOW_CASTLEVEL;
// chance for fail at orange skinning attempt
if ((m_selfContainer && (*m_selfContainer) == this) &&
skillValue < sWorld->GetConfigMaxSkillValue() &&
(ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37))
return SPELL_FAILED_TRY_AGAIN;
break;
}
case SPELL_EFFECT_OPEN_LOCK:
@@ -5992,15 +5986,15 @@ SpellCastResult Spell::CheckCast(bool strict)
if (res != SPELL_CAST_OK)
return res;
// chance for fail at orange mining/herb/LockPicking gathering attempt
// chance for fail at lockpicking attempt
// second check prevent fail at rechecks
if (skillId != SKILL_NONE && (!m_selfContainer || ((*m_selfContainer) != this)))
{
bool canFailAtMax = skillId != SKILL_HERBALISM && skillId != SKILL_MINING;
// chance for failure in orange gather / lockpick (gathering skill can't fail at maxskill)
if ((canFailAtMax || skillValue < sWorld->GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue - 25, skillValue + 37))
// chance for failure in orange lockpick
if (skillId == SKILL_LOCKPICKING && reqSkillValue > irand(skillValue - 25, skillValue + 37))
{
return SPELL_FAILED_TRY_AGAIN;
}
}
break;
}