mirror of https://github.com/pret/pokeemerald.git
create defines to support encounter index ratios
This commit is contained in:
parent
adb0a44457
commit
4594c955b4
|
@ -5,9 +5,9 @@
|
||||||
## for wild_encounter_field in wild_encounter_group.fields
|
## for wild_encounter_field in wild_encounter_group.fields
|
||||||
## for encounter_rate in wild_encounter_field.encounter_rates
|
## for encounter_rate in wild_encounter_field.encounter_rates
|
||||||
{% if trackVar(encounter_rate, 100) %}
|
{% 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
|
## endfor
|
||||||
|
#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_TOTAL (ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_INDEX_{{ getVar(wild_encounter_field.type) }})
|
||||||
## endfor
|
## endfor
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ static bool8 CheckFeebas(void)
|
||||||
if (y >= gRoute119WaterTileData[3 * 2 + 0] && y <= gRoute119WaterTileData[3 * 2 + 1])
|
if (y >= gRoute119WaterTileData[3 * 2 + 0] && y <= gRoute119WaterTileData[3 * 2 + 1])
|
||||||
route119Section = 2;
|
route119Section = 2;
|
||||||
|
|
||||||
if (Random() % 100 > 49)
|
if (Random() % 100 > 49) // 50% chance of encountering Feebas
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
FeebasSeedRng(gSaveBlock1Ptr->easyChatPairs[0].unk2);
|
FeebasSeedRng(gSaveBlock1Ptr->easyChatPairs[0].unk2);
|
||||||
|
@ -143,7 +143,7 @@ static void FeebasSeedRng(u16 seed)
|
||||||
|
|
||||||
static u8 ChooseWildMonIndex_Land(void)
|
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)
|
if (rand < ENCOUNTER_CHANCE_LAND_MONS_INDEX_0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -173,7 +173,7 @@ static u8 ChooseWildMonIndex_Land(void)
|
||||||
|
|
||||||
static u8 ChooseWildMonIndex_WaterRock(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)
|
if (rand < ENCOUNTER_CHANCE_WATER_MONS_INDEX_0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -197,7 +197,7 @@ enum
|
||||||
static u8 ChooseWildMonIndex_Fishing(u8 rod)
|
static u8 ChooseWildMonIndex_Fishing(u8 rod)
|
||||||
{
|
{
|
||||||
u8 wildMonIndex = 0;
|
u8 wildMonIndex = 0;
|
||||||
u8 rand = Random() % 100;
|
u8 rand = Random() % ENCOUNTER_CHANCE_FISHING_MONS_TOTAL;
|
||||||
|
|
||||||
switch (rod)
|
switch (rod)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
using std::string;
|
using std::string; using std::to_string;
|
||||||
|
|
||||||
#include <inja.hpp>
|
#include <inja.hpp>
|
||||||
using namespace inja;
|
using namespace inja;
|
||||||
|
@ -53,6 +53,13 @@ int main(int argc, char *argv[])
|
||||||
return "";
|
return "";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
env.add_callback("setVarInt", 2, [=](Arguments& args) {
|
||||||
|
string key = args.at(0)->get<string>();
|
||||||
|
string value = to_string(args.at(1)->get<int>());
|
||||||
|
set_custom_var(key, value);
|
||||||
|
return "";
|
||||||
|
});
|
||||||
|
|
||||||
env.add_callback("getVar", 1, [=](Arguments& args) {
|
env.add_callback("getVar", 1, [=](Arguments& args) {
|
||||||
string key = args.at(0)->get<string>();
|
string key = args.at(0)->get<string>();
|
||||||
return get_custom_var(key);
|
return get_custom_var(key);
|
||||||
|
|
Loading…
Reference in New Issue