Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void refreshBonuses() {
- bonuses = new int[15];
- int mainHandType = player.getEquipment().getWeaponId() == -1 ? Combat.MELEE_TYPE : getType(Equipment.SLOT_WEAPON);
- int offHandType = getType(Equipment.SLOT_SHIELD);
- int meleeGearArmor = 0;
- int rangeGearArmor = 0;
- int mageGearArmor = 0;
- int allGearArmor = 0;
- Item shield = player.getEquipment().getItem(Equipment.SLOT_SHIELD);
- boolean hasShield = player.getEquipment().hasShield() && shield.getDefinitions().isShield();
- int spellId = getSpellId();
- if (spellId < 1 && hasPolyporeStaff(player))
- spellId = 65535;
- if (spellId > 0) {
- mainHandType = Combat.MAGIC_TYPE;
- offHandType = Combat.MAGIC_TYPE;
- }
- val items = player.getEquipment().getItems().getItems();
- for (int i = items.length - 1; i >= 0; i--) {
- val item = items[i];
- if (item == null)
- continue;
- ItemDefinitions defs = item.getDefinitions();
- if (item.getId() == 9705)
- defs = ItemDefinitions.getItemDefinitions(857);
- if (item.getId() == 9703)
- defs = ItemDefinitions.getItemDefinitions(1303);
- if (item.getName().equalsIgnoreCase("christmas scythe"))
- defs = ItemDefinitions.getItemDefinitions(36333);
- if (item.getName().equalsIgnoreCase("soul reaper's blade"))
- defs = ItemDefinitions.getItemDefinitions(4587);
- if ((item.getName().equalsIgnoreCase("Dominion sword") ||
- item.getName().equalsIgnoreCase("Dominion crossbow") || item.getName().equalsIgnoreCase("Dominion staff")) && !DTController.isInsideDominionTower(player))
- continue;
- if (item.getName().toLowerCase().contains("goliath gloves"))
- continue;
- if(item.getName().toLowerCase().contains("primal") || item.getName().toLowerCase().contains("sagittarian")
- || item.getName().toLowerCase().contains("celestial"))
- continue;
- int defenderType = defs.getName().toLowerCase().contains(" defender") ? Combat.MELEE_TYPE : defs.getName().toLowerCase().contains(" repriser") ? Combat.RANGE_TYPE :
- defs.getName().toLowerCase().contains(" rebounder") || defs.getName().toLowerCase().contains("ancient lantern") ? Combat.MAGIC_TYPE : -1;
- int type = getType(i);
- if (i != Equipment.SLOT_SHIELD && !(i == Equipment.SLOT_ARROWS && mainHandType == Combat.RANGE_TYPE && player.getEquipment().getItem(Equipment.SLOT_WEAPON).getDefinitions().getCSOpcode(2940) != 0)) {
- int damage = (int) (defs.getDamage(mainHandType));
- if (i == Equipment.SLOT_ARROWS && item.getId() == 29617 && !Combat.hasDarkbow(player))
- damage /= 2;
- else if (i == Equipment.SLOT_ARROWS && item.getId() == 28465 && !Combat.hasAscensionCrossbow(player, true))
- damage /= 2;
- if (i == Equipment.SLOT_ARROWS) { // cap arrows
- Item weapon = player.getEquipment().getItem(Equipment.SLOT_WEAPON);
- int maxDamage = weapon == null ? 0 : (int) (weapon.getDefinitions().getRangedLevel() * 96);
- if (damage > maxDamage)
- damage = maxDamage;
- }
- if (defenderType != -1) {
- damage = (int) (damage + (Math.ceil(damage * 0.25)));
- }
- int accuracy = defs.getAccuracy(mainHandType);
- Perk blunted = player.getInventionManager().hasPerk(Perks.BLUNTED);
- if (blunted != null)
- damage -= (int) ((double) damage * ((double) blunted.getRank() * 0.01));
- Perk inaccurate = player.getInventionManager().hasPerk(Perks.INACCURATE);
- if (inaccurate != null)
- accuracy -= (int) ((double) accuracy * ((double) inaccurate.getRank() * 0.01));
- bonuses[MAINHAND_DAMAGE] += damage;
- bonuses[MAINHAND_ACCURACY] += accuracy;
- }
- if (!hasShield && i != Equipment.SLOT_WEAPON && !(i == Equipment.SLOT_ARROWS && offHandType == Combat.RANGE_TYPE && player.getEquipment().getItem(Equipment.SLOT_SHIELD).getDefinitions().getCSOpcode(2940) != 0)) {
- int damage = (int) (defs.getDamage(offHandType) / 2);
- if (i == Equipment.SLOT_ARROWS && item.getId() == 29617 && !Combat.hasDarkbow(player))
- damage /= 2;
- else if (i == Equipment.SLOT_ARROWS && item.getId() == 28465 && !Combat.hasAscensionCrossbow(player, false))
- damage /= 2;
- if (i == Equipment.SLOT_ARROWS) { // cap arrows
- Item weapon = player.getEquipment().getItem(Equipment.SLOT_SHIELD);
- int maxDamage = weapon == null ? 0 : (int) (weapon.getDefinitions().getRangedLevel() * 96);
- if (damage > maxDamage)
- damage = maxDamage;
- }
- if (defenderType != -1) {
- damage = (int) (damage + (Math.ceil(damage * 0.25)));
- }
- int accuracy = defs.getAccuracy(offHandType);
- Perk blunted = player.getInventionManager().hasPerk(Perks.BLUNTED);
- if (blunted != null)
- damage -= (int) ((double) damage * ((double) blunted.getRank() * 0.01));
- Perk inaccurate = player.getInventionManager().hasPerk(Perks.INACCURATE);
- if (inaccurate != null)
- accuracy -= (int) ((double) accuracy * ((double) inaccurate.getRank() * 0.01));
- if ((!Settings.DUAL_COMBAT && i == Equipment.SLOT_SHIELD) || (Settings.DUAL_COMBAT)) {
- bonuses[OFFHAND_DAMAGE] += damage;
- bonuses[OFFHAND_ACCURACY] += accuracy;
- }
- }
- bonuses[LIFE_B] += defs.getHealth() / 10;
- bonuses[PRAYER_B] += defs.getPrayerBonus();
- int armor = defs.getArmor();
- if (armor > 0) {
- bonuses[WORN_ARMOUR] += armor;
- if (type != Combat.ALL_TYPE && (i == Equipment.SLOT_CHEST || i == Equipment.SLOT_LEGS || i == Equipment.SLOT_FEET || i == Equipment.SLOT_HANDS || i == Equipment.SLOT_HAT || (i == Equipment.SLOT_SHIELD && !hasShield)) && player.getEquipment().getWeaponId() != -1 && type != mainHandType) {
- if (mainHandType == Combat.MELEE_TYPE)
- bonuses[MELEE_ACCURACY_PENALTY] += armor * (mainHandType == Combat.RANGE_TYPE ? 1.5 : 0.8);
- else if (mainHandType == Combat.RANGE_TYPE)
- bonuses[RANGE_ACCURACY_PENALTY] += armor * (mainHandType == Combat.MAGIC_TYPE ? 1.5 : 0.8);
- else if (mainHandType == Combat.MAGIC_TYPE)
- bonuses[MAGE_ACCURACY_PENALTY] += armor * (mainHandType == Combat.MELEE_TYPE ? 1.5 : 0.8);
- }
- if (type == Combat.ALL_TYPE) {
- allGearArmor += armor;
- } else if (type == Combat.MELEE_TYPE) {
- meleeGearArmor += armor;
- } else if (type == Combat.RANGE_TYPE) {
- rangeGearArmor += armor;
- } else if (type == Combat.MAGIC_TYPE) {
- mageGearArmor += armor;
- }
- }
- }
- if (player.getEquipment().getWeaponId() == -1 && !player.getEquipment().hasOffHand()) {
- Item gloves = player.getEquipment().getItem(Equipment.SLOT_HANDS);
- if (gloves != null && gloves.getDefinitions().getName().toLowerCase().contains("goliath gloves")) {
- bonuses[MAINHAND_DAMAGE] += 10800;
- bonuses[MAINHAND_ACCURACY] += 1694;
- }
- }
- if (!Settings.DUAL_COMBAT) {
- bonuses[MAINHAND_DAMAGE] += bonuses[OFFHAND_DAMAGE];
- bonuses[MAINHAND_ACCURACY] = Math.max(bonuses[MAINHAND_ACCURACY], bonuses[OFFHAND_ACCURACY]);
- }
- bonuses[MELEE_AFF] = (int) Combat.getArmourAffinity(bonuses[WORN_ARMOUR], mageGearArmor, meleeGearArmor + allGearArmor, rangeGearArmor);
- bonuses[RANGE_AFF] = (int) Combat.getArmourAffinity(bonuses[WORN_ARMOUR], meleeGearArmor, rangeGearArmor + allGearArmor, mageGearArmor);
- bonuses[MAGIC_AFF] = (int) Combat.getArmourAffinity(bonuses[WORN_ARMOUR], rangeGearArmor, mageGearArmor + allGearArmor, meleeGearArmor);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement