Explain disabled battle action buttons
This commit is contained in:
@@ -44,6 +44,7 @@ func _init() -> void:
|
||||
_check_scene_texture_loading(failures)
|
||||
_check_hud_focus_text(failures)
|
||||
_check_hover_intent_badges(failures)
|
||||
_check_action_button_disabled_reasons(failures)
|
||||
_check_terrain_and_unit_presentation(failures)
|
||||
_check_attack_motion_profiles(failures)
|
||||
_check_attack_motion_signal(failures)
|
||||
@@ -237,6 +238,85 @@ func _check_hud_focus_text(failures: Array[String]) -> void:
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_action_button_disabled_reasons(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
scene.wait_button = Button.new()
|
||||
scene.tactic_button = Button.new()
|
||||
scene.item_button = Button.new()
|
||||
scene.equip_button = Button.new()
|
||||
scene.end_turn_button = Button.new()
|
||||
scene.threat_button = Button.new()
|
||||
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("could not load battle scene state for action button reasons")
|
||||
_free_action_button_test_scene(scene)
|
||||
return
|
||||
scene.battle_started = true
|
||||
var cao_cao: Dictionary = scene.state.get_unit("cao_cao")
|
||||
|
||||
cao_cao["status_effects"] = [{
|
||||
"type": "action_lock",
|
||||
"status": "seal",
|
||||
"action": "skill",
|
||||
"remaining_phases": 2
|
||||
}]
|
||||
scene._update_tactic_button(cao_cao)
|
||||
if scene.tactic_button.text != "Tactic - Sealed" or not scene.tactic_button.tooltip_text.to_lower().contains("sealed"):
|
||||
failures.append("sealed unit should explain disabled tactic button: %s | %s" % [scene.tactic_button.text, scene.tactic_button.tooltip_text])
|
||||
cao_cao["status_effects"] = []
|
||||
|
||||
cao_cao["acted"] = true
|
||||
scene._update_wait_button(cao_cao)
|
||||
scene._update_tactic_button(cao_cao)
|
||||
scene._update_item_button(cao_cao)
|
||||
scene._update_equip_button(cao_cao)
|
||||
if not scene.wait_button.text.contains("Done"):
|
||||
failures.append("acted unit wait button should show Done: %s" % scene.wait_button.text)
|
||||
if not scene.tactic_button.text.contains("Done"):
|
||||
failures.append("acted unit tactic button should show Done: %s" % scene.tactic_button.text)
|
||||
if not scene.item_button.text.contains("Done"):
|
||||
failures.append("acted unit item button should show Done: %s" % scene.item_button.text)
|
||||
if not scene.equip_button.text.contains("Done"):
|
||||
failures.append("acted unit equip button should show Done: %s" % scene.equip_button.text)
|
||||
|
||||
cao_cao["acted"] = false
|
||||
cao_cao["moved"] = true
|
||||
scene._update_equip_button(cao_cao)
|
||||
if scene.equip_button.text != "Equip - Moved" or not scene.equip_button.tooltip_text.to_lower().contains("before"):
|
||||
failures.append("moved unit should explain disabled equip button: %s | %s" % [scene.equip_button.text, scene.equip_button.tooltip_text])
|
||||
|
||||
cao_cao["moved"] = false
|
||||
scene.state.set_inventory_snapshot({})
|
||||
scene._update_item_button(cao_cao)
|
||||
if scene.item_button.text != "Item - None" or not scene.item_button.tooltip_text.to_lower().contains("no consumable"):
|
||||
failures.append("empty inventory should explain disabled item button: %s | %s" % [scene.item_button.text, scene.item_button.tooltip_text])
|
||||
|
||||
scene.state.current_team = BattleState.TEAM_ENEMY
|
||||
scene._update_end_turn_button()
|
||||
if scene.end_turn_button.text != "End Turn - Enemy Turn" or not scene.end_turn_button.tooltip_text.to_lower().contains("player phase"):
|
||||
failures.append("enemy phase should explain disabled end turn button: %s | %s" % [scene.end_turn_button.text, scene.end_turn_button.tooltip_text])
|
||||
|
||||
scene.state.current_team = BattleState.TEAM_PLAYER
|
||||
scene.battle_started = false
|
||||
scene._update_threat_button()
|
||||
if scene.threat_button.text != "Threat - Start Battle" or not scene.threat_button.tooltip_text.to_lower().contains("begin"):
|
||||
failures.append("inactive battle should explain disabled threat button: %s | %s" % [scene.threat_button.text, scene.threat_button.tooltip_text])
|
||||
_free_action_button_test_scene(scene)
|
||||
|
||||
|
||||
func _free_action_button_test_scene(scene) -> void:
|
||||
for button in [
|
||||
scene.wait_button,
|
||||
scene.tactic_button,
|
||||
scene.item_button,
|
||||
scene.equip_button,
|
||||
scene.end_turn_button,
|
||||
scene.threat_button
|
||||
]:
|
||||
if button != null and is_instance_valid(button):
|
||||
button.free()
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_hover_intent_badges(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
|
||||
Reference in New Issue
Block a user