feat: add S1 walking skeleton
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
extends GutTest
|
||||
|
||||
const GameScene = preload("res://scenes/Game.tscn")
|
||||
var game: Game
|
||||
|
||||
func before_each() -> void:
|
||||
game = GameScene.instantiate()
|
||||
add_child_autofree(game)
|
||||
await get_tree().process_frame
|
||||
|
||||
func test_real_game_scene_completes_walking_combat_and_defeat_route() -> void:
|
||||
assert_not_null(game.get_node_or_null("World/MapRenderer"))
|
||||
assert_not_null(game.get_node_or_null("World/Player"))
|
||||
assert_not_null(game.get_node_or_null("World/Enemies"))
|
||||
assert_not_null(game.get_node_or_null("Camera2D"))
|
||||
assert_not_null(game.get_node_or_null("HUD/PlayerHealthLabel"))
|
||||
assert_not_null(game.get_node_or_null("HUD/EnemyHealthLabel"))
|
||||
assert_not_null(game.get_node_or_null("HUD/EventLog"))
|
||||
|
||||
var state := game.get_game_state()
|
||||
var start := state.player.cell
|
||||
var wall := game.submit_test_action(Vector2i.LEFT)
|
||||
assert_eq(wall[0].kind, &"blocked")
|
||||
assert_eq(state.player.cell, start)
|
||||
var door := game.submit_test_action(Vector2i.UP)
|
||||
assert_eq(door[0].kind, &"blocked")
|
||||
assert_eq(state.player.cell, start)
|
||||
assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "blocked")
|
||||
|
||||
var movement := game.submit_test_action(Vector2i.RIGHT)
|
||||
assert_eq(movement[0].kind, &"moved")
|
||||
assert_eq(state.player.cell, start + Vector2i.RIGHT)
|
||||
assert_eq(movement[1].kind, &"enemy_melee")
|
||||
assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "You move")
|
||||
assert_string_contains(game.get_node("HUD/PlayerHealthLabel").text, "10/12")
|
||||
var first_melee := game.submit_test_action(Vector2i.RIGHT)
|
||||
assert_eq(first_melee[0].kind, &"melee")
|
||||
assert_eq(first_melee[1].kind, &"enemy_melee")
|
||||
assert_string_contains(game.get_node("HUD/EnemyHealthLabel").text, "3/6")
|
||||
var lethal_melee := game.submit_test_action(Vector2i.RIGHT)
|
||||
assert_eq(lethal_melee[0].kind, &"melee")
|
||||
assert_eq(lethal_melee[1].kind, &"enemy_defeated")
|
||||
assert_false(state.enemies.has(&"goblin"))
|
||||
await get_tree().process_frame
|
||||
assert_eq(game.get_node("World/Enemies").get_child_count(), 0)
|
||||
assert_string_contains(game.get_node("HUD/EnemyHealthLabel").text, "defeated")
|
||||
assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "defeated")
|
||||
Reference in New Issue
Block a user