Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical Hit fixes - Previously Albeleon 3.17 #1487

Merged
merged 5 commits into from Nov 18, 2018

Conversation

Projects
None yet
5 participants
@fmatthew5876
Copy link
Contributor

fmatthew5876 commented Nov 6, 2018

Fixes critical hit behavior.

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

fmatthew5876 commented Nov 6, 2018

From CherryDT

Critical Hits

X = Actor|Enemy.critical_hit ? 100 / Actor|Enemy.critical_hit_chance : 0
X += max(weapon1's Item.critical_hit, weapon2's Item.critical_hit) [only for actors of course]

Then, X is the chance in percent.

If the target is a friend and not a foe (can happen with confusion for example), the crit chance is always zero.

If the target has an equipped item with Item.prevent_critical, the chance is zero as well.

Also, note that a critical hit does not stack with concentration. Concentration makes the attack x2, critical makes it x3, both together also make x3 and not x6.

For enemies and actors it's the same thing, it's stored in critical_hit/critical_hit_chance in the Actor/Enemy structure in the LDB.

In general, crit is only possible for normal physical attacks (double attack is just two physical attacks one after another, which have their individual damage/crit/miss calculation)

Hit Rate:

if target is not able to move, success probability = 100, otherwise: success probability = (skill success probability * (min(100, all the attacker's state accuracy rates)/100) and then only if weapon doesn't have "ignore enemy dodge rate" option is enabled: final success probability = 100 - (100 - success probability) * (1 + 0.5 * (target agility / attacker agility - 1)) and then only if target has an equipment with "increase dodge rate against physical attacks": final success probability -= 25 "this condition": only if the failure_message is 3 >and the target is an (or all) enemy not sure why the enemy thing though. that means that if an enemy casts >a spell, the agilities never matter...? I think the failure_message 3 classifies it as a physical attack in a way so you can dodge it actually it is illogical that this applies only to skills with enemies as target, yet it checks if the target has equipment with the "increase dodge rate" option since enemies can't wear equipment but I guess it's just copied from normal attack logic...
But this is for skills. Now, for physical attack, most of this is the same. But instead of the skill success probability, you have:

if attacker is actor: max(weapon1's Item.hit, weapon2's Item.hit) or 90 if no weapons equipped else: if Enemy.miss then 70, otherwise 90

@fmatthew5876 fmatthew5876 force-pushed the fmatthew5876:alb_3.17 branch from 2c5b10e to 84dc047 Nov 7, 2018

@fmatthew5876 fmatthew5876 changed the title "3.17: RM2000 + RM2003: A Weapon's critical chance is added to the cr… Critical Hit fixes - Previously Albeleon 3.17 Nov 7, 2018

@fmatthew5876 fmatthew5876 force-pushed the fmatthew5876:alb_3.17 branch 3 times, most recently from 3d3e7e3 to c9fc17b Nov 7, 2018

Show resolved Hide resolved src/game_battlealgorithm.cpp Outdated

@fmatthew5876 fmatthew5876 force-pushed the fmatthew5876:alb_3.17 branch from c9fc17b to 63c797a Nov 7, 2018

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

fmatthew5876 commented Nov 7, 2018

I added a Utils::PercentChance(float) function to be used generally for drawing random numbers against percentages in the range [0.0, 1.0]

This can also be used for #1455

@fmatthew5876 fmatthew5876 force-pushed the fmatthew5876:alb_3.17 branch 5 times, most recently from 1e430fc to 85bd4f7 Nov 7, 2018

@fdelapena fdelapena added the Battle label Nov 8, 2018

@fmatthew5876 fmatthew5876 force-pushed the fmatthew5876:alb_3.17 branch from 85bd4f7 to 3fc3b9d Nov 18, 2018

Show resolved Hide resolved src/game_actor.cpp
@Ghabry

Ghabry approved these changes Nov 18, 2018

@Ghabry Ghabry merged commit 88153e8 into EasyRPG:master Nov 18, 2018

6 checks passed

Android (armeabi-v7a) Build finished.
Details
GNU/Linux Build finished.
Details
OSX Build finished.
Details
Windows (x64) Build finished.
Details
Windows (x86) Build finished.
Details
web Build finished.
Details

@fmatthew5876 fmatthew5876 deleted the fmatthew5876:alb_3.17 branch Nov 28, 2018

@CherryDT

This comment has been minimized.

Copy link

CherryDT commented Feb 23, 2019

For future readers, let's bring this back to a readable state with line breaks:

Cherry10/23/2018
if I understand this right, then only under this conditions.....

if target is not able to move, success probability = 100, otherwise:
success probability = (skill success probability * (min(100, all the attacker's state accuracy rates)/100)
and then only if weapon doesn't have "ignore enemy dodge rate" option is enabled:
final success probability = 100 - (100 - success probability) * (1 + 0.5 * (target agility / attacker agility - 1))
and then only if target has an equipment with "increase dodge rate against physical attacks":
final success probability -= 25
"this condition": only if the failure_message is 3 and the target is an (or all) enemy
not sure why the enemy thing though. that means that if an enemy casts a spell, the agilities never matter...?
I think the failure_message 3 classifies it as a physical attack
in a way
so you can dodge it
actually it is illogical that this applies only to skills with enemies as target, yet it checks if the target has equipment with the "increase dodge rate" option
since enemies can't wear equipment
but I guess it's just copied from normal attack logic...
But this is for skills. Now, for physical attack, most of this is the same. But instead of the skill success probability, you have:

if attacker is actor: max(weapon1's Item.hit, weapon2's Item.hit) or 90 if no weapons equipped
else: if Enemy.miss then 70, otherwise 90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.