[Guide/Formula] Critical hit rate, cont. attack chance, wars

If you are stuck in the Dunan Unification Wars; or wish for more details on the gameplay systems, this is the place.
Post Reply
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

Correct, Boost does very odd things. For example, it completely negates the Kindness Rune bug. That's a can of worms I'm not going to touch though since there are very few ways to get boost going at all.
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

It seems my previous formula for Hit Rate is incorrect. The formula itself is fine, but for some reason the value used in place of an enemy's speed is actually a value tied to your specific region for random encounters. This means your chance to hit is tied not to the specific enemy, but a global for your particular region. The boundaries are also different, such that in random battles you can have a lower bound of 20% instead of 30%. I have no idea why. For Luca (who I originally tested against) it uses a slightly different routine and does actually use his speed; this may be true for other bosses as well. This is a really odd programming choice, but it wouldn't be the first odd thing to show up in the game.

While digging, I also confirmed the Critical Hit formula I reported earlier. It checks via integer math, so it truncates any remainders from the formula. Thus having a theoretical critical chance of 10.125% is in fact just 10% as far as the game is concerned.
User avatar
ninjaluc79
Posts: 867
Joined: Tue Sep 13, 2005 10:45 pm
Location: The Island Nations
Contact:

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by ninjaluc79 »

Omnigamer wrote:DAMAGE = (((Offense_ATK * FURY_MOD) + RAND(3:8)) - Defense_PROT ) * ATTACK_MOD
Is the bonus damage from Double-Strike applied in FURY_MOD or in ATTACK_MOD?
Omnigamer wrote:It seems my previous formula for Hit Rate is incorrect. The formula itself is fine, but for some reason the value used in place of an enemy's speed is actually a value tied to your specific region for random encounters. This means your chance to hit is tied not to the specific enemy, but a global for your particular region. The boundaries are also different, such that in random battles you can have a lower bound of 20% instead of 30%. I have no idea why. For Luca (who I originally tested against) it uses a slightly different routine and does actually use his speed; this may be true for other bosses as well. This is a really odd programming choice, but it wouldn't be the first odd thing to show up in the game.

While digging, I also confirmed the Critical Hit formula I reported earlier. It checks via integer math, so it truncates any remainders from the formula. Thus having a theoretical critical chance of 10.125% is in fact just 10% as far as the game is concerned.
So for random battles, I guess we can use a floor hit rate of 20% for determining physical damage tiers.

As for critical hits, make sure that the character's LUCK is divisible by 2 and his/her (TECH + LUCK / 2) total is divisible by 16, 32 if you intend to use a Killer Rune on him/her, to avoid wasted stat points from integer division.
It's not all about knowledge, but it helps.
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

I assume double strike gets tacked on to ATTACK_MOD, the same way Violence does.

How Killer interacts with the formula is ambiguous at this point. There's a possibility that they apply Killer after the regular division, in which case you only get an additional half of the final result. This is less than ideal, especially since it means you can lose an entire point from being even or odd, but it wouldn't surprise me at all is this is how they did it. Otherwise they probably apply it before the division by 16, so you get (TECH + LUCK/2)*1.5 . This provides better end numbers, but I don't think I saw any branches in the code that would indicate this.
KFCrispy
Global Admin
Posts: 6174
Joined: Wed Jun 30, 2004 3:29 pm

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by KFCrispy »

i'm pretty sure in this game, Double-Strike affects damage (after defense is applied) while berserk status affects ATK.
User avatar
ninjaluc79
Posts: 867
Joined: Tue Sep 13, 2005 10:45 pm
Location: The Island Nations
Contact:

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by ninjaluc79 »

Omnigamer wrote:I assume double strike gets tacked on to ATTACK_MOD, the same way Violence does.

How Killer interacts with the formula is ambiguous at this point. There's a possibility that they apply Killer after the regular division, in which case you only get an additional half of the final result. This is less than ideal, especially since it means you can lose an entire point from being even or odd, but it wouldn't surprise me at all is this is how they did it. Otherwise they probably apply it before the division by 16, so you get (TECH + LUCK/2)*1.5 . This provides better end numbers, but I don't think I saw any branches in the code that would indicate this.
Nonetheless, you still need your (TECH + LUCK / 2) total to be even, so that you don't lose stat points from integer division.

Just to be sure, though, I think (TECH + LUCK / 2) should be divisible by 32 for the same reason above.
It's not all about knowledge, but it helps.
KFCrispy
Global Admin
Posts: 6174
Joined: Wed Jun 30, 2004 3:29 pm

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by KFCrispy »

oh no tests for Mazus unit's Fire Magic in strategy battles? :)
User avatar
Pyriel
Webmaster
Posts: 1227
Joined: Wed Aug 18, 2004 1:20 pm

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Pyriel »

Why would it need to be divisible by 32?
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Omnigamer »

I haven't tested Mazus only because I haven't had an emulator file that actually has him in a war battle yet, but if I had to guess he probably also has a 50% hit rate.

I think ninjaluc's assumption about Killer Rune is that it does another right shift and adds it back to the original to calculate the end result. I don't think that quite works out with what he's saying though.

Scenario 1: Killer is applied after initial division.

Ex TECH: 100
Ex LUCK: 105

100+srl(105,1) = 152 //Initial Sum
srl(152,4) = 9 //Division by 16
9 + srl(9,1) = 13 //Killer Rune Calculation

152/16 = 9.5
152/32 = 4.75

9.5+4.75 = 14.25

-Just creates a rule of thumb: if base sum divided by 16 is odd, you lose a point to integer division if using the Killer Rune. It is the same as saying if the remainder of sum divided by 32 is above .5, Killer Rune is not as effective as it should be. Less accurate than actual sum of the parts.


