From 1c1c2aa89920ffcf4d80a29c12a9999188adbaac Mon Sep 17 00:00:00 2001 From: KonAki Date: Fri, 16 Oct 2026 07:08:55 +0800 Subject: add random fights to rmfield --- kon/konrmfield.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'kon/konrmfield.h') diff --git a/kon/konrmfield.h b/kon/konrmfield.h index d2b358f..17a44fd 100644 --- a/kon/konrmfield.h +++ b/kon/konrmfield.h @@ -76,10 +76,12 @@ typedef struct kon_rmField { int count; uint32_t seed; int busy; /* set it while a script that stops the player is running */ - int steps; /* the steps of the player, count them for encounters and take them back to 0 */ + int steps; /* the steps of the player so far, for the game to use as it likes */ int thisEvent; /* the id of the event whose script is running, for the commands that mean "this event". set it before you run one */ int waitIndex; /* the character a script waits for, -1 for none */ int transferPending; + int encounterCount; /* what is left until the next fight, in halves of a step */ + int encounterHalf, encounterNone; /* set them to halve the steps that count, or to stop fights altogether */ kon_rmTransfer_t transfer; /* both can stay NULL. the first is how a route that turns a switch on or off reaches your game, the second says whether @@ -111,6 +113,13 @@ int kon_rmFieldPlayerStep(kon_rmField_t *field, int dir, int dash); /* the action button: an event on the player's tile or in front of it, or behind a counter. returns 1 when one starts */ int kon_rmFieldAction(kon_rmField_t *field); +/*** fights ***/ + +/* the random fights of the map: every step of the player counts down, a bush counts twice, and when it runs out a troop is picked + from the map's list by weight, only the ones whose regions include the one the player stands in. returns the troop id once, + or 0 for no fight. call it when no script is running. nothing starts while the player is walking a forced route */ +int kon_rmFieldEncounter(kon_rmField_t *field); + /*** events that start ***/ /* the next event that wants its script to run, lowest first: the touched or talked to, and the autorun ones. call it when no -- cgit