Add sentry pacing to opening battle
This commit is contained in:
@@ -15,6 +15,7 @@ func _init() -> void:
|
||||
_check_priority_changes_enemy_targeting(state, failures)
|
||||
_check_reinforcement_priority_events(failures)
|
||||
_check_guard_ai_behavior(failures)
|
||||
_check_sentry_ai_behavior(failures)
|
||||
|
||||
if failures.is_empty():
|
||||
print("event ai priority smoke ok")
|
||||
@@ -130,6 +131,49 @@ func _check_guard_ai_behavior(failures: Array[String]) -> void:
|
||||
failures.append("guard target search should prefer targets inside the guard zone: %s" % str(target.get("id", "")))
|
||||
|
||||
|
||||
func _check_sentry_ai_behavior(failures: Array[String]) -> void:
|
||||
var state = BattleStateScript.new()
|
||||
if not state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("Could not load stage 1 sentry AI scenario")
|
||||
return
|
||||
|
||||
var sentry: Dictionary = state.get_unit("yellow_turban_5")
|
||||
if str(sentry.get("ai_behavior", "")) != "sentry":
|
||||
failures.append("central raider should load sentry AI behavior")
|
||||
if sentry.get("ai_sentry_anchor", Vector2i(-1, -1)) != Vector2i(10, 6):
|
||||
failures.append("central raider should keep its sentry anchor: %s" % str(sentry.get("ai_sentry_anchor", null)))
|
||||
if int(sentry.get("ai_sentry_radius", 0)) != 5:
|
||||
failures.append("central raider should keep its sentry radius")
|
||||
if int(sentry.get("ai_sentry_activation_turn", 0)) != 4:
|
||||
failures.append("central raider should keep delayed activation turn")
|
||||
|
||||
state._enemy_take_action(sentry)
|
||||
if bool(sentry.get("ai_awake", false)):
|
||||
failures.append("sentry should not wake while opening player positions are distant")
|
||||
if sentry.get("pos", Vector2i.ZERO) != Vector2i(10, 6):
|
||||
failures.append("sleeping sentry should hold its watch post: %s" % str(sentry.get("pos", null)))
|
||||
|
||||
state.get_unit("cao_cao")["pos"] = Vector2i(5, 6)
|
||||
state._enemy_take_action(sentry)
|
||||
if not bool(sentry.get("ai_awake", false)):
|
||||
failures.append("sentry should wake when a player enters the lure line")
|
||||
if sentry.get("pos", Vector2i.ZERO) == Vector2i(10, 6):
|
||||
failures.append("woken sentry should start pressing the lure-line target")
|
||||
|
||||
var delayed_state = BattleStateScript.new()
|
||||
if not delayed_state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("Could not load delayed sentry AI scenario")
|
||||
return
|
||||
var delayed_sentry: Dictionary = delayed_state.get_unit("yellow_turban_2")
|
||||
delayed_state._enemy_take_action(delayed_sentry)
|
||||
if bool(delayed_sentry.get("ai_awake", false)):
|
||||
failures.append("delayed sentry should not wake before its activation turn")
|
||||
delayed_state.turn_number = 5
|
||||
delayed_state._enemy_take_action(delayed_sentry)
|
||||
if not bool(delayed_sentry.get("ai_awake", false)):
|
||||
failures.append("delayed sentry should wake on its activation turn")
|
||||
|
||||
|
||||
func _feedback_has(feedback: Array[Dictionary], expected_unit_id: String, expected_text: String, expected_kind: String) -> bool:
|
||||
for entry in feedback:
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user