kerkerkruip
kerkerkruip copied to clipboard
Combatant gets a turn in between attack and reaction
Victor mentioned this in #221 but I think it's a separate issue. I just got it fighting Israfel:
Act> a isra
Smiling, Isra glides aside.
Rolling 9 - 1 (the pickaxe penalty) + 3 (inherent bonus) + 4 (concentration) - 2 (defender dodging) - 1
(the pickaxe dodge bonus) + 4 (tension) + 1 (defender large) + 1 (ment) - 2 (incense penalty) = 16, you
beat Isra’s defence rating of 10.
You deal 5 + 2 (concentration) + 2 (tension) + 1 (inherent bonus) + 1 (ment) = 11 damage, wounding
Isra to 5 health.
Isra loses concentration!
You grow to large size!
Isra’s flames burn you for 2 damage.
Fell jumps towards you, flashing her teeth.
Isra concentrates, and is now mildly concentrated.
I'm not sure this is a bug - the initiative rules have always allowed for multiple turns occasionally.
You could be right, but this definitely is a bug:
Act> a
(the rotting corpse)
The corpse walks out of the way.
Rolling 5 + 4 (inherent bonus) + 2 (concentration) - 2 (defender dodging) + 1 (tension) - 1 (weapon size)
= 9, you beat the rotting corpse’s defence rating of 8.
You deal 6 + 1 (tension) + 1 (inherent bonus) + 1 (large attacker) + 2 (sword of light radiance bonus) =
11 damage, wounding the rotting corpse to 4 health.
You grow to huge size, regaining 5 health in the process!
As the corpse reels back from the blow, his rotting left leg falls off.
The rotting left leg decays completely.
Act> c
You concentrate, and are now mildly concentrated.
The rotting corpse strikes up a defensive pose.
The rotting corpse concentrates, and is now mildly concentrated.
An extra reaction turn should never happen there!
Interesting that these both happened with the power of the blood ape - is it possible that the growing effect stops the defender from being reset to at-inactive?
I had a look at the code. I have a guess what the problem is. The increase ape damage rule updates the combat status to make sure you won't grow after killing the last enemy. But combatants are set to at-inactive only when the combat status is concluding, so by updating the combat status we skip that stage. I think we have too many uses for combat status and they get in the way of each other. To avoid this problem in the future, I think we need to split combat status into two things:
- A counter used to mark off stages of processing during a combat turn
- A phrase to determine whether we are currently in combat
Lots of places in code use "update the combat status" for 2, but we could create a phrase such as "there is hate" or "there is peace," that could give us that information without interfering with 1.
I am going to add a test for this bug, but I'm not going to try to fix it yet. @VictorGijsbers, do you think this might involve a change to Inform ATTACK?
Hey, I just noticed that the phrase already exists in Inform ATTACK Core!
[ Depreciated - check the combat status instead ]
To decide whether hate is present (deprecated):
consider the hate rules;
if rule succeeded:
decide yes;
otherwise:
decide no.
Why is this deprecated? Checking combat status just doesn't work when characters can be killed or change factions at any point during the turn. I was going to go ahead and fix the bug, but this makes me think I really need to hear from Victor first.
Maybe a more robust fix would be to check the value of the combat status at the beginning of the 'update combat status' rules. If it is peace, then it's okay to reset it. If it's not peace, it's only okay to change it to peace.
No, that doesn't work for the power of the ape after-effects or the absorption-stopping rule that ends the Arena of the Gods battle. The combat status has to be "concluding" until the combat round rules finish. I think we really do need the 'hate is present' phrase. I have to say it makes me want to radically change the way the combat round rules work. Like make the combat round into an activity, and the concluding stuff can be after-activity rules.
I'm not sure what should happen with the maze move, though.
I've merged the bug-245 branch. Whenever possible, I left the "update the combat status" phrase alone, but when it could possibly have been done while processing the combat round rules, I changed it to "if hate is present." I could close this now, but I'm pretty sure the issue will give us more problems if we don't come up with some guidelines about how to use the phrases - or some new phrases.
I haven't been following the discussions very well during the past few days, but will check it all out tomorrow!
I wrote that code in simpler times when it made sense for performance reasons to cache the result. I guess now it would be wise to check as often as needed.
That code was indeed deprecated by Dannii. I have no problem with bringing it back in!
Let's think this through for Kerkerkruip 10. I'll keep the issue open and schedule it for the next release.
I'm changing the tag from "bug" to "refactoring."