feat: complete playtest parity improvements
This commit is contained in:
@@ -15,7 +15,7 @@ func test_support_companion_intercepts_enemy_damage_then_dies_without_ending_or_
|
||||
var enemy := _actor(&"goblin", Vector2i(2, 1), 12, 20, {"ai": "aggressive", "vision_range": 6})
|
||||
var state := GameState.new(map, player, {enemy.id: enemy})
|
||||
state.companion = CompanionState.from_choice(&"moth", Vector2i(4, 1), 1)
|
||||
assert_true(state.companion.set_stance(CompanionState.Stance.SUPPORT))
|
||||
assert_true(state.companion.set_stance(CompanionState.Stance.DEFEND_ME))
|
||||
|
||||
var results: Array[TurnResult] = []
|
||||
TurnResolver.append_enemy_response(state, results)
|
||||
@@ -26,6 +26,39 @@ func test_support_companion_intercepts_enemy_damage_then_dies_without_ending_or_
|
||||
assert_true(enemy.is_alive())
|
||||
assert_true(player.is_alive())
|
||||
|
||||
func test_attack_on_sight_companion_follows_player_when_the_only_hostile_is_not_detected() -> void:
|
||||
var map := GridMapState.new(Vector2i(10, 5), GridMapState.CellKind.FLOOR)
|
||||
for y in range(5):
|
||||
map.set_cell(Vector2i(5, y), GridMapState.CellKind.WALL)
|
||||
var player := _actor(&"player", Vector2i(3, 2), 20, 3)
|
||||
var hidden_enemy := _actor(&"hidden", Vector2i(7, 2), 20, 2, {"ai": "aggressive", "vision_range": 8})
|
||||
var state := GameState.new(map, player, {hidden_enemy.id: hidden_enemy})
|
||||
state.companion = CompanionState.from_choice(&"dog", Vector2i(1, 2))
|
||||
assert_true(state.companion.set_stance(CompanionState.Stance.ATTACK_ON_SIGHT))
|
||||
|
||||
var results := state.try_player_action(Vector2i.DOWN)
|
||||
|
||||
assert_eq(state.player.cell, Vector2i(3, 3))
|
||||
assert_lt(state.companion.actor.cell.distance_to(state.player.cell), Vector2i(1, 2).distance_to(state.player.cell), "Without a detected hostile, attack-on-sight must move closer to the exploring player.")
|
||||
assert_true(results.any(func(result: TurnResult) -> bool: return result.kind == &"companion_moved"))
|
||||
|
||||
func test_attack_on_sight_companion_pursues_then_attacks_a_detected_hostile_automatically() -> void:
|
||||
var map := GridMapState.new(Vector2i(8, 5), GridMapState.CellKind.FLOOR)
|
||||
var player := _actor(&"player", Vector2i(1, 1), 20, 3)
|
||||
var enemy := _actor(&"goblin", Vector2i(4, 1), 20, 0, {"ai": "passive", "vision_range": 0})
|
||||
var state := GameState.new(map, player, {enemy.id: enemy})
|
||||
state.companion = CompanionState.from_choice(&"dog", Vector2i(2, 1))
|
||||
state.companion.actor.accuracy = 100
|
||||
assert_true(state.companion.set_stance(CompanionState.Stance.ATTACK_ON_SIGHT))
|
||||
|
||||
var pursuit_results := state.try_player_action(Vector2i.DOWN)
|
||||
assert_eq(state.companion.actor.cell, Vector2i(3, 1))
|
||||
assert_true(pursuit_results.any(func(result: TurnResult) -> bool: return result.kind == &"companion_moved"))
|
||||
|
||||
var attack_results := state.try_player_action(Vector2i.UP)
|
||||
assert_lt(enemy.hit_points, enemy.max_hit_points)
|
||||
assert_true(attack_results.any(func(result: TurnResult) -> bool: return result.kind == &"companion_melee"))
|
||||
|
||||
func test_living_companion_follows_after_player_move_without_sharing_a_cell_or_blocking_enemy_pathing() -> void:
|
||||
var map := GridMapState.new(Vector2i(8, 3), GridMapState.CellKind.FLOOR)
|
||||
var player := _actor(&"player", Vector2i(2, 1), 20, 3)
|
||||
|
||||
Reference in New Issue
Block a user