mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-18 03:22:27 +00:00
[Cleanup] other is always defined in these cases in attack.cpp (#3217)
# Notes - `other` is always defined since we check it prior to checking here.
This commit is contained in:
parent
82762c3f5a
commit
1bafe0b6b3
@ -1473,7 +1473,7 @@ bool Mob::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
||||
SetTarget(other);
|
||||
}
|
||||
|
||||
LogCombatDetail("Attacking [{}] with hand [{}] [{}]", other ? other->GetName() : "nullptr", Hand, bRiposte ? "this is a riposte" : "");
|
||||
LogCombatDetail("Attacking [{}] with hand [{}] [{}]", other->GetName(), Hand, bRiposte ? "this is a riposte" : "");
|
||||
|
||||
if (
|
||||
(IsCasting() && GetClass() != BARD && !IsFromSpell)
|
||||
@ -2110,14 +2110,16 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
||||
|
||||
//Check that we can attack before we calc heading and face our target
|
||||
if (!IsAttackAllowed(other)) {
|
||||
if (GetOwnerID())
|
||||
if (GetOwnerID()) {
|
||||
SayString(NOT_LEGAL_TARGET);
|
||||
if (other) {
|
||||
if (other->IsClient())
|
||||
}
|
||||
|
||||
if (other->IsClient()) {
|
||||
other->CastToClient()->RemoveXTarget(this, false);
|
||||
}
|
||||
|
||||
RemoveFromHateList(other);
|
||||
LogCombat("I am not allowed to attack [{}]", other->GetName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2131,17 +2133,19 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
||||
my_hit.skill = static_cast<EQ::skills::SkillType>(GetPrimSkill());
|
||||
OffHandAtk(false);
|
||||
}
|
||||
|
||||
if (Hand == EQ::invslot::slotSecondary) {
|
||||
my_hit.skill = static_cast<EQ::skills::SkillType>(GetSecSkill());
|
||||
OffHandAtk(true);
|
||||
}
|
||||
|
||||
//figure out what weapon they are using, if any
|
||||
const EQ::ItemData* weapon = nullptr;
|
||||
if (Hand == EQ::invslot::slotPrimary && equipment[EQ::invslot::slotPrimary] > 0)
|
||||
const EQ::ItemData *weapon = nullptr;
|
||||
if (Hand == EQ::invslot::slotPrimary && equipment[EQ::invslot::slotPrimary] > 0) {
|
||||
weapon = database.GetItem(equipment[EQ::invslot::slotPrimary]);
|
||||
else if (equipment[EQ::invslot::slotSecondary])
|
||||
} else if (equipment[EQ::invslot::slotSecondary]) {
|
||||
weapon = database.GetItem(equipment[EQ::invslot::slotSecondary]);
|
||||
}
|
||||
|
||||
//We dont factor much from the weapon into the attack.
|
||||
//Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons
|
||||
@ -2194,6 +2198,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
||||
if (!mob) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mob->IsNPC() && mob->CastToNPC()->IsGuard()) {
|
||||
float distance = Distance(other->GetPosition(), mob->GetPosition());
|
||||
if ((mob->CheckLosFN(other) || mob->CheckLosFN(this)) && distance <= 70) {
|
||||
@ -2910,7 +2915,6 @@ void Mob::AddToHateList(Mob* other, int64 hate /*= 0*/, int64 damage /*= 0*/, bo
|
||||
Mob* targetmob = GetTarget();
|
||||
bool on_hatelist = CheckAggro(other);
|
||||
|
||||
if (other) {
|
||||
AddRampage(other);
|
||||
if (on_hatelist) { // odd reason, if you're not on the hate list, subtlety etc don't apply!
|
||||
// Spell Casting Subtlety etc
|
||||
@ -2923,7 +2927,6 @@ void Mob::AddToHateList(Mob* other, int64 hate /*= 0*/, int64 damage /*= 0*/, bo
|
||||
else {
|
||||
hate += 100; // 100 bonus initial aggro
|
||||
}
|
||||
}
|
||||
|
||||
// Pet that is /pet hold on will not add to their hate list if they're not engaged
|
||||
// Pet that is /pet hold on and /pet focus on will not add others to their hate list
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user