70 lines
2.8 KiB
GDScript
70 lines
2.8 KiB
GDScript
extends SceneTree
|
|
|
|
const GameConfigCatalogScript := preload("res://scripts/core/game_config_catalog.gd")
|
|
const LandActionRulesScript := preload("res://scripts/domain/rules/land_action_rules.gd")
|
|
const FarmMapperScript := preload("res://scripts/domain/mappers/farm_mapper.gd")
|
|
const PlayerStateScript := preload("res://scripts/state/player_state.gd")
|
|
|
|
|
|
func _init() -> void:
|
|
var failures: Array[String] = []
|
|
|
|
var action_rules = LandActionRulesScript.new()
|
|
var dry_actions: Array[String] = action_rules.get_actions({
|
|
"crop_id": 1,
|
|
"is_ripe": 0,
|
|
"has_gather": 0,
|
|
"has_dry": 1,
|
|
"has_bug": 0,
|
|
"has_grass": 0
|
|
})
|
|
if not dry_actions.has("water"):
|
|
failures.append("dry land actions should include water")
|
|
var friend_actions: Array[String] = action_rules.get_friend_actions({
|
|
"crop_id": 1,
|
|
"interaction_type_list": [0, 1, 2, 3, 4, 5]
|
|
})
|
|
for action in ["steal", "put_bug", "put_grass", "water", "die_bug", "die_grass"]:
|
|
if not friend_actions.has(action):
|
|
failures.append("friend land action list should include %s" % action)
|
|
|
|
var config = GameConfigCatalogScript.new()
|
|
if config.get_pay_config_list().size() < 6:
|
|
failures.append("pay_list should expose at least six recharge rows")
|
|
if config.get_land_upgrade_config_for(1, 1).is_empty():
|
|
failures.append("land upgrade level 1 position 1 config missing")
|
|
if not config.get_land_upgrade_config_for(1, 99).is_empty():
|
|
failures.append("land upgrade config lookup should not fallback for missing order")
|
|
if config.get_player_exp_max(14) != 14:
|
|
failures.append("player level 14 upgrade exp should match original config")
|
|
if config.get_crop_output_item_id(1) != 102001:
|
|
failures.append("crop 1 output item should match original crop_list item_id")
|
|
|
|
var mapper = FarmMapperScript.new(config, null)
|
|
var sow_fallback: Dictionary = mapper.land_data_from_sow_result({}, 0, 101001, {})
|
|
if int(sow_fallback.get("level", -1)) != 0:
|
|
failures.append("new normal land fallback level should be 0")
|
|
|
|
var player_state = PlayerStateScript.new()
|
|
player_state.setup({"level": 14, "exp": 13}, config)
|
|
player_state.add_exp(2)
|
|
if int(player_state.data.get("level", 0)) != 15:
|
|
failures.append("player exp should level up once after reaching the current level threshold")
|
|
if int(player_state.data.get("exp", 0)) != 1:
|
|
failures.append("player exp should keep the original H5 rollover remainder")
|
|
player_state.setup({"level": 14, "exp": 13}, config)
|
|
player_state.add_exp(50)
|
|
if int(player_state.data.get("level", 0)) != 18:
|
|
failures.append("player exp should continue leveling while overflow remains")
|
|
if int(player_state.data.get("exp", 0)) != 1:
|
|
failures.append("player exp should keep remainder after multiple level ups")
|
|
|
|
if not failures.is_empty():
|
|
for failure in failures:
|
|
push_error(failure)
|
|
quit(1)
|
|
return
|
|
|
|
print("P0 verification passed.")
|
|
quit(0)
|