Sequence enemy turn presentation
This commit is contained in:
@@ -22,6 +22,7 @@ func _init() -> void:
|
||||
_check_edge_scroll_layout_contract(failures)
|
||||
_check_minimap_navigation_contract(failures)
|
||||
_check_map_focus_contract(failures)
|
||||
_check_battle_presentation_sequence_contract(failures)
|
||||
_check_readability_contract(failures)
|
||||
_check_dialogue_localization_and_side(failures)
|
||||
_check_event_dialogue_side_passthrough(failures)
|
||||
@@ -290,6 +291,71 @@ func _check_map_focus_contract(failures: Array[String]) -> void:
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_battle_presentation_sequence_contract(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("could not load opening map for battle presentation sequencing")
|
||||
scene.free()
|
||||
return
|
||||
scene.battle_started = true
|
||||
scene.state.battle_status = BattleStateScript.STATUS_ACTIVE
|
||||
scene.state.current_team = BattleStateScript.TEAM_PLAYER
|
||||
|
||||
for method_name in [
|
||||
"_begin_battle_presentation_sequence",
|
||||
"_end_battle_presentation_sequence",
|
||||
"_presentation_delay_for_step",
|
||||
"_has_active_battle_presentation_sequence"
|
||||
]:
|
||||
if not scene.has_method(method_name):
|
||||
failures.append("missing battle presentation helper: %s" % method_name)
|
||||
|
||||
scene._begin_battle_presentation_sequence()
|
||||
scene._on_unit_motion_requested("yellow_turban_1", Vector2i(12, 1), Vector2i(11, 1))
|
||||
scene._on_unit_action_motion_requested("yellow_turban_2", Vector2i(9, 4), Vector2i(8, 4), "attack")
|
||||
scene._on_combat_feedback_requested("yellow_turban_2", "-10", "damage")
|
||||
scene._end_battle_presentation_sequence()
|
||||
|
||||
var first_motion: Dictionary = scene.unit_motion_by_unit.get("yellow_turban_1", {})
|
||||
if first_motion.is_empty() or float(first_motion.get("age", 0.0)) < -0.01:
|
||||
failures.append("first queued enemy movement should start immediately: %s" % str(first_motion))
|
||||
if not bool(first_motion.get("sequence", false)):
|
||||
failures.append("enemy movement should be marked as part of the presentation sequence")
|
||||
|
||||
var action_motion: Dictionary = scene.unit_action_motion_by_unit.get("yellow_turban_2", {})
|
||||
if action_motion.is_empty() or float(action_motion.get("age", 0.0)) >= 0.0:
|
||||
failures.append("later enemy action should wait for earlier movement: %s" % str(action_motion))
|
||||
if not bool(action_motion.get("sequence", false)):
|
||||
failures.append("enemy action should be marked as part of the presentation sequence")
|
||||
if bool(action_motion.get("sfx_played", false)):
|
||||
failures.append("delayed enemy action SFX should wait for the action start: %s" % str(action_motion))
|
||||
var enemy_before_facing: Dictionary = scene.state.get_unit("yellow_turban_2")
|
||||
if scene._unit_pixel_facing(enemy_before_facing) != scene.state.unit_facing_x(enemy_before_facing):
|
||||
failures.append("delayed enemy action should not flip unit facing before it starts")
|
||||
|
||||
if scene.floating_texts.is_empty():
|
||||
failures.append("enemy damage feedback should be queued as floating text")
|
||||
else:
|
||||
var popup: Dictionary = scene.floating_texts[0]
|
||||
if float(popup.get("age", 0.0)) >= 0.0:
|
||||
failures.append("enemy damage feedback should wait for the action impact: %s" % str(popup))
|
||||
if not bool(popup.get("sequence", false)):
|
||||
failures.append("enemy damage feedback should keep input locked while it is presented")
|
||||
|
||||
if not scene._has_active_battle_presentation_sequence():
|
||||
failures.append("queued enemy presentation should stay active after enemy turn logic returns")
|
||||
if not scene._is_input_locked():
|
||||
failures.append("queued enemy presentation should lock input until the sequence has played")
|
||||
|
||||
for index in range(40):
|
||||
scene._process(0.20)
|
||||
if not scene._has_active_battle_presentation_sequence():
|
||||
break
|
||||
if scene._has_active_battle_presentation_sequence():
|
||||
failures.append("queued enemy presentation should finish after enough process time")
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_readability_contract(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
scene._create_hud()
|
||||
|
||||
Reference in New Issue
Block a user