Split Deep challenge stakes into success and failure fields
The Deep now states what happens on success and on failure as two separate fields when calling a Challenge, instead of one free-text stakes blob. ChallengePanel shows them as "✅ On success" / "❌ On failure"; the event log lists both. - Challenge.stakes_success / stakes_failure (+ migration); the old single `stakes` column is kept (vestigial) so in-scene rollback snapshots taken before the upgrade still deserialize, and ChallengePanel falls back to it for any pre-existing challenge. - create_challenge / route / DeepControlPanel updated; tests adjusted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -194,12 +194,14 @@ def test_scene_start_and_challenges(session):
|
||||
assert "Challenge" in msg
|
||||
|
||||
# The Deep calls a Challenge applying the obstacle
|
||||
ok, msg = crud.create_challenge(session, game.id, deep.id, p2.id, [obs.id], stakes="The cheese is on the line")
|
||||
ok, msg = crud.create_challenge(session, game.id, deep.id, p2.id, [obs.id], stakes_success="The cheese is yours", stakes_failure="The cheese is on the line")
|
||||
assert ok, msg
|
||||
session.refresh(game)
|
||||
challenge = game.challenges[0]
|
||||
assert challenge.status == "open"
|
||||
assert challenge.acting_player_id == p2.id
|
||||
assert challenge.stakes_success == "The cheese is yours"
|
||||
assert challenge.stakes_failure == "The cheese is on the line"
|
||||
|
||||
orig_is_red = cards.parse_card(obs.original_card)["color"] == "red"
|
||||
|
||||
@@ -2078,7 +2080,7 @@ def test_rollback_round_trip_restores_state(session):
|
||||
cp_known = crud.capture_checkpoint(session, game)
|
||||
|
||||
# A destructive action: open a challenge and play a card against the obstacle.
|
||||
crud.create_challenge(session, game.id, deep.id, p2.id, [obs.id], stakes="x")
|
||||
crud.create_challenge(session, game.id, deep.id, p2.id, [obs.id], stakes_failure="x")
|
||||
crud.capture_checkpoint(session, game)
|
||||
crud.play_challenge_card(session, p2.id, obs.id, "10D")
|
||||
crud.capture_checkpoint(session, game)
|
||||
@@ -2242,7 +2244,7 @@ def test_rollback_middleware_capture_and_route_end_to_end():
|
||||
obs.current_value = 5
|
||||
session.add_all([p2, obs])
|
||||
session.commit()
|
||||
crud.create_challenge(session, game.id, deep.id, p2.id, [obs.id], stakes="x")
|
||||
crud.create_challenge(session, game.id, deep.id, p2.id, [obs.id], stakes_failure="x")
|
||||
|
||||
# A floor checkpoint representing the pre-play state.
|
||||
floor = crud.capture_checkpoint(session, game)
|
||||
|
||||
Reference in New Issue
Block a user