From eac5b3e22e33517e9b3703531ce157b2225047d0 Mon Sep 17 00:00:00 2001 From: Sylpheed RE agent Date: Thu, 27 Aug 2026 05:28:50 +0000 Subject: [PATCH] re: resolve every ISL condition's comparand -- the clear conditions are readable The deque ops are an EXPRESSION STACK: push the left operand, evaluate the right (a built-in call, whose result lands in special[0]), pop the comparand back into special[1], compare. Tracking that through the linear decode is enough to recover what each site tests. Evidence the model is right, not just plausible: push vs pop across all 28 stages 1877 vs 1877 files that underflow or end unbalanced 0 of 28 Stage 02 pop.i sites followed by cmp.i 319 / 319 ops immediately before a pop.i call x313, cmp.a x6 isl.conditions() recovers 7563 condition sites disc-wide with 0.0% left as an unresolved special[N]; 83.2% have a built-in call as the LHS and 99.7% compare against a plain number. Most-tested: hp_pct_test 1955, unit_state 1257, unit_relation 796, dist_lt 450, unit_alive 413. They read as conditions now: if unit_alive(TCN105) != 1 if hp_pct_test(ADT308, 0) != 1 if dist_lt(ADT308, TCN000, 15000) != 1 (world unit = 1 m, so 15 km) if unit_state(ADT308) == 1 data/isl-stage02-conditions.txt was a stale artefact with NO generator -- the thing isl_report.py's docstring complained about. It has one now (isl_report.py conditions). The calls and phase-ends artefacts both regenerate byte-identical, so the change is additive. Recorded rather than glossed: 15 of Stage 02's 965 sites (1.6%) attribute the LHS to end_coroutine, which returns no value -- the tracker sets special[0] on EVERY call, so those show a stale value and are wrong, not imprecise. The fix is to set it only for built-ins that write [phase+164], which the vtable work makes checkable. --- docs/re/BACKLOG.md | 21 +- docs/re/data/isl-stage02-conditions.txt | 1332 +++++++++++++++++------ docs/re/structures/isl-conditions.md | 94 ++ tools/re-capture/isl.py | 76 ++ tools/re-capture/isl_report.py | 34 +- 5 files changed, 1214 insertions(+), 343 deletions(-) create mode 100644 docs/re/structures/isl-conditions.md diff --git a/docs/re/BACKLOG.md b/docs/re/BACKLOG.md index 52742988..9245870a 100644 --- a/docs/re/BACKLOG.md +++ b/docs/re/BACKLOG.md @@ -1412,9 +1412,26 @@ premise was wrong.** db's own `vptr_writes`. `unit_state` = slot 184 = `0x8226ADF0`, which indexes `[phase+324]` by `local[4]` and writes its answer to **`[phase+164]` = `special[0]`**. So: **result → `special[0]`, comparand popped → `special[1]`, - then `cmp.i` + branch.** ▶️ **Still open:** the other 111 vtable slots are a + then `cmp.i` + branch.** ~~▶️ **Still open:** the other 111 vtable slots are a lookup but unread; which comparand each site pushes (needs `push.i` tracked - through the decode); the 35 non-vtable built-ins; the vtable's length. The condition lives in the `op10`/`op13` poll loop upstream of + through the decode); the 35 non-vtable built-ins; the vtable's length.~~ + ✅ **(2026-08-27) COMPARANDS RESOLVED — [structures/isl-conditions](structures/isl-conditions.md).** + The deques are an **expression stack**: push the left operand, evaluate the + right (result → `special[0]`), pop → `special[1]`, compare. Evidence: push/pop + balance **1877/1877 across 28 stages with ZERO underflows**, and **319/319** + Stage-02 `pop.i` sites are immediately followed by `cmp.i`. `isl.conditions()` + now recovers **7563 condition sites disc-wide with 0.0 % left unresolved** + (83.2 % have a built-in call as LHS, 99.7 % compare against a plain number). + `data/isl-stage02-conditions.txt` finally has a generator + (`isl_report.py conditions`); the other two artefacts regenerate identical. + Top predicates: `hp_pct_test` 1955, `unit_state` 1257, `unit_relation` 796, + `dist_lt` 450. 🟡 **1.6 % are WRONG:** 15 sites attribute the LHS to + `end_coroutine`, which returns nothing — the tracker sets `special[0]` on every + call, so those show a stale value. Fix = only set it for built-ins that write + `[phase+164]`. ▶️ **Still open:** the 35 unnamed built-ins (`builtin16` 132 + sites, `builtin105` 117, `builtin103` 115 — each now a vtable-slot lookup); + which condition guards each `END_PHASE` (needs the control flow between them); + the vtable's length. The condition lives in the `op10`/`op13` poll loop upstream of the outro — e.g. phase 3 polls `unit_state(ADT308)` and branches back to `0xFEB4` until it passes. Artefact: `data/isl-stage02-phase-ends.txt`. * 🐛 **(2026-08-25) The nav fix is NOT fully reliable.** `dialog_up.py` works on diff --git a/docs/re/data/isl-stage02-conditions.txt b/docs/re/data/isl-stage02-conditions.txt index f0065f79..c5f6e14d 100644 --- a/docs/re/data/isl-stage02-conditions.txt +++ b/docs/re/data/isl-stage02-conditions.txt @@ -1,345 +1,997 @@ -# Stage02.ssb -- condition sites, symbols resolved -# unit args are symbol-table-2 indices; resolved to names. +# Stage02.ssb — condition sites, comparands resolved -== set_flag: 12 sites - -- 0x2BE8 - 002A50: builtin91(0x1, 0x6F, 0x1) - 002A8C: builtin91(0x1, 0x0, 0x1) - 002AB0: start_coroutine(0x4C2C) - 002AD4: start_coroutine(0x64C0) - 002AF8: start_coroutine(0x6198) - 002B7C: builtin75(0x39, 0x3A, 0x3B, 0x3C, 0x3D) - 002BA0: play_stream(0x3ED) - 002BC4: builtin38(0x1) - 002BE8: set_flag(0x5) - -- 0x2DCC - 002A8C: builtin91(0x1, 0x0, 0x1) - 002AB0: start_coroutine(0x4C2C) - 002AD4: start_coroutine(0x64C0) - 002AF8: start_coroutine(0x6198) - 002B7C: builtin75(0x39, 0x3A, 0x3B, 0x3C, 0x3D) - 002BA0: play_stream(0x3ED) - 002BC4: builtin38(0x1) - 002BE8: set_flag(0x5) - 002BF4: yield - -- 0xF7C0 - 00F4E4: objective_marker(0x1, 0x2D, 0x0, 0x8, 0x0) - 00F524: unit_state(0x1, ADN110) - 00F5A8: objective_marker(0x1, 0x1, 0x0, 0x8, 0x0) - 00F5E8: unit_state(0x1, ADN111) - 00F66C: objective_marker(0x1, 0x2, 0x0, 0x8, 0x0) - 00F6AC: unit_state(0x1, ADN112) - 00F730: objective_marker(0x1, 0x5, 0x0, 0x8, 0x0) - 00F79C: objective_marker(0x1, 0x3A, 0x1, 0x8, 0x0) - 00F7C0: set_flag(0x8) - -- 0x183B8 - 018220: start_coroutine(0x77D0) - 018244: start_coroutine(0x8718) - 018268: start_coroutine(0x91DC) - 0182A4: builtin79(0x1, 0x6, 0x1, 0x75) - 0182C8: start_coroutine(0x9264) - 01834C: builtin75(0xBC, 0xBD, 0xBE, 0xBF, 0xC0) - 018370: play_stream(0x3EB) - 018394: builtin38(0x1) - 0183B8: set_flag(0x5) - -- 0x18504 - 018244: start_coroutine(0x8718) - 018268: start_coroutine(0x91DC) - 0182A4: builtin79(0x1, 0x6, 0x1, 0x75) - 0182C8: start_coroutine(0x9264) - 01834C: builtin75(0xBC, 0xBD, 0xBE, 0xBF, 0xC0) - 018370: play_stream(0x3EB) - 018394: builtin38(0x1) - 0183B8: set_flag(0x5) - 0183C4: yield - -- 0x1A8B8 - 01A56C: unit_alive(0x1, ADN227) - 01A5C8: unit_alive(0x1, ADN228) - 01A624: unit_alive(0x1, ADN229) - 01A680: unit_alive(0x1, ADN230) - 01A6DC: unit_alive(0x1, ADN231) - 01A738: unit_alive(0x1, ADN232) - 01A824: builtin64(0xC3, 0x2, 0x1, 0x9, 0x1, -1) - 01A87C: named_event(0xC4) - 01A8B8: set_flag(0xE) - -- 0x1A980 - 01A680: unit_alive(0x1, ADN230) - 01A6DC: unit_alive(0x1, ADN231) - 01A738: unit_alive(0x1, ADN232) - 01A824: builtin64(0xC3, 0x2, 0x1, 0x9, 0x1, -1) - 01A87C: named_event(0xC4) - 01A8B8: set_flag(0xE) - 01A914: hp_pct_test(0x1, TCT206, 89.9) - 01A950: named_event(0xC5) - 01A980: set_flag(0xF) - -- 0x23750 - 023474: objective_marker(0x1, 0x1B, 0x0, 0x8, 0x0) - 0234B4: unit_state(0x1, ADN206) - 023538: objective_marker(0x1, 0x22, 0x0, 0x8, 0x0) - 023578: unit_state(0x1, ADN208) - 0235FC: objective_marker(0x1, 0x2F, 0x0, 0x8, 0x0) - 02363C: unit_state(0x1, ADN209) - 0236C0: objective_marker(0x1, 0x35, 0x0, 0x8, 0x0) - 02372C: objective_marker(0x1, 0x40, 0x1, 0x8, 0x0) - 023750: set_flag(0x8) - -- 0x289D0 - 028808: builtin91(0x1, 0x56, 0x1) - 028844: builtin91(0x1, 0x74, 0x1) - 028880: builtin91(0x1, 0x78, 0x1) - 0288BC: builtin91(0x1, 0x5D, 0x1) - 0288E0: start_coroutine(0x694C) - 028964: builtin75(0x124, 0x125, 0x126, 0x127, 0x128) - 028988: play_stream(0x3EE) - 0289AC: builtin38(0x1) - 0289D0: set_flag(0x5) - -- 0x28B1C - 028844: builtin91(0x1, 0x74, 0x1) - 028880: builtin91(0x1, 0x78, 0x1) - 0288BC: builtin91(0x1, 0x5D, 0x1) - 0288E0: start_coroutine(0x694C) - 028964: builtin75(0x124, 0x125, 0x126, 0x127, 0x128) - 028988: play_stream(0x3EE) - 0289AC: builtin38(0x1) - 0289D0: set_flag(0x5) - 0289DC: yield - -- 0x2CB60 - 02C900: hp_pct_test(0x1, ADN327, 0) - 02C954: hp_pct_test(0x1, ADN328, 0) - 02C9A8: hp_pct_test(0x1, ADN329, 0) - 02C9FC: hp_pct_test(0x1, ADN330, 0) - 02CA50: hp_pct_test(0x1, ADN331, 0) - 02CAA4: hp_pct_test(0x1, ADN332, 0) - 02CAF8: hp_pct_test(0x1, ADS351, 0) - 02CB30: named_event(0x132) - 02CB60: set_flag(0xE) - -- 0x2CC68 - 02C9FC: hp_pct_test(0x1, ADN330, 0) - 02CA50: hp_pct_test(0x1, ADN331, 0) - 02CAA4: hp_pct_test(0x1, ADN332, 0) - 02CAF8: hp_pct_test(0x1, ADS351, 0) - 02CB30: named_event(0x132) - 02CB60: set_flag(0xE) - 02CC00: builtin64(0x133, 0x2, 0x1, 0x9, 0x1, -1) - 02CC38: named_event(0x134) - 02CC68: set_flag(0xF) +Generated by `tools/re-capture/isl_report.py conditions`. -== END_PHASE: 12 sites - -- 0x51E4 - 004EFC: builtin64(0x3F, 0x2, 0x1, 0x9, 0x1, -1) - 004FA4: builtin64(0x40, 0x2, 0x1, 0x9, 0x1, -1) - 00504C: builtin64(0x41, 0x2, 0x1, 0x9, 0x1, -1) - 0050F4: builtin64(0x42, 0x2, 0x1, 0x9, 0x1, -1) - 005160: wait_cmds_drained - 005188: fade_sound(3) - 0051B0: builtin85(3) - 0051D8: wait_s(3) - 0051E4: END_PHASE - -- 0x5828 - 005518: builtin64(0x1, 0x9, 0x1, -1) - 0055C0: builtin64(0x46, 0x2, 0x1, 0x9, 0x1, -1) - 005668: builtin64(0x47, 0x2, 0x1, 0x9, 0x1, -1) - 005710: builtin64(0x48, 0x2, 0x1, 0x9, 0x1, -1) - 0057A4: wait_cmds_drained - 0057CC: fade_sound(3) - 0057F4: builtin85(3) - 00581C: wait_s(3) - 005828: END_PHASE - -- 0x6010 - 005E24: hp_pct_test(0x1, ADN112, 0) - 005E78: hp_pct_test(0x1, ADN114, 0) - 005ECC: hp_pct_test(0x1, ADN115, 0) - 005F80: builtin64(0x4A, 0x2, 0x1, 0x9, 0x1, -1) - 005F8C: wait_cmds_drained - 005FB4: fade_sound(3) - 005FDC: builtin85(3) - 006004: wait_s(3) - 006010: END_PHASE - -- 0x6260 - 0060FC: MARK_LAST_PHASE - 006108: builtin82 - 006130: wait_s(4) - 0061D0: builtin64(0x4B, 0x2, 0x1, 0x9, 0x1, -1) - 0061DC: wait_cmds_drained - 006204: fade_sound(3) - 00622C: builtin85(3) - 006254: wait_s(3) - 006260: END_PHASE - -- 0x19640 - 019358: builtin64(0x3F, 0x2, 0x1, 0x9, 0x1, -1) - 019400: builtin64(0x40, 0x2, 0x1, 0x9, 0x1, -1) - 0194A8: builtin64(0x41, 0x2, 0x1, 0x9, 0x1, -1) - 019550: builtin64(0x42, 0x2, 0x1, 0x9, 0x1, -1) - 0195BC: wait_cmds_drained - 0195E4: fade_sound(3) - 01960C: builtin85(3) - 019634: wait_s(3) - 019640: END_PHASE - -- 0x19934 - 019758: wait_s(4) - 0197F8: builtin64(0xC1, 0x2, 0x1, 0x9, 0x1, -1) - 019804: wait_cmds_drained - 0198A4: builtin64(0xC2, 0x2, 0x1, 0x9, 0x1, -1) - 0198B0: wait_cmds_drained - 0198D8: fade_sound(3) - 019900: builtin85(3) - 019928: wait_s(3) - 019934: END_PHASE - -- 0x1AC44 - 01AAE0: builtin64(0xC7, 0x2, 0x1, 0x9, 0x1, -1) - 01AAEC: wait_cmds_drained - 01AB44: read_freg(5) - 01AB80: read_freg(5) - 01ABC0: wait_s(5) - 01ABE8: fade_sound(3) - 01AC10: builtin85(3) - 01AC38: wait_s(3) - 01AC44: END_PHASE - -- 0x2B96C - 02B684: builtin64(0x3F, 0x2, 0x1, 0x9, 0x1, -1) - 02B72C: builtin64(0x40, 0x2, 0x1, 0x9, 0x1, -1) - 02B7D4: builtin64(0x41, 0x2, 0x1, 0x9, 0x1, -1) - 02B87C: builtin64(0x42, 0x2, 0x1, 0x9, 0x1, -1) - 02B8E8: wait_cmds_drained - 02B910: fade_sound(3) - 02B938: builtin85(3) - 02B960: wait_s(3) - 02B96C: END_PHASE - -- 0x2BFB0 - 02BCA0: builtin64(0x1, 0x9, 0x1, -1) - 02BD48: builtin64(0x46, 0x2, 0x1, 0x9, 0x1, -1) - 02BDF0: builtin64(0x47, 0x2, 0x1, 0x9, 0x1, -1) - 02BE98: builtin64(0x48, 0x2, 0x1, 0x9, 0x1, -1) - 02BF2C: wait_cmds_drained - 02BF54: fade_sound(3) - 02BF7C: builtin85(3) - 02BFA4: wait_s(3) - 02BFB0: END_PHASE - -- 0x2C1E0 - 02C060: builtin82 - 02C088: wait_s(4) - 02C0B0: wait_s(5) - 02C150: builtin64(0x131, 0x2, 0x1, 0x9, 0x1, -1) - 02C15C: wait_cmds_drained - 02C184: fade_sound(3) - 02C1AC: builtin85(3) - 02C1D4: wait_s(3) - 02C1E0: END_PHASE - -- 0x2CF74 - 02CDBC: wait_cmds_drained - 02CE14: read_freg(5) - 02CE50: read_freg(5) - 02CE90: wait_s(5) - 02CECC: builtin99 - 02CF18: fade_sound(3) - 02CF40: builtin85(3) - 02CF68: wait_s(3) - 02CF74: END_PHASE - -- 0x2D1DC - 02D06C: mark_not_last - 02D078: builtin78 - 02D0A0: wait_s(4) - 02D140: builtin64(0x136, 0x2, 0x1, 0x9, 0x1, -1) - 02D14C: wait_cmds_drained - 02D180: fade_sound(3) - 02D1A8: builtin85(3) - 02D1D0: wait_s(3) - 02D1DC: END_PHASE +The deque ops are an expression stack: `push.i` saves the comparand, +the right-hand side is evaluated (its result lands in `special[0]`), +`pop.i` restores the comparand into `special[1]`, then `cmp.i` compares. -== FORCE_END_PHASE: 3 sites - -- 0x1482C - 0144B0: builtin64 - -- 0x249F0 - 0246B0: unit_state(0x1, ADN208) - 0246EC: start_coroutine(0xD5A8) - 0246F8: yield - 02474C: unit_state(0x1, ADN209) - 024788: start_coroutine(0xD5A8) - 024794: yield - -- 0x34A10 - 034868: unit_state(0x1, ADT305) - 03488C: yield - 0348E0: unit_state(0x1, ADT306) - 034904: yield - 034958: unit_state(0x1, ADT307) - 03497C: yield - 0349D0: unit_state(0x1, ADT308) - 0349F4: yield - 034A00: yield +965 condition sites; phase bases 0xe4 0x14aa8 0x24b4c -== MARK_LAST_PHASE: 8 sites - -- 0x4DFC - 004A94: start_coroutine(0x7290) - 004AB8: start_coroutine(0x8A68) - 004ADC: start_coroutine(0x93D8) - 004AE8: yield - -- 0x52C8 - 0051F0: yield - 005230: hp_pct_test(0x1, TCN004, 0) - 005268: builtin116(0x0) - 005274: builtin101 - 005280: push_trigger - 00528C: timer_stop - 0052B0: clear_flag(0xFFFFFFFF) - 0052BC: builtin118 - 0052C8: MARK_LAST_PHASE - -- 0x60FC - 00601C: yield - 006060: read_freg(0x0) - 00609C: builtin116(0x0) - 0060A8: builtin101 - 0060B4: push_trigger - 0060C0: timer_stop - 0060E4: clear_flag(0xFFFFFFFF) - 0060F0: builtin118 - 0060FC: MARK_LAST_PHASE - -- 0x19258 - 018F04: builtin58(0x1, 0x35, 0x1) - 018F5C: builtin15(0x1, 0x35, 0x2, 380) - 018FB0: builtin47(0x1, 0x35, 0x1, 0x75, 0x0) - 018FF0: hp_pct_test(0x1, ADN208, 0) - 019028: builtin63(0x1, 0x4E) - 01907C: builtin47(0x1, 0x4E, 0x1, 0x35, 0x1) - 0190D8: builtin47(0x1, 0x4E, 0x1, 0x35, 0x0) - 0190FC: start_coroutine(0xC48C) - 019108: yield - -- 0x19724 - 01964C: yield - 01968C: hp_pct_test(0x1, TCT206, 0) - 0196C4: builtin116(0x0) - 0196D0: builtin101 - 0196DC: push_trigger - 0196E8: timer_stop - 01970C: clear_flag(0xFFFFFFFF) - 019718: builtin118 - 019724: MARK_LAST_PHASE - -- 0x2B584 - 02B304: builtin47(0x1, 0x51, 0x1, 0x15, 0x0) - 02B328: start_coroutine(0x9680) - 02B34C: start_coroutine(0x9708) - 02B370: start_coroutine(0x9790) - 02B394: start_coroutine(0xA2D8) - 02B3B8: start_coroutine(0xA4F8) - 02B3DC: start_coroutine(0xAA10) - 02B47C: builtin64(0x130, 0x2, 0x0, 0x8, 0x1, -1) - 02B488: yield - -- 0x2BA50 - 02B978: yield - 02B9B8: hp_pct_test(0x1, TCN004, 0) - 02B9F0: builtin116(0x0) - 02B9FC: builtin101 - 02BA08: push_trigger - 02BA14: timer_stop - 02BA38: clear_flag(0xFFFFFFFF) - 02BA44: builtin118 - 02BA50: MARK_LAST_PHASE - -- 0x2C054 - 02BFB0: END_PHASE - 02BFBC: yield - 02BFF4: builtin116(0x0) - 02C000: builtin101 - 02C00C: push_trigger - 02C018: timer_stop - 02C03C: clear_flag(0xFFFFFFFF) - 02C048: builtin118 - 02C054: MARK_LAST_PHASE +## most-tested predicates + unit_state 255 + hp_pct_test 167 + dist_lt 92 + unit_alive 71 + unit_relation 52 + builtin103 39 + builtin105 38 + builtin80 28 + request_script_message 26 + end_coroutine 15 + read_freg 10 + unit_hp_pct 9 + builtin7 9 + builtin83 2 + builtin99 1 +## phase 1 — 435 sites + 0x002E48 if builtin103() != 1 -> 0x322C + 0x0032F4 if unit_alive(TCN105) != 1 -> 0x3388 + 0x0044A4 if unit_alive(TCN105) != 1 -> 0x4538 + 0x004D70 if unit_hp_pct(TCN001, Character_Player_Test) != 0 -> 0x51FC + 0x005110 if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 0 -> 0x4E68 + 0x005124 if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 1 -> 0x4F10 + 0x005138 if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 2 -> 0x4FB8 + 0x00514C if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 3 -> 0x5060 + 0x00523C if hp_pct_test(TCN004, 0) != 1 -> 0x5840 + 0x00572C if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 0 -> 0x5334 + 0x005740 if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 1 -> 0x53DC + 0x005754 if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 2 -> 0x5484 + 0x005768 if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 3 -> 0x552C + 0x00577C if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 4 -> 0x55D4 + 0x005790 if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 5 -> 0x567C + 0x005888 if read_freg(0) <= 210 -> 0x6028 + 0x0058DC if hp_pct_test(ADT102, 0) != 1 -> 0x6028 + 0x005930 if hp_pct_test(ADT107, 0) != 1 -> 0x6028 + 0x005984 if hp_pct_test(ADT113, 0) != 1 -> 0x6028 + 0x005B3C if hp_pct_test(ADN101, 0) != 1 -> 0x5F98 + 0x005B90 if hp_pct_test(ADN103, 0) != 1 -> 0x5F98 + 0x005BE4 if hp_pct_test(ADN104, 0) != 1 -> 0x5F98 + 0x005C38 if hp_pct_test(ADN105, 0) != 1 -> 0x5F98 + 0x005C8C if hp_pct_test(ADN106, 0) != 1 -> 0x5F98 + 0x005CE0 if hp_pct_test(ADN108, 0) != 1 -> 0x5F98 + 0x005D34 if hp_pct_test(ADN109, 0) != 1 -> 0x5F98 + 0x005D88 if hp_pct_test(ADN110, 0) != 1 -> 0x5F98 + 0x005DDC if hp_pct_test(ADN111, 0) != 1 -> 0x5F98 + 0x005E30 if hp_pct_test(ADN112, 0) != 1 -> 0x5F98 + 0x005E84 if hp_pct_test(ADN114, 0) != 1 -> 0x5F98 + 0x005ED8 if hp_pct_test(ADN115, 0) != 1 -> 0x5F98 + 0x006070 if read_freg(0) < 1200 -> 0x6278 + 0x0062C0 if unit_state(ADS151) != 2 -> 0x65A0 + 0x0062F8 if builtin105(ADS151) != 1 -> 0x6594 + 0x006330 if unit_alive(TCS151) != 1 -> 0x6594 + 0x0064D8 if builtin103() != 1 -> 0x64F4 + 0x0065E4 if hp_pct_test(ADN131, 0) != 1 -> 0x69BC + 0x006638 if hp_pct_test(ADN132, 0) != 1 -> 0x69BC + 0x00668C if hp_pct_test(ADN133, 0) != 1 -> 0x69BC + 0x0066E0 if hp_pct_test(ADN134, 0) != 1 -> 0x69BC + 0x006734 if hp_pct_test(ADN135, 0) != 1 -> 0x69BC + 0x006788 if hp_pct_test(ADN136, 0) != 1 -> 0x69BC + 0x0067DC if hp_pct_test(ADN137, 0) != 1 -> 0x69BC + 0x006830 if hp_pct_test(ADN138, 0) != 1 -> 0x69BC + 0x006884 if hp_pct_test(ADN139, 0) != 1 -> 0x69BC + 0x0068D8 if hp_pct_test(ADN140, 0) != 1 -> 0x69BC + 0x006A00 if hp_pct_test(ADN101, 0) != 1 -> 0x6DE0 + 0x006A54 if hp_pct_test(ADN103, 0) != 1 -> 0x6DE0 + 0x006AA8 if hp_pct_test(ADN104, 0) != 1 -> 0x6DE0 + 0x006AFC if hp_pct_test(ADN105, 0) != 1 -> 0x6DE0 + 0x006B50 if hp_pct_test(ADN106, 0) != 1 -> 0x6DE0 + 0x006BA4 if hp_pct_test(ADN108, 0) != 1 -> 0x6DE0 + 0x006BF8 if hp_pct_test(ADN109, 0) != 1 -> 0x6DE0 + 0x006C4C if hp_pct_test(ADN110, 0) != 1 -> 0x6DE0 + 0x006CA0 if hp_pct_test(ADN111, 0) != 1 -> 0x6DE0 + 0x006CF4 if hp_pct_test(ADN112, 0) != 1 -> 0x6DE0 + 0x006D48 if hp_pct_test(ADN114, 0) != 1 -> 0x6DE0 + 0x006D9C if hp_pct_test(ADN115, 0) != 1 -> 0x6DE0 + 0x006E24 if hp_pct_test(ADN103, 0) != 1 -> 0x6E44 + 0x006E84 if hp_pct_test(TCN105, 0) != 1 -> 0x6EE0 + 0x006F3C if dist_lt(ADN106, TCN001, 5000) != 1 -> 0x6FAC + 0x007038 if hp_pct_test(ADN108, 0) != 1 -> 0x7058 + 0x007098 if hp_pct_test(ADT107, 0) != 1 -> 0x70F4 + 0x007150 if dist_lt(ADN109, TCN001, 5000) != 1 -> 0x71C0 + 0x00724C if hp_pct_test(ADN112, 0) != 1 -> 0x726C + 0x0072AC if hp_pct_test(ADN112, 0) != 1 -> 0x7308 + 0x007350 if unit_alive(ADT113) != 2 -> 0x7370 + 0x0073B8 if unit_alive(ADN114) != 2 -> 0x73D8 + 0x00741C if unit_alive(ADT113) != 2 -> 0x7478 + 0x007488 if builtin103() != 1 -> 0x7544 + 0x008454 if hp_pct_test(ADN105, 0) == 1 -> 0x84BC + 0x0084A8 if hp_pct_test(TCN003, 0) != 1 -> 0x84C8 + 0x008520 if dist_lt(ADN105, TCN003, 10000) != 1 -> 0x85E0 + 0x008624 if hp_pct_test(ADN106, 0) != 1 -> 0x8644 + 0x00869C if dist_lt(ADN106, TCN004, 10000) != 1 -> 0x875C + 0x0087A0 if hp_pct_test(ADT107, 0) != 1 -> 0x87C0 + 0x008818 if dist_lt(ADT107, TCN001, 10000) != 1 -> 0x8978 + 0x0089BC if hp_pct_test(ADN112, 0) == 1 -> 0x8A24 + 0x008A10 if hp_pct_test(TCN105, 0) != 1 -> 0x8A30 + 0x008A88 if dist_lt(ADN112, TCN105, 10000) != 1 -> 0x8B48 + 0x008B8C if hp_pct_test(ADT113, 0) != 1 -> 0x8BAC + 0x008C04 if dist_lt(ADT113, TCN001, 10000) != 1 -> 0x8E24 + 0x008C24 if builtin103() != 1 -> 0x8CD8 + 0x008E68 if hp_pct_test(ADT102, 50) != 1 -> 0x8F4C + 0x008F90 if hp_pct_test(ADT102, 0) != 1 -> 0x9138 + 0x008FB0 if builtin103() != 1 -> 0x908C + 0x008FC4 if global[20] == 1 -> 0x8FEC + 0x008FD8 if global[20] != 29 -> 0x908C + 0x00917C if hp_pct_test(ADT107, 50) != 1 -> 0x9260 + 0x0092A4 if hp_pct_test(ADT107, 0) != 1 -> 0x94B8 + 0x0092B8 if global[8] != 1 -> 0x936C + 0x0094FC if hp_pct_test(ADT113, 50) != 1 -> 0x95E0 + 0x009624 if hp_pct_test(ADT113, 25) != 1 -> 0x96E4 + 0x009728 if hp_pct_test(TCN003, 50) != 1 -> 0x97E8 + 0x00982C if hp_pct_test(TCS151, 0) == 1 -> 0x9894 + 0x009880 if hp_pct_test(ADS151, 0) != 1 -> 0x98A0 + 0x0098DC if unit_relation(TCS151, ADS151) == 1 -> 0x9940 + 0x00992C if unit_relation(ADS151, TCS151) != 1 -> 0x9A84 + 0x009A58 if builtin103() != 1 -> 0x9A78 + 0x009AC8 if hp_pct_test(ADS151, 0) != 1 -> 0x9BF4 + 0x009C38 if hp_pct_test(TCN003, 75) != 1 -> 0x9D1C + 0x009D60 if hp_pct_test(ADT107, 0) == 1 -> 0x9DC8 + 0x009DB4 if hp_pct_test(TCN004, 0) != 1 -> 0x9DD4 + 0x009E2C if dist_lt(ADT107, TCN004, 15000) != 1 -> 0x9EF8 + 0x009F3C if hp_pct_test(TCN004, 70) != 1 -> 0xA09C + 0x00A0CC if builtin103() != 0 -> 0xA0EC + 0x00A130 if unit_state(ADT102) != 1 -> 0xA1EC + 0x00A230 if unit_state(ADT107) != 1 -> 0xA394 + 0x00A3D8 if unit_state(ADT113) != 1 -> 0xA53C + 0x00A580 if unit_state(ADN101) != 1 -> 0xA6B0 + 0x00A5EC if dist_lt(TCN001, ADN101, 5000) != 1 -> 0xA6B0 + 0x00A6F4 if unit_state(ADN103) != 1 -> 0xA824 + 0x00A760 if dist_lt(TCN001, ADN103, 5000) != 1 -> 0xA824 + 0x00A868 if unit_state(ADN104) != 1 -> 0xA998 + 0x00A8D4 if dist_lt(TCN001, ADN104, 5000) != 1 -> 0xA998 + 0x00A9DC if unit_state(ADN106) != 1 -> 0xAB0C + 0x00AA48 if dist_lt(TCN001, ADN106, 5000) != 1 -> 0xAB0C + 0x00AB50 if unit_state(ADN108) != 1 -> 0xAC80 + 0x00ABBC if dist_lt(TCN001, ADN108, 5000) != 1 -> 0xAC80 + 0x00ACC4 if unit_state(ADN109) != 1 -> 0xADF4 + 0x00AD30 if dist_lt(TCN001, ADN109, 5000) != 1 -> 0xADF4 + 0x00AE38 if unit_state(ADN110) != 1 -> 0xAF68 + 0x00AEA4 if dist_lt(TCN001, ADN110, 5000) != 1 -> 0xAF68 + 0x00AFAC if unit_state(ADN111) != 1 -> 0xB0DC + 0x00B018 if dist_lt(TCN001, ADN111, 5000) != 1 -> 0xB0DC + 0x00B120 if unit_state(ADN112) != 1 -> 0xB250 + 0x00B18C if dist_lt(TCN001, ADN112, 5000) != 1 -> 0xB250 + 0x00B294 if unit_state(ADN101) != 1 -> 0xB358 + 0x00B39C if unit_state(ADN103) != 1 -> 0xB460 + 0x00B4A4 if unit_state(ADN104) != 1 -> 0xB568 + 0x00B5AC if unit_state(ADN106) != 1 -> 0xB670 + 0x00B6B4 if unit_state(ADN108) != 1 -> 0xB778 + 0x00B7BC if unit_state(ADN109) != 1 -> 0xB880 + 0x00B8C4 if unit_state(ADN110) != 1 -> 0xB988 + 0x00B9CC if unit_state(ADN111) != 1 -> 0xBA90 + 0x00BAD4 if unit_state(ADN112) != 1 -> 0xBB98 + 0x00BBF0 if builtin103() != 0 -> 0xBC10 + 0x00BC70 if unit_hp_pct(TCN001, Character_Player_Test) > 40 -> 0xC8F0 + 0x00BC84 if global[20] == 26 -> 0xC8F0 + 0x00BEC0 if unit_state(ADT102) != 1 -> 0xBF40 + 0x00BF84 if unit_state(ADT107) != 1 -> 0xC004 + 0x00C048 if unit_state(ADT113) != 1 -> 0xC0C8 + 0x00C10C if unit_state(ADN101) != 1 -> 0xC18C + 0x00C1D0 if unit_state(ADN103) != 1 -> 0xC250 + 0x00C294 if unit_state(ADN104) != 1 -> 0xC314 + 0x00C358 if unit_state(ADN106) != 1 -> 0xC3D8 + 0x00C41C if unit_state(ADN108) != 1 -> 0xC49C + 0x00C4E0 if unit_state(ADN109) != 1 -> 0xC560 + 0x00C5A4 if unit_state(ADN110) != 1 -> 0xC624 + 0x00C668 if unit_state(ADN111) != 1 -> 0xC6E8 + 0x00C72C if unit_state(ADN112) != 1 -> 0xC7AC + 0x00C7F0 if unit_state(ADS151) != 1 -> 0xC870 + 0x00C930 if hp_pct_test(TCN004, 50, 26) != 1 -> 0xEC70 + 0x00C944 if global[20] > 25 -> 0xEC70 + 0x00C99C if unit_state(ADN101) != 1 -> 0xCA08 + 0x00C9EC if unit_relation(ADN101, TCN004) != 1 -> 0xCA08 + 0x00CA4C if unit_state(ADT102) != 1 -> 0xCAB8 + 0x00CA9C if unit_relation(ADT102, TCN004) != 1 -> 0xCAB8 + 0x00CAFC if unit_state(ADN103) != 1 -> 0xCB68 + 0x00CB4C if unit_relation(ADN103, TCN004) != 1 -> 0xCB68 + 0x00CBAC if unit_state(ADN104) != 1 -> 0xCC18 + 0x00CBFC if unit_relation(ADN104, TCN004) != 1 -> 0xCC18 + 0x00CC5C if unit_state(ADN105) != 1 -> 0xCCC8 + 0x00CCAC if unit_relation(ADN105, TCN004) != 1 -> 0xCCC8 + 0x00CD0C if unit_state(ADN106) != 1 -> 0xCD78 + 0x00CD5C if unit_relation(ADN106, TCN004) != 1 -> 0xCD78 + 0x00CDBC if unit_state(ADT107) != 1 -> 0xCE28 + 0x00CE0C if unit_relation(ADT107, TCN004) != 1 -> 0xCE28 + 0x00CE6C if unit_state(ADN108) != 1 -> 0xCED8 + 0x00CEBC if unit_relation(ADN108, TCN004) != 1 -> 0xCED8 + 0x00CF1C if unit_state(ADN109) != 1 -> 0xCF88 + 0x00CF6C if unit_relation(ADN109, TCN004) != 1 -> 0xCF88 + 0x00CFCC if unit_state(ADN110) != 1 -> 0xD038 + 0x00D01C if unit_relation(ADN110, TCN004) != 1 -> 0xD038 + 0x00D07C if unit_state(ADN111) != 1 -> 0xD0E8 + 0x00D0CC if unit_relation(ADN111, TCN004) != 1 -> 0xD0E8 + 0x00D12C if unit_state(ADN112) != 1 -> 0xD198 + 0x00D17C if unit_relation(ADN112, TCN004) != 1 -> 0xD198 + 0x00D1DC if unit_state(ADT113) != 1 -> 0xD248 + 0x00D22C if unit_relation(ADT113, TCN004) != 1 -> 0xD248 + 0x00D28C if unit_state(ADN114) != 1 -> 0xD2F8 + 0x00D2DC if unit_relation(ADN114, TCN004) != 1 -> 0xD2F8 + 0x00D33C if unit_state(ADN115) != 1 -> 0xEC70 + 0x00D38C if unit_relation(ADN115, TCN004) != 1 -> 0xEC70 + 0x00D3E4 if unit_state(ADT102) != 1 -> 0xD464 + 0x00D4A8 if unit_state(ADT107) != 1 -> 0xD528 + 0x00D56C if unit_state(ADT113) != 1 -> 0xD5EC + 0x00D630 if unit_state(ADN101) != 1 -> 0xD6B0 + 0x00D6F4 if unit_state(ADN103) != 1 -> 0xD774 + 0x00D7B8 if unit_state(ADN104) != 1 -> 0xD838 + 0x00D87C if unit_state(ADN106) != 1 -> 0xD8FC + 0x00D940 if unit_state(ADN108) != 1 -> 0xD9C0 + 0x00DA04 if unit_state(ADN109) != 1 -> 0xDA84 + 0x00DAC8 if unit_state(ADN110) != 1 -> 0xDB48 + 0x00DB8C if unit_state(ADN111) != 1 -> 0xDC0C + 0x00DC50 if unit_state(ADN112) != 1 -> 0xDCD0 + 0x00DD14 if unit_state(ADS151) != 1 -> 0xDD94 + 0x00DDD0 if unit_relation(ADN101, TCN004) != 1 -> 0xDE64 + 0x00DEA0 if unit_relation(ADT102, TCN004) != 1 -> 0xDF34 + 0x00DF70 if unit_relation(ADN103, TCN004) != 1 -> 0xE004 + 0x00E040 if unit_relation(ADN104, TCN004) != 1 -> 0xE0D4 + 0x00E110 if unit_relation(ADN105, TCN004) != 1 -> 0xE1A4 + 0x00E1E0 if unit_relation(ADN106, TCN004) != 1 -> 0xE274 + 0x00E2B0 if unit_relation(ADT107, TCN004) != 1 -> 0xE344 + 0x00E380 if unit_relation(ADN108, TCN004) != 1 -> 0xE414 + 0x00E450 if unit_relation(ADN109, TCN004) != 1 -> 0xE4E4 + 0x00E520 if unit_relation(ADN110, TCN004) != 1 -> 0xE5B4 + 0x00E5F0 if unit_relation(ADN111, TCN004) != 1 -> 0xE684 + 0x00E6C0 if unit_relation(ADN112, TCN004) != 1 -> 0xE754 + 0x00E790 if unit_relation(ADT113, TCN004) != 1 -> 0xE824 + 0x00E860 if unit_relation(ADN114, TCN004) != 1 -> 0xE8F4 + 0x00E930 if unit_relation(ADN115, TCN004) != 1 -> 0xE9BC + 0x00E9BC if global[32] != 0 -> 0xEA84 + 0x00EC70 if global[24] != 0 -> 0xF7CC + 0x00EC84 if global[20] > 25 -> 0xF7CC + 0x00EC98 if global[28] != 1 -> 0xF7CC + 0x00EE50 if unit_state(ADT102, 1) != 1 -> 0xEED0 + 0x00EF14 if unit_state(ADT107) != 1 -> 0xEF94 + 0x00EFD8 if unit_state(ADT113) != 1 -> 0xF058 + 0x00F09C if unit_state(ADN101) != 1 -> 0xF11C + 0x00F160 if unit_state(ADN103) != 1 -> 0xF1E0 + 0x00F224 if unit_state(ADN104) != 1 -> 0xF2A4 + 0x00F2E8 if unit_state(ADN106) != 1 -> 0xF368 + 0x00F3AC if unit_state(ADN108) != 1 -> 0xF42C + 0x00F470 if unit_state(ADN109) != 1 -> 0xF4F0 + 0x00F534 if unit_state(ADN110) != 1 -> 0xF5B4 + 0x00F5F8 if unit_state(ADN111) != 1 -> 0xF678 + 0x00F6BC if unit_state(ADN112) != 1 -> 0xF73C + 0x00F7FC if builtin103() != 0 -> 0xF81C + 0x00F874 if dist_lt(TCN001, TCN004, 8000) != 1 -> 0xF934 + 0x00F964 if builtin103() != 0 -> 0xF984 + 0x00F9E4 if unit_hp_pct(TCN001, Character_Player_Test) <= 50 -> 0xFAB8 + 0x00FAE8 if builtin103() != 0 -> 0xFB08 + 0x00FB60 if unit_state(ADN101) == 1 -> 0xFBC8 + 0x00FC14 if unit_state(ADT102) == 1 -> 0xFC7C + 0x00FCC8 if unit_state(ADN103) == 1 -> 0xFD30 + 0x00FD7C if unit_state(ADN104) == 1 -> 0xFDE4 + 0x00FE30 if unit_state(ADN105) == 1 -> 0xFE98 + 0x00FEE4 if unit_state(ADN106) == 1 -> 0xFF4C + 0x00FF98 if unit_state(ADT107) == 1 -> 0x10000 + 0x01004C if unit_state(ADN108) == 1 -> 0x100B4 + 0x010100 if unit_state(ADN109) == 1 -> 0x10168 + 0x0101B4 if unit_state(ADN110) == 1 -> 0x1021C + 0x010268 if unit_state(ADN111) == 1 -> 0x102D0 + 0x01031C if unit_state(ADN112) == 1 -> 0x10384 + 0x0103D0 if unit_state(ADT113) == 1 -> 0x10438 + 0x010484 if unit_state(ADN114) == 1 -> 0x104EC + 0x010538 if unit_state(ADN115) == 1 -> 0x105A0 + 0x0105C4 if end_coroutine() == 28 -> 0xFB1C + 0x0105D8 if end_coroutine() == 29 -> 0xFBD0 + 0x0105EC if end_coroutine() == 30 -> 0xFC84 + 0x010600 if end_coroutine() == 31 -> 0xFD38 + 0x010614 if end_coroutine() == 32 -> 0xFDEC + 0x010628 if end_coroutine() == 33 -> 0xFEA0 + 0x01063C if end_coroutine() == 34 -> 0xFF54 + 0x010650 if end_coroutine() == 35 -> 0x10008 + 0x010664 if end_coroutine() == 36 -> 0x100BC + 0x010678 if end_coroutine() == 37 -> 0x10170 + 0x01068C if end_coroutine() == 38 -> 0x10224 + 0x0106A0 if end_coroutine() == 39 -> 0x102D8 + 0x0106B4 if end_coroutine() == 40 -> 0x1038C + 0x0106C8 if end_coroutine() == 41 -> 0x10440 + 0x0106DC if end_coroutine() == 42 -> 0x104F4 + 0x010728 if builtin103() != 0 -> 0x10748 + 0x010788 if hp_pct_test(TCN004, 30) != 1 -> 0x108D4 + 0x010814 if dist_lt(TCN004, TCN001, 10000) == 1 -> 0x108D4 + 0x010904 if builtin103() != 0 -> 0x10924 + 0x010968 if unit_state(ADS151) != 1 -> 0x109D4 + 0x0109C0 if unit_state(TCS151) == 1 -> 0x10A4C + 0x010AA4 if dist_lt(TCN001, ADS151, 7000) != 1 -> 0x10B64 + 0x010B94 if builtin103() != 0 -> 0x10BB4 + 0x010BF8 if unit_state(ADS151) != 1 -> 0x10C64 + 0x010C50 if unit_state(TCS151) == 1 -> 0x10D24 + 0x010D7C if dist_lt(TCN001, ADS151, 4000) != 1 -> 0x10EA8 + 0x010EF0 if read_freg(8) <= 60 -> 0x11064 + 0x011094 if builtin103() != 0 -> 0x110B4 + 0x0110F8 if unit_state(TCS151) == 1 -> 0x11184 + 0x0111C4 if hp_pct_test(ADS151, 0) != 1 -> 0x112F0 + 0x011320 if builtin103() != 0 -> 0x11340 + 0x011340 if global[20] != 1 -> 0x11400 + 0x011398 if unit_state(ADT102) == 1 -> 0x11400 + 0x011400 if global[20] != 6 -> 0x114C0 + 0x011458 if unit_state(ADT107) == 1 -> 0x114C0 + 0x0114C0 if global[20] != 12 -> 0x11580 + 0x011518 if unit_state(ADT113) == 1 -> 0x11580 + 0x011580 if global[20] != 0 -> 0x11640 + 0x0115D8 if unit_state(ADN101) == 1 -> 0x11640 + 0x011640 if global[20] != 2 -> 0x11700 + 0x011698 if unit_state(ADN103) == 1 -> 0x11700 + 0x011700 if global[20] != 3 -> 0x117C0 + 0x011758 if unit_state(ADN104) == 1 -> 0x117C0 + 0x0117C0 if global[20] != 5 -> 0x11880 + 0x011818 if unit_state(ADN106) == 1 -> 0x11880 + 0x011880 if global[20] != 7 -> 0x11940 + 0x0118D8 if unit_state(ADN108) == 1 -> 0x11940 + 0x011940 if global[20] != 8 -> 0x11A00 + 0x011998 if unit_state(ADN109) == 1 -> 0x11A00 + 0x011A00 if global[20] != 9 -> 0x11AC0 + 0x011A58 if unit_state(ADN110) == 1 -> 0x11AC0 + 0x011AC0 if global[20] != 10 -> 0x11B80 + 0x011B18 if unit_state(ADN111) == 1 -> 0x11B80 + 0x011B80 if global[20] != 11 -> 0x11C40 + 0x011BD8 if unit_state(ADN112) == 1 -> 0x11C40 + 0x011C70 if builtin103() != 0 -> 0x11C90 + 0x011CD4 if unit_state(ADT102) != 2 -> 0x11D78 + 0x011D0C if builtin105(ADT102) != 1 -> 0x11D6C + 0x011D20 if global[20] == 1 -> 0x11D6C + 0x011D34 if global[20] == 29 -> 0x11D6C + 0x011DA8 if builtin103() != 0 -> 0x11DC8 + 0x011E0C if unit_state(ADT107) != 2 -> 0x11EB0 + 0x011E44 if builtin105(ADT107) != 1 -> 0x11EA4 + 0x011E58 if global[20] == 6 -> 0x11EA4 + 0x011E6C if global[20] == 34 -> 0x11EA4 + 0x011EE0 if builtin103() != 0 -> 0x11F00 + 0x011F44 if unit_state(ADT113) != 2 -> 0x11FE8 + 0x011F7C if builtin105(ADT113) != 1 -> 0x11FDC + 0x011F90 if global[20] == 12 -> 0x11FDC + 0x011FA4 if global[20] == 40 -> 0x11FDC + 0x012018 if builtin103() != 0 -> 0x12038 + 0x01207C if unit_state(ADN101) != 2 -> 0x12120 + 0x0120B4 if builtin105(ADN101) != 1 -> 0x12114 + 0x0120C8 if global[20] == 0 -> 0x12114 + 0x0120DC if global[20] == 28 -> 0x12114 + 0x012150 if builtin103() != 0 -> 0x12170 + 0x0121B4 if unit_state(ADN103) != 2 -> 0x12258 + 0x0121EC if builtin105(ADN103) != 1 -> 0x1224C + 0x012200 if global[20] == 2 -> 0x1224C + 0x012214 if global[20] == 30 -> 0x1224C + 0x012288 if builtin103() != 0 -> 0x122A8 + 0x0122EC if unit_state(ADN104) != 2 -> 0x12390 + 0x012324 if builtin105(ADN104) != 1 -> 0x12384 + 0x012338 if global[20] == 3 -> 0x12384 + 0x01234C if global[20] == 31 -> 0x12384 + 0x0123C0 if builtin103() != 0 -> 0x123E0 + 0x012424 if unit_state(ADN105) != 2 -> 0x124C8 + 0x01245C if builtin105(ADN105) != 1 -> 0x124BC + 0x012470 if global[20] == 4 -> 0x124BC + 0x012484 if global[20] == 32 -> 0x124BC + 0x0124F8 if builtin103() != 0 -> 0x12518 + 0x01255C if unit_state(ADN106) != 2 -> 0x12600 + 0x012594 if builtin105(ADN106) != 1 -> 0x125F4 + 0x0125A8 if global[20] == 5 -> 0x125F4 + 0x0125BC if global[20] == 33 -> 0x125F4 + 0x012630 if builtin103() != 0 -> 0x12650 + 0x012694 if unit_state(ADN108) != 2 -> 0x12738 + 0x0126CC if builtin105(ADN108) != 1 -> 0x1272C + 0x0126E0 if global[20] == 7 -> 0x1272C + 0x0126F4 if global[20] == 35 -> 0x1272C + 0x012768 if builtin103() != 0 -> 0x12788 + 0x0127CC if unit_state(ADN109) != 2 -> 0x12870 + 0x012804 if builtin105(ADN109) != 1 -> 0x12864 + 0x012818 if global[20] == 8 -> 0x12864 + 0x01282C if global[20] == 36 -> 0x12864 + 0x0128A0 if builtin103() != 0 -> 0x128C0 + 0x012904 if unit_state(ADN110) != 2 -> 0x129A8 + 0x01293C if builtin105(ADN110) != 1 -> 0x1299C + 0x012950 if global[20] == 9 -> 0x1299C + 0x012964 if global[20] == 37 -> 0x1299C + 0x0129D8 if builtin103() != 0 -> 0x129F8 + 0x012A3C if unit_state(ADN111) != 2 -> 0x12AE0 + 0x012A74 if builtin105(ADN111) != 1 -> 0x12AD4 + 0x012A88 if global[20] == 10 -> 0x12AD4 + 0x012A9C if global[20] == 38 -> 0x12AD4 + 0x012B10 if builtin103() != 0 -> 0x12B30 + 0x012B74 if unit_state(ADN112) != 2 -> 0x12C18 + 0x012BAC if builtin105(ADN112) != 1 -> 0x12C0C + 0x012BC0 if global[20] == 11 -> 0x12C0C + 0x012BD4 if global[20] == 39 -> 0x12C0C + 0x012C48 if builtin103() != 0 -> 0x12C68 + 0x012CAC if unit_state(ADN114) != 2 -> 0x12D50 + 0x012CE4 if builtin105(ADN114) != 1 -> 0x12D44 + 0x012CF8 if global[20] == 13 -> 0x12D44 + 0x012D0C if global[20] == 41 -> 0x12D44 + 0x012D80 if builtin103() != 0 -> 0x12DA0 + 0x012DE4 if unit_state(ADN115) != 2 -> 0x12E88 + 0x012E1C if builtin105(ADN115) != 1 -> 0x12E7C + 0x012E30 if global[20] == 14 -> 0x12E7C + 0x012E44 if global[20] == 42 -> 0x12E7C + 0x012EB8 if builtin103() != 0 -> 0x12ED8 + 0x012F1C if unit_state(ADN131) != 2 -> 0x12FAC + 0x012F30 if global[36] != 0 -> 0x12FAC + 0x012F68 if builtin105(ADN131) != 1 -> 0x12FAC + 0x012FF0 if unit_state(ADN132, global[12], 1) != 2 -> 0x13080 + 0x013004 if global[40] != 0 -> 0x13080 + 0x01303C if builtin105(ADN132) != 1 -> 0x13080 + 0x0130C4 if unit_state(ADN133, global[12], 1) != 2 -> 0x13154 + 0x0130D8 if global[44] != 0 -> 0x13154 + 0x013110 if builtin105(ADN133) != 1 -> 0x13154 + 0x013198 if unit_state(ADN134, global[12], 1) != 2 -> 0x13228 + 0x0131AC if global[48] != 0 -> 0x13228 + 0x0131E4 if builtin105(ADN134) != 1 -> 0x13228 + 0x01326C if unit_state(ADN135, global[12], 1) != 2 -> 0x132FC + 0x013280 if global[52] != 0 -> 0x132FC + 0x0132B8 if builtin105(ADN135) != 1 -> 0x132FC + 0x013340 if unit_state(ADN136, global[12], 1) != 2 -> 0x133D0 + 0x013354 if global[56] != 0 -> 0x133D0 + 0x01338C if builtin105(ADN136) != 1 -> 0x133D0 + 0x013414 if unit_state(ADN137, global[12], 1) != 2 -> 0x134A4 + 0x013428 if global[60] != 0 -> 0x134A4 + 0x013460 if builtin105(ADN137) != 1 -> 0x134A4 + 0x0134E8 if unit_state(ADN138, global[12], 1) != 2 -> 0x13578 + 0x0134FC if global[64] != 0 -> 0x13578 + 0x013534 if builtin105(ADN138) != 1 -> 0x13578 + 0x0135BC if unit_state(ADN139, global[12], 1) != 2 -> 0x1364C + 0x0135D0 if global[68] != 0 -> 0x1364C + 0x013608 if builtin105(ADN139) != 1 -> 0x1364C + 0x013690 if unit_state(ADN140, global[12], 1) != 2 -> 0x13720 + 0x0136A4 if global[72] != 0 -> 0x13720 + 0x0136DC if builtin105(ADN140) != 1 -> 0x13720 + 0x013724 if global[12] < 6 -> 0x14264 + 0x013738 if global[16] >= 6 -> 0x14264 + 0x0138A8 if unit_state(ADT102) != 1 -> 0x13928 + 0x01396C if unit_state(ADT107) != 1 -> 0x139EC + 0x013A30 if unit_state(ADT113) != 1 -> 0x13AB0 + 0x013AF4 if unit_state(ADN101) != 1 -> 0x13B74 + 0x013BB8 if unit_state(ADN103) != 1 -> 0x13C38 + 0x013C7C if unit_state(ADN104) != 1 -> 0x13CFC + 0x013D40 if unit_state(ADN106) != 1 -> 0x13DC0 + 0x013E04 if unit_state(ADN108) != 1 -> 0x13E84 + 0x013EC8 if unit_state(ADN109) != 1 -> 0x13F48 + 0x013F8C if unit_state(ADN110) != 1 -> 0x1400C + 0x014050 if unit_state(ADN111) != 1 -> 0x140D0 + 0x014114 if unit_state(ADN112) != 1 -> 0x14194 + 0x0141D8 if unit_state(ADS151) != 1 -> 0x14258 + 0x014264 if global[12] < 5 -> 0x1432C + 0x014278 if global[16] >= 5 -> 0x1432C + 0x01432C if global[12] < 4 -> 0x143F4 + 0x014340 if global[16] >= 4 -> 0x143F4 + 0x0143F4 if global[12] < 3 -> 0x144BC + 0x014408 if global[16] >= 3 -> 0x144BC + 0x014504 if builtin103(global[12]) != 0 -> 0x14524 + 0x014524 if global[28] != 1 -> 0x145E4 + 0x014628 if unit_state(ADS151) != 1 -> 0x14694 + 0x014680 if unit_state(TCS151) == 1 -> 0x146A0 + 0x014744 if dist_lt(TCN001, ADS151, 8000) == 1 -> 0x1481C + +## phase 2 — 302 sites + 0x018580 if builtin103() != 1 -> 0x186E8 + 0x018C30 if unit_alive(TCN208) != 1 -> 0x18C98 + 0x018CBC if unit_alive(TCN207) != 1 -> 0x18D24 + 0x018DB8 if hp_pct_test(ADN204, 0) != 1 -> 0x18E4C + 0x018FFC if hp_pct_test(ADN208, 0) != 1 -> 0x19090 + 0x019124 if builtin103() != 1 -> 0x1915C + 0x0191CC if unit_hp_pct(TCN001, Character_Player_Test) != 0 -> 0x19658 + 0x01956C if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 0 -> 0x192C4 + 0x019580 if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 1 -> 0x1936C + 0x019594 if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 2 -> 0x19414 + 0x0195A8 if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 3 -> 0x194BC + 0x019698 if hp_pct_test(TCT206, 0) != 1 -> 0x1994C + 0x0199C8 if builtin7(TCT206, 1, Route_TCT206_p2S, 4294967295, 500) == 1 -> 0x19A38 + 0x019A24 if read_freg(0) <= 600 -> 0x19A44 + 0x019A8C if read_freg(0, 1) <= 240 -> 0x1A1E4 + 0x019AE0 if hp_pct_test(ADN201, 0) != 1 -> 0x1A1E4 + 0x019B34 if hp_pct_test(ADN202, 0) != 1 -> 0x1A1E4 + 0x019B88 if hp_pct_test(ADN203, 0) != 1 -> 0x1A1E4 + 0x019BDC if hp_pct_test(ADN204, 0) != 1 -> 0x1A1E4 + 0x019C30 if hp_pct_test(ADN205, 0) != 1 -> 0x1A1E4 + 0x019C84 if hp_pct_test(ADN206, 0) != 1 -> 0x1A1E4 + 0x019CD8 if hp_pct_test(ADN207, 0) != 1 -> 0x1A1E4 + 0x019D2C if hp_pct_test(ADN208, 0) != 1 -> 0x1A1E4 + 0x019D80 if hp_pct_test(ADN209, 0) != 1 -> 0x1A1E4 + 0x019DD4 if hp_pct_test(ADN221, 0) != 1 -> 0x1A1E4 + 0x019E28 if hp_pct_test(ADN222, 0) != 1 -> 0x1A1E4 + 0x019E7C if hp_pct_test(ADN223, 0) != 1 -> 0x1A1E4 + 0x019ED0 if hp_pct_test(ADN224, 0) != 1 -> 0x1A1E4 + 0x019F24 if hp_pct_test(ADN225, 0) != 1 -> 0x1A1E4 + 0x019F78 if hp_pct_test(ADN226, 0) != 1 -> 0x1A1E4 + 0x019FCC if hp_pct_test(ADN227, 0) != 1 -> 0x1A1E4 + 0x01A020 if hp_pct_test(ADN228, 0) != 1 -> 0x1A1E4 + 0x01A074 if hp_pct_test(ADN229, 0) != 1 -> 0x1A1E4 + 0x01A0C8 if hp_pct_test(ADN230, 0) != 1 -> 0x1A1E4 + 0x01A11C if hp_pct_test(ADN231, 0) != 1 -> 0x1A1E4 + 0x01A170 if hp_pct_test(ADN232, 0) != 1 -> 0x1A1E4 + 0x01A1C4 if hp_pct_test(ADS251, 0) != 1 -> 0x1A1E4 + 0x01A1E4 if global[4] == 0 -> 0x1AC5C + 0x01A2B0 if global[4] != 1 -> 0x1A864 + 0x01A2F4 if unit_alive(ADN201, 0) != 1 -> 0x1A32C + 0x01A350 if unit_alive(ADN202, global[104]) != 1 -> 0x1A388 + 0x01A3AC if unit_alive(ADN207, global[104]) != 1 -> 0x1A3E4 + 0x01A408 if unit_alive(ADN223, global[104]) != 1 -> 0x1A440 + 0x01A464 if unit_alive(ADN224, global[104]) != 1 -> 0x1A49C + 0x01A4C0 if unit_alive(ADN225, global[104]) != 1 -> 0x1A4F8 + 0x01A51C if unit_alive(ADN226, global[104]) != 1 -> 0x1A554 + 0x01A578 if unit_alive(ADN227, global[104]) != 1 -> 0x1A5B0 + 0x01A5D4 if unit_alive(ADN228, global[104]) != 1 -> 0x1A60C + 0x01A630 if unit_alive(ADN229, global[104]) != 1 -> 0x1A668 + 0x01A68C if unit_alive(ADN230, global[104]) != 1 -> 0x1A6C4 + 0x01A6E8 if unit_alive(ADN231, global[104]) != 1 -> 0x1A720 + 0x01A744 if unit_alive(ADN232, global[104]) != 1 -> 0x1A77C + 0x01A77C if global[104] <= 1 -> 0x1A844 + 0x01A924 if hp_pct_test(TCT206, 89.9) != 0 -> 0x1AA38 + 0x01AA38 if global[104] != 0 -> 0x1AAEC + 0x01AAF8 if global[4] == 0 -> 0x1ABCC + 0x01AB54 if read_freg(global[4]) >= 5 -> 0x1ABCC + 0x01AC98 if unit_alive(ADN201) != 1 -> 0x1AD68 + 0x01AD04 if dist_lt(TCT206, ADN201, 15000) != 1 -> 0x1AD68 + 0x01AD8C if unit_alive(ADN202) != 1 -> 0x1AE5C + 0x01ADF8 if dist_lt(TCT206, ADN202, 15000) != 1 -> 0x1AE5C + 0x01AE80 if unit_alive(ADN207) != 1 -> 0x1AF50 + 0x01AEEC if dist_lt(TCT206, ADN207, 15000) != 1 -> 0x1AF50 + 0x01AF74 if unit_alive(ADN231) != 1 -> 0x1B044 + 0x01AFE0 if dist_lt(TCT206, ADN231, 15000) != 1 -> 0x1B044 + 0x01B068 if unit_alive(ADN232) != 1 -> 0x1B138 + 0x01B0D4 if dist_lt(TCT206, ADN232, 15000) != 1 -> 0x1B138 + 0x01B180 if hp_pct_test(ADN201, 0) == 1 -> 0x1B220 + 0x01B20C if dist_lt(TCT206, ADN201, 20000) == 1 -> 0x1B250 + 0x01B298 if hp_pct_test(ADN202, 0, 0) == 1 -> 0x1B338 + 0x01B324 if dist_lt(TCT206, ADN202, 20000) == 1 -> 0x1B368 + 0x01B3B0 if hp_pct_test(ADN207, 0, 0) == 1 -> 0x1B450 + 0x01B43C if dist_lt(TCT206, ADN207, 20000) == 1 -> 0x1B480 + 0x01B4C8 if hp_pct_test(ADN231, 0, 0) == 1 -> 0x1B568 + 0x01B554 if dist_lt(TCT206, ADN231, 20000) == 1 -> 0x1B598 + 0x01B5E0 if hp_pct_test(ADN232, 0, 0) == 1 -> 0x1B680 + 0x01B66C if dist_lt(TCT206, ADN232, 20000) == 1 -> 0x1B6B0 + 0x01B6C0 if builtin80(1, 117) == 0 -> 0x1AC74 + 0x01B6D4 if builtin80(1, 117) == 1 -> 0x1B140 + 0x01B6E8 if builtin80(1, 117) == 2 -> 0x1B258 + 0x01B6FC if builtin80(1, 117) == 3 -> 0x1B370 + 0x01B710 if builtin80(1, 117) == 4 -> 0x1B488 + 0x01B724 if builtin80(1, 117) == 5 -> 0x1B5A0 + 0x01B77C if hp_pct_test(TCN207, 0, 0) != 1 -> 0x1B79C + 0x01B7D4 if unit_alive(ADN201) != 1 -> 0x1B8A4 + 0x01B840 if dist_lt(TCN207, ADN201, 15000) != 1 -> 0x1B8A4 + 0x01B8C8 if unit_alive(ADN202) != 1 -> 0x1B998 + 0x01B934 if dist_lt(TCN207, ADN202, 15000) != 1 -> 0x1B998 + 0x01B9BC if unit_alive(ADN207) != 1 -> 0x1BA8C + 0x01BA28 if dist_lt(TCN207, ADN207, 15000) != 1 -> 0x1BA8C + 0x01BAB0 if unit_alive(ADN231) != 1 -> 0x1BB80 + 0x01BB1C if dist_lt(TCN207, ADN231, 15000) != 1 -> 0x1BB80 + 0x01BBA4 if unit_alive(ADN232) != 1 -> 0x1BC74 + 0x01BC10 if dist_lt(TCN207, ADN232, 15000) != 1 -> 0x1BC74 + 0x01BCBC if hp_pct_test(ADN201, 0) == 1 -> 0x1BD5C + 0x01BD48 if dist_lt(TCN207, ADN201, 20000) == 1 -> 0x1BD8C + 0x01BDD4 if hp_pct_test(ADN202, 0, 0) == 1 -> 0x1BE74 + 0x01BE60 if dist_lt(TCN207, ADN202, 20000) == 1 -> 0x1BEA4 + 0x01BEEC if hp_pct_test(ADN207, 0, 0) == 1 -> 0x1BF8C + 0x01BF78 if dist_lt(TCN207, ADN207, 20000) == 1 -> 0x1BFBC + 0x01C004 if hp_pct_test(ADN231, 0, 0) == 1 -> 0x1C0A4 + 0x01C090 if dist_lt(TCN207, ADN231, 20000) == 1 -> 0x1C0D4 + 0x01C11C if hp_pct_test(ADN232, 0, 0) == 1 -> 0x1C1BC + 0x01C1A8 if dist_lt(TCN207, ADN232, 20000) == 1 -> 0x1C1EC + 0x01C1FC if builtin80(1, 101) == 0 -> 0x1B7B0 + 0x01C210 if builtin80(1, 101) == 1 -> 0x1BC7C + 0x01C224 if builtin80(1, 101) == 2 -> 0x1BD94 + 0x01C238 if builtin80(1, 101) == 3 -> 0x1BEAC + 0x01C24C if builtin80(1, 101) == 4 -> 0x1BFC4 + 0x01C260 if builtin80(1, 101) == 5 -> 0x1C0DC + 0x01C2B8 if hp_pct_test(TCN208, 0, 0) != 1 -> 0x1C2D8 + 0x01C310 if unit_alive(ADN201) != 1 -> 0x1C3E0 + 0x01C37C if dist_lt(TCN208, ADN201, 15000) != 1 -> 0x1C3E0 + 0x01C404 if unit_alive(ADN202) != 1 -> 0x1C4D4 + 0x01C470 if dist_lt(TCN208, ADN202, 15000) != 1 -> 0x1C4D4 + 0x01C4F8 if unit_alive(ADN207) != 1 -> 0x1C5C8 + 0x01C564 if dist_lt(TCN208, ADN207, 15000) != 1 -> 0x1C5C8 + 0x01C5EC if unit_alive(ADN231) != 1 -> 0x1C6BC + 0x01C658 if dist_lt(TCN208, ADN231, 15000) != 1 -> 0x1C6BC + 0x01C6E0 if unit_alive(ADN232) != 1 -> 0x1C7B0 + 0x01C74C if dist_lt(TCN208, ADN232, 15000) != 1 -> 0x1C7B0 + 0x01C7F8 if hp_pct_test(ADN201, 0) == 1 -> 0x1C898 + 0x01C884 if dist_lt(TCN208, ADN201, 20000) == 1 -> 0x1C8C8 + 0x01C910 if hp_pct_test(ADN202, 0, 0) == 1 -> 0x1C9B0 + 0x01C99C if dist_lt(TCN208, ADN202, 20000) == 1 -> 0x1C9E0 + 0x01CA28 if hp_pct_test(ADN207, 0, 0) == 1 -> 0x1CAC8 + 0x01CAB4 if dist_lt(TCN208, ADN207, 20000) == 1 -> 0x1CAF8 + 0x01CB40 if hp_pct_test(ADN231, 0, 0) == 1 -> 0x1CBE0 + 0x01CBCC if dist_lt(TCN208, ADN231, 20000) == 1 -> 0x1CC10 + 0x01CC58 if hp_pct_test(ADN232, 0, 0) == 1 -> 0x1CCF8 + 0x01CCE4 if dist_lt(TCN208, ADN232, 20000) == 1 -> 0x1CD28 + 0x01CD38 if builtin80(1, 104) == 0 -> 0x1C2EC + 0x01CD4C if builtin80(1, 104) == 1 -> 0x1C7B8 + 0x01CD60 if builtin80(1, 104) == 2 -> 0x1C8D0 + 0x01CD74 if builtin80(1, 104) == 3 -> 0x1C9E8 + 0x01CD88 if builtin80(1, 104) == 4 -> 0x1CB00 + 0x01CD9C if builtin80(1, 104) == 5 -> 0x1CC18 + 0x01D200 if hp_pct_test(ADN201, 0) != 1 -> 0x1D244 + 0x01D27C if unit_alive(TCN207) != 1 -> 0x1D34C + 0x01D2E8 if dist_lt(ADN201, TCN207, 15000) != 1 -> 0x1D34C + 0x01D370 if unit_alive(TCN208) != 1 -> 0x1D440 + 0x01D3DC if dist_lt(ADN201, TCN208, 15000) != 1 -> 0x1D440 + 0x01D498 if dist_lt(ADN201, TCT206, 15000) != 1 -> 0x1D4FC + 0x01D56C if builtin7(ADN201, 1, Route_ADN201_p2S, 4294967295, 500) != 1 -> 0x1D5E0 + 0x01D658 if builtin7(ADN201, 1, Route_ADN201_p2S, 4294967295, 500) != 1 -> 0x1D6F8 + 0x01D738 if hp_pct_test(TCN207, 0) == 1 -> 0x1D7D8 + 0x01D7C4 if dist_lt(ADN201, TCN207, 20000) == 1 -> 0x1D808 + 0x01D880 if builtin7(ADN201, 1, Route_ADN201_p2S, 4294967295, 500, 0) != 1 -> 0x1D920 + 0x01D960 if hp_pct_test(TCN208, 0) == 1 -> 0x1DA00 + 0x01D9EC if dist_lt(ADN201, TCN208, 20000) == 1 -> 0x1DA30 + 0x01DAA8 if builtin7(ADN201, 1, Route_ADN201_p2S, 4294967295, 500, 0) != 1 -> 0x1DB48 + 0x01DBC0 if dist_lt(ADN201, TCT206, 20000) == 1 -> 0x1DC04 + 0x01DC1C if builtin80(1, 3) == 0 -> 0x1D258 + 0x01DC30 if builtin80(1, 3) == 1 -> 0x1D5E8 + 0x01DC44 if builtin80(1, 3) == 2 -> 0x1D810 + 0x01DC58 if builtin80(1, 3) == 3 -> 0x1DA38 + 0x01DC6C if builtin80(1, 3) == 4 -> 0x1DC0C + 0x01DCC4 if hp_pct_test(ADN202, 0, 0) != 1 -> 0x1DD08 + 0x01DD4C if hp_pct_test(ADN207, 0) != 1 -> 0x1DD6C + 0x01DDA4 if unit_alive(TCN207) != 1 -> 0x1DE74 + 0x01DE10 if dist_lt(ADN207, TCN207, 15000) != 1 -> 0x1DE74 + 0x01DE98 if unit_alive(TCN208) != 1 -> 0x1DF68 + 0x01DF04 if dist_lt(ADN207, TCN208, 15000) != 1 -> 0x1DF68 + 0x01DFC0 if dist_lt(ADN207, TCT206, 15000) != 1 -> 0x1E024 + 0x01E094 if builtin7(ADN207, 1, Route_ADN207_p2S, 3, 55) != 1 -> 0x1E1CC + 0x01E0CC if unit_alive(TCN208) != 1 -> 0x1E16C + 0x01E244 if builtin7(ADN207, 1, Route_ADN201_p2S, 4294967295, 500) != 1 -> 0x1E384 + 0x01E27C if unit_alive(TCN208) != 1 -> 0x1E31C + 0x01E3C4 if hp_pct_test(TCN207, 0) == 1 -> 0x1E464 + 0x01E450 if dist_lt(ADN207, TCN207, 20000) == 1 -> 0x1E494 + 0x01E50C if builtin7(ADN207, 1, Route_ADN207_p2S, 3, 55, 0) != 1 -> 0x1E64C + 0x01E544 if unit_alive(TCN208) != 1 -> 0x1E5E4 + 0x01E68C if hp_pct_test(TCN208, 0) == 1 -> 0x1E72C + 0x01E718 if dist_lt(ADN207, TCN208, 20000) == 1 -> 0x1E75C + 0x01E7D4 if builtin7(ADN207, 1, Route_ADN207_p2S, 3, 55, 0) != 1 -> 0x1E914 + 0x01E80C if unit_alive(TCN208) != 1 -> 0x1E8AC + 0x01E98C if dist_lt(ADN207, TCT206, 20000) == 1 -> 0x1E9D0 + 0x01E9E8 if builtin80(1, 42) == 0 -> 0x1DD80 + 0x01E9FC if builtin80(1, 42) == 1 -> 0x1E1D4 + 0x01EA10 if builtin80(1, 42) == 2 -> 0x1E49C + 0x01EA24 if builtin80(1, 42) == 3 -> 0x1E764 + 0x01EA38 if builtin80(1, 42) == 4 -> 0x1E9D8 + 0x01F78C if unit_state(ADN201) != 1 -> 0x1F7F8 + 0x01F7E4 if unit_state(TCT206) == 1 -> 0x1F804 + 0x01F85C if dist_lt(ADN201, TCT206, 10000) != 1 -> 0x1FA7C + 0x01F9BC if builtin103() != 1 -> 0x1FA70 + 0x01FAC4 if unit_state(ADN207) != 1 -> 0x1FB30 + 0x01FB1C if unit_state(TCT206) == 1 -> 0x1FB3C + 0x01FB94 if dist_lt(ADN207, TCT206, 10000) != 1 -> 0x1FC54 + 0x01FC88 if unit_alive(ADN201) != 1 -> 0x1FCF8 + 0x01FCD8 if unit_relation(TCN001, ADN201) != 1 -> 0x1FCF8 + 0x01FD1C if unit_alive(ADN202) != 1 -> 0x1FD8C + 0x01FD6C if unit_relation(TCN001, ADN202) != 1 -> 0x1FD8C + 0x01FDB0 if unit_alive(ADN207) != 1 -> 0x1FE20 + 0x01FE00 if unit_relation(TCN001, ADN207) != 1 -> 0x1FE20 + 0x01FE44 if unit_alive(ADN223) != 1 -> 0x1FEB4 + 0x01FE94 if unit_relation(TCN001, ADN223) != 1 -> 0x1FEB4 + 0x01FED8 if unit_alive(ADN224) != 1 -> 0x1FF48 + 0x01FF28 if unit_relation(TCN001, ADN224) != 1 -> 0x1FF48 + 0x01FF6C if unit_alive(ADN225) != 1 -> 0x1FFDC + 0x01FFBC if unit_relation(TCN001, ADN225) != 1 -> 0x1FFDC + 0x020000 if unit_alive(ADN226) != 1 -> 0x20070 + 0x020050 if unit_relation(TCN001, ADN226) != 1 -> 0x20070 + 0x020094 if unit_alive(ADN227) != 1 -> 0x20104 + 0x0200E4 if unit_relation(TCN001, ADN227) != 1 -> 0x20104 + 0x020128 if unit_alive(ADN228) != 1 -> 0x20198 + 0x020178 if unit_relation(TCN001, ADN228) != 1 -> 0x20198 + 0x0201BC if unit_alive(ADN229) != 1 -> 0x2022C + 0x02020C if unit_relation(TCN001, ADN229) != 1 -> 0x2022C + 0x020250 if unit_alive(ADN230) != 1 -> 0x202C0 + 0x0202A0 if unit_relation(TCN001, ADN230) != 1 -> 0x202C0 + 0x0202E4 if unit_alive(ADN231) != 1 -> 0x20354 + 0x020334 if unit_relation(TCN001, ADN231) != 1 -> 0x20354 + 0x020378 if unit_alive(ADN232) != 1 -> 0x203E8 + 0x0203C8 if unit_relation(TCN001, ADN232) != 1 -> 0x203E8 + 0x0203E8 if global[4] != 1 -> 0x207C8 + 0x020810 if unit_state(ADN205) == 1 -> 0x20830 + 0x02086C if unit_relation(ADN205, TCN001) == 1 -> 0x208D0 + 0x0208BC if unit_relation(TCN001, ADN205) != 1 -> 0x2097C + 0x0209C4 if unit_state(ADN206) != 1 -> 0x20A30 + 0x020A1C if unit_state(TCT206) == 1 -> 0x20A3C + 0x020A94 if dist_lt(ADN206, TCT206, 10000) != 1 -> 0x20B54 + 0x020B9C if unit_state(ADN206) != 1 -> 0x20C08 + 0x020BF4 if unit_state(TCT206) == 1 -> 0x20C14 + 0x020C50 if unit_relation(ADN206, TCT206) != 1 -> 0x20DB0 + 0x020DF8 if unit_state(ADN208) == 1 -> 0x20E18 + 0x020E70 if dist_lt(ADN208, TCN001, 10000) != 1 -> 0x20F30 + 0x020F78 if unit_state(ADN209) != 1 -> 0x20FE4 + 0x020FD0 if unit_state(TCT206) == 1 -> 0x20FF0 + 0x021048 if dist_lt(ADN209, TCT206, 10000) != 1 -> 0x21108 + 0x021150 if unit_state(ADS251) != 1 -> 0x211BC + 0x0211A8 if unit_state(TCS251) == 1 -> 0x211C8 + 0x021204 if unit_relation(ADS251, TCS251) != 1 -> 0x213FC + 0x021330 if builtin103() != 1 -> 0x213F0 + 0x021444 if unit_state(TCS251) == 2 -> 0x217F4 + 0x021498 if hp_pct_test(ADS251, 0) != 1 -> 0x217F4 + 0x02153C if builtin105(ADS251) != 1 -> 0x217F4 + 0x021838 if hp_pct_test(TCT206, 75) != 1 -> 0x2191C + 0x021960 if hp_pct_test(TCT206, 50) != 1 -> 0x21A20 + 0x021A64 if hp_pct_test(TCN207, 0) != 1 -> 0x21BC4 + 0x021C04 if hp_pct_test(TCN208, 0) != 1 -> 0x21D64 + 0x021D68 if global[100] != 1 -> 0x21E4C + 0x021E50 if global[100] != 2 -> 0x21F10 + 0x021F8C if dist_lt(TCN001, TCT206, 20000) == 1 -> 0x2204C + 0x022094 if unit_state(ADN204) != 1 -> 0x22158 + 0x02219C if unit_state(ADN203) != 1 -> 0x22260 + 0x0222A4 if unit_state(ADN206) != 1 -> 0x223D4 + 0x022310 if dist_lt(TCT206, ADN206, 15000) != 1 -> 0x223D4 + 0x022418 if unit_state(ADN205) != 1 -> 0x22548 + 0x022484 if dist_lt(TCT206, ADN205, 15000) != 1 -> 0x22548 + 0x02258C if unit_state(ADN208) != 1 -> 0x22650 + 0x022694 if unit_state(ADN209) != 1 -> 0x22758 + 0x0227BC if unit_hp_pct(TCN001, Character_Player_Test) > 40 -> 0x22FFC + 0x0227D0 if global[20] == 6 -> 0x22FFC + 0x022A64 if unit_state(ADN203) != 1 -> 0x22AE4 + 0x022B28 if unit_state(ADN204) != 1 -> 0x22BA8 + 0x022BEC if unit_state(ADN205) != 1 -> 0x22C6C + 0x022CB0 if unit_state(ADN206) != 1 -> 0x22D30 + 0x022D74 if unit_state(ADN208) != 1 -> 0x22DF4 + 0x022E38 if unit_state(ADN209) != 1 -> 0x22EB8 + 0x022EFC if unit_state(ADS251) != 1 -> 0x22F7C + 0x022FFC if global[24] != 0 -> 0x2375C + 0x023010 if global[20] > 5 -> 0x2375C + 0x023024 if global[28] != 1 -> 0x2375C + 0x0230D8 if dist_lt(TCN001, TCS251, 6000) == 1 -> 0x231B0 + 0x023278 if unit_state(ADN203, 1) != 1 -> 0x232F8 + 0x02333C if unit_state(ADN204) != 1 -> 0x233BC + 0x023400 if unit_state(ADN205) != 1 -> 0x23480 + 0x0234C4 if unit_state(ADN206) != 1 -> 0x23544 + 0x023588 if unit_state(ADN208) != 1 -> 0x23608 + 0x02364C if unit_state(ADN209) != 1 -> 0x236CC + 0x0237A0 if hp_pct_test(ADN202, 0) == 1 -> 0x23808 + 0x0237F4 if hp_pct_test(TCT206, 0) != 1 -> 0x23814 + 0x023850 if unit_relation(ADN202, TCT206) == 1 -> 0x238B4 + 0x0238A0 if unit_relation(TCT206, ADN202) != 1 -> 0x23960 + 0x0239BC if dist_lt(TCN001, TCN099, 8000) != 1 -> 0x23A7C + 0x023AE0 if unit_hp_pct(TCN001, Character_Player_Test) <= 50 -> 0x23BB4 + 0x023BFC if unit_state(ADS251) != 1 -> 0x23C68 + 0x023C54 if unit_state(TCS251) == 1 -> 0x23CE0 + 0x023D38 if dist_lt(TCN001, TCS251, 5000) != 1 -> 0x23DF8 + 0x023E40 if unit_state(ADS251) != 1 -> 0x23EAC + 0x023E98 if unit_state(TCS251) == 1 -> 0x23F6C + 0x023FC4 if dist_lt(TCN001, ADS251, 4000) != 1 -> 0x2402C + 0x024074 if read_freg(8) <= 60 -> 0x241E8 + 0x024230 if unit_state(TCS251) == 1 -> 0x24328 + 0x024368 if hp_pct_test(ADS251, 0) != 1 -> 0x243F4 + 0x0243F8 if global[20] != 0 -> 0x24494 + 0x024450 if unit_state(ADN204) == 1 -> 0x24494 + 0x024494 if global[20] != 1 -> 0x24530 + 0x0244EC if unit_state(ADN203) == 1 -> 0x24530 + 0x024530 if global[20] != 2 -> 0x245CC + 0x024588 if unit_state(ADN206) == 1 -> 0x245CC + 0x0245CC if global[20] != 3 -> 0x24668 + 0x024624 if unit_state(ADN205) == 1 -> 0x24668 + 0x024668 if global[20] != 4 -> 0x24704 + 0x0246C0 if unit_state(ADN208) == 1 -> 0x24704 + 0x024704 if global[20] != 5 -> 0x247A0 + 0x02475C if unit_state(ADN209) == 1 -> 0x247A0 + 0x0247E4 if hp_pct_test(ADN202, 0) != 1 -> 0x24804 + 0x024848 if unit_state(TCT206) != 1 -> 0x249EC + 0x0248A0 if unit_state(ADN202) != 1 -> 0x249EC + 0x02492C if dist_lt(TCT206, ADN202, 10000) != 1 -> 0x249EC + +## phase 3 — 228 sites + 0x028B98 if builtin103() != 1 -> 0x28E20 + 0x029C78 if unit_alive(TCN002) != 1 -> 0x29D04 + 0x02A4D8 if unit_alive(TCN002) != 1 -> 0x2A60C + 0x02A630 if unit_alive(TCN003) != 1 -> 0x2A764 + 0x02B0D8 if unit_alive(TCN002) != 1 -> 0x2B20C + 0x02B230 if unit_alive(TCN003) != 1 -> 0x2B310 + 0x02B4F8 if unit_hp_pct(TCN001, Character_Player_Test) != 0 -> 0x2B984 + 0x02B898 if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 0 -> 0x2B5F0 + 0x02B8AC if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 1 -> 0x2B698 + 0x02B8C0 if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 2 -> 0x2B740 + 0x02B8D4 if request_script_message(MSG_VOICE_D_257, 2, 1, 9, 1, -1) == 3 -> 0x2B7E8 + 0x02B9C4 if hp_pct_test(TCN004, 0) != 1 -> 0x2BFC8 + 0x02BEB4 if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 0 -> 0x2BABC + 0x02BEC8 if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 1 -> 0x2BB64 + 0x02BEDC if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 2 -> 0x2BC0C + 0x02BEF0 if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 3 -> 0x2BCB4 + 0x02BF04 if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 4 -> 0x2BD5C + 0x02BF18 if request_script_message(MSG_VOICE_D_261, 2, 1, 9, 1, -1) == 5 -> 0x2BE04 + 0x02BFC8 if global[112] < 4 -> 0x2C1F8 + 0x02C240 if read_freg(0) <= 300 -> 0x2CF8C + 0x02C294 if hp_pct_test(ADT301, 0) != 1 -> 0x2CF8C + 0x02C2E8 if hp_pct_test(ADT302, 0) != 1 -> 0x2CF8C + 0x02C33C if hp_pct_test(ADT303, 0) != 1 -> 0x2CF8C + 0x02C390 if hp_pct_test(ADT304, 0) != 1 -> 0x2CF8C + 0x02C3E4 if hp_pct_test(ADT305, 0) != 1 -> 0x2CF8C + 0x02C438 if hp_pct_test(ADT306, 0) != 1 -> 0x2CF8C + 0x02C48C if hp_pct_test(ADT307, 0) != 1 -> 0x2CF8C + 0x02C4E0 if hp_pct_test(ADT308, 0) != 1 -> 0x2CF8C + 0x02C5C4 if global[112] != 0 -> 0x2CC0C + 0x02C618 if hp_pct_test(ADN310, 0) != 1 -> 0x2CC0C + 0x02C66C if hp_pct_test(ADN311, 0) != 1 -> 0x2CC0C + 0x02C6C0 if hp_pct_test(ADN312, 0) != 1 -> 0x2CC0C + 0x02C714 if hp_pct_test(ADN321, 0) != 1 -> 0x2CC0C + 0x02C768 if hp_pct_test(ADN322, 0) != 1 -> 0x2CC0C + 0x02C7BC if hp_pct_test(ADN323, 0) != 1 -> 0x2CC0C + 0x02C810 if hp_pct_test(ADN324, 0) != 1 -> 0x2CC0C + 0x02C864 if hp_pct_test(ADN325, 0) != 1 -> 0x2CC0C + 0x02C8B8 if hp_pct_test(ADN326, 0) != 1 -> 0x2CC0C + 0x02C90C if hp_pct_test(ADN327, 0) != 1 -> 0x2CC0C + 0x02C960 if hp_pct_test(ADN328, 0) != 1 -> 0x2CC0C + 0x02C9B4 if hp_pct_test(ADN329, 0) != 1 -> 0x2CC0C + 0x02CA08 if hp_pct_test(ADN330, 0) != 1 -> 0x2CC0C + 0x02CA5C if hp_pct_test(ADN331, 0) != 1 -> 0x2CC0C + 0x02CAB0 if hp_pct_test(ADN332, 0) != 1 -> 0x2CC0C + 0x02CB04 if hp_pct_test(ADS351, 0) != 1 -> 0x2CC0C + 0x02CC0C if global[112] != 0 -> 0x2CD1C + 0x02CDC8 if global[4] == 0 -> 0x2CE9C + 0x02CE24 if read_freg(global[4]) >= 5 -> 0x2CE9C + 0x02CE9C if global[112] != 0 -> 0x2CEFC + 0x02CEDC if builtin99() == 0 -> 0x2CEFC + 0x02CFD4 if read_freg(0) < 1200 -> 0x2D1F4 + 0x02D238 if hp_pct_test(ADS351, 0) != 1 -> 0x2D2F4 + 0x02D270 if builtin105(ADS351) != 1 -> 0x2D2F4 + 0x02DF64 if hp_pct_test(ADT301, 0) != 1 -> 0x2DFA8 + 0x02DFEC if hp_pct_test(ADT302, 0) != 1 -> 0x2E030 + 0x02E074 if hp_pct_test(ADT303, 0) != 1 -> 0x2E0B8 + 0x02E0FC if hp_pct_test(ADT304, 0) != 1 -> 0x2E140 + 0x02E184 if hp_pct_test(ADT305, 0) != 1 -> 0x2E1C8 + 0x02E20C if hp_pct_test(ADT306, 0) != 1 -> 0x2E250 + 0x02E294 if hp_pct_test(ADT307, 0) != 1 -> 0x2E2D8 + 0x02E31C if hp_pct_test(ADT308, 0) != 1 -> 0x2E360 + 0x02E410 if builtin103() != 1 -> 0x2E4CC + 0x02EC90 if unit_state(ADN311) != 1 -> 0x2ECFC + 0x02ECE8 if unit_state(TCN003) == 1 -> 0x2ED08 + 0x02ED60 if dist_lt(ADN311, TCN003, 10000) != 1 -> 0x2EE20 + 0x02EE68 if unit_state(ADN312) == 1 -> 0x2EE88 + 0x02EEE0 if dist_lt(ADN312, TCN001, 10000) != 1 -> 0x2F040 + 0x02F084 if hp_pct_test(ADT306, 0) == 1 -> 0x2F0EC + 0x02F0D8 if hp_pct_test(TCN003, 0) != 1 -> 0x2F0F8 + 0x02F150 if dist_lt(ADT306, TCN003, 10000) != 1 -> 0x2F2B0 + 0x02F2F4 if hp_pct_test(ADS351, 0) != 1 -> 0x2F454 + 0x02F498 if hp_pct_test(TCN004, 50) != 1 -> 0x2F558 + 0x02F59C if hp_pct_test(TCN003, 0) != 1 -> 0x2F5BC + 0x02F5BC if global[124] != 0 -> 0x2F664 + 0x02F5F4 if unit_alive(ADT306) != 1 -> 0x2F664 + 0x02F644 if unit_relation(TCN003, ADT306) != 1 -> 0x2F664 + 0x02F6A4 if hp_pct_test(ADT306, 0, 1) != 1 -> 0x2F82C + 0x02F6B8 if global[120] != 0 -> 0x2F780 + 0x02F6CC if global[124] != 1 -> 0x2F780 + 0x02F830 if global[108] != 1 -> 0x2F9FC + 0x02F9C8 if request_script_message(MSG_VOICE_A_223, 2, 0, 8, 1, -1) == 0 -> 0x2F870 + 0x02F9DC if request_script_message(MSG_VOICE_A_223, 2, 0, 8, 1, -1) == 1 -> 0x2F918 + 0x02FA44 if 8 < 1 -> 0x2FBC8 + 0x02FC10 if 8 < 3 -> 0x2FCF4 + 0x02FD3C if 8 < 4 -> 0x2FE20 + 0x02FE68 if 8 < 5 -> 0x2FF4C + 0x02FF94 if 8 < 6 -> 0x30118 + 0x030160 if 8 < 7 -> 0x30220 + 0x030254 if unit_alive(ADT301) != 1 -> 0x302E0 + 0x0302C0 if dist_lt(ADT301, TCN000, 15000) != 1 -> 0x302E0 + 0x030304 if unit_alive(ADT302) != 1 -> 0x30390 + 0x030370 if dist_lt(ADT302, TCN000, 15000) != 1 -> 0x30390 + 0x0303B4 if unit_alive(ADT303) != 1 -> 0x30440 + 0x030420 if dist_lt(ADT303, TCN000, 15000) != 1 -> 0x30440 + 0x030464 if unit_alive(ADT304) != 1 -> 0x304F0 + 0x0304D0 if dist_lt(ADT304, TCN000, 15000) != 1 -> 0x304F0 + 0x030514 if unit_alive(ADT305) != 1 -> 0x305A0 + 0x030580 if dist_lt(ADT305, TCN000, 15000) != 1 -> 0x305A0 + 0x0305C4 if unit_alive(ADT306) != 1 -> 0x30650 + 0x030630 if dist_lt(ADT306, TCN000, 15000) != 1 -> 0x30650 + 0x030674 if unit_alive(ADT307) != 1 -> 0x30700 + 0x0306E0 if dist_lt(ADT307, TCN000, 15000) != 1 -> 0x30700 + 0x030724 if unit_alive(ADT308) != 1 -> 0x307B0 + 0x030790 if dist_lt(ADT308, TCN000, 15000) != 1 -> 0x307B0 + 0x0307B0 if global[4] != 1 -> 0x30870 + 0x030874 if global[112] < 1 -> 0x309D4 + 0x0309D8 if global[112] < 1 -> 0x30ABC + 0x030AC0 if global[112] < 2 -> 0x30D08 + 0x030D0C if global[112] < 3 -> 0x30F0C + 0x030F10 if global[112] < 3 -> 0x30FD0 + 0x031018 if unit_state(ADT302) != 1 -> 0x31170 + 0x031044 if global[128] != 1 -> 0x310CC + 0x0311B4 if unit_state(ADT301) != 1 -> 0x3130C + 0x0311E0 if global[128] != 1 -> 0x31268 + 0x031350 if unit_state(ADT303) != 1 -> 0x314A8 + 0x03137C if global[128] != 1 -> 0x31404 + 0x0314EC if unit_state(ADT305) != 1 -> 0x31644 + 0x031518 if global[128] != 1 -> 0x315A0 + 0x031688 if unit_state(ADT304) != 1 -> 0x317E0 + 0x0316B4 if global[128] != 1 -> 0x3173C + 0x031824 if unit_state(ADT306) != 1 -> 0x3197C + 0x031850 if global[128] != 1 -> 0x318D8 + 0x0319C0 if unit_state(ADT307) != 1 -> 0x31B18 + 0x0319EC if global[128] != 1 -> 0x31A74 + 0x031B5C if unit_state(ADT308) != 1 -> 0x31CB4 + 0x031B88 if global[128] != 1 -> 0x31C10 + 0x031D18 if unit_hp_pct(TCN001, Character_Player_Test) > 40 -> 0x32D80 + 0x031D2C if global[20] == 8 -> 0x32D80 + 0x031F1C if global[128] != 1 -> 0x3261C + 0x031F74 if unit_state(ADT301) != 1 -> 0x31FF4 + 0x032038 if unit_state(ADT302) != 1 -> 0x320B8 + 0x0320FC if unit_state(ADT303) != 1 -> 0x3217C + 0x0321C0 if unit_state(ADT304) != 1 -> 0x32240 + 0x032284 if unit_state(ADT305) != 1 -> 0x32304 + 0x032348 if unit_state(ADT306) != 1 -> 0x323C8 + 0x03240C if unit_state(ADT307) != 1 -> 0x3248C + 0x0324D0 if unit_state(ADT308) != 1 -> 0x32550 + 0x032594 if unit_state(ADS351) != 1 -> 0x32614 + 0x032660 if unit_state(ADT301) != 1 -> 0x326E0 + 0x032724 if unit_state(ADT302) != 1 -> 0x327A4 + 0x0327E8 if unit_state(ADT303) != 1 -> 0x32868 + 0x0328AC if unit_state(ADT304) != 1 -> 0x3292C + 0x032970 if unit_state(ADT305) != 1 -> 0x329F0 + 0x032A34 if unit_state(ADT306) != 1 -> 0x32AB4 + 0x032AF8 if unit_state(ADT307) != 1 -> 0x32B78 + 0x032BBC if unit_state(ADT308) != 1 -> 0x32C3C + 0x032C80 if unit_state(ADS351) != 1 -> 0x32D00 + 0x032DDC if dist_lt(TCN001, TCN099, 8000, 8) != 1 -> 0x32E9C + 0x032F00 if unit_hp_pct(TCN001, Character_Player_Test) <= 50 -> 0x32FD4 + 0x03301C if unit_state(ADS351) == 1 -> 0x3303C + 0x033094 if dist_lt(TCN001, ADS351, 5000) != 1 -> 0x33154 + 0x03319C if unit_state(ADS351) == 1 -> 0x33204 + 0x033208 if global[20] != 0 -> 0x33430 + 0x033260 if unit_state(ADT301) == 1 -> 0x33430 + 0x033300 if unit_state(ADT302) != 2 -> 0x33424 + 0x033338 if builtin105(ADT302) != 1 -> 0x33424 + 0x033370 if builtin105(ADT301) != 1 -> 0x33424 + 0x033430 if global[20] != 1 -> 0x334F0 + 0x033488 if unit_state(ADT302) == 1 -> 0x334F0 + 0x0334F0 if global[20] != 2 -> 0x335B0 + 0x033548 if unit_state(ADT303) == 1 -> 0x335B0 + 0x0335B0 if global[20] != 3 -> 0x33670 + 0x033608 if unit_state(ADT304) == 1 -> 0x33670 + 0x033670 if global[20] != 4 -> 0x33730 + 0x0336C8 if unit_state(ADT305) == 1 -> 0x33730 + 0x033730 if global[20] != 5 -> 0x337F0 + 0x033788 if unit_state(ADT306) == 1 -> 0x337F0 + 0x0337F0 if global[20] != 6 -> 0x338B0 + 0x033848 if unit_state(ADT307) == 1 -> 0x338B0 + 0x0338B0 if global[20] != 7 -> 0x33970 + 0x033908 if unit_state(ADT308) == 1 -> 0x33970 + 0x0339B8 if unit_state(ADT301) != 2 -> 0x33A48 + 0x0339F0 if builtin105(ADT301) != 1 -> 0x33A3C + 0x033A04 if global[20] == 0 -> 0x33A3C + 0x033A90 if unit_state(ADT302) != 2 -> 0x33B20 + 0x033AC8 if builtin105(ADT302) != 1 -> 0x33B14 + 0x033ADC if global[20] == 1 -> 0x33B14 + 0x033B68 if unit_state(ADT303) != 2 -> 0x33BF8 + 0x033BA0 if builtin105(ADT303) != 1 -> 0x33BEC + 0x033BB4 if global[20] == 2 -> 0x33BEC + 0x033C40 if unit_state(ADT304) != 2 -> 0x33CD0 + 0x033C78 if builtin105(ADT304) != 1 -> 0x33CC4 + 0x033C8C if global[20] == 3 -> 0x33CC4 + 0x033D18 if unit_state(ADT305) != 2 -> 0x33DA8 + 0x033D50 if builtin105(ADT305) != 1 -> 0x33D9C + 0x033D64 if global[20] == 4 -> 0x33D9C + 0x033DF0 if unit_state(ADT306) != 2 -> 0x33E80 + 0x033E28 if builtin105(ADT306) != 1 -> 0x33E74 + 0x033E3C if global[20] == 5 -> 0x33E74 + 0x033EC8 if unit_state(ADT307) != 2 -> 0x33F58 + 0x033F00 if builtin105(ADT307) != 1 -> 0x33F4C + 0x033F14 if global[20] == 6 -> 0x33F4C + 0x033FA0 if unit_state(ADT308) != 2 -> 0x34030 + 0x033FD8 if builtin105(ADT308) != 1 -> 0x34024 + 0x033FEC if global[20] == 7 -> 0x34024 + 0x034034 if global[12] < 3 -> 0x340FC + 0x034048 if global[16] >= 3 -> 0x340FC + 0x0340FC if global[12] < 2 -> 0x341C4 + 0x034110 if global[16] >= 2 -> 0x341C4 + 0x0341C4 if global[12] < 1 -> 0x3428C + 0x0341D8 if global[16] >= 1 -> 0x3428C + 0x0342EC if unit_state(ADT301, global[12]) == 1 -> 0x34358 + 0x034344 if unit_state(ADT302) != 1 -> 0x345FC + 0x03439C if unit_state(TCN000) == 1 -> 0x343BC + 0x034400 if unit_state(ADT301) == 1 -> 0x34478 + 0x034458 if unit_state(ADT302) == 1 -> 0x34478 + 0x0344D0 if dist_lt(ADT301, TCN000, 20000) == 1 -> 0x34550 + 0x03453C if dist_lt(ADT302, TCN000, 20000) != 1 -> 0x345FC + 0x03460C if global[20] == 8 -> 0x34634 + 0x034620 if global[20] != 9 -> 0x34640 + 0x034640 if global[20] != 0 -> 0x346B8 + 0x034698 if unit_state(ADT301) == 1 -> 0x346B8 + 0x0346B8 if global[20] != 1 -> 0x34730 + 0x034710 if unit_state(ADT302) == 1 -> 0x34730 + 0x034730 if global[20] != 2 -> 0x347A8 + 0x034788 if unit_state(ADT303) == 1 -> 0x347A8 + 0x0347A8 if global[20] != 3 -> 0x34820 + 0x034800 if unit_state(ADT304) == 1 -> 0x34820 + 0x034820 if global[20] != 4 -> 0x34898 + 0x034878 if unit_state(ADT305) == 1 -> 0x34898 + 0x034898 if global[20] != 5 -> 0x34910 + 0x0348F0 if unit_state(ADT306) == 1 -> 0x34910 + 0x034910 if global[20] != 6 -> 0x34988 + 0x034968 if unit_state(ADT307) == 1 -> 0x34988 + 0x034988 if global[20] != 7 -> 0x34A00 + 0x0349E0 if unit_state(ADT308) == 1 -> 0x34A00 + 0x034A90 if builtin83(209) == 1 -> 0x34A30 + 0x034AA4 if builtin83(209) == 2 -> 0x34A5C diff --git a/docs/re/structures/isl-conditions.md b/docs/re/structures/isl-conditions.md new file mode 100644 index 00000000..d44291a2 --- /dev/null +++ b/docs/re/structures/isl-conditions.md @@ -0,0 +1,94 @@ +# ✅ Every condition site, with its comparand — the clear conditions are readable + +This is what the whole ISL chain was for. `data/isl-stage02-conditions.txt` has +existed for a long time as a **stale artefact with no generator** — +`isl_report.py`'s own docstring says so. It has one now, and the conditions are +resolved rather than printed as `special[N]`. + +## ✅ The deque ops are an expression stack + +`isl-bytecode.md` names ops 21–24 `push.i`/`push.f`/`pop.i`/`pop.f` over deques +at `phase+44` / `phase+64`. What they are *used for* is the missing piece: + +``` +set.i special[0] = 1 +set.i special[1] = special[0] +push.i ; save the comparand +set.i local[0] = 1 +set.i local[4] = 0x49 +call unit_state(ADT308) ; result -> special[0] (clobbers it) +pop.i ; restore comparand -> special[1] +cmp.i special[0], special[1] +beq -> 0xFEB4 +``` + +A textbook stack-machine lowering: **push the left operand, evaluate the right, +pop, compare.** Tracking the stack through the decode is therefore enough to +recover what every site actually tests. + +### The evidence it is a stack, not something else + +| check | result | +|---|---| +| `push` vs `pop` across all 28 stages | **1877 vs 1877** | +| files where the deque underflows or ends unbalanced | **0 of 28** | +| Stage 02 `pop.i` sites immediately followed by `cmp.i` | **319 / 319** | +| ops immediately preceding a `pop.i` | `call` ×313, `cmp.a` ×6 | + +Perfect balance with zero underflow across 28 independent files is not something +a wrong model produces, and `pop.i` → `cmp.i` at 319/319 makes `pop.i` a reliable +marker for a condition site. + +## ✅ Result — disc-wide + +`isl.conditions()` walks the linear stream tracking `special[]`, `local[]` and +the stack, then reports each compare with its branch: + +| | all 28 stages | +|---|---| +| condition sites | **7 563** | +| **either side left unresolved as `special[N]`** | **0 — 0.0 %** | +| LHS is a resolved built-in call | 6 292 — 83.2 % | +| RHS is a plain number | 7 544 — 99.7 % | + +**Most-tested predicates disc-wide:** `hp_pct_test` 1955, `unit_state` 1257, +`unit_relation` 796, `dist_lt` 450, `request_script_message` 425, +`unit_alive` 413, `read_freg` 187. + +And they read as conditions: + +``` +0x032F4 ph1 if unit_alive(TCN105) != 1 -> 0x3388 +0x04D70 ph1 if unit_hp_pct(TCN001, Character_Player_Test) != 0 -> 0x51FC +0x2C4E0 ph3 if hp_pct_test(ADT308, 0) != 1 -> 0x2CF8C +0x30790 ph3 if dist_lt(ADT308, TCN000, 15000) != 1 -> 0x307B0 +0x33FA0 ph3 if unit_state(ADT308) != 2 -> 0x34030 +0x349E0 ph3 if unit_state(ADT308) == 1 -> 0x34A00 +``` + +`dist_lt(ADT308, TCN000, 15000)` — with the world unit established as 1 metre, +that is a **15 km** proximity test. + +## 🟡 A caveat the numbers themselves expose + +15 of Stage 02's 965 sites (1.6 %) attribute the left-hand side to +**`end_coroutine`**, which does not return a value. The tracker sets +`special[0]` on *every* call, so where the right-hand side of a comparison was +not actually a value-producing built-in, the LHS shown is a **stale** +`special[0]` from an earlier call. Those sites are wrong, not merely imprecise. + +The fix is to set `special[0]` only for built-ins that write `[phase+164]` — +which [`isl-builtin-dispatch`](isl-builtin-dispatch.md) makes checkable, since +112 of 147 are vtable slots whose implementations can be tested for that store. +Not done; recorded so the 1.6 % is not read as accurate. + +## 🟡 Not settled + +* The **35 unnamed built-ins** still print as `builtinN` — `builtin103` (115 + sites), `builtin105` (117) and `builtin16` (132) are the highest-traffic + unknowns, and each is now a vtable-slot lookup away. +* **Which condition guards each `END_PHASE`.** Every site is readable, but + linking a condition to the phase exit it eventually reaches needs the control + flow between them, which this listing does not follow. +* Only Stage 02's artefact is committed; the other 27 generate from the same + command but are not in the tree. diff --git a/tools/re-capture/isl.py b/tools/re-capture/isl.py index b90035b5..6e4a2284 100755 --- a/tools/re-capture/isl.py +++ b/tools/re-capture/isl.py @@ -354,6 +354,82 @@ def dis(b, off, count=40, code_base=0x24, args=True, sym2=None, sym1=None, return out +REL = {13: '==', 14: '!=', 15: '<', 16: '<=', 17: '>', 18: '>='} + + +def conditions(b, sym1=None, sym2=None): + """Every condition site, with its comparand resolved. + + The deque ops are an EXPRESSION STACK, which is what makes this possible: + `push.i` saves `special[1]`, the right-hand side is evaluated (usually a + built-in call, whose result lands in `special[0]`), `pop.i` restores the + saved comparand into `special[1]`, and `cmp.i` compares the two. + + MEASURED, and this is why the model is trusted: across all 28 stages + push and pop balance at 1877 each with ZERO underflows, and in Stage 02 + all 319 `pop.i` sites are immediately followed by `cmp.i`. + """ + bases = phase_bases(b) + sp, loc, stack = {}, {}, [] + out, pend = [], None + for off in linear_offsets(b): + w = struct.unpack_from('>I', b, off)[0] + op, ln = w & 0xFF, (w >> 8) & 0xFF + src_kind, dst_kind = (w >> 24) & 0xFF, (w >> 16) & 0xFF + words = [struct.unpack_from('>I', b, off + i)[0] + for i in range(4, max(ln, 4), 4) if off + i + 4 <= len(b)] + + def val(kind, operand, lo=0): + if kind == 1: + if op == 1: + return '%.6g' % struct.unpack('>d', + struct.pack('>II', operand, lo))[0] + return str(operand) + if kind == 2: + return sp.get(operand, 'special[%d]' % operand) + if kind == 3: + return loc.get(operand, 'local[%d]' % operand) + return 'global[%d]' % operand + + if op in (0, 1) and len(words) >= 2: + v = val(src_kind, words[1], words[2] if len(words) > 2 else 0) + (sp if dst_kind == 2 else loc)[words[0]] = v + elif op == 19 and words: + nm = BUILTIN.get(words[0], 'builtin%d' % words[0]) + args = [] + tags = {sl - 4 for sl, ids in UNIT_SLOTS.items() + if words[0] in ids and sl in loc} + for sl in sorted(loc): + v = loc[sl] + if sl in tags and v == '1': + continue + if v.isdigit(): + i = int(v) + if sym2 and words[0] in UNIT_SLOTS.get(sl, ()) and i in sym2: + v = sym2[i][1] + elif sym1 and words[0] in SYM1_SLOTS.get(sl, ()) and i in sym1: + v = sym1[i][1] + args.append(v) + sp[0] = '%s(%s)' % (nm, ', '.join(args)) + loc = {} + elif op == 21: + stack.append(sp.get(1)) + elif op == 22: + stack.append(sp.get(1)) + elif op in (23, 24): + sp[1] = stack.pop() if stack else None + elif op in (10, 11): + pend = (off, val(dst_kind, words[0]), val(src_kind, words[1])) + elif op in REL and pend: + ph = sum(1 for x in bases if x <= off) + tgt = bases[ph - 1] + words[0] if words else None + out.append({'off': pend[0], 'phase': ph, 'lhs': pend[1], + 'rel': REL[op], 'rhs': pend[2], 'branch': off, + 'target': tgt}) + pend = None + return out + + def call_sites(b): """Every `call` in the code region. Scans on the encoding, not by decoding, so a bad length somewhere cannot hide the rest of the file.""" diff --git a/tools/re-capture/isl_report.py b/tools/re-capture/isl_report.py index 0b1bb57e..17ccbda7 100644 --- a/tools/re-capture/isl_report.py +++ b/tools/re-capture/isl_report.py @@ -9,6 +9,7 @@ arguments) and once when three built-in names were corrected. Keeping the generator in the tree is the point of this file. isl_report.py phase-ends -> every END_PHASE with its context + isl_report.py conditions -> every condition site, comparand resolved The "needs the coroutine entry points" blocker recorded here is REFUTED: the instruction stream is FLAT and `isl.linear_offsets` reaches 25705/25705 call @@ -93,11 +94,42 @@ def emit_phase_ends(b, path): print(' ' + line) +def emit_conditions(b, path): + """Every condition site with its comparand — what `data/isl-stage02-conditions.txt` + never had a generator for.""" + import collections + cs = isl.conditions(b, isl.symbols(b, 1), isl.symbols(b, 2)) + bases = isl.phase_bases(b) + print('# %s — condition sites, comparands resolved' % path) + print() + print('Generated by `tools/re-capture/isl_report.py conditions`.') + print() + print('The deque ops are an expression stack: `push.i` saves the comparand,') + print('the right-hand side is evaluated (its result lands in `special[0]`),') + print('`pop.i` restores the comparand into `special[1]`, then `cmp.i` compares.') + print() + print('%d condition sites; phase bases %s' + % (len(cs), ' '.join('0x%x' % x for x in bases))) + h = collections.Counter(c['lhs'].split('(')[0] for c in cs if '(' in c['lhs']) + print() + print('## most-tested predicates') + for k, n in h.most_common(20): + print(' %-28s %4d' % (k, n)) + for ph in range(1, len(bases) + 1): + rows = [c for c in cs if c['phase'] == ph] + print() + print('## phase %d — %d sites' % (ph, len(rows))) + for c in rows: + print(' 0x%06X if %s %s %s -> 0x%X' + % (c['off'], c['lhs'], c['rel'], c['rhs'], c['target'])) + + def main(): path = sys.argv[1] b = isl.load(path) name = path.replace('\\', '/').split('/')[-1] - {'calls': emit_calls, 'phase-ends': emit_phase_ends}[sys.argv[2]](b, name) + {'calls': emit_calls, 'phase-ends': emit_phase_ends, + 'conditions': emit_conditions}[sys.argv[2]](b, name) if __name__ == '__main__':