mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +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
103
zone/attack.cpp
103
zone/attack.cpp
@ -1473,7 +1473,7 @@ bool Mob::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
|||||||
SetTarget(other);
|
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 (
|
if (
|
||||||
(IsCasting() && GetClass() != BARD && !IsFromSpell)
|
(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
|
//Check that we can attack before we calc heading and face our target
|
||||||
if (!IsAttackAllowed(other)) {
|
if (!IsAttackAllowed(other)) {
|
||||||
if (GetOwnerID())
|
if (GetOwnerID()) {
|
||||||
SayString(NOT_LEGAL_TARGET);
|
SayString(NOT_LEGAL_TARGET);
|
||||||
if (other) {
|
|
||||||
if (other->IsClient())
|
|
||||||
other->CastToClient()->RemoveXTarget(this, false);
|
|
||||||
RemoveFromHateList(other);
|
|
||||||
LogCombat("I am not allowed to attack [{}]", other->GetName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (other->IsClient()) {
|
||||||
|
other->CastToClient()->RemoveXTarget(this, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveFromHateList(other);
|
||||||
|
LogCombat("I am not allowed to attack [{}]", other->GetName());
|
||||||
return false;
|
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());
|
my_hit.skill = static_cast<EQ::skills::SkillType>(GetPrimSkill());
|
||||||
OffHandAtk(false);
|
OffHandAtk(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Hand == EQ::invslot::slotSecondary) {
|
if (Hand == EQ::invslot::slotSecondary) {
|
||||||
my_hit.skill = static_cast<EQ::skills::SkillType>(GetSecSkill());
|
my_hit.skill = static_cast<EQ::skills::SkillType>(GetSecSkill());
|
||||||
OffHandAtk(true);
|
OffHandAtk(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//figure out what weapon they are using, if any
|
//figure out what weapon they are using, if any
|
||||||
const EQ::ItemData* weapon = nullptr;
|
const EQ::ItemData *weapon = nullptr;
|
||||||
if (Hand == EQ::invslot::slotPrimary && equipment[EQ::invslot::slotPrimary] > 0)
|
if (Hand == EQ::invslot::slotPrimary && equipment[EQ::invslot::slotPrimary] > 0) {
|
||||||
weapon = database.GetItem(equipment[EQ::invslot::slotPrimary]);
|
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]);
|
weapon = database.GetItem(equipment[EQ::invslot::slotSecondary]);
|
||||||
|
}
|
||||||
|
|
||||||
//We dont factor much from the weapon into the attack.
|
//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
|
//Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons
|
||||||
@ -2154,34 +2158,34 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (weapon->ItemType) {
|
switch (weapon->ItemType) {
|
||||||
case EQ::item::ItemType1HSlash:
|
case EQ::item::ItemType1HSlash:
|
||||||
my_hit.skill = EQ::skills::Skill1HSlashing;
|
my_hit.skill = EQ::skills::Skill1HSlashing;
|
||||||
break;
|
break;
|
||||||
case EQ::item::ItemType2HSlash:
|
case EQ::item::ItemType2HSlash:
|
||||||
my_hit.skill = EQ::skills::Skill2HSlashing;
|
my_hit.skill = EQ::skills::Skill2HSlashing;
|
||||||
break;
|
break;
|
||||||
case EQ::item::ItemType1HPiercing:
|
case EQ::item::ItemType1HPiercing:
|
||||||
my_hit.skill = EQ::skills::Skill1HPiercing;
|
my_hit.skill = EQ::skills::Skill1HPiercing;
|
||||||
break;
|
break;
|
||||||
case EQ::item::ItemType2HPiercing:
|
case EQ::item::ItemType2HPiercing:
|
||||||
my_hit.skill = EQ::skills::Skill2HPiercing;
|
my_hit.skill = EQ::skills::Skill2HPiercing;
|
||||||
break;
|
break;
|
||||||
case EQ::item::ItemType1HBlunt:
|
case EQ::item::ItemType1HBlunt:
|
||||||
my_hit.skill = EQ::skills::Skill1HBlunt;
|
my_hit.skill = EQ::skills::Skill1HBlunt;
|
||||||
break;
|
break;
|
||||||
case EQ::item::ItemType2HBlunt:
|
case EQ::item::ItemType2HBlunt:
|
||||||
my_hit.skill = EQ::skills::Skill2HBlunt;
|
my_hit.skill = EQ::skills::Skill2HBlunt;
|
||||||
break;
|
break;
|
||||||
case EQ::item::ItemTypeBow:
|
case EQ::item::ItemTypeBow:
|
||||||
my_hit.skill = EQ::skills::SkillArchery;
|
my_hit.skill = EQ::skills::SkillArchery;
|
||||||
break;
|
break;
|
||||||
case EQ::item::ItemTypeLargeThrowing:
|
case EQ::item::ItemTypeLargeThrowing:
|
||||||
case EQ::item::ItemTypeSmallThrowing:
|
case EQ::item::ItemTypeSmallThrowing:
|
||||||
my_hit.skill = EQ::skills::SkillThrowing;
|
my_hit.skill = EQ::skills::SkillThrowing;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
my_hit.skill = EQ::skills::SkillHandtoHand;
|
my_hit.skill = EQ::skills::SkillHandtoHand;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2194,6 +2198,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
|||||||
if (!mob) {
|
if (!mob) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mob->IsNPC() && mob->CastToNPC()->IsGuard()) {
|
if (mob->IsNPC() && mob->CastToNPC()->IsGuard()) {
|
||||||
float distance = Distance(other->GetPosition(), mob->GetPosition());
|
float distance = Distance(other->GetPosition(), mob->GetPosition());
|
||||||
if ((mob->CheckLosFN(other) || mob->CheckLosFN(this)) && distance <= 70) {
|
if ((mob->CheckLosFN(other) || mob->CheckLosFN(this)) && distance <= 70) {
|
||||||
@ -2910,19 +2915,17 @@ void Mob::AddToHateList(Mob* other, int64 hate /*= 0*/, int64 damage /*= 0*/, bo
|
|||||||
Mob* targetmob = GetTarget();
|
Mob* targetmob = GetTarget();
|
||||||
bool on_hatelist = CheckAggro(other);
|
bool on_hatelist = CheckAggro(other);
|
||||||
|
|
||||||
if (other) {
|
AddRampage(other);
|
||||||
AddRampage(other);
|
if (on_hatelist) { // odd reason, if you're not on the hate list, subtlety etc don't apply!
|
||||||
if (on_hatelist) { // odd reason, if you're not on the hate list, subtlety etc don't apply!
|
// Spell Casting Subtlety etc
|
||||||
// Spell Casting Subtlety etc
|
int64 hatemod = 100 + other->spellbonuses.hatemod + other->itembonuses.hatemod + other->aabonuses.hatemod;
|
||||||
int64 hatemod = 100 + other->spellbonuses.hatemod + other->itembonuses.hatemod + other->aabonuses.hatemod;
|
|
||||||
|
|
||||||
if (hatemod < 1)
|
if (hatemod < 1)
|
||||||
hatemod = 1;
|
hatemod = 1;
|
||||||
hate = ((hate * (hatemod)) / 100);
|
hate = ((hate * (hatemod)) / 100);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hate += 100; // 100 bonus initial aggro
|
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 will not add to their hate list if they're not engaged
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user