Jump to content

Search the Community

Showing results for tags 'accuracy'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RuneLocus
    • News & Announcements
    • Information Booth
    • Website Support
    • Introductions
    • Chat
    • Forum Games
  • RuneScape Development
    • RSPS General
    • RuneScape Private Server (RS2)
    • RuneScape Private Server (503+)
    • RuneScape Private Server (EoC 742+)
  • Other
    • Digital Art
    • Gaming
    • Webdevelopment
    • Computers
  • Marketplace
    • RuneScape Market
    • RSPS Market
    • Others Market
    • Freelance Middleman Services
  • Super Secret Club's Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 2 results

  1. [CENTER][SIZE=7]Calculating Player vs Player Combat Accuracy[/SIZE][/CENTER] When calculating PVP combat accuracy there are 3 major steps: [LIST] [*]Effective Attack & Effective Defence Calculation [*]Augmented Attack & Augmented Defence Calculation [*]Hit & Block Chance Calculation [/LIST] [CODE] Variable key: off - denotes 'offensive', this prefix implies variable belongs to offensive entity. def - denotes 'defensive', this prefix implies variable belongs to defensive entity.[/CODE] [SIZE=5]Effective Attack[/SIZE] Effective Attack is a base stat level with invisible level modifiers applied (level modifiers that are not displayed via ui). This value is calculated as off_current_*_level with the following modifiers applied depending on combat type: [LIST] [*]Melee combat: [LIST] [*][*]off_attack_prayer_bonus [*][*]off_additional_bonus [*][*]off_stance_bonus [*][*]off_weapon_bonus [/LIST] [/LIST] [LIST] [*]Ranged combat: [LIST] [*][*]off_ranged_prayer_bonus [*][*]off_additional_bonus [*][*]off_stance_bonus [*][*]off_weapon_bonus [/LIST] [/LIST] [LIST] [*]Magic combat: [LIST] [*][*]off_magic_prayer_bonus [*][*]off_additional_bonus [*][*]off_spell_bonus [/LIST] [/LIST] This value is then rounded down. Effective Attack is the offensive entities "effective attack level" after base stat modifiers have been applied. A base stat modifier is a bonus that directly modifies entity (attack, ranged, magic) levels. These modifiers include bonuses from prayers, bonuses granted by special equipment(Black Mask, Salve Amulet, Dragon Slayer Gloves, etc), bonuses granted by equipment/spell mastery and bonuses granted by chosen attack stance(Accurate, Defensive and so on..). Below you will find documentation for each of the above variables. [CODE]Name: off_base_*_level Type: Base value Description: Base stat level pre any modifiers. This value can be calculated using entity current xp. Max value: 99 Examples: 80/99 = 99 base level 116/95 = 95 base level[/CODE] [CODE]Name: off_current_*_level Type: Base value Description: Base stat level post visible stat modifiers. Examples: 80/99 = 80 current level 116/95 = 116 current level[/CODE] [CODE]Name: off_*_prayer_bonus Type: Multiplicative Bonus Description: Multiplicative stat level modifier depending on chosen prayer(s), relevent to current calculation. This bonus is granted for both physical and magic attacks. Default value: 1.0 Melee prayer offence: Clarity of Thought - 1.05 (5%) Improved Reflexes - 1.10 (10%) Incredible Reflexes - 1.15 (15%) Chivalry - 1.15 (15%) Piety - 1.20 (20%) Ranged prayer offence: Sharp Eye - 1.05 (5%) Hawk Eye - 1.10 (10%) Eagle Eye - 1.15 (15%) Rigour - 1.20 (20%) Magic prayer offence: Mystic Will - 1.05 (5%) Mystic Lore - 1.10 (10%) Mystic Might - 1.15 (15%) Augury - 1.20 (20$)[/CODE] [CODE]Name: off_additional_bonus Type: Multiplicative Bonus Description: Multiplicative stat level modifier depending on worn equipment, relevent to current calculation. This bonus is granted for both physical and magic attacks. This bonus is only granted to the offensive entity. In the case that more than one of these conditions is met, modifiers are added together before being applied. Default value: 1.0 Versus general slayer task: Melee: Black Mask - 1.125 (12.5%) Slayer Helmet - 1.125 (12.5%) Full Slayer Helmet - 1.125 (12.5%) Ranged: Focus Sight - 1.125 (12.5%) Slayer Helmet - 1.125 (12.5%) Full Slayer Helmet - 1.125 (12.5%) Magic: Hexcrest - 1.125 (12.5%) Slayer Helmet - 1.125 (12.5%) Full Slayer Helmet - 1.125 (12.5%) Versus dragon slayer task: Melee: Dragon Slayer Gloves - 1.10 (10%) Versus undead: Melee & Magic & Ranged: Salve Amulet - 1.15 (15%) Salve Amulet (e) - 1.20 (20%) Examples: Items: Salve Amulet, Black Mask Versus: Undead, Slayer Task Modifier: 1.275 (27.5%) Items: Full Slayer Helmet, Dragon Slayer Gloves Versus: Dragon, Slayer Task Modifier: 1.225 (22.5%)[/CODE] [CODE]Name: off_stance_bonus Type: Additive Bonus Description: Additive stat level modifier depending on chosen combat stance, relevent to current calculation. This bonus is only granted for physical attacks (melee and ranged). Melee weapon offence: Accurate - 3 level(s) Aggressive - 0 level(s) Controlled - 1 level(s) Defensive - 0 level(s) Ranged weapon offence: Accurate - 3 level(s) Rapid - 0 level(s) Long Ranged - 0 level(s)[/CODE] [CODE]Name: off_spell_bonus Type: Additive Bonus Description: Additive stat level modifier depending on 'experience' using a spell. "When you cast combat-related spells, there is a chance of failure. This is dependent on a few factors such as your magical attack bonuses, the magical Defence bonuses of your opponent and your Magic experience." This bonus is calculated as .3 bonus level(s) per level above spell requirement. This modifier uses BASE level, not CURRENT level. (ie. 112/99 = 99 base level) Examples: Current Magic Level: 99 Spell: Ice Blitz (Level 82) Effective Magic Level: 104 Current Magic Level: 99 Spell: Fire Blast (Level 59) Effective Magic Level: 111[/CODE] [CODE]Name: off_weapon_bonus Type: Additive Bonus Description: Additive stat level modifier depending on 'experience' using a weapon. This is an experimental stat modifier based on the logic provided in the *_spell_bonus documentation. This addition is justified by the observation that "dragon" weapons appear to be more accurate than their higher level counterparts at the exchange of worse equipment stats when used by high level characters. This is an important balance point as part of the Runescape accuracy algorithm. This modifier provides a benefit to the attack stat level beyond weapon equip requirements, and an important trade off for those who choose to level their attack stat level further versus those who do not. In addition low tier weaponry in currently utilised versions of the algorithm become completely obsolete and outclassed by high tier defence equipment giving the outcome of seemingly "overpowered" defence. High level characters utilising high tier defence equipment against eachother will find lower tier weaponry a more viable choice, and will find it much more powerful against low tier armour. These characters will also be granted a benefit versus characters with an inferior attack stat level. This bonus is calculated as .3 bonus level(s) per level above weapon requirement. This modifier uses BASE level, not CURRENT level. (ie. 112/99 = 99 base level) Examples: Current Attack Level: 99 Weapon: Dragon Dagger (Level 60) Effective Attack Level: 110 Current Attack Level: 99 Weapon Abyssal Whip (Level 70) Effective Attack Level: 107 Current Attack Level: 84 Weapon Abyssal Whip (Level 70) Effective Attack Level: 88[/CODE] Using the above modifiers Effective Attack is calculated as: [CODE]String off_combat_type = "melee"; //melee, ranged, magic switch(off_combat_type) { case "melee": effective_attack = Math.floor(((off_current_attack_level * off_attack_prayer_bonus) * off_additional_bonus) + off_stance_bonus + off_weapon_bonus); break; case "ranged": effective_attack = Math.floor(((off_current_ranged_level * off_ranged_prayer_bonus) * off_additional_bonus) + off_stance_bonus + off_weapon_bonus); break; case "magic": effective_attack = Math.floor(((off_current_magic_level * off_magic_prayer_bonus) * off_additional_bonus) + off_spell_bonus); break; }[/CODE] [SIZE=5]Effective Defence[/SIZE] Effective Defence is a base stat level with invisible level modifiers applied (level modifiers that are not displayed via ui). For Melee and Ranged combat this value is calculated as off_current_defence_level with the following modifiers applied: [LIST] [*]def_defence_prayer_bonus [*]def_defence_stance_bonus [/LIST] For Magic combat there is a special case, this value is calculated using a combination of two values: [LIST] [*]effective_defence [*]effective_magic [/LIST] [QUOTE]For Magic combat def_current_defence_level has the following modifiers applied: [LIST] [*]def_defence_prayer_bonus [/LIST] These values are then multiplied by .3 and .7 respectively. Composing the final whole value using these two values combined. Magic defence is a special case as defence level and stat modifiers should only play a small part in the final value used to calculate magic defence. In currently utilised versions of the algorithm it is common for magic attacks to miss(or "splash") a lot because melee defence levels and modifiers are used for the calculation of defence against magic spells but this is not their intended use. Rather, they are intended for defence against melee and ranged attacks. It is worth noting the incredibly high effective_attack and effective_defence levels when using melee & ranged attacks in comparison to the pitiful effective_attack of magic attacks. These melee/ranged defence steroids were not intended as defence against magic, and the effective_attack of magic spells simply can not compare. This implementation of magic defence creates the desired effect of magic hitting often versus characters with great melee and ranged defences (melee equipment) in addition to current magic level playing a much greater role in defence against magic attacks as intended. Characters are required to raise their magic level as defence against magic attacks.[/QUOTE] This value is rounded down. Effective Defence is the defensive entities "effective defence level" after base stat modifiers have been applied. A base stat modifier is a bonus that directly modifies entity (Defence, Magic) levels. These modifiers include bonuses from prayers and bonuses granted by chosen attack stance(Accurate, Defensive and so on..). Below you will find documentation for each of the above variables. [CODE]Name: effective_magic Type: Base Value Description: Additive stat level modifier depending on defending entity magic level. Magic defence is calculated as 3 shares physical defence (or effective_defence) and 7 shares magic defence (or effective_magic). In other words, this value makes up 70% of defence against magic spells. With the other 30% coming from effective_defence. This value is def_current_magic_level multiplied by .7, or 70%. This value is rounded down.[/CODE] [CODE]Name: def_current_defence_level Type: Base value Description: Base stat level post visible stat modifiers. Examples: 80/99 = 80 current level 116/95 = 116 current level[/CODE] [CODE]Name: def_defence_prayer_bonus Type: Multiplicative Bonus Description: Multiplicative stat level modifier depending on chosen prayer(s), relevent to current calculation. This bonus is granted for both physical and magic attacks. Default value: 1.0 General prayer defence: Thick Skin - 1.05 (5%) Rock Skin - 1.10 (10%) Steel Skin - 1.15 (15%) Chivalry - 1.20 (20%) Piety - 1.25 (25%)[/CODE] [CODE]Name: def_stance_bonus Type: Additive Bonus Description: Additive stat level modifier depending on chosen combat stance, relevent to current calculation. This bonus is only granted for physical attacks (melee and ranged). Melee weapon defence: Accurate - 0 level(s) Aggressive - 0 level(s) Controlled - 1 level(s) Defensive - 3 level(s) Ranged weapon defence: Accurate - 0 level(s) Rapid - 0 level(s) Long Ranged - 3 level(s)[/CODE] Using the above modifiers Effective Defence is calculated as: [CODE]String off_combat_type = "melee"; //melee, ranged, magic switch(off_combat_type) { case "melee": effective_defence = Math.floor((def_current_defence_level * def_defence_prayer_bonus) + def_stance_bonus); break; case "ranged": effective_defence = Math.floor((def_current_defence_level * def_defence_prayer_bonus) + def_stance_bonus); break; case "magic": effective_defence = Math.floor((def_current_defence_level * def_defence_prayer_bonus) * .3); effective_magic = Math.floor(def_current_magic_level * .7); effective_defence = effective_defence + effective_magic; break; }[/CODE] [SIZE=5]Augmented Attack[/SIZE] Augmented attack is a base stat level with equipment stat value modifiers applied (modifiers retrieved from offensive entities worn equipment). This value is calculated as: [CODE]Math.floor(((effective_attack + 8) * (off_equipment_bonus + 64)) / 10);[/CODE] effective_attack and off_equipment_bonus have 8 and 64 added to their values respectively before multiplication. These values are also added to augmented_defence and act as means of eliminating negetive numbers. Negetive numbers create a lot of issues and strange behaviour within the algorithm. We can eliminate these easily by giving both values identical amounts that exceed the max possible negetive value they can contain. A negetive off_equipment_bonus value would be corrected to a positive value, for example, and 64 exceeds the max possible negetive equipment bonus achievable within the game. Following the multiplication of the two values, we divide by 10 for no reason other than to make small, more easily digestable numbers. This value is rounded down. Augmented attack is the offensive entities "augmented attack level" after equipment stat modifiers have been applied. Equipment stat modifiers include bonuses from worn equipment. Below you will find documentation for each of the above variables. [CODE]Name: off_equipment_*_attack Type: Base Value Description: Base equipment stat value of offensive entity. Examples: Stab Attack: 150 Slash Attack: 190 Crush Attack: 120 Ranged Attack: 5 Magic Attack: 70 off_equipment_magic_attack = 70 Stab Attack: 150 Slash Attack: 190 Crush Attack: 120 Ranged Attack: 5 Magic Attack: 70 off_equipment_stab_attack = 150[/CODE] [CODE]Name: off_equipment_bonus Type: Multiplicative Bonus Description: Multiplicative stat level modifier depending on combat type and attack style, relevant to current calculation. This bonus is granted for both physical and magic attacks. Default value: 1.0 Examples: Combat Type: Magic Attack Style: n/a off_equipment_bonus = off_equipment_magic_attack Combat Type: Melee Attack Style: Slash off_equipment_bonus = off_equipment_slash_attack[/CODE] Using the above modifiers Augmented Attack is calculated as: [CODE]augmented_attack = Math.floor(((effective_attack + 8) * (off_equipment_bonus + 64)) / 10);[/CODE] [SIZE=5]Augmented Defence[/SIZE] Augmented defence is a base stat level with equipment stat value modifiers applied (modifiers retrieved from defensive entities worn equipment). This value is calculated as: [CODE]Math.floor(((effective_defence +8) * (def_equipment_bonus + 64)) / 10);[/CODE] The same safety operations and readability optimisations are made here as mentioned above. Augmented defence is the defensive entities "augmented defence level" after equipment stat modifiers have been applied. Equipment stat modifiers include bonuses from worn equipment. Below you will find documentation for each of the above variables. [CODE]Name: def_equipment_*_defence Type: Base Value Description: Base equipment stat value of defensive entity. Examples: Stab Defence: 80 Slash Defence: 320 Crush Defence: 250 Ranged Defence: 400 Magic Defence: 130 def_equipment_magic_defence = 130 Stab Defence: 80 Slash Defence: 320 Crush Defence: 250 Ranged Defence: 400 Magic Defence: 130 def_equipment_stab_defence = 80[/CODE] [CODE]Name: def_equipment_bonus Type: Multiplicative Bonus Description: Multiplicative stat level modifier depending on combat type and attack style, relevant to current calculation. This bonus is granted for both physical and magic attacks. Default value: 1.0 Examples: Combat Type: Magic Attack Style: n/a def_equipment_bonus = def_equipment_magic_defence Combat Type: Melee Attack Style: Slash def_equipment_bonus = def_equipment_slash_defence[/CODE] Using the above modifiers Augmented Defence is calculated as: [CODE]augmented_defence = Math.floor(((effective_defence +8) * (def_equipment_bonus + 64)) / 10);[/CODE] [SIZE=5]Hit & Block Chance[/SIZE] Hit Chance and Block Chance are base probabilities to hit or miss with chance modifiers applied (modifiers applied directly to the chance calculation post all other modifiers). These values are calculated as hit_chance with the following modifiers applied: [LIST] [*]off_special_attack_bonus [*]off_void_bonus [*]def_protect_from_* [/LIST] hit_chance is the base probability to hit calculated as a fraction of the lesser value (of augmented_attack and augmented_defence). If augmented_attack has a lesser value than augmented_defence this means the value will be below 50%. Therefore: [CODE]hit_chance = augmented_attack / (augmented_defence * 2)[/CODE] This calculation will provide us with a value sub 0.5, providing the chance to hit versus a superior equipped opponent. If augmented_attack has a greater value than augmented_defence this means the value will be above 50%. Therefore: [CODE]hit_chance = augmented_defence / (augmented_attack * 2)[/CODE] This calculation will provide us with a value sur 0.5, providing the chance to hit versus a inferior equipped opponent. In addition to these calculations we subtract or add 1 to the value depending on whether augmented_attack is greater or lesser than augmented_defence. This small modification ensures that the lesser entity always has a value greater than 0 so we can ensure a minimum chance to block or hit of 1% at all times. Using the above logic hit_chance can be calculated as: [CODE]if(augmented_attack < augmented_defence) { hit_chance = (augmented_attack - 1) / (augmented_defence * 2); } else { hit_chance = 1 - ((augmented_defence + 1) / (augmented_attack * 2)); }[/CODE] Below you will find documentation for each of the above variables. [CODE]Name: off_special_attack_bonus Type: Multiplicative Bonus Description: Multiplicative hit chance modifier depending on offensive entity special attack. This is an experimental chance modifier based on the assumption that certain special attacks modify offensive entity chance to hit post all other modifiers similar to how void equipment works. Please note this is a delicate value and brash modifiers will break the balance of the the algorithm completely. Default value: 1.0 Below are recomendations for this modifiers value depending on special attack being used: Dragon Dagger - 1.15 (+15%) Dragon Scimitar - 1.15 (+15%) Dragon Mace - 0.85 (-15%) Dragon Battleaxe - 0.90 (-10%) Rune Claw - 1.15 (+15%) Vesta's Longsword - 1.20 (+20%) Brackish Blade - 2.0 (+100%) Magic Shortbow - 0.85 (-15%) Magic Shieldbow - 1.15 (+15%) Hand Cannon - 1.75 (+75%) Please note: Anything not listed above DOES NOT have a specal attack accuracy modifier. Korasi Sword is an exception to this and requires a special case which sets the off_hit_chance roll to 100. I have not had the opportunity to test these values, however they are educated guesses based on observations made regarding simularities in max hit and accuracy calculations. These values unless stated otherwise, are NOT meant to be dramatic modifiers. Other systems present in this algorithm will do much of the heavy lifting with securing a hit when using special attacks.[/CODE] [CODE]Name: off_void_bonus Type: Multiplicative Bonus Description: Multiplicative hit chance modifier depending on if a full set of void equipment is worn, and which type. Default value: 1.0 Void Set Modifier Values: Melee - 1.10 (10%) Ranged - 1.10 (10%) Magic - 1.30 (30%)[/CODE] [CODE]Name: def_protect_from_* Type: Multiplicative Bonus Description: Multiplicative hit chance modifier depending on if the defensive entity is using a protect from * prayer that matches the offensive entities combat type. Prior to the dice being rolled, if the defensive entity is using a protect from * prayer that corresponds with the offensive entities combat type hit_chance is multiplied by .6 reducing the offensive entities chance to hit, and increasing the defensive entities chance to block. Protect from * prayers reduce damage and chance to hit by 60% in player vs player combat.[/CODE] Using the above modifiers Hit Chance can be calculated as: [CODE]String off_combat_type = "melee"; //melee, ranged, magic switch(off_combat_type) { case "melee": if(def_protect_from_melee == true) { off_hit_chance = Math.floor((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100); } else { off_hit_chance = Math.floor(((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100); } break; case "ranged": if(def_protect_from_ranged == true) { off_hit_chance = Math.floor((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100); } else { off_hit_chance = Math.floor(((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100); } break; case "magic": if(def_protect_from_magic == true) { off_hit_chance = Math.floor(((hit_chance * off_void_bonus) * .6) * 100); } else { off_hit_chance = Math.floor((hit_chance * off_void_bonus) * 100); } break; } System.out.println("\nYour chance to hit is: " + off_hit_chance + "%");[/CODE] Using the above modifiers Block Chance can be calculated as: [CODE]String off_combat_type = "melee"; //melee, ranged, magic switch(off_combat_type) { case "melee": if(def_protect_from_melee == true) { def_block_chance = Math.floor(101 - ((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100)); } else { def_block_chance = Math.floor(101 - (((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100)); } break; case "ranged": if(def_protect_from_ranged == true) { def_block_chance = Math.floor(101 - ((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100)); } else { def_block_chance = Math.floor(101 - (((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100)); } break; case "magic": if(def_protect_from_magic == true) { def_block_chance = Math.floor(101 - (((hit_chance * off_void_bonus) * .6) * 100)); } else { def_block_chance = Math.floor(101 - ((hit_chance * off_void_bonus) * 100)); } break; } System.out.println("Your opponents chance to block is: " + def_block_chance + "%");[/CODE] Following this we use these values to generate two dice rolls and determine if the offensive entity is granted a hit or not. This is calculated as: [CODE]math.random(0, off_hit_chance) math.random(0, def_block_chance) if(off_hit_chance > def_block_chance) { //hit } else { //block }[/CODE] Both entities roll a dice between 0 and their calculated chance to hit or block, whoever has the greatest value is successful. This provides a chance for the defensive entity to fail a block, as opposed to the defensive entity being ensured a block if the offensive entity does not successfully hit. This is another problem present in the currently utilised version of the algorithm that gives the illusion of "overpowered defence". Giving the defensive entity an ensured block puts the offensive entity at a huge disadvantage. Using the above logic we calculate whether the offensive entity is granted a hit or not as: [CODE]off_hit_chance = 0 + (int)(Math.random() * off_hit_chance); def_block_chance = 0 + (int)(Math.random() * def_block_chance); System.out.println("\nYou rolled: " + (int) off_hit_chance); System.out.println("Your opponent rolled: " + (int) def_block_chance); if(off_hit_chance > def_block_chance) { System.out.print("\nYou hit your opponent!"); } else { System.out.print("\nYour opponent blocked your hit."); }[/CODE] [SIZE=5]What does this algorithm ensure?[/SIZE] [LIST] [*]Entity combat type, stance and attack style have significant effects on chance to hit. [*]Weapons/spells with requirements that fall beneath base stat level grant an accuracy bonus. [*]Magic defence is more heavily weighted towards effective magic, than effective defence. [*]Two entities with equal levels and no equipment will have a 60% chance to hit, and a 40% chance to block. [*]Regardless of equipment or levels, the offensive entity always has >=1% chance to hit. [*]Regardless of equipment or levels, the defensive entity always has >=1% chance to block. [*]The offensive entity has a chance to successfully hit. [*]The offensive entity has a chance to fail a hit. [*]The defensive entity has a chance to successfully block. [*]The defensive entity has a chance to fail a block. [/LIST] For a more in-depth analysis of the algorithm see below for a heavily documented example written in Java for you to play with: [CODE]public class accuracy { public static void main(String args[]) { /* off denotes 'offensive', this prefix implies variable belongs to offensive entity. def denotes 'defensive', this prefix implies variable belongs to defensive entity. */ String off_combat_type = "melee"; //melee, ranged, magic String off_style = "stab"; //stab, slash, crush, ranged, magic int off_weapon_requirement = 1; //weapon attack level requirement int off_spell_requirement = 1; //spell magic level requirement /* Name: off_base_*_level Type: Base value Description: Base stat level pre any modifiers. This value can be calculated using entity current xp. Max value: 99 Examples: 80/99 = 99 base level 116/95 = 95 base level */ int off_base_attack_level = 99; int off_base_ranged_level = 99; int off_base_magic_level = 99; /* Name: *_current_*_level Type: Base value Description: Base stat level post visible stat modifiers. Examples: 80/99 = 80 current level 116/95 = 116 current level */ double off_current_attack_level = 99; double off_current_ranged_level = 99; double off_current_magic_level = 99; double def_current_defence_level = 99; double def_current_magic_level = 99; /* Name: *_*_prayer_bonus Type: Multiplicative Bonus Description: Multiplicative stat level modifier depending on chosen prayer(s), relevent to current calculation. This bonus is granted for both physical and magic attacks. Default value: 1.0 Melee prayer offence: Clarity of Thought - 1.05 (5%) Improved Reflexes - 1.10 (10%) Incredible Reflexes - 1.15 (15%) Chivalry - 1.15 (15%) Piety - 1.20 (20%) Ranged prayer offence: Sharp Eye - 1.05 (5%) Hawk Eye - 1.10 (10%) Eagle Eye - 1.15 (15%) Rigour - 1.20 (20%) Magic prayer offence: Mystic Will - 1.05 (5%) Mystic Lore - 1.10 (10%) Mystic Might - 1.15 (15%) Augury - 1.20 (20$) General prayer defence: Thick Skin - 1.05 (5%) Rock Skin - 1.10 (10%) Steel Skin - 1.15 (15%) Chivalry - 1.20 (20%) Piety - 1.25 (25%) */ double off_attack_prayer_bonus = 1.0; double off_ranged_prayer_bonus = 1.0; double off_magic_prayer_bonus = 1.0; double def_defence_prayer_bonus = 1.0; /* Name: off_additional_bonus Type: Multiplicative Bonus Description: Multiplicative stat level modifier depending on worn equipment, relevent to current calculation. This bonus is granted for both physical and magic attacks. This bonus is only granted to the offensive entity. In the case that more than one of these conditions is met, modifiers are added together before being applied. Default value: 1.0 Versus general slayer task: Melee: Black Mask - 1.125 (12.5%) Slayer Helmet - 1.125 (12.5%) Full Slayer Helmet - 1.125 (12.5%) Ranged: Focus Sight - 1.125 (12.5%) Slayer Helmet - 1.125 (12.5%) Full Slayer Helmet - 1.125 (12.5%) Magic: Hexcrest - 1.125 (12.5%) Slayer Helmet - 1.125 (12.5%) Full Slayer Helmet - 1.125 (12.5%) Versus dragon slayer task: Melee: Dragon Slayer Gloves - 1.10 (10%) Versus undead: Melee & Magic & Ranged: Salve Amulet - 1.15 (15%) Salve Amulet (e) - 1.20 (20%) Examples: Items: Salve Amulet, Black Mask Versus: Undead, Slayer Task Modifier: 1.275 (27.5%) Items: Full Slayer Helmet, Dragon Slayer Gloves Versus: Dragon, Slayer Task Modifier: 1.225 (22.5%) */ double off_additional_bonus = 1.0; /* Name: *_stance_bonus Type: Additive Bonus Description: Additive stat level modifier depending on chosen combat stance, relevent to current calculation. This bonus is only granted for physical attacks (melee and ranged). Melee weapon offence: Accurate - 3 level(s) Aggressive - 0 level(s) Controlled - 1 level(s) Defensive - 0 level(s) Ranged weapon offence: Accurate - 3 level(s) Rapid - 0 level(s) Long Ranged - 0 level(s) Melee weapon defence: Accurate - 0 level(s) Aggressive - 0 level(s) Controlled - 1 level(s) Defensive - 3 level(s) Ranged weapon defence: Accurate - 0 level(s) Rapid - 0 level(s) Long Ranged - 3 level(s) */ int off_stance_bonus = 0; int def_stance_bonus = 0; /* Name: off_spell_bonus Type: Additive Bonus Description: Additive stat level modifier depending on 'experience' using a spell. "When you cast combat-related spells, there is a chance of failure. This is dependent on a few factors such as your magical attack bonuses, the magical Defence bonuses of your opponent and your Magic experience." This bonus is calculated as .3 bonus level(s) per level above spell requirement. This modifier uses BASE level, not CURRENT level. (ie. 112/99 = 99 base level) Examples: Current Magic Level: 99 Spell: Ice Blitz (Level 82) Effective Magic Level: 104 Current Magic Level: 99 Spell: Fire Blast (Level 59) Effective Magic Level: 111 */ double off_spell_bonus = 0; switch(off_combat_type){ case "magic": if(off_base_magic_level > off_spell_requirement) { off_spell_bonus = (off_base_magic_level - off_spell_requirement) * .3; } break; } /* Name: off_weapon_bonus Type: Additive Bonus Description: Additive stat level modifier depending on 'experience' using a weapon. This is an experimental stat modifier based on the logic provided in the *_spell_bonus documentation. This addition is justified by the observation that "dragon" weapons appear to be more accurate than their higher level counterparts at the exchange of worse equipment stats when used by high level characters. This is an important balance point as part of the Runescape accuracy algorithm. This modifier provides a benefit to the attack stat level beyond weapon equip requirements, and an important trade off for those who choose to level their attack stat level further versus those who do not. In addition low tier weaponry in currently utilised versions of the algorithm become completely obsolete and outclassed by high tier defence equipment giving the outcome of seemingly "overpowered" defence. High level characters utilising high tier defence equipment against eachother will find lower tier weaponry a more viable choice, and will find it much more powerful against low tier armour. These characters will also be granted a benefit versus characters with an inferior attack stat level. This bonus is calculated as .3 bonus level(s) per level above weapon requirement. This modifier uses BASE level, not CURRENT level. (ie. 112/99 = 99 base level) Examples: Current Attack Level: 99 Weapon: Dragon Dagger (Level 60) Effective Attack Level: 110 Current Attack Level: 99 Weapon Abyssal Whip (Level 70) Effective Attack Level: 107 Current Attack Level: 84 Weapon Abyssal Whip (Level 70) Effective Attack Level: 88 */ double off_weapon_bonus = 0; switch(off_combat_type){ case "melee": if(off_base_attack_level > off_weapon_requirement) { off_weapon_bonus = (off_base_attack_level - off_weapon_requirement) * .3; } break; case "ranged": if(off_base_ranged_level > off_weapon_requirement) { off_weapon_bonus = (off_base_ranged_level - off_weapon_requirement) * .3; } break; } /* Name: effective_attack Type: Base Value Description: Base stat level post invisible stat modifiers. This value is off_current_*_level with the following modifiers applied depending on combat type: Melee combat: * off_attack_prayer_bonus * off_additional_bonus * off_stance_bonus * off_weapon_bonus Ranged combat: * off_ranged_prayer_bonus * off_additional_bonus * off_stance_bonus * off_weapon_bonus Magic combat: * off_magic_prayer_bonus * off_additional_bonus * off_spell_bonus This value is rounded down. */ double effective_attack = 0; switch(off_combat_type) { case "melee": effective_attack = Math.floor(((off_current_attack_level * off_attack_prayer_bonus) * off_additional_bonus) + off_stance_bonus + off_weapon_bonus); break; case "ranged": effective_attack = Math.floor(((off_current_ranged_level * off_ranged_prayer_bonus) * off_additional_bonus) + off_stance_bonus + off_weapon_bonus); break; case "magic": effective_attack = Math.floor(((off_current_magic_level * off_magic_prayer_bonus) * off_additional_bonus) + off_spell_bonus); break; } /* Name: effective_magic Type: Base Value Description: Additive stat level modifier depending on defending entity magic level. Magic defence is calculated as 3 shares physical defence (or effective_defence) and 7 shares magic defence (or effective_magic). In other words, this value makes up 70% of defence against magic spells. With the other 30% coming from effective_defence. This value is def_current_magic_level multiplied by .7, or 70%. This value is rounded down. */ double effective_magic = 0; switch(off_combat_type) { case "magic": effective_magic = Math.floor(def_current_magic_level * .7); break; } /* Name: effective_defence Type: Base Value Description: Base stat level post invisible stat modifiers. For Melee and Ranged combat this value is def_current_defence_level with the following modifiers applied: * def_defence_prayer_bonus * def_defence_stance_bonus For magic combat there is a special case, this value is composed of two values combined: * effective_defence * effective_magic For magic combat def_current_defence_level has the following modifiers applied: * def_defence_prayer_bonus These values are then multiplied by .3, and .7 respectively. Composing the final whole value using two values combined. Magic defence is a special case as defence level and stat modifiers should only play a small part in the final value used to calculate magic defence. In currently utilised versions of the algorithm it is common for magic attacks to miss(or "splash") a lot because melee defence levels and modifiers are used for the calculation of defence against magic spells but this is not their intended use. Rather, they are intended for defence against melee and ranged attacks. It is worth noting the incredibly high effective_attack and effective_defence levels when using melee & ranged attacks in comparison to the pitiful effective_attack of magic attacks. These melee/ranged defence steroids were not intended as defence against magic, and the effective_attack of magic spells simply can not compare. This new implementation of magic defence creates the desired effect of magic hitting often versus characters with great melee and ranged defences (melee equipment) in addition to current magic level playing a much greater role in defence against magic attacks as intended. Characters are required to raise their magic level as defence against magic attacks. This value is rounded down. */ double effective_defence = 0; switch(off_combat_type) { case "melee": effective_defence = Math.floor((def_current_defence_level * def_defence_prayer_bonus) + def_stance_bonus); break; case "ranged": effective_defence = Math.floor((def_current_defence_level * def_defence_prayer_bonus) + def_stance_bonus); break; case "magic": effective_defence = Math.floor((def_current_defence_level * def_defence_prayer_bonus) * .3); effective_defence = effective_defence + effective_magic; break; } /* Name: off_equipment_*_attack Type: Base Value Description: Base equipment stat value of offensive entity. Examples: Stab Attack: 150 Slash Attack: 190 Crush Attack: 120 Ranged Attack: 5 Magic Attack: 70 off_equipment_magic_attack = 70 Stab Attack: 150 Slash Attack: 190 Crush Attack: 120 Ranged Attack: 5 Magic Attack: 70 off_equipment_stab_attack = 150 */ int off_equipment_stab_attack = 0; int off_equipment_slash_attack = 0; int off_equipment_crush_attack = 0; int off_equipment_ranged_attack = 0; int off_equipment_magic_attack = 0; /* Name: def_equipment_*_defence Type: Base Value Description: Base equipment stat value of defensive entity. Examples: Stab Defence: 80 Slash Defence: 320 Crush Defence: 250 Ranged Defence: 400 Magic Defence: 130 def_equipment_magic_defence = 130 Stab Defence: 80 Slash Defence: 320 Crush Defence: 250 Ranged Defence: 400 Magic Defence: 130 def_equipment_stab_defence = 80 */ int def_equipment_stab_defence = 0; int def_equipment_slash_defence = 0; int def_equipment_crush_defence = 0; int def_equipment_ranged_defence = 0; int def_equipment_magic_defence = 0; /* Name: *_equipment_bonus Type: Multiplicative Bonus Description: Multiplicative stat level modifier depending on combat type and attack style, relevant to current calculation. This bonus is granted for both physical and magic attacks. Default value: 1.0 Examples: Combat Type: Magic Attack Style: n/a off_equipment_bonus = off_equipment_magic_attack def_equipment_bonus = def_equipment_magic_defence Combat Type: Melee Attack Style: Slash off_equipment_bonus = off_equipment_slash_attack def_equipment_bonus = def_equipment_slash_defence */ int off_equipment_bonus = 0; int def_equipment_bonus = 0; switch(off_combat_type) { case "melee": switch(off_style) { case "stab": off_equipment_bonus = off_equipment_stab_attack; def_equipment_bonus = def_equipment_stab_defence; break; case "slash": off_equipment_bonus = off_equipment_slash_attack; def_equipment_bonus = def_equipment_slash_defence; break; case "crush": off_equipment_bonus = off_equipment_crush_attack; def_equipment_bonus = def_equipment_crush_defence; break; } break; case "ranged": off_equipment_bonus = off_equipment_ranged_attack; def_equipment_bonus = def_equipment_ranged_defence; break; case "magic": off_equipment_bonus = off_equipment_magic_attack; def_equipment_bonus = def_equipment_magic_defence; break; } /* Name: augmented_attack Type: Base Value Description: Base stat level post equipment stat value modifiers. This value is calculated as: math.floor(((effective_attack + 8) * (off_equipment_bonus + 64)) / 10) effective_attack and off_equipment_bonus have 8 and 64 added to their values respectively before multiplication. These values are also added to augmented_defence and act as means of eliminating negetive numbers. Negetive numbers create a lot of issues and strange behaviour within the algorithm. We can eliminate these easily by giving both values identical amounts that exceed the max possible negetive value they can contain. A negetive off_equipment_bonus value would be corrected to a positive value, for example, and 64 exceeds the max possible negetive equipment bonus achievable within the game. Following the multiplication of the two values, we divide by 10 for no reason other than to make small, more easily digestable numbers. This value is rounded down. */ double augmented_attack = 0; augmented_attack = Math.floor(((effective_attack + 8) * (off_equipment_bonus + 64)) / 10); /* Name augmented_defence Type: Base Value Description: Base stat level post equipment stat value modifiers. This value is calculated as: math.floor(((effective_defence + 8) * (def_equipment_bonus + 64)) / 10) The same safety operations and readability optimisations are made here as mentioned above. */ double augmented_defence = 0; augmented_defence = Math.floor(((effective_defence +8) * (def_equipment_bonus + 64)) / 10); /* Name: hit_chance Type: Base Value Description: Base probability to hit calculated as a fraction of the lesser value. If augmented_attack has a lesser value than augmented_defence this means the value will be below 50%. Therefore: hit_chance = augmented_attack / (augmented_defence * 2) This calculation will provide us with a value sub 0.5, providing the chance to hit vs a superior equiped opponent. If augmented_attack has a greater value than augmented_defence this means the value will be above 50%. Therefore: hit_chance = augmented_defence / (augmented_attack * 2) This calculation will provide us with a value sur 0.5, providing the chance to hit vs a inferior equiped opponent. In addition to these calculations we subtract or add 1 to the value depending on whether augmented_attack is greater or lesser than augmented_defence. This small modification ensures that the lesser entity always has a value greater than 0 so we can ensure a minimum chance to block or hit of 1% at all times. */ double hit_chance = 0; if(augmented_attack < augmented_defence) { hit_chance = (augmented_attack - 1) / (augmented_defence * 2); } else { hit_chance = 1 - ((augmented_defence + 1) / (augmented_attack * 2)); } /* Name: off_special_attack_bonus Type: Multiplicative Bonus Description: Multiplicative hit chance modifier depending on offensive entity special attack. This is an experimental chance modifier based on the assumption that certain special attacks modify offensive entity chance to hit post all other modifiers similar to how void equipment works. Please note this is a delicate value and brash modifiers will break the balance of the the algorithm completely. Default value: 1.0 Below are recomendations for this modifiers value depending on special attack being used: Dragon Dagger - 1.15 (+15%) Dragon Scimitar - 1.15 (+15%) Dragon Mace - 0.85 (-15%) Dragon Battleaxe - 0.90 (-10%) Rune Claw - 1.15 (+15%) Vesta's Longsword - 1.20 (+20%) Brackish Blade - 2.0 (+100%) Magic Shortbow - 0.85 (-15%) Magic Shieldbow - 1.15 (+15%) Hand Cannon - 1.75 (+75%) Please note: Anything not listed above DOES NOT have a specal attack accuracy modifier. Korasi Sword is an exception to this and requires a special case which sets the off_hit_chance roll to 100. I have not had the opportunity to test these values, however they are educated guesses based on observations made regarding simularities in max hit and accuracy calculations. These values unless stated otherwise, are NOT meant to be dramatic modifiers. Other systems present in this algorithm will do much of the heavy lifting with securing a hit when using special attacks. */ double off_special_attack_bonus = 1.0; /* Name: off_void_bonus Type: Multiplicative Bonus Description: Multiplicative hit chance modifier depending on if a full set of void equipment is worn, and which type. Default value: 1.0 Void Set Modifier Values: Melee - 1.10 (10%) Ranged - 1.10 (10%) Magic - 1.30 (30%) */ double off_void_bonus = 1.0; /* Name: def_protect_from_* Type: Multiplicative Bonus Description: Multiplicative hit chance modifier depending on if the defensive entity is using a protect from * prayer that matches the offensive entities combat type. Prior to the dice being rolled, if the defensive entity is using a protect from * prayer that corresponds with the offensive entities combat type hit_chance is multiplied by .6 reducing the offensive entities chance to hit, and increasing the defensive entities chance to block. Protect from * prayers reduce damage and chance to hit by 60% in player vs player combat. */ boolean def_protect_from_melee = false; boolean def_protect_from_ranged = false; boolean def_protect_from_magic = false; /* Name: off_hit_chance Type: Base Value Description: Base probability to hit post chance modifiers. This value is used to roll a dice and determine if the offensive entity is granted a hit or not. This is calculated as: math.random(0, off_hit_chance) math.random(0, def_block_chance) if(off_hit_chance > def_block_chance) { //hit } else { //block } Both entities roll a dice between 0 and their calculated chance to hit or block, whoever has the greatest value is successful. This provides a chance for the defensive entity to fail a block, as opposed to the defensive entity being ensured a block if the offensive entity does not successfully hit. This is another problem present in the currently utilised version of the algorithm that gives the illusion of "overpowered defence". Giving the defensive entity an ensured block puts the offensive entity at a huge disadvantage. */ double off_hit_chance = 0; switch(off_combat_type) { case "melee": if(def_protect_from_melee == true) { off_hit_chance = Math.floor((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100); } else { off_hit_chance = Math.floor(((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100); } break; case "ranged": if(def_protect_from_ranged == true) { off_hit_chance = Math.floor((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100); } else { off_hit_chance = Math.floor(((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100); } break; case "magic": if(def_protect_from_magic == true) { off_hit_chance = Math.floor(((hit_chance * off_void_bonus) * .6) * 100); } else { off_hit_chance = Math.floor((hit_chance * off_void_bonus) * 100); } break; } System.out.println("\nYour chance to hit is: " + off_hit_chance + "%"); off_hit_chance = 0 + (int)(Math.random() * off_hit_chance); /* Name: def_block_chance Type: Base Value Description: Base probability to block post chance modifiers. This value is used to roll a dice and determine if the defensive entity is granted a block or not. See above for details on calculation. */ double def_block_chance = 0; switch(off_combat_type) { case "melee": if(def_protect_from_melee == true) { def_block_chance = Math.floor(101 - ((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100)); } else { def_block_chance = Math.floor(101 - (((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100)); } break; case "ranged": if(def_protect_from_ranged == true) { def_block_chance = Math.floor(101 - ((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100)); } else { def_block_chance = Math.floor(101 - (((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100)); } break; case "magic": if(def_protect_from_magic == true) { def_block_chance = Math.floor(101 - (((hit_chance * off_void_bonus) * .6) * 100)); } else { def_block_chance = Math.floor(101 - ((hit_chance * off_void_bonus) * 100)); } break; } System.out.println("Your opponents chance to block is: " + def_block_chance + "%"); def_block_chance = 0 + (int)(Math.random() * def_block_chance); System.out.println("\nYou rolled: " + (int) off_hit_chance); System.out.println("Your opponent rolled: " + (int) def_block_chance); if(off_hit_chance > def_block_chance) { System.out.print("\nYou hit your opponent!"); } else { System.out.print("\nYour opponent blocked your hit."); } } //end main } //end class[/CODE] Here is how a working version might look with the above readability taken out: [CODE]public class accuracy_sm { public static void main(String args[]) { /* S E T T I N G S S T A R T */ //attack types String off_combat_type = "melee"; //melee, ranged, magic String off_style = "stab"; //stab, slash, crush, ranged, magic //attack stances int off_stance_bonus = 0; //accurate, aggressive, controlled, defensive int def_stance_bonus = 0; //accurate, aggressive, controlled, defensive //requirements int off_weapon_requirement = 1; //weapon attack level requirement int off_spell_requirement = 1; //spell magic level requirement //base levels int off_base_attack_level = 99; int off_base_ranged_level = 99; int off_base_magic_level = 99; //current levels double off_current_attack_level = 99; double off_current_ranged_level = 99; double off_current_magic_level = 99; double def_current_defence_level = 99; double def_current_magic_level = 99; //prayer bonuses double off_attack_prayer_bonus = 1.0; double off_ranged_prayer_bonus = 1.0; double off_magic_prayer_bonus = 1.0; double def_defence_prayer_bonus = 1.0; //additional bonus double off_additional_bonus = 1.0; //equipment bonuses int off_equipment_stab_attack = 0; int off_equipment_slash_attack = 0; int off_equipment_crush_attack = 0; int off_equipment_ranged_attack = 0; int off_equipment_magic_attack = 0; int def_equipment_stab_defence = 0; int def_equipment_slash_defence = 0; int def_equipment_crush_defence = 0; int def_equipment_ranged_defence = 0; int def_equipment_magic_defence = 0; //protect from * prayers boolean def_protect_from_melee = false; boolean def_protect_from_ranged = false; boolean def_protect_from_magic = false; //chance bonuses double off_special_attack_bonus = 1.0; double off_void_bonus = 1.0; /* S E T T I N G S E N D */ /* C A L C U L A T E D V A R I A B L E S S T A R T */ //experience bonuses double off_spell_bonus = 0; double off_weapon_bonus = 0; //effective levels double effective_attack = 0; double effective_magic = 0; double effective_defence = 0; //relevent equipment bonuses int off_equipment_bonus = 0; int def_equipment_bonus = 0; //augmented levels double augmented_attack = 0; double augmented_defence = 0; //hit chances double hit_chance = 0; double off_hit_chance = 0; double def_block_chance = 0; /* C A L C U L A T E D V A R I A B L E S E N D */ //determine effective attack switch(off_combat_type){ case "melee": if(off_base_attack_level > off_weapon_requirement) { off_weapon_bonus = (off_base_attack_level - off_weapon_requirement) * .3; } effective_attack = Math.floor(((off_current_attack_level * off_attack_prayer_bonus) * off_additional_bonus) + off_stance_bonus + off_weapon_bonus); effective_defence = Math.floor((def_current_defence_level * def_defence_prayer_bonus) + def_stance_bonus); switch(off_style) { case "stab": off_equipment_bonus = off_equipment_stab_attack; def_equipment_bonus = def_equipment_stab_defence; break; case "slash": off_equipment_bonus = off_equipment_slash_attack; def_equipment_bonus = def_equipment_slash_defence; break; case "crush": off_equipment_bonus = off_equipment_crush_attack; def_equipment_bonus = def_equipment_crush_defence; break; } break; case "ranged": if(off_base_ranged_level > off_weapon_requirement) { off_weapon_bonus = (off_base_ranged_level - off_weapon_requirement) * .3; } effective_attack = Math.floor(((off_current_ranged_level * off_ranged_prayer_bonus) * off_additional_bonus) + off_stance_bonus + off_weapon_bonus); effective_defence = Math.floor((def_current_defence_level * def_defence_prayer_bonus) + def_stance_bonus); off_equipment_bonus = off_equipment_ranged_attack; def_equipment_bonus = def_equipment_ranged_defence; break; case "magic": if(off_base_magic_level > off_spell_requirement) { off_spell_bonus = (off_base_magic_level - off_spell_requirement) * .3; } effective_attack = Math.floor(((off_current_magic_level * off_magic_prayer_bonus) * off_additional_bonus) + off_spell_bonus); effective_magic = Math.floor(def_current_magic_level * .7); effective_defence = Math.floor((def_current_defence_level * def_defence_prayer_bonus) * .3); effective_defence = effective_defence + effective_magic; off_equipment_bonus = off_equipment_magic_attack; def_equipment_bonus = def_equipment_magic_defence; break; } //determine augmented levels augmented_attack = Math.floor(((effective_attack + 8) * (off_equipment_bonus + 64)) / 10); augmented_defence = Math.floor(((effective_defence +8) * (def_equipment_bonus + 64)) / 10); //determine hit chance if(augmented_attack < augmented_defence) { hit_chance = (augmented_attack - 1) / (augmented_defence * 2); } else { hit_chance = 1 - ((augmented_defence + 1) / (augmented_attack * 2)); } switch(off_combat_type) { case "melee": if(def_protect_from_melee == true) { off_hit_chance = Math.floor((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100); def_block_chance = Math.floor(101 - ((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100)); } else { off_hit_chance = Math.floor(((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100); def_block_chance = Math.floor(101 - (((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100)); } break; case "ranged": if(def_protect_from_ranged == true) { off_hit_chance = Math.floor((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100); def_block_chance = Math.floor(101 - ((((hit_chance * off_special_attack_bonus) * off_void_bonus) * .6) * 100)); } else { off_hit_chance = Math.floor(((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100); def_block_chance = Math.floor(101 - (((hit_chance * off_special_attack_bonus) * off_void_bonus) * 100)); } break; case "magic": if(def_protect_from_magic == true) { off_hit_chance = Math.floor(((hit_chance * off_void_bonus) * .6) * 100); def_block_chance = Math.floor(101 - (((hit_chance * off_void_bonus) * .6) * 100)); } else { off_hit_chance = Math.floor((hit_chance * off_void_bonus) * 100); def_block_chance = Math.floor(101 - ((hit_chance * off_void_bonus) * 100)); } break; } //print hit chance System.out.println("\nYour chance to hit is: " + off_hit_chance + "%"); System.out.println("Your opponents chance to block is: " + def_block_chance + "%"); //roll dice off_hit_chance = 0 + (int)(Math.random() * off_hit_chance); def_block_chance = 0 + (int)(Math.random() * def_block_chance); //print roll System.out.println("\nYou rolled: " + (int) off_hit_chance); System.out.println("Your opponent rolled: " + (int) def_block_chance); //determine hit if(off_hit_chance > def_block_chance) { //print hit System.out.print("\nYou hit your opponent!"); } else { //print block System.out.print("\nYour opponent blocked your hit."); } } //end main } //end class[/CODE] [SIZE=5]Test Cases[/SIZE] Unarmed vs unarmed, same stats (99): [CODE] Chance 60.0% & 40.0% || Rolled: 1 & 28 || BLOCK Chance 60.0% & 40.0% || Rolled: 33 & 17 || HIT Chance 60.0% & 40.0% || Rolled: 28 & 29 || BLOCK Chance 60.0% & 40.0% || Rolled: 18 & 27 || BLOCK Chance 60.0% & 40.0% || Rolled: 12 & 10 || HIT Chance 60.0% & 40.0% || Rolled: 15 & 12 || HIT Chance 60.0% & 40.0% || Rolled: 36 & 20 || HIT Chance 60.0% & 40.0% || Rolled: 49 & 28 || HIT Chance 60.0% & 40.0% || Rolled: 24 & 22 || HIT Chance 60.0% & 40.0% || Rolled: 25 & 35 || BLOCK[/CODE] Rune-whip vs rune w/shield, 118 attack vs 99 defence, piety: [CODE] Chance 32.0% & 68.0% || Rolled: 28 & 47 || BLOCK Chance 32.0% & 68.0% || Rolled: 23 & 1 || HIT Chance 32.0% & 68.0% || Rolled: 27 & 11 || HIT Chance 32.0% & 68.0% || Rolled: 26 & 25 || HIT Chance 32.0% & 68.0% || Rolled: 15 & 27 || BLOCK Chance 32.0% & 68.0% || Rolled: 30 & 11 || HIT Chance 32.0% & 68.0% || Rolled: 0 & 62 || BLOCK Chance 32.0% & 68.0% || Rolled: 11 & 34 || BLOCK Chance 32.0% & 68.0% || Rolled: 31 & 22 || HIT Chance 32.0% & 68.0% || Rolled: 1 & 9 || BLOCK[/CODE] Rune-whip vs adamant w/shield, 118 attack vs 30 defence, both piety: [CODE] Chance 78.0% & 22.0% || Rolled: 45 & 2 || HIT Chance 78.0% & 22.0% || Rolled: 70 & 13 || HIT Chance 78.0% & 22.0% || Rolled: 8 & 15 || BLOCK Chance 78.0% & 22.0% || Rolled: 41 & 19 || HIT Chance 78.0% & 22.0% || Rolled: 62 & 10 || HIT Chance 78.0% & 22.0% || Rolled: 67 & 13 || HIT Chance 78.0% & 22.0% || Rolled: 2 & 15 || BLOCK Chance 78.0% & 22.0% || Rolled: 63 & 9 || HIT Chance 78.0% & 22.0% || Rolled: 49 & 19 || HIT Chance 78.0% & 22.0% || Rolled: 70 & 2 || HIT[/CODE] rune-defender whip vs rune-defender rune armour, 118 attack vs 80 defence, both incredible reflexes: [CODE]Chance 59.0% & 41.0% || Rolled: 0 & 11 || BLOCK Chance 59.0% & 41.0% || Rolled: 49 & 21 || HIT Chance 59.0% & 41.0% || Rolled: 41 & 12 || HIT Chance 59.0% & 41.0% || Rolled: 4 & 11 || BLOCK Chance 59.0% & 41.0% || Rolled: 28 & 20 || HIT Chance 59.0% & 41.0% || Rolled: 12 & 25 || BLOCK Chance 59.0% & 41.0% || Rolled: 18 & 38 || BLOCK Chance 59.0% & 41.0% || Rolled: 17 & 6 || HIT Chance 59.0% & 41.0% || Rolled: 8 & 2 || HIT Chance 59.0% & 41.0% || Rolled: 27 & 4 || HIT[/CODE] rune-defender dragon scimitar vs rune-defender rune armour, 118 attack vs 80 defence, both incredible reflexes: [CODE] Chance 55.0% & 45.0% || Rolled: 42 & 34 || HIT Chance 55.0% & 45.0% || Rolled: 13 & 36 || BLOCK Chance 55.0% & 45.0% || Rolled: 7 & 7 || BLOCK Chance 55.0% & 45.0% || Rolled: 36 & 3 || HIT Chance 55.0% & 45.0% || Rolled: 7 & 28 || BLOCK Chance 55.0% & 45.0% || Rolled: 52 & 2 || HIT Chance 55.0% & 45.0% || Rolled: 30 & 23 || HIT Chance 55.0% & 45.0% || Rolled: 25 & 6 || HIT Chance 55.0% & 45.0% || Rolled: 26 & 23 || HIT Chance 55.0% & 45.0% || Rolled: 31 & 40 || BLOCK[/CODE] full mystic ancient staff ice blitz vs rune armour defender, 99 magic vs 99 magic&80 defence: [CODE]Chance 81.0% & 19.0% || Rolled: 11 & 15 || BLOCK Chance 81.0% & 19.0% || Rolled: 48 & 16 || HIT Chance 81.0% & 19.0% || Rolled: 7 & 16 || BLOCK Chance 81.0% & 19.0% || Rolled: 47 & 3 || HIT Chance 81.0% & 19.0% || Rolled: 30 & 9 || HIT Chance 81.0% & 19.0% || Rolled: 23 & 11 || HIT Chance 81.0% & 19.0% || Rolled: 33 & 18 || HIT Chance 81.0% & 19.0% || Rolled: 74 & 11 || HIT Chance 81.0% & 19.0% || Rolled: 76 & 6 || HIT Chance 81.0% & 19.0% || Rolled: 58 & 13 || HIT[/CODE] full mystic ancient staff ice blitz vs black dragonhide, 99 magic vs 99 magic&99 defence: [CODE]Chance 43.0% & 57.0% || Rolled: 37 & 4 || HIT Chance 43.0% & 57.0% || Rolled: 5 & 28 || BLOCK Chance 43.0% & 57.0% || Rolled: 27 & 19 || HIT Chance 43.0% & 57.0% || Rolled: 35 & 51 || BLOCK Chance 43.0% & 57.0% || Rolled: 10 & 9 || HIT Chance 43.0% & 57.0% || Rolled: 23 & 20 || HIT Chance 43.0% & 57.0% || Rolled: 27 & 5 || HIT Chance 43.0% & 57.0% || Rolled: 23 & 33 || BLOCK Chance 43.0% & 57.0% || Rolled: 32 & 39 || BLOCK Chance 43.0% & 57.0% || Rolled: 17 & 44 || BLOCK[/CODE] ice blitz, full rune, abyssal whip vs full rune, 99 magic vs 99 magic 99 defence: [CODE]Chance 34.0% & 66.0% || Rolled: 30 & 21 || HIT Chance 34.0% & 66.0% || Rolled: 23 & 32 || BLOCK Chance 34.0% & 66.0% || Rolled: 28 & 10 || HIT Chance 34.0% & 66.0% || Rolled: 24 & 10 || HIT Chance 34.0% & 66.0% || Rolled: 29 & 55 || BLOCK Chance 34.0% & 66.0% || Rolled: 6 & 43 || BLOCK Chance 34.0% & 66.0% || Rolled: 12 & 18 || BLOCK Chance 34.0% & 66.0% || Rolled: 6 & 12 || BLOCK Chance 34.0% & 66.0% || Rolled: 33 & 34 || BLOCK Chance 34.0% & 66.0% || Rolled: 21 & 7 || HIT[/CODE] ice blitz, full rune, abyssal whip vs black dragonhide, 99 magic vs 99 magic 99 defence: [CODE]Chance 11.0% & 89.0% || Rolled: 8 & 12 || BLOCK Chance 11.0% & 89.0% || Rolled: 2 & 20 || BLOCK Chance 11.0% & 89.0% || Rolled: 10 & 40 || BLOCK Chance 11.0% & 89.0% || Rolled: 0 & 72 || BLOCK Chance 11.0% & 89.0% || Rolled: 9 & 71 || BLOCK Chance 11.0% & 89.0% || Rolled: 1 & 44 || BLOCK Chance 11.0% & 89.0% || Rolled: 0 & 32 || BLOCK Chance 11.0% & 89.0% || Rolled: 9 & 1 || HIT Chance 11.0% & 89.0% || Rolled: 5 & 76 || BLOCK Chance 11.0% & 89.0% || Rolled: 2 & 74 || BLOCK[/CODE] [SIZE=4]FAQ[/SIZE] [I]Can this be applied to Non Player Characters?[/I] Yes. I've developed a method of estimating non player character stat levels, and in doing this we can treat them just like player characters for the purpose of accuracy calculation. This has obvious benefits too, which result in emulation closer to Runescape and provide additional utility to armour for both player and non player characters. Coming soon. [SIZE=4]Postface[/SIZE] Earlier this year my good friend Alex, or Light232 passed away. This brings an unfortunate end to our work together. In light of the situation I'd like to release some of my research, enjoy. I'll be posting more threads like this soon.
  2. hi im using insidiax to make a server and the hits are bad. all low hits a lot of 0's... how do i fix this? without changing weapon stats? how do i change invisible weapon bonuses
×