Drive battle rounds through cutscene items, fix render/init bugs
Adds BATTLE_START, BATTLE_SET_STATE and BATTLE_WAIT_SELECTION cutscene items so a battle's state transitions (opening -> pre-round -> selection -> executing) are chained through the running cutscene, with cutsceneSystemInsertItemsNext/InsertItems splitting "splice" from "splice and advance immediately". Adds battlestateselection's get-current-fighter/player-attack/player-flee API backing the battle UI, and battleMoveGetIdByName for JSON-authored ability lookups. Fixes: off-by-one in battleMoveInit that let the first-defined move alias BATTLE_MOVE_ID_NULL; a segfault in scenebattle.c from rendering unfilled (NULL) fighter slots; stale battleGetCurrentFighter/ battlePlayerAttack/battlePlayerFlee references in the battle UI. Adds assertions across the battle/scene/UI code for fighter-index bounds and non-null invariants. Updates battletest.jsonc for the new BATTLE_START item schema. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -1,24 +1,22 @@
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"type": "START_BATTLE",
|
||||
"encounterType": "REGULAR",
|
||||
"fleeAvailable": true,
|
||||
"type": "BATTLE_START",
|
||||
"enemies": [
|
||||
{
|
||||
"stats": { "attack": 8, "defense": 4, "magic": 0, "speed": 5, "luck": 2 },
|
||||
"healthMax": 30,
|
||||
"mpMax": 0
|
||||
"stats": {
|
||||
"attack": 8, "defense": 4, "magic": 0, "speed": 5, "luck": 2,
|
||||
"healthMax": 30, "mpMax": 0
|
||||
},
|
||||
"abilities": ["fire"]
|
||||
},
|
||||
{
|
||||
"stats": { "attack": 6, "defense": 3, "magic": 0, "speed": 7, "luck": 2 },
|
||||
"healthMax": 20,
|
||||
"mpMax": 0
|
||||
"stats": {
|
||||
"attack": 6, "defense": 3, "magic": 0, "speed": 7, "luck": 2,
|
||||
"healthMax": 20, "mpMax": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "REGULAR_BATTLE"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user