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(); }
/** Calculates a mob's melee max hit. */ public static int calculateMeleeMaxHit(Mob mob, boolean special) { if (mob.isNPC()) { NPC npc = (NPC) mob; return npc.getCombatDefinition().getMaxHit(); } int maxHit = 0; double specialMultiplier = 1; double prayerMultiplier = 1; double otherBonusMultiplier = 1; // TODO: void melee = 1.2, slayer helm = 1.15, salve amulet = 1.15, salve amulet(e) = 1.2 Item helm = mob.getEquipment().get(Equipment.SLOT_HELM); int strengthLevel = mob.getSkills().getLevel(Skills.STRENGTH); int combatStyleBonus = 0; if (mob.isWerewolf()) { prayerMultiplier = 1.40; prayerMultiplier = 1.60; otherBonusMultiplier = 1.80; } if (mob.getCombatState().getPrayer(Prayers.BURST_OF_STRENGTH)) { prayerMultiplier = 1.05; } else if (mob.getCombatState().getPrayer(Prayers.SUPERHUMAN_STRENGTH)) { prayerMultiplier = 1.1; } else if (mob.getCombatState().getPrayer(Prayers.ULTIMATE_STRENGTH)) { prayerMultiplier = 1.15; } else if (mob.getCombatState().getPrayer(Prayers.CHIVALRY)) { prayerMultiplier = 1.18; } else if (mob.getCombatState().getPrayer(Prayers.PIETY)) { prayerMultiplier = 1.23; } switch (mob.getCombatState().getCombatStyle()) { case AGGRESSIVE_1: case AGGRESSIVE_2: combatStyleBonus = 3; break; case CONTROLLED_1: case CONTROLLED_2: case CONTROLLED_3: combatStyleBonus = 1; break; } if (fullVoidMelee(mob)) { otherBonusMultiplier = 1.1; } int effectiveStrengthDamage = (int) ((strengthLevel * prayerMultiplier * otherBonusMultiplier) + combatStyleBonus); double baseDamage = 1.3 + (effectiveStrengthDamage / 10) + (mob.getCombatState().getBonus(10) / 80) + ((effectiveStrengthDamage * mob.getCombatState().getBonus(10)) / 640); if (special) { if (mob.getEquipment().get(Equipment.SLOT_WEAPON) != null) { switch (mob.getEquipment().get(Equipment.SLOT_WEAPON).getId()) { case 11694: specialMultiplier = 1.34375; break; case 11696: specialMultiplier = 1.1825; break; case 11698: case 11700: specialMultiplier = 1.075; break; case 3101: case 3204: case 1215: case 1231: case 5680: case 5698: specialMultiplier = 1.1; break; case 1305: specialMultiplier = 1.15; break; case 1434: specialMultiplier = 1.45; break; } } } maxHit = (int) (baseDamage * specialMultiplier); if (fullDharok(mob)) { int hpLost = mob.getSkills().getLevelForExperience(Skills.HITPOINTS) - mob.getSkills().getLevel(Skills.HITPOINTS); maxHit += hpLost * 0.35; } return maxHit; }