diff --git a/scripts/presentation/hud.gd b/scripts/presentation/hud.gd index 8c0cb09..1e81fe1 100644 --- a/scripts/presentation/hud.gd +++ b/scripts/presentation/hud.gd @@ -52,7 +52,7 @@ const STATUS_EFFECT_NAMES := { @onready var action_hint_label: Label = $ResponsiveLayout/PromptPanel/ActionHintLabel @onready var responsive_layout: Control = $ResponsiveLayout -const HIDDEN_JOURNAL_KINDS: Array[StringName] = [&"moved", &"enemy_moved", &"companion_moved", &"party_moved"] +const HIDDEN_JOURNAL_KINDS: Array[StringName] = [&"moved", &"enemy_moved", &"companion_moved", &"party_moved", &"episode_published"] var combat_summary := "" var log_expanded := false diff --git a/tests/e2e/test_audience_episode_e2e.gd b/tests/e2e/test_audience_episode_e2e.gd index de2b350..1c67e31 100644 --- a/tests/e2e/test_audience_episode_e2e.gd +++ b/tests/e2e/test_audience_episode_e2e.gd @@ -21,9 +21,21 @@ func test_real_actions_build_audience_unlock_sponsor_publish_episode_and_open_pa assert_gte(game.audience_state.spectacle_score(), 1) assert_eq(game.audience_state.followers(), 50) assert_eq(game.audience_state.unlocked_sponsors(), [&"first_sponsor"]) + var run_state := game.get_run_state() + var episode_events := run_state.recent_events(run_state.log.size()).filter(func(event: GameEvent) -> bool: return event.kind == &"episode_published") assert_eq(game.recap_log.episodes().size(), 1) - assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"sponsor_unlocked")) - assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"episode_published")) + assert_true(run_state.recent_events(run_state.log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"sponsor_unlocked")) + assert_eq(episode_events.size(), 1, "RunState must retain the published episode event") + var episode := game.recap_log.episodes()[0] + assert_eq(int(episode.get("number", 0)), 1) + assert_eq(int(episode.get("turn", 0)), run_state.current_turn) + assert_gte(int(episode.get("spectacle", 0)), 1) + assert_eq(int(episode.get("followers", 0)), 50) + assert_eq(episode.get("sponsors", []), [&"first_sponsor"]) + + var event_log := game.get_node("HUD/EventLog") as RichTextLabel + assert_eq(event_log.get_parsed_text().find("Épisode 1 publié"), -1) + assert_eq(event_log.get_parsed_text().find(episode_events[0].message), -1) await _dispatch_key(KEY_U) var audience_panel := game.get_node("HUD/AudiencePanel") as PanelContainer diff --git a/tests/unit/test_hud_journal_localization.gd b/tests/unit/test_hud_journal_localization.gd index cf3167b..f21878f 100644 --- a/tests/unit/test_hud_journal_localization.gd +++ b/tests/unit/test_hud_journal_localization.gd @@ -48,18 +48,17 @@ func test_hud_localizes_current_structured_journal_events_without_using_the_engl "Butin — au sol : Bandage x2, Couteau de chasse x1 ; or récupéré : 12.", "Votre familier intercepte l’attaque du gobelin.", "Votre familier tombe, mais votre aventure continue.", - "Épisode 7 publié.", ]: assert_string_contains(journal_text, expected) - for hidden_movement: String in ["You move to (6, 8).", "The goblin moves.", "Your companion follows.", "The party moves.", "Vous vous déplacez vers (6, 8).", "Le gobelin se déplace.", "Votre familier vous suit."]: - assert_eq(journal_text.find(hidden_movement), -1, "GameHud must omit movement events from the journal even when they provide source messages") - for english_source: String in ["Ariane begins a new run.", "Your way is blocked.", "You strike the goblin with a short sword for 3.", "The goblin hits you with claws for 2.", "The goblin is defeated.", "You attack.", "You hit.", "You deal 3 damage.", "You gain experience.", "Loot dropped.", "Your companion intercepts the attack.", "Your companion falls, but your run continues.", "Episode 7 published."]: + for hidden_event: String in ["You move to (6, 8).", "The goblin moves.", "Your companion follows.", "The party moves.", "Vous vous déplacez vers (6, 8).", "Le gobelin se déplace.", "Votre familier vous suit.", "Épisode 7 publié.", "Episode 7 published."]: + assert_eq(journal_text.find(hidden_event), -1, "GameHud must omit movement and episode publication events from the journal even when they provide source messages") + for english_source: String in ["Ariane begins a new run.", "Your way is blocked.", "You strike the goblin with a short sword for 3.", "The goblin hits you with claws for 2.", "The goblin is defeated.", "You attack.", "You hit.", "You deal 3 damage.", "You gain experience.", "Loot dropped.", "Your companion intercepts the attack.", "Your companion falls, but your run continues."]: assert_eq(journal_text.find(english_source), -1, "GameHud must localize %s from structured event data, not reuse its source message" % english_source) for technical_id: String in ["consumable_bandage", "weapon_hunting_knife"]: assert_eq(journal_text.find(technical_id), -1, "GameHud must resolve %s through the content catalog" % technical_id) -func test_hud_shows_only_non_movement_events_in_a_mixed_batch() -> void: +func test_hud_hides_movement_and_episode_publication_in_a_mixed_batch() -> void: var game := GameScene.instantiate() as Game add_child_autofree(game) await get_tree().process_frame @@ -70,6 +69,7 @@ func test_hud_shows_only_non_movement_events_in_a_mixed_batch() -> void: GameEvent.new(1, 0, &"enemy_moved", {}, "The goblin moves.", &"goblin", &"player"), GameEvent.new(1, 0, &"companion_moved", {}, "Your companion follows.", &"companion", &"player"), GameEvent.new(1, 0, &"party_moved", {}, "The party moves.", &"player"), + GameEvent.new(1, 0, &"episode_published", {"number": 1}, "Episode 1 published."), GameEvent.new(1, 0, &"blocked", {}, "Your way is blocked.", &"player"), GameEvent.new(1, 0, &"loot_dropped", {"items": [], "gold": 4}, "Loot dropped.", &"goblin", &"player"), GameEvent.new(1, 0, &"melee", {"damage": 3, "attack_method": "épée courte"}, "You strike.", &"player", &"goblin"),