mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 04:04:17 +01:00
Rename obedient/fatefulEncounter to eventLegal
Per discussion on pret, `obedient`/`fatefulEncounter` has been renamed to `eventLegal`, and all related functions and constants have been modified with this in mind. Additionally, fixed some whitespace alignment issues in `script_cmd_table.h`, `pokemon.h`, and `tv.c` from the last commit.
This commit is contained in:
parent
b89c3e901e
commit
7b2bf8c7e2
@ -1486,15 +1486,15 @@
|
|||||||
.4byte \value
|
.4byte \value
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Sets the Pokemon in the specified slot of the player party's fateful encounter bit.
|
@ Sets the Pokemon in the specified slot of the player party's eventLegal bit.
|
||||||
.macro setmonfatefulencounter slot:req
|
.macro setmoneventlegal slot:req
|
||||||
.byte 0xcd
|
.byte 0xcd
|
||||||
.2byte \slot
|
.2byte \slot
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Checks if the Pokemon in the specified slot of the player's party is a fateful encounter. If the Pokemon isn't a fateful encounter,
|
@ Checks if the Pokemon in the specified slot of the player's party has its eventLegal bit set. If it isn't set,
|
||||||
@ VAR_RESULT is TRUE. If the Pokemon is a fateful encounter (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
|
@ VAR_RESULT is TRUE. If the bit is set (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
|
||||||
.macro checkmonfatefulencounter slot:req
|
.macro checkmoneventlegal slot:req
|
||||||
.byte 0xce
|
.byte 0xce
|
||||||
.2byte \slot
|
.2byte \slot
|
||||||
.endm
|
.endm
|
||||||
|
@ -85,7 +85,7 @@ BirthIsland_Exterior_EventScript_Deoxys:: @ 8267FC1
|
|||||||
setvar VAR_0x8004, SPECIES_DEOXYS
|
setvar VAR_0x8004, SPECIES_DEOXYS
|
||||||
setvar VAR_0x8005, 30 @ level
|
setvar VAR_0x8005, 30 @ level
|
||||||
setvar VAR_0x8006, ITEM_NONE
|
setvar VAR_0x8006, ITEM_NONE
|
||||||
special CreateFatefulEncounterEnemyMon
|
special CreateEventLegalEnemyMon
|
||||||
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
||||||
special BattleSetup_StartLegendaryBattle
|
special BattleSetup_StartLegendaryBattle
|
||||||
waitstate
|
waitstate
|
||||||
|
@ -141,7 +141,7 @@ FarawayIsland_Interior_EventScript_Mew:: @ 8267DF2
|
|||||||
setvar VAR_0x8004, SPECIES_MEW
|
setvar VAR_0x8004, SPECIES_MEW
|
||||||
setvar VAR_0x8005, 30 @ level
|
setvar VAR_0x8005, 30 @ level
|
||||||
setvar VAR_0x8006, ITEM_NONE
|
setvar VAR_0x8006, ITEM_NONE
|
||||||
special CreateFatefulEncounterEnemyMon
|
special CreateEventLegalEnemyMon
|
||||||
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
||||||
special BattleSetup_StartLegendaryBattle
|
special BattleSetup_StartLegendaryBattle
|
||||||
waitstate
|
waitstate
|
||||||
|
@ -57,7 +57,7 @@ NavelRock_Bottom_EventScript_Lugia:: @ 82692A2
|
|||||||
setvar VAR_0x8004, SPECIES_LUGIA
|
setvar VAR_0x8004, SPECIES_LUGIA
|
||||||
setvar VAR_0x8005, 70 @ level
|
setvar VAR_0x8005, 70 @ level
|
||||||
setvar VAR_0x8006, ITEM_NONE
|
setvar VAR_0x8006, ITEM_NONE
|
||||||
special CreateFatefulEncounterEnemyMon
|
special CreateEventLegalEnemyMon
|
||||||
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
||||||
special BattleSetup_StartLegendaryBattle
|
special BattleSetup_StartLegendaryBattle
|
||||||
waitstate
|
waitstate
|
||||||
|
@ -61,7 +61,7 @@ NavelRock_Top_EventScript_HoOh:: @ 826916F
|
|||||||
setvar VAR_0x8004, SPECIES_HO_OH
|
setvar VAR_0x8004, SPECIES_HO_OH
|
||||||
setvar VAR_0x8005, 70 @ level
|
setvar VAR_0x8005, 70 @ level
|
||||||
setvar VAR_0x8006, ITEM_NONE
|
setvar VAR_0x8006, ITEM_NONE
|
||||||
special CreateFatefulEncounterEnemyMon
|
special CreateEventLegalEnemyMon
|
||||||
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
||||||
special BattleSetup_StartLegendaryBattle
|
special BattleSetup_StartLegendaryBattle
|
||||||
waitstate
|
waitstate
|
||||||
|
@ -118,14 +118,14 @@ SouthernIsland_Interior_EventScript_SetLatiosBattleVars:: @ 8242BA4
|
|||||||
setvar VAR_0x8004, SPECIES_LATIOS
|
setvar VAR_0x8004, SPECIES_LATIOS
|
||||||
setvar VAR_0x8005, 50 @ level
|
setvar VAR_0x8005, 50 @ level
|
||||||
setvar VAR_0x8006, ITEM_SOUL_DEW
|
setvar VAR_0x8006, ITEM_SOUL_DEW
|
||||||
special CreateFatefulEncounterEnemyMon
|
special CreateEventLegalEnemyMon
|
||||||
return
|
return
|
||||||
|
|
||||||
SouthernIsland_Interior_EventScript_SetLatiasBattleVars:: @ 8242BB7
|
SouthernIsland_Interior_EventScript_SetLatiasBattleVars:: @ 8242BB7
|
||||||
setvar VAR_0x8004, SPECIES_LATIAS
|
setvar VAR_0x8004, SPECIES_LATIAS
|
||||||
setvar VAR_0x8005, 50 @ level
|
setvar VAR_0x8005, 50 @ level
|
||||||
setvar VAR_0x8006, ITEM_SOUL_DEW
|
setvar VAR_0x8006, ITEM_SOUL_DEW
|
||||||
special CreateFatefulEncounterEnemyMon
|
special CreateEventLegalEnemyMon
|
||||||
return
|
return
|
||||||
|
|
||||||
SouthernIsland_Interior_Movement_CameraPanUp: @ 8242BCA
|
SouthernIsland_Interior_Movement_CameraPanUp: @ 8242BCA
|
||||||
|
@ -205,8 +205,8 @@ gScriptCmdTable:: @ 81DB67C
|
|||||||
.4byte ScrCmd_nop1 @ 0xca
|
.4byte ScrCmd_nop1 @ 0xca
|
||||||
.4byte ScrCmd_nop1 @ 0xcb
|
.4byte ScrCmd_nop1 @ 0xcb
|
||||||
.4byte ScrCmd_nop1 @ 0xcc
|
.4byte ScrCmd_nop1 @ 0xcc
|
||||||
.4byte ScrCmd_setmonfatefulencounter @ 0xcd
|
.4byte ScrCmd_setmoneventlegal @ 0xcd
|
||||||
.4byte ScrCmd_checkmonfatefulencounter @ 0xce
|
.4byte ScrCmd_checkmoneventlegal @ 0xce
|
||||||
.4byte ScrCmd_gotoram @ 0xcf
|
.4byte ScrCmd_gotoram @ 0xcf
|
||||||
.4byte ScrCmd_nop1 @ 0xd0
|
.4byte ScrCmd_nop1 @ 0xd0
|
||||||
.4byte ScrCmd_warpspinenter @ 0xd1
|
.4byte ScrCmd_warpspinenter @ 0xd1
|
||||||
|
@ -30,7 +30,7 @@ SurfPichu_FullParty: @ 8674D73
|
|||||||
|
|
||||||
SurfPichu_GiveEgg: @ 8674D7E
|
SurfPichu_GiveEgg: @ 8674D7E
|
||||||
giveegg SPECIES_PICHU
|
giveegg SPECIES_PICHU
|
||||||
setmonfatefulencounter VAR_EVENT_PICHU_SLOT
|
setmoneventlegal VAR_EVENT_PICHU_SLOT
|
||||||
setmonmetlocation VAR_EVENT_PICHU_SLOT, METLOC_FATEFUL_ENCOUNTER
|
setmonmetlocation VAR_EVENT_PICHU_SLOT, METLOC_FATEFUL_ENCOUNTER
|
||||||
compare VAR_EVENT_PICHU_SLOT, 1
|
compare VAR_EVENT_PICHU_SLOT, 1
|
||||||
vgoto_if_eq SurfPichu_Slot1
|
vgoto_if_eq SurfPichu_Slot1
|
||||||
|
@ -490,7 +490,7 @@ gSpecials:: @ 81DBA64
|
|||||||
def_special sub_813AF48
|
def_special sub_813AF48
|
||||||
def_special DoDeoxysRockInteraction
|
def_special DoDeoxysRockInteraction
|
||||||
def_special SetDeoxysRockPalette
|
def_special SetDeoxysRockPalette
|
||||||
def_special CreateFatefulEncounterEnemyMon
|
def_special CreateEventLegalEnemyMon
|
||||||
def_special StartMirageTowerDisintegration
|
def_special StartMirageTowerDisintegration
|
||||||
def_special StartMirageTowerShake
|
def_special StartMirageTowerShake
|
||||||
def_special StartMirageTowerFossilFallAndSink
|
def_special StartMirageTowerFossilFallAndSink
|
||||||
|
@ -172,7 +172,7 @@
|
|||||||
#define MON_DATA_EARTH_RIBBON 77
|
#define MON_DATA_EARTH_RIBBON 77
|
||||||
#define MON_DATA_WORLD_RIBBON 78
|
#define MON_DATA_WORLD_RIBBON 78
|
||||||
#define MON_DATA_FILLER 79
|
#define MON_DATA_FILLER 79
|
||||||
#define MON_DATA_FATEFUL_ENCOUNTER 80
|
#define MON_DATA_EVENT_LEGAL 80
|
||||||
#define MON_DATA_KNOWN_MOVES 81
|
#define MON_DATA_KNOWN_MOVES 81
|
||||||
#define MON_DATA_RIBBON_COUNT 82
|
#define MON_DATA_RIBBON_COUNT 82
|
||||||
#define MON_DATA_RIBBONS 83
|
#define MON_DATA_RIBBONS 83
|
||||||
|
@ -65,15 +65,15 @@ struct PokemonSubstruct3
|
|||||||
/* 0x0A */ u32 victoryRibbon:1;
|
/* 0x0A */ u32 victoryRibbon:1;
|
||||||
/* 0x0A */ u32 artistRibbon:1;
|
/* 0x0A */ u32 artistRibbon:1;
|
||||||
/* 0x0A */ u32 effortRibbon:1;
|
/* 0x0A */ u32 effortRibbon:1;
|
||||||
/* 0x0A */ u32 marineRibbon:1; //never distributed
|
/* 0x0A */ u32 marineRibbon:1; // never distributed
|
||||||
/* 0x0A */ u32 landRibbon:1; //never distributed
|
/* 0x0A */ u32 landRibbon:1; // never distributed
|
||||||
/* 0x0A */ u32 skyRibbon:1; //never distributed
|
/* 0x0A */ u32 skyRibbon:1; // never distributed
|
||||||
/* 0x0A */ u32 countryRibbon:1; //distributed during Pokémon Festa '04 and '05 to tournament winners
|
/* 0x0A */ u32 countryRibbon:1; // distributed during Pokémon Festa '04 and '05 to tournament winners
|
||||||
/* 0x0B */ u32 nationalRibbon:1;
|
/* 0x0B */ u32 nationalRibbon:1;
|
||||||
/* 0x0B */ u32 earthRibbon:1;
|
/* 0x0B */ u32 earthRibbon:1;
|
||||||
/* 0x0B */ u32 worldRibbon:1; //distributed during Pokémon Festa '04 and '05 to tournament winners
|
/* 0x0B */ u32 worldRibbon:1; // distributed during Pokémon Festa '04 and '05 to tournament winners
|
||||||
/* 0x0B */ u32 filler:4;
|
/* 0x0B */ u32 filler:4;
|
||||||
/* 0x0B */ u32 fatefulEncounter:1; //controls Mew and Deoxys obedience
|
/* 0x0B */ u32 eventLegal:1; // controls Mew & Deoxys obedience; if set, Pokémon is a fateful encounter in Gen 4+; set for in-game event island legendaries, some distributed events, and Pokémon from XD: Gale of Darkness.
|
||||||
};
|
};
|
||||||
|
|
||||||
union PokemonSubstruct
|
union PokemonSubstruct
|
||||||
@ -286,12 +286,12 @@ void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src,
|
|||||||
void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId);
|
void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId);
|
||||||
void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId);
|
void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId);
|
||||||
void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest);
|
void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest);
|
||||||
void CreateFatefulEncounterMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId);
|
void CreateEventLegalMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId);
|
||||||
bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId);
|
bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId);
|
||||||
void SetDeoxysStats(void);
|
void SetDeoxysStats(void);
|
||||||
u16 GetUnionRoomTrainerPic(void);
|
u16 GetUnionRoomTrainerPic(void);
|
||||||
u16 GetUnionRoomTrainerClass(void);
|
u16 GetUnionRoomTrainerClass(void);
|
||||||
void CreateFatefulEncounterEnemyMon(void);
|
void CreateEventLegalEnemyMon(void);
|
||||||
void CalculateMonStats(struct Pokemon *mon);
|
void CalculateMonStats(struct Pokemon *mon);
|
||||||
void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest);
|
void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest);
|
||||||
u8 GetLevelFromMonExp(struct Pokemon *mon);
|
u8 GetLevelFromMonExp(struct Pokemon *mon);
|
||||||
|
@ -3949,14 +3949,14 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
|
|||||||
return targetBattler;
|
return targetBattler;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 IsNotEventMewOrDeoxys(u8 battlerId)
|
static bool32 IsNotEventLegalMewOrDeoxys(u8 battlerId)
|
||||||
{
|
{
|
||||||
if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
|
if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS
|
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS
|
||||||
&& GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_MEW)
|
&& GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_MEW)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_FATEFUL_ENCOUNTER, NULL);
|
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_EVENT_LEGAL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 IsMonDisobedient(void)
|
u8 IsMonDisobedient(void)
|
||||||
@ -3970,7 +3970,7 @@ u8 IsMonDisobedient(void)
|
|||||||
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT)
|
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (IsNotEventMewOrDeoxys(gBattlerAttacker)) // only if species is Mew or Deoxys
|
if (IsNotEventLegalMewOrDeoxys(gBattlerAttacker)) // only if species is Mew or Deoxys
|
||||||
{
|
{
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gBattlerAttacker) == 2)
|
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gBattlerAttacker) == 2)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -297,7 +297,7 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
|||||||
{
|
{
|
||||||
u16 species;
|
u16 species;
|
||||||
u32 personality, pokerus;
|
u32 personality, pokerus;
|
||||||
u8 i, friendship, language, gameMet, markings, isFatefulEncounter;
|
u8 i, friendship, language, gameMet, markings, isEventLegal;
|
||||||
u16 moves[MAX_MON_MOVES];
|
u16 moves[MAX_MON_MOVES];
|
||||||
u32 ivs[NUM_STATS];
|
u32 ivs[NUM_STATS];
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
|||||||
gameMet = GetMonData(egg, MON_DATA_MET_GAME);
|
gameMet = GetMonData(egg, MON_DATA_MET_GAME);
|
||||||
markings = GetMonData(egg, MON_DATA_MARKINGS);
|
markings = GetMonData(egg, MON_DATA_MARKINGS);
|
||||||
pokerus = GetMonData(egg, MON_DATA_POKERUS);
|
pokerus = GetMonData(egg, MON_DATA_POKERUS);
|
||||||
isFatefulEncounter = GetMonData(egg, MON_DATA_FATEFUL_ENCOUNTER);
|
isEventLegal = GetMonData(egg, MON_DATA_EVENT_LEGAL);
|
||||||
|
|
||||||
CreateMon(temp, species, EGG_HATCH_LEVEL, USE_RANDOM_IVS, TRUE, personality, OT_ID_PLAYER_ID, 0);
|
CreateMon(temp, species, EGG_HATCH_LEVEL, USE_RANDOM_IVS, TRUE, personality, OT_ID_PLAYER_ID, 0);
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
|||||||
friendship = 120;
|
friendship = 120;
|
||||||
SetMonData(temp, MON_DATA_FRIENDSHIP, &friendship);
|
SetMonData(temp, MON_DATA_FRIENDSHIP, &friendship);
|
||||||
SetMonData(temp, MON_DATA_POKERUS, &pokerus);
|
SetMonData(temp, MON_DATA_POKERUS, &pokerus);
|
||||||
SetMonData(temp, MON_DATA_FATEFUL_ENCOUNTER, &isFatefulEncounter);
|
SetMonData(temp, MON_DATA_EVENT_LEGAL, &isEventLegal);
|
||||||
|
|
||||||
*egg = *temp;
|
*egg = *temp;
|
||||||
}
|
}
|
||||||
|
@ -3520,9 +3520,9 @@ static void CursorCb_Register(u8 taskId)
|
|||||||
{
|
{
|
||||||
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
|
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
|
||||||
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
|
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
|
||||||
u8 isFatefulEncounter = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_FATEFUL_ENCOUNTER);
|
u8 isEventLegal = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_EVENT_LEGAL);
|
||||||
|
|
||||||
switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), species2, species, isFatefulEncounter))
|
switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), species2, species, isEventLegal))
|
||||||
{
|
{
|
||||||
case CANT_REGISTER_MON:
|
case CANT_REGISTER_MON:
|
||||||
StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow);
|
StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow);
|
||||||
@ -3547,8 +3547,8 @@ static void CursorCb_Trade1(u8 taskId)
|
|||||||
{
|
{
|
||||||
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
|
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
|
||||||
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
|
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
|
||||||
u8 isFatefulEncounter = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_FATEFUL_ENCOUNTER);
|
u8 isEventLegal = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_EVENT_LEGAL);
|
||||||
u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, isFatefulEncounter);
|
u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, isEventLegal);
|
||||||
|
|
||||||
if (stringId != UR_TRADE_MSG_NONE)
|
if (stringId != UR_TRADE_MSG_NONE)
|
||||||
{
|
{
|
||||||
|
@ -2615,12 +2615,12 @@ void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerP
|
|||||||
GetMonData(mon, MON_DATA_NICKNAME, dest->nickname);
|
GetMonData(mon, MON_DATA_NICKNAME, dest->nickname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateFatefulEncounterMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId)
|
void CreateEventLegalMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId)
|
||||||
{
|
{
|
||||||
bool32 isFatefulEncounter = TRUE;
|
bool32 isEventLegal = TRUE;
|
||||||
|
|
||||||
CreateMon(mon, species, level, fixedIV, hasFixedPersonality, fixedPersonality, otIdType, fixedOtId);
|
CreateMon(mon, species, level, fixedIV, hasFixedPersonality, fixedPersonality, otIdType, fixedOtId);
|
||||||
SetMonData(mon, MON_DATA_FATEFUL_ENCOUNTER, &isFatefulEncounter);
|
SetMonData(mon, MON_DATA_EVENT_LEGAL, &isEventLegal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If FALSE, should load this game's Deoxys form. If TRUE, should load normal Deoxys form
|
// If FALSE, should load this game's Deoxys form. If TRUE, should load normal Deoxys form
|
||||||
@ -2755,14 +2755,14 @@ u16 GetUnionRoomTrainerClass(void)
|
|||||||
return gFacilityClassToTrainerClass[gLinkPlayerFacilityClasses[arrId]];
|
return gFacilityClassToTrainerClass[gLinkPlayerFacilityClasses[arrId]];
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateFatefulEncounterEnemyMon(void)
|
void CreateEventLegalEnemyMon(void)
|
||||||
{
|
{
|
||||||
s32 species = gSpecialVar_0x8004;
|
s32 species = gSpecialVar_0x8004;
|
||||||
s32 level = gSpecialVar_0x8005;
|
s32 level = gSpecialVar_0x8005;
|
||||||
s32 itemId = gSpecialVar_0x8006;
|
s32 itemId = gSpecialVar_0x8006;
|
||||||
|
|
||||||
ZeroEnemyPartyMons();
|
ZeroEnemyPartyMons();
|
||||||
CreateFatefulEncounterMon(&gEnemyParty[0], species, level, USE_RANDOM_IVS, 0, 0, 0, 0);
|
CreateEventLegalMon(&gEnemyParty[0], species, level, USE_RANDOM_IVS, 0, 0, 0, 0);
|
||||||
if (itemId)
|
if (itemId)
|
||||||
{
|
{
|
||||||
u8 heldItem[2];
|
u8 heldItem[2];
|
||||||
@ -3931,8 +3931,8 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
|||||||
case MON_DATA_FILLER:
|
case MON_DATA_FILLER:
|
||||||
retVal = substruct3->filler;
|
retVal = substruct3->filler;
|
||||||
break;
|
break;
|
||||||
case MON_DATA_FATEFUL_ENCOUNTER:
|
case MON_DATA_EVENT_LEGAL:
|
||||||
retVal = substruct3->fatefulEncounter;
|
retVal = substruct3->eventLegal;
|
||||||
break;
|
break;
|
||||||
case MON_DATA_SPECIES2:
|
case MON_DATA_SPECIES2:
|
||||||
retVal = substruct0->species;
|
retVal = substruct0->species;
|
||||||
@ -4310,8 +4310,8 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
|
|||||||
case MON_DATA_FILLER:
|
case MON_DATA_FILLER:
|
||||||
SET8(substruct3->filler);
|
SET8(substruct3->filler);
|
||||||
break;
|
break;
|
||||||
case MON_DATA_FATEFUL_ENCOUNTER:
|
case MON_DATA_EVENT_LEGAL:
|
||||||
SET8(substruct3->fatefulEncounter);
|
SET8(substruct3->eventLegal);
|
||||||
break;
|
break;
|
||||||
case MON_DATA_IVS:
|
case MON_DATA_IVS:
|
||||||
{
|
{
|
||||||
|
12
src/scrcmd.c
12
src/scrcmd.c
@ -2207,21 +2207,21 @@ bool8 ScrCmd_lockfortrainer(struct ScriptContext *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This command will set a Pokémon's Fateful Encounter bit; there is no similar command to clear it.
|
// This command will set a Pokémon's eventLegal bit; there is no similar command to clear it.
|
||||||
bool8 ScrCmd_setmonfatefulencounter(struct ScriptContext *ctx)
|
bool8 ScrCmd_setmoneventlegal(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
bool8 isFatefulEncounter = TRUE;
|
bool8 isEventLegal = TRUE;
|
||||||
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
SetMonData(&gPlayerParty[partyIndex], MON_DATA_FATEFUL_ENCOUNTER, &isFatefulEncounter);
|
SetMonData(&gPlayerParty[partyIndex], MON_DATA_EVENT_LEGAL, &isEventLegal);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScrCmd_checkmonfatefulencounter(struct ScriptContext *ctx)
|
bool8 ScrCmd_checkmoneventlegal(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_FATEFUL_ENCOUNTER, NULL);
|
gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_EVENT_LEGAL, NULL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
src/trade.c
16
src/trade.c
@ -1489,7 +1489,7 @@ static u8 CheckValidityOfTradeMons(u8 *aliveMons, u8 playerPartyCount, u8 player
|
|||||||
// Partner cant trade illegitimate Deoxys or Mew
|
// Partner cant trade illegitimate Deoxys or Mew
|
||||||
if (partnerSpecies == SPECIES_DEOXYS || partnerSpecies == SPECIES_MEW)
|
if (partnerSpecies == SPECIES_DEOXYS || partnerSpecies == SPECIES_MEW)
|
||||||
{
|
{
|
||||||
if (!GetMonData(&gEnemyParty[partnerMonIdx], MON_DATA_FATEFUL_ENCOUNTER))
|
if (!GetMonData(&gEnemyParty[partnerMonIdx], MON_DATA_EVENT_LEGAL))
|
||||||
return PARTNER_MON_INVALID;
|
return PARTNER_MON_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2329,7 +2329,7 @@ static u32 CanTradeSelectedMon(struct Pokemon *playerParty, int partyCount, int
|
|||||||
|
|
||||||
if (species[monIdx] == SPECIES_DEOXYS || species[monIdx] == SPECIES_MEW)
|
if (species[monIdx] == SPECIES_DEOXYS || species[monIdx] == SPECIES_MEW)
|
||||||
{
|
{
|
||||||
if (!GetMonData(&playerParty[monIdx], MON_DATA_FATEFUL_ENCOUNTER))
|
if (!GetMonData(&playerParty[monIdx], MON_DATA_EVENT_LEGAL))
|
||||||
return CANT_TRADE_INVALID_MON;
|
return CANT_TRADE_INVALID_MON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2394,17 +2394,17 @@ s32 GetGameProgressForLinkTrade(void)
|
|||||||
return TRADE_BOTH_PLAYERS_READY;
|
return TRADE_BOTH_PLAYERS_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isFatefulEncounter)
|
static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isEventLegal)
|
||||||
{
|
{
|
||||||
if (species == SPECIES_DEOXYS || species == SPECIES_MEW)
|
if (species == SPECIES_DEOXYS || species == SPECIES_MEW)
|
||||||
{
|
{
|
||||||
if (!isFatefulEncounter)
|
if (!isEventLegal)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGnameSub rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isFatefulEncounter)
|
int GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGnameSub rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isEventLegal)
|
||||||
{
|
{
|
||||||
bool8 playerHasNationalDex = rfuPlayer.hasNationalDex;
|
bool8 playerHasNationalDex = rfuPlayer.hasNationalDex;
|
||||||
bool8 playerIsChampion = rfuPlayer.isChampion;
|
bool8 playerIsChampion = rfuPlayer.isChampion;
|
||||||
@ -2424,7 +2424,7 @@ int GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGname
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsDeoxysOrMewUntradable(playerSpecies, isFatefulEncounter))
|
if (IsDeoxysOrMewUntradable(playerSpecies, isEventLegal))
|
||||||
{
|
{
|
||||||
return UR_TRADE_MSG_MON_CANT_BE_TRADED_2;
|
return UR_TRADE_MSG_MON_CANT_BE_TRADED_2;
|
||||||
}
|
}
|
||||||
@ -2475,11 +2475,11 @@ int GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGname
|
|||||||
return UR_TRADE_MSG_NONE;
|
return UR_TRADE_MSG_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CanRegisterMonForTradingBoard(struct GFtgtGnameSub rfuPlayer, u16 species2, u16 species, u8 isFatefulEncounter)
|
int CanRegisterMonForTradingBoard(struct GFtgtGnameSub rfuPlayer, u16 species2, u16 species, u8 isEventLegal)
|
||||||
{
|
{
|
||||||
bool8 hasNationalDex = rfuPlayer.hasNationalDex;
|
bool8 hasNationalDex = rfuPlayer.hasNationalDex;
|
||||||
|
|
||||||
if (IsDeoxysOrMewUntradable(species, isFatefulEncounter))
|
if (IsDeoxysOrMewUntradable(species, isEventLegal))
|
||||||
return CANT_REGISTER_MON;
|
return CANT_REGISTER_MON;
|
||||||
|
|
||||||
if (hasNationalDex)
|
if (hasNationalDex)
|
||||||
|
Loading…
Reference in New Issue
Block a user