diff options
| author | QAston <none@none> | 2009-02-03 15:56:07 +0100 |
|---|---|---|
| committer | QAston <none@none> | 2009-02-03 15:56:07 +0100 |
| commit | 9c560802cd615a3e43253b238eb48e4e1e7a5b68 (patch) | |
| tree | f0c9a40a30f9a26a885f3c340bf30790195d68fa /src/game/Unit.h | |
| parent | cccfd132dd4388f42da8087a9ad5ff54b7ec4808 (diff) | |
*Handle disarm offhand and ranged weapon, since now disarm affects all bonuses given by item.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.h')
| -rw-r--r-- | src/game/Unit.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/game/Unit.h b/src/game/Unit.h index aa038ab1fb4..ed496526e56 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -544,6 +544,8 @@ enum UnitFlags2 UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip) UNIT_FLAG2_COMPREHEND_LANG = 0x00000008, UNIT_FLAG2_FORCE_MOVE = 0x00000040, + UNIT_FLAG2_DISARM_OFFHAND = 0x00000080, + UNIT_FLAG2_DISARM_RANGED = 0x00000400, //this does not disable ranged weapon display (maybe additional flag needed?) UNIT_FLAG2_REGENERATE_POWER = 0x00000800 }; @@ -1005,6 +1007,16 @@ class TRINITY_DLL_SPEC Unit : public WorldObject float GetUnitParryChance() const; float GetUnitBlockChance() const; float GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVictim) const; + bool CanUseAttackType( uint8 attacktype ) const + { + switch(attacktype) + { + case BASE_ATTACK: return !HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISARMED); + case OFF_ATTACK: return !HasFlag(UNIT_FIELD_FLAGS_2,UNIT_FLAG2_DISARM_OFFHAND); + case RANGED_ATTACK: return !HasFlag(UNIT_FIELD_FLAGS_2,UNIT_FLAG2_DISARM_RANGED); + } + return true; + } virtual uint32 GetShieldBlockValue() const =0; uint32 GetUnitMeleeSkill(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } |
