diff options
author | garak <garakmon@gmail.com> | 2019-07-01 23:47:45 -0400 |
---|---|---|
committer | garak <garakmon@gmail.com> | 2019-07-01 23:47:45 -0400 |
commit | 4594c955b4f2145891d6728b84e33489ee352a3a (patch) | |
tree | 9df5c5121e76950b723f40ccc9a8684dd7b308f3 /src | |
parent | adb0a444577b59eb02788c782a3d04bc285be0ba (diff) |
create defines to support encounter index ratios
Diffstat (limited to 'src')
-rwxr-xr-x | src/data/wild_encounters.json.txt | 4 | ||||
-rw-r--r-- | src/wild_encounter.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/data/wild_encounters.json.txt b/src/data/wild_encounters.json.txt index 3fb42c404..30b05360c 100755 --- a/src/data/wild_encounters.json.txt +++ b/src/data/wild_encounters.json.txt @@ -5,9 +5,9 @@ ## for wild_encounter_field in wild_encounter_group.fields ## for encounter_rate in wild_encounter_field.encounter_rates {% if trackVar(encounter_rate, 100) %} -#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_INDEX_{{ loop.index }} {{ encounter_rate }} {% else %}#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_INDEX_{{ loop.index }} ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_INDEX_{{ subtract(loop.index, 1) }} + {{ encounter_rate }}{% endif %} +#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_INDEX_{{ loop.index }} {{ encounter_rate }} {% else %}#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_INDEX_{{ loop.index }} ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_INDEX_{{ subtract(loop.index, 1) }} + {{ encounter_rate }}{% endif %} {{ setVarInt(wild_encounter_field.type, loop.index) }} ## endfor - +#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_TOTAL (ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_INDEX_{{ getVar(wild_encounter_field.type) }}) ## endfor {% endif %} diff --git a/src/wild_encounter.c b/src/wild_encounter.c index f8031c451..5a11396d9 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -105,7 +105,7 @@ static bool8 CheckFeebas(void) if (y >= gRoute119WaterTileData[3 * 2 + 0] && y <= gRoute119WaterTileData[3 * 2 + 1]) route119Section = 2; - if (Random() % 100 > 49) + if (Random() % 100 > 49) // 50% chance of encountering Feebas return FALSE; FeebasSeedRng(gSaveBlock1Ptr->easyChatPairs[0].unk2); @@ -143,7 +143,7 @@ static void FeebasSeedRng(u16 seed) static u8 ChooseWildMonIndex_Land(void) { - u8 rand = Random() % 100; + u8 rand = Random() % ENCOUNTER_CHANCE_LAND_MONS_TOTAL; if (rand < ENCOUNTER_CHANCE_LAND_MONS_INDEX_0) return 0; @@ -173,7 +173,7 @@ static u8 ChooseWildMonIndex_Land(void) static u8 ChooseWildMonIndex_WaterRock(void) { - u8 rand = Random() % 100; + u8 rand = Random() % ENCOUNTER_CHANCE_WATER_MONS_TOTAL; if (rand < ENCOUNTER_CHANCE_WATER_MONS_INDEX_0) return 0; @@ -197,7 +197,7 @@ enum static u8 ChooseWildMonIndex_Fishing(u8 rod) { u8 wildMonIndex = 0; - u8 rand = Random() % 100; + u8 rand = Random() % ENCOUNTER_CHANCE_FISHING_MONS_TOTAL; switch (rod) { |