@Override public void execute() { int dmg = mob.getCombatState().getPoisonDamage(); if (dmg > mob.getSkills().getLevel(Skills.HITPOINTS)) { dmg = mob.getSkills().getLevel(Skills.HITPOINTS); } mob.inflictDamage(new Hit(HitType.POISON_HIT, dmg), null); drainAmount--; if (drainAmount == 0) { mob.getCombatState().decreasePoisonDamage(1); drainAmount = 4; } }
/** Calculates a mob's range max hit. */ public static int calculateRangeMaxHit(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; int rangedStrength = mob.getCombatState().getBonus(12); Item weapon = mob.getEquipment().get(Equipment.SLOT_WEAPON); BowType bow = weapon.getEquipmentDefinition().getBowType(); if (bow == BowType.CRYSTAL_BOW) { /** Crystal Bow does not use arrows, so we don't use the arrows range strength bonus. */ rangedStrength = mob.getEquipment().get(Equipment.SLOT_WEAPON).getEquipmentDefinition().getBonus(12); } int rangeLevel = mob.getSkills().getLevel(Skills.RANGE); int combatStyleBonus = 0; switch (mob.getCombatState().getCombatStyle()) { case ACCURATE: combatStyleBonus = 3; break; } if (fullVoidRange(mob)) { otherBonusMultiplier = 1.1; } int effectiveRangeDamage = (int) ((rangeLevel * prayerMultiplier * otherBonusMultiplier) + combatStyleBonus); double baseDamage = 1.3 + (effectiveRangeDamage / 10) + (rangedStrength / 80) + ((effectiveRangeDamage * rangedStrength) / 640); if (special) { if (mob.getEquipment().get(Equipment.SLOT_ARROWS) != null) { switch (mob.getEquipment().get(Equipment.SLOT_ARROWS).getId()) { case 11212: specialMultiplier = 1.5; break; case 9243: specialMultiplier = 1.15; break; case 9244: specialMultiplier = 1.45; break; case 9245: specialMultiplier = 1.15; break; case 9236: specialMultiplier = 1.25; break; case 882: case 884: case 886: case 888: case 890: case 892: if (mob.getEquipment().get(Equipment.SLOT_WEAPON) != null && mob.getEquipment().get(Equipment.SLOT_WEAPON).getId() == 11235) { specialMultiplier = 1.3; } break; } } } maxHit = (int) (baseDamage * specialMultiplier); return maxHit; }
/** 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; }
@Override public void hit(final Mob attacker, final Mob victim) { super.hit(attacker, victim); // System.out.println("In hit ytmejkot"); if (!attacker.isNPC()) { return; // this should be an NPC! } NPC npc = (NPC) attacker; CombatStyle style = CombatStyle.MELEE; int maxHit; int damage; int randomHit; int hitDelay; boolean blockAnimation; final int hit; switch (style) { default: case MELEE: Animation anim = attacker.getAttackAnimation(); attacker.playAnimation(anim); hitDelay = 1; blockAnimation = true; maxHit = npc.getCombatDefinition().getMaxHit(); damage = damage( maxHit, attacker, victim, attacker.getCombatState().getAttackType(), Skills.ATTACK, Prayers.PROTECT_FROM_MELEE, false, false); randomHit = random.nextInt(damage < 1 ? 1 : damage + 1); if (randomHit > victim.getSkills().getLevel(Skills.HITPOINTS)) { randomHit = victim.getSkills().getLevel(Skills.HITPOINTS); } hit = randomHit; break; } attacker.getCombatState().setAttackDelay(5); attacker.getCombatState().setSpellDelay(5); World.getWorld() .submit( new Tickable(hitDelay) { @Override public void execute() { victim.inflictDamage(new Hit(hit), attacker); smite(attacker, victim, hit); recoil(attacker, victim, hit); this.stop(); } }); vengeance(attacker, victim, hit, 1); victim.getActiveCombatAction().defend(attacker, victim, blockAnimation); }