extends GutTest ## Permadeath is announced. The server unbinds a character on the tick it dies, ## so before this the only sign anything had happened was the roster appearing. const GAME_SCENE := preload("res://src/view/game_scene.gd") func test_the_line_names_who_fell_how_far_they_got_and_where() -> void: var line: String = GAME_SCENE.fallen_line( {"name": "Bramcreek", "level": 7, "where": "Warden's Descent"}) assert_string_contains(line, "Bramcreek") assert_string_contains(line, "level 7") assert_string_contains(line, "in the Warden's Descent") func test_a_dungeon_already_called_the_something_is_not_the_the_something() -> void: var line: String = GAME_SCENE.fallen_line( {"name": "Wren", "level": 3, "where": "The Choir Vault"}) assert_string_contains(line, "in the Choir Vault") assert_false(line.contains("the The")) func test_the_client_records_its_own_death_from_the_server_event() -> void: var c: ClientRuntime = autofree(ClientRuntime.new()) c.my_peer = 5 c.characters = [{"id": "a", "name": "Ash", "active": true}] as Array[Dictionary] c.selected_character = "a" c.instance_kind = Protocol.InstanceKind.DUNGEON c.dungeon_id = Dungeons.VAULT c.my_total_xp = Progression.total_xp_for_level(4) c.on_events(NetCodec.encode_events(10, [{"t": SimEvent.Type.PLAYER_DIED, "peer": 5}] as Array[Dictionary])) assert_eq(c.last_fallen.get("name", ""), "Ash") assert_eq(int(c.last_fallen.get("level", 0)), 4) assert_eq(String(c.last_fallen.get("where", "")), "The Choir Vault") func test_someone_elses_death_is_not_yours() -> void: var c: ClientRuntime = autofree(ClientRuntime.new()) c.my_peer = 5 c.characters = [{"id": "a", "name": "Ash", "active": true}] as Array[Dictionary] c.selected_character = "a" c.on_events(NetCodec.encode_events(10, [{"t": SimEvent.Type.PLAYER_DIED, "peer": 6}] as Array[Dictionary])) assert_true(c.last_fallen.is_empty())