Scenario 2: Killer Rune is applied to the base sum.

Ex TECH: 100
Ex LUCK: 105

100+srl(105,1) = 152 //Initial Sum
152+srl(152,1) = 228 //Killer Rune Calculation
srl(228,4) = 14 //Division by 16

152/16 = 9.5
152/32 = 4.75

9.5+4.75 = 14.25

-Much closer to what the actual floating point sums would be.


For scenario 1, division by 32 just tells you how close you are to gaining back that point that you should have. Or you could just look at the whole number of division by 16 and determine its parity. If Scenario 1 is in fact the way it is calculated, you will be losing a point on your crit rate for ~45.6% of possible values.
User avatar
Pyriel
Webmaster
Posts: 1227
Joined: Wed Aug 18, 2004 1:20 pm

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Pyriel »

Oh, there's a broader formula being discussed here. All I saw was (TECH + LUCK / 2) which on top of reading pretty oddly, wouldn't lose anything by not being divisible by 32. Fault me for not reading back through the entire discussion to establish context I didn't realize was missing.
User avatar
ninjaluc79
Posts: 867
Joined: Tue Sep 13, 2005 10:45 pm
Location: The Island Nations
Contact:

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by ninjaluc79 »

We just need to know how the Killer Rune calculation is done, then.

As far as we know, though, the sum (TECH + LUCK / 2) should be divisible by 16 so that we don't lose stat points from integer division.
It's not all about knowledge, but it helps.
User avatar
Pyriel
Webmaster
Posts: 1227
Joined: Wed Aug 18, 2004 1:20 pm

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by Pyriel »

I wouldn't recommend soiling yourself over it. Honestly, that's way too focused. Let's optimize Tech and Luck for critical hits by not increasing them unless it'll make the sum over 2 divisible by 16. Meanwhile every point of luck counts in some other calculations, and it's better if your Tech is divisible by 3 for dodges or something (more appears to be better for hit %, at least). It's a consideration, say if your luck is enough that all the other calculations it's in are maximized or minimized to your liking, and the one stat stone you have would make (TECH+LUCK/2) % 16 = 15, then not a lot of value. Or say you don't have enough Master Garbs and the Karate Uniform only brings it up to remainder 10, so you'd might as well use something with better defense or a resistance you need. Otherwise, who cares? You're not really losing anything if your character goes up a level, and suddenly the remainder is 3.
User avatar
ninjaluc79
Posts: 867
Joined: Tue Sep 13, 2005 10:45 pm
Location: The Island Nations
Contact:

Re: [Guide/Formula] Critical hit rate, cont. attack chance,

Post by ninjaluc79 »

Yeah. I'm just trying to build a high critical build for characters, especially for Shin and Genshu, who can't be upgraded any further because they don't have any open rune slots. As for Killer, I'm just trying to figure out the maximum critical hit rate without losing any more points from integer division, especially for Shilo (highest critical hit rate in the game) so that, as you said, I could replace Master Garbs and/or Lucky/Skill Rings with anything else that increases hit rate, defense, or elemental resistances.

All right, let's do this.

For a theoretical character with 255 TECH, 255 LUCK who can equip a Master Garb and 3x Skill Rings:


Defensive Equipments only:
(255 + 255 / 2) / 16 = 23% critical hit rate (r. 14) = 34% with Killer Rune

Master Garb + 3x Skill Ring:
(255 + 75 + 255 / 2) / 16 = 28% critical hit rate (r. 9) = 42% with Killer Rune

Master Garb + 2x Skill Ring:
(255 + 55 + 255 / 2) / 16 = 27% critical hit rate (r. 5) = 40% with Killer Rune

Master Garb + 1x Skill Ring:
(255 + 35 + 255 / 2) / 16 = 26% critical hit rate (r. 1) = 39% with Killer Rune

I guess Master Garb + 1x Skill Ring is already good enough. More slots for defensive/elem resist equipment.

In Shilo's case (~200 TECH, ~180 LUCK @ level 60):

Defensive Equipments only:
(200 + 180 / 2) / 16 = 18% critical hit rate (r. 2) = 27% with Killer Rune

Master Garb + 3x Skill Ring:
(200 + 75 + 180 / 2) / 16 = 22% critical hit rate (r. 13) = 33% with Killer Rune

Master Garb + 2x Skill Ring:
(200 + 55 + 180 / 2) / 16 = 21% critical hit rate (r. 9) = 31% with Killer Rune

Master Garb + 1x Skill Ring:
(200 + 35 + 180 / 2) / 16 = 20% critical hit rate (r. 5) = 30% with Killer Rune

Yep, looks like Master Garb + 1x Skill Ring is good as well. More slots for Fire Emblem + Power Ring (more DMG) or Water Amulet (vs Beast Rune's ice attacks).
It's not all about knowledge, but it helps.
Saj
Posts: 17
Joined: Wed Aug 19, 2015 4:32 am

Re: [Guide/Formula] Critical hit rate, cont. attack chance, wars

Post by Saj »

* Best Rune water attacks. Btw Valeria and Anita can Crit in Falcon rune, Killer rune works here also.
User avatar
ninjaluc79
Posts: 867
Joined: Tue Sep 13, 2005 10:45 pm
Location: The Island Nations
Contact:

Re: [Guide/Formula] Critical hit rate, cont. attack chance, wars

Post by ninjaluc79 »

Saj wrote:* Best Rune water attacks. Btw Valeria and Anita can Crit in Falcon rune, Killer rune works here also.
Are you sure? Have you even tried if Killer increases Falcon's chance to Crit?
It's not all about knowledge, but it helps.
Post Reply