fix(Core/Unit): fix Dual Wield for more creatures, CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK, creature disarm damage (#20015)

* enable CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK

* sql set CREATURE_FLAG_EXTRA_USE_OFFHAND

* use new HasOffHandWeaponForAttack instead of haveOffhandWeapon

no longer requires m_CanDualwield set to use Offhand attack
requires non-disarmed weapon in Offhand OR creature_flag_extra enabled

Co-authored-by: Ovah <dreadkiller@gmx.de>
Co-authored-by: Warlockbugs <warlockbugs@outlook.com>

* Make shapeshift forms which dont override attack speed use weapon damage

Co-authored-by: killerwife <killerwife@gmail.com>

* SetEquipmentSlots turning off damage update when using template default

Co-authored-by: killerwife <killerwife@gmail.com>

* Setup DualWield & Damage On Equipment Updates, implement Set and GetVirtualItem

Co-authored-by: Yatzii <47720837+Yatzii93@users.noreply.github.com>

* creature disarm damage

set disarm to reduce minmax damage by 50% instead of setting to 0

Co-authored-by: Warlockbugs <warlockbugs@outlook.com>

---------

Co-authored-by: Ovah <dreadkiller@gmx.de>
Co-authored-by: Warlockbugs <warlockbugs@outlook.com>
Co-authored-by: killerwife <killerwife@gmail.com>
Co-authored-by: Yatzii <47720837+Yatzii93@users.noreply.github.com>
This commit is contained in:
Jelle Meeus
2024-09-25 16:53:39 +02:00
committed by GitHub
parent da31098094
commit 6e4a9bbb14
13 changed files with 160 additions and 30 deletions

View File

@@ -524,6 +524,8 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, cinfo->HoverHeight);
SetCanDualWield(cinfo->flags_extra & CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK);
// checked at loading
m_defaultMovementType = MovementGeneratorType(cinfo->MovementType);
if (!m_wanderDistance && m_defaultMovementType == RANDOM_MOTION_TYPE)
@@ -568,6 +570,8 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
ReplaceAllDynamicFlags(dynamicflags);
SetCanDualWield(cInfo->flags_extra & CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK);
SetAttackTime(BASE_ATTACK, cInfo->BaseAttackTime);
SetAttackTime(OFF_ATTACK, cInfo->BaseAttackTime);
SetAttackTime(RANGED_ATTACK, cInfo->RangeAttackTime);
@@ -3172,6 +3176,14 @@ bool Creature::IsImmuneToKnockback() const
return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK);
}
bool Creature::HasWeapon(WeaponAttackType type) const
{
const uint8 slot = uint8(type);
ItemEntry const* item = sItemStore.LookupEntry(GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + slot));
return ((item && item->ClassID == ITEM_CLASS_WEAPON) || (type == OFF_ATTACK && CanDualWield()));
}
/**
* @brief Enable or disable the creature's walk mode by removing: MOVEMENTFLAG_WALKING. Infom also the client
*/