Skip to content

Commit

Permalink
Fix crit not always being 0.33 crit per luk but less
Browse files Browse the repository at this point in the history
Basically when luk changed due to status effects such as Gloria and
other cases, the crit difference was calculated via 0.3 crit per luk
instead of 0.33.

Also only adding the difference on top can result in edge cases where
integer arithmetic will round down to less than one should get,
to prevent this we remove the old luk from our current crit first and
recalculate with the new luk.

Verified in pre-re 11.2 and re 14.0
  • Loading branch information
skyleo committed Nov 13, 2023
1 parent b097666 commit 4c8a5ef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/map/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -3201,7 +3201,9 @@ static void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag
if (st->luk == bst->luk) {
st->cri = status->calc_critical(bl, sc, bst->cri, true);
} else {
st->cri = status->calc_critical(bl, sc, bst->cri + 3*(st->luk - bst->luk), true);
// supposedly for Renewal some say it might be 0.3 crit per luk instead of 0.33 crit per luk as here.
// The behavior here is also identical to episode 14.0, can't verify this for later versions of Aegis.
st->cri = status->calc_critical(bl, sc, bst->cri - (bst->luk * 10 / 3) + (st->luk * 10 / 3), true);
}
if (battle_config.show_katar_crit_bonus && bl->type == BL_PC && BL_UCAST(BL_PC, bl)->weapontype == W_KATAR) {
st->cri *= 2;
Expand Down Expand Up @@ -3860,7 +3862,7 @@ static void status_calc_misc(struct block_list *bl, struct status_data *st, int
#endif // RENEWAL

if ( bl->type&battle_config.enable_critical )
st->cri += 10 + (st->luk * 10 / 3); //(every 1 luk = +0.3 critical)
st->cri += 10 + (st->luk * 10 / 3); // (every 1 luk = +0.33 critical -> 3 luk = +1 critical)
else
st->cri = 0;

Expand Down

0 comments on commit 4c8a5ef

Please sign in to comment.