[Ohrrpgce] SVN: teeemcee/10634 Fix off-by-one attack delays in turn-based mode due to improper tie brea

subversion at HamsterRepublic.com subversion at HamsterRepublic.com
Wed Sep 12 06:09:28 PDT 2018


teeemcee
2018-09-12 06:09:28 -0700 (Wed, 12 Sep 2018)
956
Fix off-by-one attack delays in turn-based mode due to improper tie breaking

This bug is unrelated to my previous commits, it has always been present, and
it doesn't affect negative delays in particular.

Consider a hero (slot 0) and enemy (slot 4) attacking, where the hero has higher
speed and the hero's attack has delay 1.
Then the enemy attack should have happened first, but it didn't, because
the hero's attack has initiative 0 + attack_delay 1 = atkq delay 1,
the enemy's attack has initiative 1 + attack_delay 0 = atkq delay 1,
so battle_check_delays() would pick the first attack in atkq(), which is the
hero attack, because of a lower bslot() index.

So lack of tie handling effectively meant delays were off-by-one about half
the time.

Also, I added battl global variable, equal to @bat, for convenience.
It seemed ridiculous to waste time to add bat onto dozens of function calls and
declarations just to use bat.turn.mode in a single place.
---
U   wip/bmod.rbas
U   wip/gglobals.bi
U   wip/whatsnew.txt


More information about the Ohrrpgce mailing list