Decode RTINIT providers 17 and 52

This commit is contained in:
gamer147
2026-07-23 16:54:39 -04:00
parent cb68e9eabd
commit 1168535f1b
7 changed files with 88 additions and 23 deletions

View File

@@ -367,6 +367,24 @@ MOVEMENT_PROVIDER_PARAMETER_SCHEMAS = {
"Pillar exists within the configured route-step radius"
),
},
17: {
"behavior": "route_toward_lowest_hp_reachable_normal_attack_target",
"parameter_fields": {},
"target_selection": (
"require a usable normal attack, build the acting entity's "
"movement-limited reach grid, and retain active foreign-faction "
"entities whose occupied tile remains element-effective after "
"SETMVWORK filtering and costs no more than current FS; sort by "
"current HP ascending, preserving source order among ties, then "
"use the first candidate for which SETROUTE produces "
"a route"
),
"completion": (
"advance the current step's progress counter and produce movement "
"result state 1 after routing toward the lowest-current-HP "
"reachable normal-attack target"
),
},
51: {
"behavior": "select_effective_attack_target_and_action",
"parameter_fields": {},
@@ -391,6 +409,29 @@ MOVEMENT_PROVIDER_PARAMETER_SCHEMAS = {
"movement route is produced"
),
},
52: {
"behavior": "select_lowest_hp_effective_attack_target_and_action",
"parameter_fields": {},
"target_selection": (
"require a usable nonzero attack-range band, scan active foreign-"
"faction entities inside the ATSEEK range grid, and retain only "
"the equal-lowest-current-HP targets for which at least one "
"allowed normal-attack/equipped-skill element has positive "
"effectiveness against the target's defense element; choose "
"randomly among those HP ties"
),
"action_selection": (
"reload the chosen target's actual ATSEEK range band, collect the "
"effective actions enabled there (0 means normal attack; nonzero "
"values are equipped skill ids), choose randomly, and store both "
"the target entity and selected action"
),
"completion": (
"advance the current step's progress counter and produce immediate-"
"battle result state 2 when a target/action pair is selected; no "
"movement route is produced"
),
},
}
UNIT_STAT_COLUMNS = (

View File

@@ -371,8 +371,8 @@ def test_real_routine_banks() -> None:
and len(meta["used_battle_provider_selectors"]) == 4
and len(meta["record_field_columns"]) == 117,
"RTINIT assembles every populated movement and battle step")
check(meta["decoded_movement_provider_count"] == 14
and meta["decoded_movement_step_count"] == 858
check(meta["decoded_movement_provider_count"] == 16
and meta["decoded_movement_step_count"] == 1027
and meta["decoded_movement_parameter_count"] == 974
and meta["decoded_movement_defaulted_parameter_count"] == 13
and meta["ignored_movement_parameter_count"] == 3,
@@ -498,6 +498,18 @@ def test_real_routine_banks() -> None:
== "select_effective_attack_target_and_action"
and "movement_parameter_1" not in provider_51,
"RTINIT joins RTN_M051's parameterless attack-selection behavior")
provider_17 = by_id[3]["movement_steps"][2]
check(provider_17["movement_provider_selector"] == 17
and provider_17["provider_behavior"]
== "route_toward_lowest_hp_reachable_normal_attack_target"
and "movement_parameter_1" not in provider_17,
"RTINIT joins RTN_M017's low-HP attack-route behavior")
provider_52 = by_id[3]["movement_steps"][0]
check(provider_52["movement_provider_selector"] == 52
and provider_52["provider_behavior"]
== "select_lowest_hp_effective_attack_target_and_action"
and "movement_parameter_1" not in provider_52,
"RTINIT joins RTN_M052's low-HP attack-selection behavior")
undecoded_movement = by_id[2]["movement_steps"][1]
check(undecoded_movement["movement_provider_selector"] == 2
and "provider_behavior" not in undecoded_movement