Fixes daze absorb and duplicate target flags (#67)
- Fixes daze absorb and duplicate target flags - Fix chests showing out of range even when in range
This commit is contained in:
parent
5aa68fa21d
commit
77d285010d
@ -1767,28 +1767,35 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
||||
DealDamage(pVictim, damageInfo->damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->damageSchoolMask), NULL, durabilityLoss);
|
||||
|
||||
// If this is a creature and it attacks from behind it has a probability to daze it's victim
|
||||
if ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
|
||||
GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->GetCharmerOrOwnerGuid() && !pVictim->HasInArc(M_PI_F, this))
|
||||
{
|
||||
// -probability is between 0% and 40%
|
||||
// 20% base chance
|
||||
float Probability = 20.0f;
|
||||
if ((!damageInfo->absorb) && (damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
|
||||
GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->GetCharmerOrOwnerGuid() && !pVictim->HasInArc(M_PI_F, this))
|
||||
{
|
||||
// -probability is between 0% and 40%
|
||||
// 20% base chance
|
||||
float Probability = 20.0f;
|
||||
|
||||
// there is a newbie protection, at level 10 just 7% base chance; assuming linear function
|
||||
if (pVictim->getLevel() < 30)
|
||||
{ Probability = 0.65f * pVictim->getLevel() + 0.5f; }
|
||||
// there is a newbie protection, at level 10 just 7% base chance; assuming linear function
|
||||
if (pVictim->getLevel() < 30)
|
||||
{
|
||||
Probability = 0.65f * pVictim->getLevel() + 0.5f;
|
||||
}
|
||||
|
||||
uint32 VictimDefense = pVictim->GetDefenseSkillValue();
|
||||
uint32 AttackerMeleeSkill = GetUnitMeleeSkill();
|
||||
uint32 VictimDefense = pVictim->GetDefenseSkillValue();
|
||||
uint32 AttackerMeleeSkill = GetUnitMeleeSkill();
|
||||
|
||||
Probability *= AttackerMeleeSkill / (float)VictimDefense;
|
||||
Probability *= AttackerMeleeSkill / (float)VictimDefense;
|
||||
|
||||
if (Probability > 40.0f)
|
||||
{ Probability = 40.0f; }
|
||||
if (Probability > 40.0f)
|
||||
{
|
||||
Probability = 40.0f;
|
||||
}
|
||||
|
||||
if (roll_chance_f(Probability))
|
||||
{ CastSpell(pVictim, 1604, true); }
|
||||
}
|
||||
if (roll_chance_f(Probability))
|
||||
{
|
||||
CastSpell(pVictim, 1604, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// update at damage Judgement aura duration that applied by attacker at victim
|
||||
if (damageInfo->damage)
|
||||
|
@ -1575,6 +1575,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
|
||||
Cell::VisitAllObjects(m_caster, searcher, max_range);
|
||||
break;
|
||||
}
|
||||
case TARGET_RANDOM_UNIT_CHAIN_IN_AREA: // This works the same as Target_random_friend_chain_in_area but is named differently for some reason
|
||||
case TARGET_RANDOM_FRIEND_CHAIN_IN_AREA:
|
||||
{
|
||||
MaNGOS::AnyFriendlyUnitInObjectRangeCheck u_check(m_caster, max_range);
|
||||
@ -1582,13 +1583,6 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
|
||||
Cell::VisitAllObjects(m_caster, searcher, max_range);
|
||||
break;
|
||||
}
|
||||
case TARGET_RANDOM_UNIT_CHAIN_IN_AREA:
|
||||
{
|
||||
MaNGOS::AnyUnitInObjectRangeCheck u_check(m_caster, max_range);
|
||||
MaNGOS::UnitListSearcher<MaNGOS::AnyUnitInObjectRangeCheck> searcher(tempTargetUnitMap, u_check);
|
||||
Cell::VisitAllObjects(m_caster, searcher, max_range);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tempTargetUnitMap.empty())
|
||||
@ -4980,7 +4974,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
{ return SPELL_FAILED_ALREADY_OPEN; }
|
||||
|
||||
// Is the lock within the spell max range?
|
||||
if (!IsLockInRange(go))
|
||||
if (!IsLockInRange(go) && go->GetGoType() == GAMEOBJECT_TYPE_TRAP)
|
||||
{ return SPELL_FAILED_OUT_OF_RANGE; }
|
||||
}
|
||||
else if (Item* item = m_targets.getItemTarget())
|
||||
|
Loading…
x
Reference in New Issue
Block a user