mirror of
https://github.com/pret/pokefirered.git
synced 2026-05-22 22:05:06 -05:00
added seasons and season based form encounters
This commit is contained in:
parent
b2a56f6b6c
commit
4efba579cd
|
|
@ -88,6 +88,13 @@
|
|||
#define TIME_EVENING 2
|
||||
#define TIME_NIGHT 3
|
||||
|
||||
#define SEASON_SPRING 0
|
||||
#define SEASON_SUMMER 1
|
||||
#define SEASON_AUTUMN 2
|
||||
#define SEASON_WINTER 3
|
||||
#define NUM_SEASONS 4
|
||||
#define DAYS_PER_SEASON 5
|
||||
|
||||
extern struct Time gLocalTime;
|
||||
|
||||
void RtcDisableInterrupts(void);
|
||||
|
|
@ -118,5 +125,6 @@ void RtcCalcLocalTimeOffset(s32 days, s32 hours, s32 minutes, s32 seconds);
|
|||
void CalcTimeDifference(struct Time *result, struct Time *t1, struct Time *t2);
|
||||
u32 RtcGetMinuteCount(void);
|
||||
u32 RtcGetLocalDayCount(void);
|
||||
u8 GetSeason(void);
|
||||
|
||||
#endif // GUARD_RTC_UTIL_H
|
||||
|
|
|
|||
|
|
@ -8263,27 +8263,27 @@
|
|||
{
|
||||
"min_level": 3,
|
||||
"max_level": 3,
|
||||
"species": "SPECIES_FARFETCHD_GALARIAN"
|
||||
"species": "SPECIES_DEERLING"
|
||||
},
|
||||
{
|
||||
"min_level": 3,
|
||||
"max_level": 3,
|
||||
"species": "SPECIES_FARFETCHD_GALARIAN"
|
||||
"species": "SPECIES_DEERLING"
|
||||
},
|
||||
{
|
||||
"min_level": 3,
|
||||
"max_level": 3,
|
||||
"species": "SPECIES_FARFETCHD_GALARIAN"
|
||||
"species": "SPECIES_DEERLING"
|
||||
},
|
||||
{
|
||||
"min_level": 3,
|
||||
"max_level": 3,
|
||||
"species": "SPECIES_FARFETCHD_GALARIAN"
|
||||
"species": "SPECIES_DEERLING"
|
||||
},
|
||||
{
|
||||
"min_level": 2,
|
||||
"max_level": 2,
|
||||
"species": "SPECIES_FARFETCHD_GALARIAN"
|
||||
"species": "SPECIES_DEERLING"
|
||||
},
|
||||
{
|
||||
"min_level": 2,
|
||||
|
|
|
|||
19
src/rtc.c
19
src/rtc.c
|
|
@ -307,6 +307,25 @@ u8 GetTimeOfDay(void)
|
|||
return TIME_DAY;
|
||||
}
|
||||
|
||||
u8 GetSeason(void)
|
||||
{
|
||||
u8 seasonIndex;
|
||||
|
||||
RtcCalcLocalTime();
|
||||
seasonIndex = (gLocalTime.days / DAYS_PER_SEASON) % NUM_SEASONS;
|
||||
switch (seasonIndex)
|
||||
{
|
||||
case 0:
|
||||
return SEASON_SPRING;
|
||||
case 1:
|
||||
return SEASON_SUMMER;
|
||||
case 2:
|
||||
return SEASON_AUTUMN;
|
||||
case 3:
|
||||
return SEASON_WINTER;
|
||||
}
|
||||
}
|
||||
|
||||
void RtcCalcLocalTime(void)
|
||||
{
|
||||
RtcGetInfo(&sRtc);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "link.h"
|
||||
#include "quest_log.h"
|
||||
#include "safari_zone.h"
|
||||
#include "rtc.h"
|
||||
#include "constants/maps.h"
|
||||
#include "constants/abilities.h"
|
||||
#include "constants/items.h"
|
||||
|
|
@ -226,11 +227,56 @@ static bool8 UnlockedTanobyOrAreNotInTanoby(void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static u16 GetSeasonalDeerling()
|
||||
{
|
||||
switch (GetSeason())
|
||||
{
|
||||
case SEASON_SPRING:
|
||||
return SPECIES_DEERLING_SPRING;
|
||||
case SEASON_SUMMER:
|
||||
return SPECIES_DEERLING_SUMMER;
|
||||
case SEASON_AUTUMN:
|
||||
return SPECIES_DEERLING_AUTUMN;
|
||||
case SEASON_WINTER:
|
||||
return SPECIES_DEERLING_WINTER;
|
||||
}
|
||||
return SPECIES_DEERLING;
|
||||
}
|
||||
|
||||
static u16 GetSeasonalSawsbuck()
|
||||
{
|
||||
switch (GetSeason())
|
||||
{
|
||||
case SEASON_SPRING:
|
||||
return SPECIES_SAWSBUCK_SPRING;
|
||||
case SEASON_SUMMER:
|
||||
return SPECIES_SAWSBUCK_SUMMER;
|
||||
case SEASON_AUTUMN:
|
||||
return SPECIES_SAWSBUCK_AUTUMN;
|
||||
case SEASON_WINTER:
|
||||
return SPECIES_SAWSBUCK_WINTER;
|
||||
}
|
||||
return SPECIES_SAWSBUCK;
|
||||
}
|
||||
|
||||
static u16 GetSeasonalSpecies(u16 species)
|
||||
{
|
||||
switch(species)
|
||||
{
|
||||
case SPECIES_DEERLING:
|
||||
return GetSeasonalDeerling();
|
||||
case SPECIES_SAWSBUCK:
|
||||
return GetSeasonalSawsbuck();
|
||||
}
|
||||
return species;
|
||||
}
|
||||
|
||||
static void GenerateWildMon(u16 species, u8 level, u8 slot)
|
||||
{
|
||||
u32 personality;
|
||||
s8 chamber;
|
||||
ZeroEnemyPartyMons();
|
||||
species = GetSeasonalSpecies(species);
|
||||
if (species != SPECIES_UNOWN)
|
||||
{
|
||||
CreateMonWithNature(&gEnemyParty[0], species, level, USE_RANDOM_IVS, Random() % NUM_NATURES);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user