If you use this earlier version of the Mad Theorist, it exposes the original bug which I tried to workaround https://github.com/davewx7/citadel/commit/8d99e776c5fa3cb2eec412d518ae27aac89398aa -- in that version, when the human or AI moved two units at once they were discarding only once. Meaning that multiples of delayed_command are broken.
Steps to reproduce:
Roll back Mad Theorist to the linked commit
Run the play_test("chrono")
Click Move All
Observe that you are only asked to Discard once
Other steps taken:
I speculated that this line in tbs_game was the problem:
add(delayed_commands, [state.delayed_commands]),
it looks like it should just be add(delayed_commands, state.delayed_commands), . However when I changed that the behavior seemed to get even worse (assert fails on choice, overlapping choice controllers), so I didn't change it.
After that change, the human player is able to discard two cards as intended (when two Mad Theorists move simultaneously). However believe it or not, the AI only discards one card.
Steps to reproduce:
Run the play_test("chrono")
End turn without killing the AI units
Observe that the AI only discarded one card
You may also observe that the value of state.players[1].creature_avatar.effects_tracking['Mad Theorist'] is 1, when it should be 0. This variable was added to track the number of forced discards remaining, which were to be consolidated.
Other steps taken:
I wrestled with the code for several hours trying some more workarounds but couldn’t get the AI discarding two cards.
[ ] Bug number 3
Bug number 3 discovered by the Mad Theorist is that I can get a current_choice null assert fail if I end turn with remaining movement. It seems there are some situations where you are allowed to click End Turn where you probably shouldn't be allowed to End Turn, and this is one of the consequences. I have attached log files for Bug 3. You can see the assert fail in the server log.
20180608 current_choice assert.zip
[ ] The original bug
If you use this earlier version of the Mad Theorist, it exposes the original bug which I tried to workaround https://github.com/davewx7/citadel/commit/8d99e776c5fa3cb2eec412d518ae27aac89398aa -- in that version, when the human or AI moved two units at once they were discarding only once. Meaning that multiples of delayed_command are broken.
Steps to reproduce:
Other steps taken:
I speculated that this line in tbs_game was the problem:
add(delayed_commands, [state.delayed_commands]),
it looks like it should just beadd(delayed_commands, state.delayed_commands),
. However when I changed that the behavior seemed to get even worse (assert fails on choice, overlapping choice controllers), so I didn't change it.[ ] Bug number two
Bug number two was discovered when I attempted to workaround bug number one by allowing multiple discards to be consolidated in the same delayed_command. You can witness this bug in current version in master, but here is the relevant commit: https://github.com/davewx7/citadel/commit/986f8534cf6c761a74d54bcbe971f9bfc063b123
After that change, the human player is able to discard two cards as intended (when two Mad Theorists move simultaneously). However believe it or not, the AI only discards one card.
Steps to reproduce:
state.players[1].creature_avatar.effects_tracking['Mad Theorist']
is 1, when it should be 0. This variable was added to track the number of forced discards remaining, which were to be consolidated.Other steps taken:
I wrestled with the code for several hours trying some more workarounds but couldn’t get the AI discarding two cards.
[ ] Bug number 3
Bug number 3 discovered by the Mad Theorist is that I can get a current_choice null assert fail if I end turn with remaining movement. It seems there are some situations where you are allowed to click End Turn where you probably shouldn't be allowed to End Turn, and this is one of the consequences. I have attached log files for Bug 3. You can see the assert fail in the server log. 20180608 current_choice assert.zip