mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
wild encounter review changes
This commit is contained in:
parent
3de416662b
commit
4e25ef10f2
@ -80,7 +80,7 @@
|
|||||||
.equiv FLAG_0x050, 0x50
|
.equiv FLAG_0x050, 0x50
|
||||||
.equiv FLAG_0x051, 0x51
|
.equiv FLAG_0x051, 0x51
|
||||||
.equiv FLAG_0x052, 0x52
|
.equiv FLAG_0x052, 0x52
|
||||||
.equiv FLAG_0x053, 0x53
|
.equiv FLAG_LEGENDARIES_IN_SOOTOPOLIS, 0x53
|
||||||
.equiv FLAG_0x054, 0x54
|
.equiv FLAG_0x054, 0x54
|
||||||
.equiv FLAG_0x055, 0x55
|
.equiv FLAG_0x055, 0x55
|
||||||
.equiv FLAG_0x056, 0x56
|
.equiv FLAG_0x056, 0x56
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
.equiv VAR_0x403B, 0x403B
|
.equiv VAR_0x403B, 0x403B
|
||||||
.equiv VAR_0x403C, 0x403C
|
.equiv VAR_0x403C, 0x403C
|
||||||
.equiv VAR_0x403D, 0x403D
|
.equiv VAR_0x403D, 0x403D
|
||||||
.equiv VAR_0x403E, 0x403E
|
.equiv VAR_ALTERING_CAVE_WILD_SET, 0x403E
|
||||||
.equiv VAR_0x403F, 0x403F
|
.equiv VAR_0x403F, 0x403F
|
||||||
.equiv VAR_DAYS, 0x4040
|
.equiv VAR_DAYS, 0x4040
|
||||||
.equiv VAR_0x4041, 0x4041
|
.equiv VAR_0x4041, 0x4041
|
||||||
|
@ -127,7 +127,7 @@ SeafloorCavern_Room9_EventScript_234DC9:: @ 8234DC9
|
|||||||
clearflag FLAG_0x3E6
|
clearflag FLAG_0x3E6
|
||||||
clearflag FLAG_0x3E5
|
clearflag FLAG_0x3E5
|
||||||
setflag FLAG_0x347
|
setflag FLAG_0x347
|
||||||
setflag FLAG_0x053
|
setflag FLAG_LEGENDARIES_IN_SOOTOPOLIS
|
||||||
clearflag FLAG_0x3B0
|
clearflag FLAG_0x3B0
|
||||||
clearflag FLAG_0x3B1
|
clearflag FLAG_0x3B1
|
||||||
setflag FLAG_SYS_WEATHER_CTRL
|
setflag FLAG_SYS_WEATHER_CTRL
|
||||||
|
@ -545,7 +545,7 @@ SootopolisCity_EventScript_1E5C1E:: @ 81E5C1E
|
|||||||
waitstate
|
waitstate
|
||||||
clearflag FLAG_SYS_WEATHER_CTRL
|
clearflag FLAG_SYS_WEATHER_CTRL
|
||||||
setvar VAR_0x40CA, 3
|
setvar VAR_0x40CA, 3
|
||||||
clearflag FLAG_0x053
|
clearflag FLAG_LEGENDARIES_IN_SOOTOPOLIS
|
||||||
fadenewbgm BGM_RUNECITY
|
fadenewbgm BGM_RUNECITY
|
||||||
delay 120
|
delay 120
|
||||||
clearflag FLAG_SPECIAL_FLAG_0x4000
|
clearflag FLAG_SPECIAL_FLAG_0x4000
|
||||||
@ -598,7 +598,7 @@ SootopolisCity_EventScript_1E5CCE:: @ 81E5CCE
|
|||||||
waitstate
|
waitstate
|
||||||
clearflag FLAG_SYS_WEATHER_CTRL
|
clearflag FLAG_SYS_WEATHER_CTRL
|
||||||
setvar VAR_0x40CA, 2
|
setvar VAR_0x40CA, 2
|
||||||
clearflag FLAG_0x053
|
clearflag FLAG_LEGENDARIES_IN_SOOTOPOLIS
|
||||||
fadenewbgm BGM_NAMINORI
|
fadenewbgm BGM_NAMINORI
|
||||||
delay 120
|
delay 120
|
||||||
clearflag FLAG_SPECIAL_FLAG_0x4000
|
clearflag FLAG_SPECIAL_FLAG_0x4000
|
||||||
|
@ -81,7 +81,7 @@ static bool8 CheckFeebas(void)
|
|||||||
u16 feebasSpots[NUM_FEEBAS_SPOTS];
|
u16 feebasSpots[NUM_FEEBAS_SPOTS];
|
||||||
s16 x;
|
s16 x;
|
||||||
s16 y;
|
s16 y;
|
||||||
u8 route119section = 0;
|
u8 route119Section = 0;
|
||||||
u16 waterTileNum;
|
u16 waterTileNum;
|
||||||
|
|
||||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP_ROUTE119
|
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP_ROUTE119
|
||||||
@ -93,16 +93,16 @@ static bool8 CheckFeebas(void)
|
|||||||
|
|
||||||
#ifdef NONMATCHING
|
#ifdef NONMATCHING
|
||||||
if (y >= gRoute119WaterTileData[3 * 1 + 0] && y <= gRoute119WaterTileData[3 * 1 + 1])
|
if (y >= gRoute119WaterTileData[3 * 1 + 0] && y <= gRoute119WaterTileData[3 * 1 + 1])
|
||||||
route119section = 1;
|
route119Section = 1;
|
||||||
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;
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
register const u16 *arr asm("r0");
|
register const u16 *arr asm("r0");
|
||||||
if (y >= (arr = gRoute119WaterTileData)[3 * 1 + 0] && y <= arr[3 * 1 + 1])
|
if (y >= (arr = gRoute119WaterTileData)[3 * 1 + 0] && y <= arr[3 * 1 + 1])
|
||||||
route119section = 1;
|
route119Section = 1;
|
||||||
if (y >= arr[3 * 2 + 0] && y <= arr[3 * 2 + 1])
|
if (y >= arr[3 * 2 + 0] && y <= arr[3 * 2 + 1])
|
||||||
route119section = 2;
|
route119Section = 2;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ static bool8 CheckFeebas(void)
|
|||||||
if (feebasSpots[i] < 1 || feebasSpots[i] >= 4)
|
if (feebasSpots[i] < 1 || feebasSpots[i] >= 4)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
waterTileNum = GetRoute119WaterTileNum(x, y, route119section);
|
waterTileNum = GetRoute119WaterTileNum(x, y, route119Section);
|
||||||
for (i = 0; i < NUM_FEEBAS_SPOTS; i++)
|
for (i = 0; i < NUM_FEEBAS_SPOTS; i++)
|
||||||
{
|
{
|
||||||
if (waterTileNum == feebasSpots[i])
|
if (waterTileNum == feebasSpots[i])
|
||||||
@ -128,9 +128,12 @@ static bool8 CheckFeebas(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The number 1103515245 comes from the example implementation of rand and srand
|
||||||
|
// in the ISO C standard.
|
||||||
|
|
||||||
static u16 FeebasRandom(void)
|
static u16 FeebasRandom(void)
|
||||||
{
|
{
|
||||||
sFeebasRngValue = 12345 + 0x41C64E6D * sFeebasRngValue;
|
sFeebasRngValue = (1103515245 * sFeebasRngValue) + 12345;
|
||||||
return sFeebasRngValue >> 16;
|
return sFeebasRngValue >> 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,25 +148,25 @@ static u8 ChooseWildMonIndex_Land(void)
|
|||||||
|
|
||||||
if (rand < 20) // 20% chance
|
if (rand < 20) // 20% chance
|
||||||
return 0;
|
return 0;
|
||||||
if (rand >= 20 && rand < 40) // 20% chance
|
else if (rand >= 20 && rand < 40) // 20% chance
|
||||||
return 1;
|
return 1;
|
||||||
if (rand >= 40 && rand < 50) // 10% chance
|
else if (rand >= 40 && rand < 50) // 10% chance
|
||||||
return 2;
|
return 2;
|
||||||
if (rand >= 50 && rand < 60) // 10% chance
|
else if (rand >= 50 && rand < 60) // 10% chance
|
||||||
return 3;
|
return 3;
|
||||||
if (rand >= 60 && rand < 70) // 10% chance
|
else if (rand >= 60 && rand < 70) // 10% chance
|
||||||
return 4;
|
return 4;
|
||||||
if (rand >= 70 && rand < 80) // 10% chance
|
else if (rand >= 70 && rand < 80) // 10% chance
|
||||||
return 5;
|
return 5;
|
||||||
if (rand >= 80 && rand < 85) // 5% chance
|
else if (rand >= 80 && rand < 85) // 5% chance
|
||||||
return 6;
|
return 6;
|
||||||
if (rand >= 85 && rand < 90) // 5% chance
|
else if (rand >= 85 && rand < 90) // 5% chance
|
||||||
return 7;
|
return 7;
|
||||||
if (rand >= 90 && rand < 94) // 4% chance
|
else if (rand >= 90 && rand < 94) // 4% chance
|
||||||
return 8;
|
return 8;
|
||||||
if (rand >= 94 && rand < 98) // 4% chance
|
else if (rand >= 94 && rand < 98) // 4% chance
|
||||||
return 9;
|
return 9;
|
||||||
if (rand == 98) // 1% chance
|
else if (rand == 98) // 1% chance
|
||||||
return 10;
|
return 10;
|
||||||
else // 1% chance
|
else // 1% chance
|
||||||
return 11;
|
return 11;
|
||||||
@ -175,11 +178,11 @@ static u8 ChooseWildMonIndex_WaterRock(void)
|
|||||||
|
|
||||||
if (rand < 60) // 60% chance
|
if (rand < 60) // 60% chance
|
||||||
return 0;
|
return 0;
|
||||||
if (rand >= 60 && rand < 90) // 30% chance
|
else if (rand >= 60 && rand < 90) // 30% chance
|
||||||
return 1;
|
return 1;
|
||||||
if (rand >= 90 && rand < 95) // 5% chance
|
else if (rand >= 90 && rand < 95) // 5% chance
|
||||||
return 2;
|
return 2;
|
||||||
if (rand >= 95 && rand < 99) // 4% chance
|
else if (rand >= 95 && rand < 99) // 4% chance
|
||||||
return 3;
|
return 3;
|
||||||
else // 1% chance
|
else // 1% chance
|
||||||
return 4;
|
return 4;
|
||||||
@ -535,11 +538,11 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
|
|||||||
headerId = GetBattlePikeWildMonHeaderId();
|
headerId = GetBattlePikeWildMonHeaderId();
|
||||||
if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll())
|
if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (DoWildEncounterRateTest(gBattlePikeWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
else if (DoWildEncounterRateTest(gBattlePikeWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (TryGenerateWildMon(gBattlePikeWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_KEEN_EYE) != TRUE)
|
else if (TryGenerateWildMon(gBattlePikeWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_KEEN_EYE) != TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!TryGenerateBattlePikeWildMon(TRUE))
|
else if (!TryGenerateBattlePikeWildMon(TRUE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
BattleSetup_StartBattlePikeWildBattle();
|
BattleSetup_StartBattlePikeWildBattle();
|
||||||
@ -550,9 +553,9 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
|
|||||||
headerId = gSaveBlock2Ptr->battlePyramidWildHeaderId;
|
headerId = gSaveBlock2Ptr->battlePyramidWildHeaderId;
|
||||||
if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll())
|
if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (DoWildEncounterRateTest(gBattlePyramidWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
else if (DoWildEncounterRateTest(gBattlePyramidWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (TryGenerateWildMon(gBattlePyramidWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_KEEN_EYE) != TRUE)
|
else if (TryGenerateWildMon(gBattlePyramidWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_KEEN_EYE) != TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
GenerateBattlePyramidWildMon();
|
GenerateBattlePyramidWildMon();
|
||||||
@ -566,9 +569,9 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
|
|||||||
{
|
{
|
||||||
if (gWildMonHeaders[headerId].landMonsInfo == NULL)
|
if (gWildMonHeaders[headerId].landMonsInfo == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll())
|
else if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (DoWildEncounterRateTest(gWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
else if (DoWildEncounterRateTest(gWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (TryStartRoamerEncounter() == TRUE)
|
if (TryStartRoamerEncounter() == TRUE)
|
||||||
@ -603,11 +606,11 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
|
|||||||
{
|
{
|
||||||
if (AreLegendariesInSootopolisPreventingEncounters() == TRUE)
|
if (AreLegendariesInSootopolisPreventingEncounters() == TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (gWildMonHeaders[headerId].waterMonsInfo == NULL)
|
else if (gWildMonHeaders[headerId].waterMonsInfo == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll())
|
else if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (DoWildEncounterRateTest(gWildMonHeaders[headerId].waterMonsInfo->encounterRate, FALSE) != TRUE)
|
else if (DoWildEncounterRateTest(gWildMonHeaders[headerId].waterMonsInfo->encounterRate, FALSE) != TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (TryStartRoamerEncounter() == TRUE)
|
if (TryStartRoamerEncounter() == TRUE)
|
||||||
@ -783,10 +786,10 @@ u16 GetLocalWildMon(bool8 *isWaterMon)
|
|||||||
if (landMonsInfo == NULL && waterMonsInfo == NULL)
|
if (landMonsInfo == NULL && waterMonsInfo == NULL)
|
||||||
return SPECIES_NONE;
|
return SPECIES_NONE;
|
||||||
// Land Pokemon
|
// Land Pokemon
|
||||||
if (landMonsInfo != NULL && waterMonsInfo == NULL)
|
else if (landMonsInfo != NULL && waterMonsInfo == NULL)
|
||||||
return landMonsInfo->wildPokemon[ChooseWildMonIndex_Land()].species;
|
return landMonsInfo->wildPokemon[ChooseWildMonIndex_Land()].species;
|
||||||
// Water Pokemon
|
// Water Pokemon
|
||||||
if (landMonsInfo == NULL && waterMonsInfo != NULL)
|
else if (landMonsInfo == NULL && waterMonsInfo != NULL)
|
||||||
{
|
{
|
||||||
*isWaterMon = TRUE;
|
*isWaterMon = TRUE;
|
||||||
return waterMonsInfo->wildPokemon[ChooseWildMonIndex_WaterRock()].species;
|
return waterMonsInfo->wildPokemon[ChooseWildMonIndex_WaterRock()].species;
|
||||||
@ -907,9 +910,9 @@ static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildM
|
|||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3))
|
if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (GetMonAbility(&gPlayerParty[0]) != ability)
|
else if (GetMonAbility(&gPlayerParty[0]) != ability)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (Random() % 2 != 0)
|
else if (Random() % 2 != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TryGetRandomWildMonIndexByType(wildMon, type, LAND_WILD_COUNT, monIndex);
|
return TryGetRandomWildMonIndexByType(wildMon, type, LAND_WILD_COUNT, monIndex);
|
||||||
|
Loading…
Reference in New Issue
Block a user