Skip to content

Commit

Permalink
An HP change message can come after hitting self in confusion for end…
Browse files Browse the repository at this point in the history
…-of-attack effects.
  • Loading branch information
davidstone committed Feb 4, 2024
1 parent fce1c22 commit 30ebce4
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,6 @@ auto BattleMessageHandler::handle_message(std::span<ParsedMessage const> const b
},
[&](HPMessage const message) {
tv::visit(action_builder, tv::overload(
[&](Nothing) {
require_is_end_of_turn();
end_of_turn_state.set_expected(message.party, message.status);
end_of_turn_state.set_expected(message.party, message.hp);
},
[&](MoveStateBuilder & builder) {
builder.set_expected(message.party, message.status);
builder.set_expected(message.party, message.hp);
Expand All @@ -315,8 +310,11 @@ auto BattleMessageHandler::handle_message(std::span<ParsedMessage const> const b
ptr->status = message.status;
ptr->hp = message.hp;
},
[](HitSelf) {
throw std::runtime_error("Got multiple HP messages for hitting self in confusion");
[&](auto const previous) {
do_action(previous);
require_is_end_of_turn();
end_of_turn_state.set_expected(message.party, message.status);
end_of_turn_state.set_expected(message.party, message.hp);
}
));
},
Expand Down

0 comments on commit 30ebce4

Please sign in to comment.