Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2013
    PvP Tournaments Won
    Thanks (Received)

    Bonus Critical, Damage / Heal "Inconsistency" Explained

    A while back, a member of another fansite posted about bonus Critical Chance.
    While that post is no longer available, it had some important points.
    There was also a graph of data, comparing data that made something click rather quickly about the formula behind it.
    That was vital to learning about bonus Critical, and later about a hidden factor regarding various abilities' effectiveness (mostly Powers).

    This article is a summary of my findings about these things.
    (It is split into three posts because it is a longer article. This is part 1 of the article.)

    Note: lots of math and formula usage below! (+ technical information in bonus sections)
    Specific formulas and extremely technical information are not required knowledge.
    Do not overly fixate on them ― noting the factors and what's affected should be enough.

    Explaining Bonus Critical Chance

    During recent investigation, I derived bonus critical chance to be:

        Crit+ = 0.125 × (ATK / DEF - 1).

     - Crit+ refers to bonus Critical Chance,
    ATK refers to the attacking unit's amount of their attacking stat, and
    DEF refers to the defending unit's amount of the attacking stat.

    This is bounded between 0 and 0.25.
    It also rounds down when displayed as a percentage in battle.

    To make it easier to understand, here's an example:
    My Witchdoctor wishes to use a basic attack on another Pirate's Kan Po.

    To get bonus Critical Chance, you must first get what the attacking character's main stat is ― in this case, Will.
    Then, you must get the amount of that stat for both the attacking and defending units.

    In this case…
     - Witchdoctor (attacker) → 48 Will
     - Kan Po (defender) → 19 Will

    Now, we just plug these in…

        Crit+ = 0.125 × (ATK / DEF - 1)
            = 0.125 × (48 / 19 - 1)
            = 0.19078…+19% Critical Chance

    So, my Witchdoctor has a bonus Critical Chance of 19% against Kan Po.

    Explaining Damage Inconsistency

    In the past, I noted deviances from Mojo Storm, Mojo Blast, and Mojo Strike’s displayed base amounts, but had no actual explanation for them.
    Upon recent investigation, I concluded that there is a hidden factor to these Powers' Damage Accuracy and Dodge.
    The game uses a variation of the above formula, plugging in the attacker's Accuracy in for ATK and the enemy's Dodge in for DEF., the formula becomes:

        Acc-Dodge Comp = 0.125 × (Accuracy / Dodge - 1),

     - Acc-Dodge Comp is short for Accuracy-Dodge Comparison (comparing your Accuracy and your enemy's Dodge),
     - Accuracy refers to the caster's Accuracy, and
    Dodge refers to the enemy's Dodge.

    Like the previous formula, it ranges from 0 to 0.25.
    However, instead of being used as a percentage, it is used as a "hidden multi" (hidden multiplier boost) towards the base Damage amount.

    This comparison of Accuracy and Dodge is used as part of the base Damage formula for:
     - Mojo AoEs: Mojo Storm, Mojo Blast, Mojo Strike
     - ALL trainable Musketeer trick shots: Hurricane Round, Inferno Shot, Cyclone Round, Bonfire Shot, Storm Round, Incendiary Shot, Uncanny Shot, Quick Shot, Snap Shot, Canister Shot, Case Shot, Grape Shot
     - initial hit of Musketeer's Trap Powers: Tempest of Torpedoes, Hail of Cannonballs, Rain of Mortarshells
     - initial hit of Artillery, The Big Guns
     - Hurl Blades
     - some untrainable Powers: Blunderbuss Shot, Scatterblast

    Note: This explains the Non-Musket Mojo Storm / Blast / Strike Damage inconsistency phenomenon I posted about over 2 years ago.
    (I checked this myself, but I didn't keep detailed notes, like stats, on those specific cases. However, I did verify the user's Accuracy and target's Dodge as factors multiple times during my recent investigations.)

    Example: Mojo Storm
    To get an idea of how this is used, here's an example:

    Let's say my Privateer casts Mojo Storm on a Level 56 Cyclops in Illios.
    He has 131 Accuracy, while the Cyclops has 101 Dodge.
    Also, my Privateer has 274 Spell Power and 119 Will, and the Cyclops has 0 Magic Resist.

    Plugging in 131 for Accuracy and 106 for Dodge:
        Acc-Dodge Comp = 0.125 × (Accuracy / Dodge - 1)
            = 0.125 × (131 / 101 - 1)
            ~ 0.03713

    Next, Mojo Storm's base Damage formula is:

        base = 1.5 × [Spell Power] × (1 + [Acc-Dodge Comp] + 0.002 × Will),

     - base refers to the Power's base Damage,
     - Spell Power refers to the caster's Spell Power,
    Acc-Dodge Comp refers to the result from above, comparing the attacker's Accuracy to the defender's Dodge, and
     - Will refers to the caster's Will.

    Plugging 0.03713 in for Acc-Dodge Comp, as well as 274 for Spell Power and 119 for Will:
        base = 1.5 × [Spell Power] × (1 + [Acc-Dodge Comp] + 0.002 × Will)
            = 1.5 × 274 × (1 + 0.03713 + 0.002 × 103)
            = 524.07843 → 524

    ...which is what happens in-game:

    Explaining Healing Inconsistency

    You're likely aware that healing doesn't always use the stated base amount.
    (I've known this for years, but didn't successfully investigate it until recently.)

    Regarding that, I've concluded that most forms of healing has a sort of hidden boost.
    Here, the game compares the unit's maximum and current Health in the same formula to obtain a "hidden multi" that affects the healing that unit receives.

    As such, this variation of the formula is:

        HP% Comp = 0.125 × (MaxHP / HP - 1),

     - HP% Comp is short for Health Percentage Comparison (comparing max. Health to current Health, basically 1 / health%),
    MaxHP refers to the unit's maximum Health, and
    HP refers to the unit's current Health (at time of casting).

    Like other versions of this formula, it's bounded between 0 and 0.25.
    Like the version used in Powers, this is used as a hidden boost.

    How this value is factored in depends on the manner of healing…
     - Privateers' heals → used the same way as for Powers like Mojo Storm, acting as a hidden multiplier boost
     - "Drains" → used as part of a direct multiplier to the healing part of these Powers
     - Second Wind → used as a direct multiplier to maximum Health; the 50% variant multiplies this result by 2

    Example: Privateer Heals
    For easier understanding, here's an example.

    So, suppose I want to use a Revive on myself.

    I have 1539 / 3075 Health, as well as 274 Spell Power and 119 Will.

    We’ll need HP% Comp, which, in this case, is:
        HP% Comp = 0.125 × (MaxHP / HP - 1)
            = 0.125 × (3075 / 1539 - 1)
            ~ 0.1248

    The formula for Revive’s initial heal is:

        base = 1.5 × [Spell Power] × (1 + [HP% Comp] + 0.002 × Will),

     - base refers to the heal's base amount,
     - Spell Power refers to the caster's Spell Power,
    HP% Comp refers to the result from earlier, comparing one's Health percentage to get a value, and
     - Will refers to the caster's Will.

    Plugging in 0.1248 for HP% Comp, as well as 274 for Spell Power and 119 for Will, the base heal amount becomes:
        base = 1.5 × [Spell Power] × (1 + [HP% Comp] + 0.002 × Will)
            = 1.5 × 274 × (1 + 0.1248 + 0.002 × 119)
            = 560.1108 → 560

    ….which is the exact amount shown here (at 0:43):

    This post contains 3 auto-link(s) to our wiki for your reference.

  2. The Following User Says Thank You to Cody Nightblade For This Useful Post:

    RealDux (08-03-2022)

  3. #2
    Join Date
    Dec 2013
    PvP Tournaments Won
    Thanks (Received)

    Re: Bonus Critical, Damage / Heal "Inconsistency" Explained

    (This is part 2 of the article.)

    Example: "Drains"
    This same formula affects "drains" in a different way, so here's an example:
    Near the end of a battle in Devilfish Hollow, I used a Jobu's Embrace on a Spider with 0 Resist.
    I landed a Mega hit and had 2661 / 2875 Health prior to the cast.
    In this case, I also have 327 Spell Power and 118 Will.

    This scenario’s HP% Comp is….
        HP% Comp = 0.125 × (MaxHP / HP - 1)
            = 0.125 × (2875 / 2661 - 1)
            ~ 0.01005

    Then, here’s the formula for the healing part of Jobu’s Embrace:

        heal = 0.75 × ([Spell Power] × (1 + 0.002 * Will) × multi - [Enemy Resist]) × (1 + [HP% Comp]),

     - HP% Comp refers to the value from above,
     - Spell Power refers to the caster's Spell Power,
     - Will refers to the caster's Will,
     - Multi refers to the multiplier used, and
     - Enemy Resist refers to the Resist roll used.

    Plugging in 0.01005 for HP% Comp, as well as 327 for Spell Power, 118 for Will, 1.66 for multi (Mega Critical), and 0 for Enemy Resist:

        heal = 0.75 × ([Spell Power] × (1 + 0.002 * Will)
    × multi - [Enemy Resist]) × (1 + [HP% Comp])
            = 0.75 × (327 × (1 + 0.002 × 118)
    × 1.66 - 0) × (1 + 0.01005)
    508.2512 → 508

    …which is the exact amount I healed for:

    Example: Second Wind (25%)
    In the case of Second Wind, this formula applies as a direct multiplier to the target ally's total Health.
    This result is doubled if using the 50% version of Second Wind.

    As an example....
    At the end of a fight, I have
    2269 / 3149 Health.
    I have Bonnie Anne heal me with Second Wind (25%).

    The HP% Comp for this scenario becomes....
        HP% Comp = 0.125 × (MaxHP / HP - 1)
            = 0.125 × (3149 / 2269 - 1)
            ~ 0.04848

    Then, Second Wind's healing becomes....
        Healing = MaxHP × [HP% Comp]
            = 3149 × 0.04848
            = 152.6620 → 152 Health

    ...which is the exact amount shown here:

    Interestingly enough, this Epic Talent uses a different variant of that hidden formula.
    Specifically, it compares the user's maximum Health to the target's Health to determine the multiplier used.

    This variant of the formula looks like this:

    ExplComp = 0.125 × ([user's MaxHP] / [target's HP] - 1),

    ExplComp is the result, short for Explosive! Comparison (as this is the only place where this specific comparison is used),
    user's MaxHP refers to the maximum Health of the unit with this Epic Talent (typically an Iron Golem or Terror-Cotta Warrior), and
    target's HP refers to the target's Health when the Epic Talent activates.

    Here's one more example:
    Suppose you're bored, and you want to explode a few Barricades in the middle of a fight.
    A Level 62 Golem will be used, with 220 Weapon Power and a
    ×0.5 innate multiplier (for now, just note that it exists).
    The target will be some Barricades, with 967 Health, and the Iron Golem's maximum Health is 1130.

    The Explosive! Comparison results in...

    ExplComp = 0.125 × ([user's MaxHP] / [target's HP] - 1)
            = 0.125 × (
    1130 / 967 - 1) = 0.02107

    Then, the base formula for Explosive! is:

        base = [Weapon Power]
    × (1 +
    ExplComp) × [innate multi],

     - base refers to base Damage,
     - Weapon Power refers to the user's Weapon Power,
    ExplComp refers to the result we got earlier, and
     - innate multi refers to a special number used in Damage calculation (mostly important for summons).

    Plugging in
    0.02107 for ExplComp, 220 for Weapon Power, and 0.5 for innate multi, we get:
        base = [Weapon Power] × (1 +
    ExplComp) × [innate multi]
            = 220 × (1 +
    0.02107) × 0.5 = 112.3177

    Finally, the Epic Talent landed a Super Critical hit, so the actual Damage dealt becomes...
        112.3177 × 2 = 224.6354 → 224

    ...which is the exact amount shown here:

    A General Statement on this Formula
    The four formulas listed above are nearly identical.
    The only difference is that each variation uses a different pair of numbers.
    Therefore, it's possible to define a general equation for these calculations.

    Generally, this formula compares two stats:
     - bonus Critical Chance:
    attacker's main stat amount, defender's amount of same stat
     - hidden multi (Mojo Storm, etc.): attacker's Accuracy, target's Dodge
     - hidden multi (heals): receiver's max. HP, receiver's current HP
     - Explosive!: user's max. HP, target's current HP

    For easier understanding, I'll define this comparison function:

        compare (stat1, stat2) = 0.125 × (stat1 / stat2 - 1)

     - compare (stat1, stat2) is the result, obtained by comparing stat1 to stat2,
    stat1 is the first stat to compare, and
    stat2 is the second stat to compare.
       stat1 is compared to stat2.

     - This formula is not commutative, so please make sure you remember which stat goes first if you do use these formulas.
       For example, stat1: 75 vs stat2: 50 is not the same as stat1: 50 vs stat2: 75.
           stat1: 75 vs stat2: 50 yields:
                comp(75, 50) = 0.125 × (75 / 50 - 1)
                    = 0.0625
       Meanwhile, stat1: 50 vs stat2: 75 yields:
                comp(50, 75) = 0.125 × (50 / 75 - 1)
                    = -0.0416666.... → 0
     - This function is bounded between 0 and 0.25.
     - Bonus Critical Chance has an issue with lossy data conversion, but I am unsure if it is the same case with damage / heal usage.
        (Note: I have noted one case of inaccuracy with healing.)

    Using this definition, you can define the other formulas easily:
     - Crit+ = compare (ATK, DEF),
         - ATK = attacker's main stat amount
         - DEF = defender's amount of the same stat
     - Acc-Dodge Comp = compare (Accuracy, Dodge),
         - Accuracy = attacker's Accuracy
         - Dodge = defender's Dodge
     - HP% Comp = compare (MaxHP, HP),
         - MaxHP = receiver's max. health
         - HP = receiver's current health
     - ExplComp = compare([user MaxHP], [target HP]),
         - user MaxHP = user's max. Health
         - target HP = target's current Health

    This article dives into an explanation for bonus Critical Chance, as well as variation in some abilities' base Damage / healing.
     - We defined a
    comparison function, which compares two stats, bounded between 0 and 0.25.

     - Bonus Critical Chance compares the attacker's main stat amount to the defender's amount of that same stat.
     - Base Damage for various Powers compares the user's Accuracy to the target's Dodge for a base Damage boost.
     - Healing compares the receiver's
    maximum Health to their current Health for a healing boost.
     - Explosive! compares the user's maximum Health to the target's current Health for a base Damage boost.

    Special Thanks
    Special thanks go to:

    • Willowdreamer and Jester, for helping with image embeds (Thank goodness, that issue got fixed....)
    • ultimatewizardx, for notifying me about Mojo Storm's damage being off
    • You, for reading this article

    Thank you for reading!
    If there are any further questions, please leave a comment below, and I will try to answer to the best of my ability!
    Well then, until the next post, happy Piratin', and stay safe out there!~

    This post contains 2 auto-link(s) to our wiki for your reference.
    Last edited by Cody Nightblade; 07-19-2022 at 04:27 AM.

  4. The Following User Says Thank You to Cody Nightblade For This Useful Post:

    RealDux (08-03-2022)

  5. #3
    Join Date
    Dec 2013
    PvP Tournaments Won
    Thanks (Received)

    Re: Bonus Critical, Damage / Heal "Inconsistency" Explained

    (This is part 3 of the article.)
    Bonus Section
    Information here is mostly for completion (as these points were a huge part of my investigations).
    Feel free to skip this section if you wish.

    Slight Bonus Critical Inaccuracy, and a Potential Explanation
    When I initially investigated bonus Critical Chance, I derived a slightly different formula:

        Crit+ = 0.125 × (ATK - DEF) / DEF.

    This is mathematically equivalent to the current formula.
    (The reason I changed how it was written is explained in the section after this.)

    That said, there are scenarios where a certain
    ATK / DEF pair always showed 1% less than expected.

    For example, my first encounter with this issue.
    In this situation, my Musketeer, with
    126 Agility, attacks an enemy with 50 Agility.

    The formula says I have a +19% Critical Chance bonus:

        Crit+ = 0.125 × (ATK - DEF) / DEF
            = 0.125 × (126 - 50) / 50
            = 0.19+19% Critical Chance

    However, it always displayed +18% when in-game…
    This drove me up the wall and was the main reason I left these findings unpublished for over a year.
    Fortunately, though, I recently found a possible explanation for it., why does this happen?

    My explanation's a bit technological, so I'll try to make it a bit easier to understand.
    First, I'll introduce a few terms: float and double.
    Both are numerical data types that allow for storing decimals (e.g. 0.125, 1299.25, 3.141592, 2.718281828, etc.)
    There are a few additional things to note...
     - floats are less accurate (accurate to 6 - 7 decimal places, compared to double's 15 decimal places) and have a smaller range
     - floats use half the storage that doubles use for storage
     - both floats and doubles have potential for rounding errors

    Now, for the potential explanation...

    Converting between various number types may result in lossy data.
    (I was told this in a basic computer programming class.)

    For example, take two numbers, say 94 and 50, and store them as floats.
    Then, divide them, and store the result as a double.

    If you do the math by hand, you should get exactly 1.88.
    However, when you type these into a compiler (I use a Java compiler), you get 1.8799999952316284:

    This is not the value you'd want (it's not 1.88).

    The same thing happens in-game, when calculating bonus Critical Chance.
    Here's a snippet of the code I used to verify this:

    Code Explanation
       float atk = 126, def = 50;
          This stores the two values as floats.
       double ans = (double) (0.125 * ((atk - def) / def));
          Does the calculation with 126 and 50 stored as float variables named atk and def, respectively.
          (Despite looking unpleasant because of parentheses, it's the same formula noted above I've color-coded this line as such, to make this a bit clearer to those who aren't as familiar with analyzing code.)
          Stores this result as a double.
       System.out.println(" Exact:" + (ans * 100));
          Displays the exact value of the result as a percentage.
       System.out.println("Displayed:" + (int) Math.floor(ans * 100) + "%");
          Displays the value of the result as a percentage, rounded down.

    These errors may occur because of lossy conversion, like float → double, and compilers may warn you about doing these kinds of things.

    Further Lossy Data ― Formula Variation

    In the past section, I defined the bonus Critical Chance formula as

        Crit+ = 0.125 × (ATK - DEF) / DEF.

    Upon recent investigation, though, I've determined that there's importance in how the formula is written in the code, leading to my recent change in how it was written.
    I came across this while investigating an example where the
    attacker attacks with 78 Will, while the defender has 50 Will.
    It turns out that, among the multiple ways I chose to write the formula, only one of them was able to obtain the proper result.

    These are the in-game values I observed during my recent investigation:

    Next, here's a code snippet with some variations of the same bonus Critical Chance formula:

    The four formulas in this code snippet are mathematically equivalent.
    However, they are all different on a technical level (because of rounding errors).

    Of the resulting values, only one of them ― the first one ― explains why hovering in-game shows +6% Critical Chance instead of +7%.
    Along with ease in typing the formula, this led to the redefinition of the bonus Critical Chance formula to its current version.

    Does this affect actual Critical chance?
    It's hard to say because we only get to see what's displayed. I wouldn't deem it statistically significant, although it is still worth noting (for the sake of completion, as someone's bound to encounter this issue if they crunch enough numbers).

    Why does converting from float to double result in lossy conversion?
    Admittedly, while I am aware of lossy conversion, I wasn't taught why it happens, so I don't have a proper explanation. If there are any computer programmers that know the answer to this, please reply down below, thanks!

    Why would Pirate101 have lossy conversion?
    Honestly, I don't know ― you could probably get away with using a pair of ints (short for integers) in place of floats, and simply cast one of them as a double to prevent the lossy conversion, all while using the same amount of storage.
    Then again, they probably have their reasons for it.
    There might be some technical reason that I'm not aware of, or it might be related to another part of the game's programming.

    My statements on this potential reason are solely based on my investigation, which was set up as an experiment.
    To truly confirm whether this really is the case, though, we'd have to look at the code itself, but that's something we won't see because we're players, not KI staff.
    The main reason for mentioning this topic is that I have been able to consistently use this to predict when this would happen during my investigation, with various test cases:

    (Although I am only showing these examples, I have a spreadsheet with other examples, predicted by finding ATK-DEF pairs that would result in this error, then checking whether this issue would appear in-game with said pair. Each prediction led to this happening.)

    Are there any other possible factors?
    Without going too much into it, yes.
    Numerical data types are not 100% precise, so even if there wasn't any lossy conversion, things like rounding errors are still possible.
    Last edited by Cody Nightblade; 07-19-2022 at 03:02 AM.

  6. The Following User Says Thank You to Cody Nightblade For This Useful Post:

    RealDux (08-03-2022)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Single Sign On provided by vBSSO