public static CombatAction getActiveCombatAction(Mob mob) { if (mob.getDefaultCombatAction() != null) { return mob.getDefaultCombatAction(); } if (mob.isWerewolf()) { return MeleeCombatAction.getAction(); } if (mob.getCombatState().getQueuedSpell() != null || (mob.getAutocastSpell() != null && (mob.getCombatState().getCombatStyle() == CombatStyle.AUTOCAST || mob.getCombatState().getCombatStyle() == CombatStyle.DEFENSIVE_AUTOCAST))) { return MagicCombatAction.getAction(); } Item weapon = mob.getEquipment().get(Equipment.SLOT_WEAPON); if (weapon != null) { EquipmentDefinition weaponEquipDef = weapon.getEquipmentDefinition(); if (weaponEquipDef.getBowType() != null || weaponEquipDef.getRangeWeaponType() != null) { return RangeCombatAction.getAction(); } } return MeleeCombatAction.getAction(); }