mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-15 08:42:26 +00:00
Fix issue with two hander for NPCs dual wielding
Cleaned up some other 2hander logic as well
This commit is contained in:
parent
d083262555
commit
dcd1a07553
@ -4921,7 +4921,6 @@ void Client::SetAttackTimer()
|
||||
attack_timer.SetAtTrigger(4000, true);
|
||||
|
||||
Timer *TimerToUse = nullptr;
|
||||
const Item_Struct *PrimaryWeapon = nullptr;
|
||||
|
||||
for (int i = MainRange; i <= MainSecondary; i++) {
|
||||
//pick a timer
|
||||
@ -4943,19 +4942,8 @@ void Client::SetAttackTimer()
|
||||
|
||||
//special offhand stuff
|
||||
if (i == MainSecondary) {
|
||||
//if we have a 2H weapon in our main hand, no dual
|
||||
if (PrimaryWeapon != nullptr) {
|
||||
if (PrimaryWeapon->ItemClass == ItemClassCommon
|
||||
&& (PrimaryWeapon->ItemType == ItemType2HSlash
|
||||
|| PrimaryWeapon->ItemType == ItemType2HBlunt
|
||||
|| PrimaryWeapon->ItemType == ItemType2HPiercing)) {
|
||||
attack_dw_timer.Disable();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//if we cant dual wield, skip it
|
||||
if (!CanThisClassDualWield()) {
|
||||
if (!CanThisClassDualWield() || HasTwoHanderEquipped()) {
|
||||
attack_dw_timer.Disable();
|
||||
continue;
|
||||
}
|
||||
@ -5004,9 +4992,6 @@ void Client::SetAttackTimer()
|
||||
if (quiver_haste > 0)
|
||||
speed *= quiver_haste;
|
||||
TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true, true);
|
||||
|
||||
if (i == MainPrimary)
|
||||
PrimaryWeapon = ItemToUse;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5044,7 +5029,7 @@ void NPC::SetAttackTimer()
|
||||
|
||||
//special offhand stuff
|
||||
if (i == MainSecondary) {
|
||||
if(!CanThisClassDualWield()) {
|
||||
if(!CanThisClassDualWield() || HasTwoHanderEquipped()) {
|
||||
attack_dw_timer.Disable();
|
||||
continue;
|
||||
}
|
||||
@ -5085,14 +5070,8 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell)
|
||||
}
|
||||
|
||||
auto extraattackchance = aabonuses.ExtraAttackChance + spellbonuses.ExtraAttackChance + itembonuses.ExtraAttackChance;
|
||||
if (extraattackchance) {
|
||||
auto wpn = GetInv().GetItem(MainPrimary);
|
||||
if (wpn && (wpn->GetItem()->ItemType == ItemType2HBlunt ||
|
||||
wpn->GetItem()->ItemType == ItemType2HSlash ||
|
||||
wpn->GetItem()->ItemType == ItemType2HPiercing))
|
||||
if (zone->random.Roll(extraattackchance))
|
||||
Attack(target, hand, false, false, IsFromSpell);
|
||||
}
|
||||
if (extraattackchance && HasTwoHanderEquipped() && zone->random.Roll(extraattackchance))
|
||||
Attack(target, hand, false, false, IsFromSpell);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -141,6 +141,7 @@ void Client::CalcItemBonuses(StatBonuses* newbon) {
|
||||
ClearItemFactionBonuses();
|
||||
SetShieldEquiped(false);
|
||||
SetTwoHandBluntEquiped(false);
|
||||
SetTwoHanderEquipped(false);
|
||||
|
||||
unsigned int i;
|
||||
//should not include 21 (SLOT_AMMO)
|
||||
@ -154,8 +155,11 @@ void Client::CalcItemBonuses(StatBonuses* newbon) {
|
||||
const Item_Struct *item = inst->GetItem();
|
||||
if (i == MainSecondary && (item && item->ItemType == ItemTypeShield))
|
||||
SetShieldEquiped(true);
|
||||
else if (i == MainPrimary && (item && item->ItemType == ItemType2HBlunt))
|
||||
else if (i == MainPrimary && (item && item->ItemType == ItemType2HBlunt)) {
|
||||
SetTwoHandBluntEquiped(true);
|
||||
SetTwoHanderEquipped(true);
|
||||
} else if (i == MainPrimary && (item && (item->ItemType == ItemType2HSlash || item->ItemType == ItemType2HPiercing)))
|
||||
SetTwoHanderEquipped(true);
|
||||
}
|
||||
|
||||
//Power Source Slot
|
||||
|
||||
@ -334,9 +334,11 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
|
||||
eslot = MaterialPrimary;
|
||||
if (item2->Damage > 0)
|
||||
SendAddPlayerState(PlayerState::PrimaryWeaponEquipped);
|
||||
if (item2->ItemType == ItemType2HBlunt || item2->ItemType == ItemType2HSlash || item2->ItemType == ItemType2HPiercing)
|
||||
SetTwoHanderEquipped(true);
|
||||
}
|
||||
else if (foundslot == MainSecondary
|
||||
&& (GetOwner() != nullptr || (GetLevel() >= 13 && zone->random.Roll(NPC_DW_CHANCE)) || (item2->Damage==0)) &&
|
||||
&& (GetOwner() != nullptr || (CanThisClassDualWield() && zone->random.Roll(NPC_DW_CHANCE)) || (item2->Damage==0)) &&
|
||||
(item2->ItemType == ItemType1HSlash || item2->ItemType == ItemType1HBlunt || item2->ItemType == ItemTypeShield ||
|
||||
item2->ItemType == ItemType1HPiercing))
|
||||
{
|
||||
|
||||
@ -211,6 +211,7 @@ Mob::Mob(const char* in_name,
|
||||
trackable = true;
|
||||
has_shieldequiped = false;
|
||||
has_twohandbluntequiped = false;
|
||||
has_twohanderequipped = false;
|
||||
has_numhits = false;
|
||||
has_MGB = false;
|
||||
has_ProjectIllusion = false;
|
||||
|
||||
@ -336,6 +336,8 @@ public:
|
||||
inline void SetShieldEquiped(bool val) { has_shieldequiped = val; }
|
||||
bool HasTwoHandBluntEquiped() const { return has_twohandbluntequiped; }
|
||||
inline void SetTwoHandBluntEquiped(bool val) { has_twohandbluntequiped = val; }
|
||||
bool HasTwoHanderEquipped() { return has_twohanderequipped; }
|
||||
void SetTwoHanderEquipped(bool val) { has_twohanderequipped = val; }
|
||||
virtual uint16 GetSkill(SkillUseTypes skill_num) const { return 0; }
|
||||
virtual uint32 GetEquipment(uint8 material_slot) const { return(0); }
|
||||
virtual int32 GetEquipmentMaterial(uint8 material_slot) const;
|
||||
@ -1221,6 +1223,7 @@ protected:
|
||||
bool offhand;
|
||||
bool has_shieldequiped;
|
||||
bool has_twohandbluntequiped;
|
||||
bool has_twohanderequipped;
|
||||
bool has_numhits;
|
||||
bool has_MGB;
|
||||
bool has_ProjectIllusion;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user