mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-26 21:33:53 +01:00
Fix giftRibbons Field in SaveBlock1 & Relabel Gift Ribbons in pokemon.h
The giftRibbons field has been split out into proper subfields. The new ExternalEvent structs deal with interconnectivity between external games/peripherals and Emerald, such as PokéCoupon storage and the flag for receiving Wishmaker Jirachi. The giftRibbon fields in `PokemonSubstruct3` have also been renamed to their appropriate ribbons, and commented with distribution info if applicable. The previous `fatefulEncounter` field was actually filler, and relabeled as such, while the obedient bit was renamed `fatefulEncounter`. All relevant constants and functions dealing with the Pokémon data structure were renamed with these changes in mind.
This commit is contained in:
parent
5f58ea02c6
commit
b89c3e901e
@ -1486,15 +1486,15 @@
|
||||
.4byte \value
|
||||
.endm
|
||||
|
||||
@ Makes the Pokemon in the specified slot of the player's party obedient. It will not randomly disobey orders in battle.
|
||||
.macro setmonobedient slot:req
|
||||
@ Sets the Pokemon in the specified slot of the player party's fateful encounter bit.
|
||||
.macro setmonfatefulencounter slot:req
|
||||
.byte 0xcd
|
||||
.2byte \slot
|
||||
.endm
|
||||
|
||||
@ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient,
|
||||
@ VAR_RESULT is TRUE. If the Pokemon is obedient (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
|
||||
.macro checkmonobedience slot:req
|
||||
@ 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,
|
||||
@ VAR_RESULT is TRUE. If the Pokemon is a fateful encounter (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
|
||||
.macro checkmonfatefulencounter slot:req
|
||||
.byte 0xce
|
||||
.2byte \slot
|
||||
.endm
|
||||
|
@ -85,7 +85,7 @@ BirthIsland_Exterior_EventScript_Deoxys:: @ 8267FC1
|
||||
setvar VAR_0x8004, SPECIES_DEOXYS
|
||||
setvar VAR_0x8005, 30 @ level
|
||||
setvar VAR_0x8006, ITEM_NONE
|
||||
special CreateObedientEnemyMon
|
||||
special CreateFatefulEncounterEnemyMon
|
||||
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
||||
special BattleSetup_StartLegendaryBattle
|
||||
waitstate
|
||||
|
@ -141,7 +141,7 @@ FarawayIsland_Interior_EventScript_Mew:: @ 8267DF2
|
||||
setvar VAR_0x8004, SPECIES_MEW
|
||||
setvar VAR_0x8005, 30 @ level
|
||||
setvar VAR_0x8006, ITEM_NONE
|
||||
special CreateObedientEnemyMon
|
||||
special CreateFatefulEncounterEnemyMon
|
||||
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
||||
special BattleSetup_StartLegendaryBattle
|
||||
waitstate
|
||||
|
@ -57,7 +57,7 @@ NavelRock_Bottom_EventScript_Lugia:: @ 82692A2
|
||||
setvar VAR_0x8004, SPECIES_LUGIA
|
||||
setvar VAR_0x8005, 70 @ level
|
||||
setvar VAR_0x8006, ITEM_NONE
|
||||
special CreateObedientEnemyMon
|
||||
special CreateFatefulEncounterEnemyMon
|
||||
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
||||
special BattleSetup_StartLegendaryBattle
|
||||
waitstate
|
||||
|
@ -61,7 +61,7 @@ NavelRock_Top_EventScript_HoOh:: @ 826916F
|
||||
setvar VAR_0x8004, SPECIES_HO_OH
|
||||
setvar VAR_0x8005, 70 @ level
|
||||
setvar VAR_0x8006, ITEM_NONE
|
||||
special CreateObedientEnemyMon
|
||||
special CreateFatefulEncounterEnemyMon
|
||||
setflag FLAG_SYS_CTRL_OBJ_DELETE
|
||||
special BattleSetup_StartLegendaryBattle
|
||||
waitstate
|
||||
|
@ -118,14 +118,14 @@ SouthernIsland_Interior_EventScript_SetLatiosBattleVars:: @ 8242BA4
|
||||
setvar VAR_0x8004, SPECIES_LATIOS
|
||||
setvar VAR_0x8005, 50 @ level
|
||||
setvar VAR_0x8006, ITEM_SOUL_DEW
|
||||
special CreateObedientEnemyMon
|
||||
special CreateFatefulEncounterEnemyMon
|
||||
return
|
||||
|
||||
SouthernIsland_Interior_EventScript_SetLatiasBattleVars:: @ 8242BB7
|
||||
setvar VAR_0x8004, SPECIES_LATIAS
|
||||
setvar VAR_0x8005, 50 @ level
|
||||
setvar VAR_0x8006, ITEM_SOUL_DEW
|
||||
special CreateObedientEnemyMon
|
||||
special CreateFatefulEncounterEnemyMon
|
||||
return
|
||||
|
||||
SouthernIsland_Interior_Movement_CameraPanUp: @ 8242BCA
|
||||
|
@ -205,8 +205,8 @@ gScriptCmdTable:: @ 81DB67C
|
||||
.4byte ScrCmd_nop1 @ 0xca
|
||||
.4byte ScrCmd_nop1 @ 0xcb
|
||||
.4byte ScrCmd_nop1 @ 0xcc
|
||||
.4byte ScrCmd_setmonobedient @ 0xcd
|
||||
.4byte ScrCmd_checkmonobedience @ 0xce
|
||||
.4byte ScrCmd_setmonfatefulencounter @ 0xcd
|
||||
.4byte ScrCmd_checkmonfatefulencounter @ 0xce
|
||||
.4byte ScrCmd_gotoram @ 0xcf
|
||||
.4byte ScrCmd_nop1 @ 0xd0
|
||||
.4byte ScrCmd_warpspinenter @ 0xd1
|
||||
|
@ -30,7 +30,7 @@ SurfPichu_FullParty: @ 8674D73
|
||||
|
||||
SurfPichu_GiveEgg: @ 8674D7E
|
||||
giveegg SPECIES_PICHU
|
||||
setmonobedient VAR_EVENT_PICHU_SLOT
|
||||
setmonfatefulencounter VAR_EVENT_PICHU_SLOT
|
||||
setmonmetlocation VAR_EVENT_PICHU_SLOT, METLOC_FATEFUL_ENCOUNTER
|
||||
compare VAR_EVENT_PICHU_SLOT, 1
|
||||
vgoto_if_eq SurfPichu_Slot1
|
||||
|
@ -490,7 +490,7 @@ gSpecials:: @ 81DBA64
|
||||
def_special sub_813AF48
|
||||
def_special DoDeoxysRockInteraction
|
||||
def_special SetDeoxysRockPalette
|
||||
def_special CreateObedientEnemyMon
|
||||
def_special CreateFatefulEncounterEnemyMon
|
||||
def_special StartMirageTowerDisintegration
|
||||
def_special StartMirageTowerShake
|
||||
def_special StartMirageTowerFossilFallAndSink
|
||||
|
@ -164,15 +164,15 @@
|
||||
#define MON_DATA_VICTORY_RIBBON 69
|
||||
#define MON_DATA_ARTIST_RIBBON 70
|
||||
#define MON_DATA_EFFORT_RIBBON 71
|
||||
#define MON_DATA_GIFT_RIBBON_1 72
|
||||
#define MON_DATA_GIFT_RIBBON_2 73
|
||||
#define MON_DATA_GIFT_RIBBON_3 74
|
||||
#define MON_DATA_GIFT_RIBBON_4 75
|
||||
#define MON_DATA_GIFT_RIBBON_5 76
|
||||
#define MON_DATA_GIFT_RIBBON_6 77
|
||||
#define MON_DATA_GIFT_RIBBON_7 78
|
||||
#define MON_DATA_FATEFUL_ENCOUNTER 79
|
||||
#define MON_DATA_OBEDIENCE 80
|
||||
#define MON_DATA_MARINE_RIBBON 72
|
||||
#define MON_DATA_LAND_RIBBON 73
|
||||
#define MON_DATA_SKY_RIBBON 74
|
||||
#define MON_DATA_COUNTRY_RIBBON 75
|
||||
#define MON_DATA_NATIONAL_RIBBON 76
|
||||
#define MON_DATA_EARTH_RIBBON 77
|
||||
#define MON_DATA_WORLD_RIBBON 78
|
||||
#define MON_DATA_FILLER 79
|
||||
#define MON_DATA_FATEFUL_ENCOUNTER 80
|
||||
#define MON_DATA_KNOWN_MOVES 81
|
||||
#define MON_DATA_RIBBON_COUNT 82
|
||||
#define MON_DATA_RIBBONS 83
|
||||
|
@ -898,6 +898,41 @@ struct MysteryEventStruct
|
||||
/*0x344 0x3570*/ u32 unk_344[2][5];
|
||||
}; // 0x36C 0x3598
|
||||
|
||||
// For external event data storage. The majority of these may have never been used.
|
||||
struct ExternalEventData
|
||||
{
|
||||
u8 unknownExternalDataFields1[7]; // if actually used, may be broken up into different fields.
|
||||
u32 currentPokeCoupons; // PokéCoupons stored by Pokémon Colosseum and XD from Mt. Battle runs. Earned PokéCoupons are also added to totalEarnedPokeCoupons.
|
||||
u32 totalEarnedPokeCoupons; // Used by the JP Colosseum bonus disc. Determines PokéCoupon rank to distribute rewards. Unread in International games.
|
||||
u8 unknownExternalDataFields2[5]; // if actually used, may be broken up into different fields.
|
||||
} __attribute__((packed)); /*size = 0x14*/
|
||||
|
||||
// For external event flags. The majority of these may have never been used.
|
||||
struct ExternalEventFlags
|
||||
{
|
||||
u8 unknownFlag1;
|
||||
u8 receivedWishmakerJirachi; // may also be used for Ageto Celebi?
|
||||
u8 unknownFlag3;
|
||||
u8 unknownFlag4;
|
||||
u8 unknownFlag5;
|
||||
u8 unknownFlag6;
|
||||
u8 unknownFlag7;
|
||||
u8 unknownFlag8;
|
||||
u8 unknownFlag9;
|
||||
u8 unknownFlag10;
|
||||
u8 unknownFlag11;
|
||||
u8 unknownFlag12;
|
||||
u8 unknownFlag13;
|
||||
u8 unknownFlag14;
|
||||
u8 unknownFlag15;
|
||||
u8 unknownFlag16;
|
||||
u8 unknownFlag17;
|
||||
u8 unknownFlag18;
|
||||
u8 unknownFlag19;
|
||||
u8 unknownFlag20;
|
||||
|
||||
};/*size = 0x14*/
|
||||
|
||||
struct SaveBlock1
|
||||
{
|
||||
/*0x00*/ struct Coords16 pos;
|
||||
@ -971,7 +1006,9 @@ struct SaveBlock1
|
||||
/*0x2e90*/ struct ContestWinner contestWinners[NUM_CONTEST_WINNERS]; // see CONTEST_WINNER_*
|
||||
/*0x3030*/ struct DayCare daycare;
|
||||
/*0x3150*/ struct LinkBattleRecords linkBattleRecords;
|
||||
/*0x31A8*/ u8 giftRibbons[52];
|
||||
/*0x31A8*/ u8 giftRibbons[11];
|
||||
/*0x31B3*/ struct ExternalEventData externalEventData;
|
||||
/*0x31C7*/ struct ExternalEventFlags externalEventFlags;
|
||||
/*0x31DC*/ struct Roamer roamer;
|
||||
/*0x31F8*/ struct EnigmaBerry enigmaBerry;
|
||||
/*0x322C*/ struct MEventBuffers unk_322C;
|
||||
|
@ -65,15 +65,15 @@ struct PokemonSubstruct3
|
||||
/* 0x0A */ u32 victoryRibbon:1;
|
||||
/* 0x0A */ u32 artistRibbon:1;
|
||||
/* 0x0A */ u32 effortRibbon:1;
|
||||
/* 0x0A */ u32 giftRibbon1:1;
|
||||
/* 0x0A */ u32 giftRibbon2:1;
|
||||
/* 0x0A */ u32 giftRibbon3:1;
|
||||
/* 0x0A */ u32 giftRibbon4:1;
|
||||
/* 0x0B */ u32 giftRibbon5:1;
|
||||
/* 0x0B */ u32 giftRibbon6:1;
|
||||
/* 0x0B */ u32 giftRibbon7:1;
|
||||
/* 0x0B */ u32 fatefulEncounter:4;
|
||||
/* 0x0B */ u32 obedient:1;
|
||||
/* 0x0A */ u32 marineRibbon:1; //never distributed
|
||||
/* 0x0A */ u32 landRibbon:1; //never distributed
|
||||
/* 0x0A */ u32 skyRibbon:1; //never distributed
|
||||
/* 0x0A */ u32 countryRibbon:1; //distributed during Pokémon Festa '04 and '05 to tournament winners
|
||||
/* 0x0B */ u32 nationalRibbon:1;
|
||||
/* 0x0B */ u32 earthRibbon:1;
|
||||
/* 0x0B */ u32 worldRibbon:1; //distributed during Pokémon Festa '04 and '05 to tournament winners
|
||||
/* 0x0B */ u32 filler:4;
|
||||
/* 0x0B */ u32 fatefulEncounter:1; //controls Mew and Deoxys obedience
|
||||
};
|
||||
|
||||
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 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 CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId);
|
||||
void CreateFatefulEncounterMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId);
|
||||
bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId);
|
||||
void SetDeoxysStats(void);
|
||||
u16 GetUnionRoomTrainerPic(void);
|
||||
u16 GetUnionRoomTrainerClass(void);
|
||||
void CreateObedientEnemyMon(void);
|
||||
void CreateFatefulEncounterEnemyMon(void);
|
||||
void CalculateMonStats(struct Pokemon *mon);
|
||||
void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest);
|
||||
u8 GetLevelFromMonExp(struct Pokemon *mon);
|
||||
|
@ -3949,14 +3949,14 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
|
||||
return targetBattler;
|
||||
}
|
||||
|
||||
static bool32 HasObedientBitSet(u8 battlerId)
|
||||
static bool32 IsNotEventMewOrDeoxys(u8 battlerId)
|
||||
{
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
|
||||
return TRUE;
|
||||
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS
|
||||
&& GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_MEW)
|
||||
return TRUE;
|
||||
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_OBEDIENCE, NULL);
|
||||
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_FATEFUL_ENCOUNTER, NULL);
|
||||
}
|
||||
|
||||
u8 IsMonDisobedient(void)
|
||||
@ -3970,7 +3970,7 @@ u8 IsMonDisobedient(void)
|
||||
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT)
|
||||
return 0;
|
||||
|
||||
if (HasObedientBitSet(gBattlerAttacker)) // only if species is Mew or Deoxys
|
||||
if (IsNotEventMewOrDeoxys(gBattlerAttacker)) // only if species is Mew or Deoxys
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gBattlerAttacker) == 2)
|
||||
return 0;
|
||||
|
@ -297,7 +297,7 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
||||
{
|
||||
u16 species;
|
||||
u32 personality, pokerus;
|
||||
u8 i, friendship, language, gameMet, markings, obedience;
|
||||
u8 i, friendship, language, gameMet, markings, isFatefulEncounter;
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
u32 ivs[NUM_STATS];
|
||||
|
||||
@ -320,7 +320,7 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
||||
gameMet = GetMonData(egg, MON_DATA_MET_GAME);
|
||||
markings = GetMonData(egg, MON_DATA_MARKINGS);
|
||||
pokerus = GetMonData(egg, MON_DATA_POKERUS);
|
||||
obedience = GetMonData(egg, MON_DATA_OBEDIENCE);
|
||||
isFatefulEncounter = GetMonData(egg, MON_DATA_FATEFUL_ENCOUNTER);
|
||||
|
||||
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;
|
||||
SetMonData(temp, MON_DATA_FRIENDSHIP, &friendship);
|
||||
SetMonData(temp, MON_DATA_POKERUS, &pokerus);
|
||||
SetMonData(temp, MON_DATA_OBEDIENCE, &obedience);
|
||||
SetMonData(temp, MON_DATA_FATEFUL_ENCOUNTER, &isFatefulEncounter);
|
||||
|
||||
*egg = *temp;
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon)
|
||||
|
||||
for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + CONTEST_CATEGORIES_COUNT; i++)
|
||||
SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data));
|
||||
for (i = MON_DATA_CHAMPION_RIBBON; i <= MON_DATA_FATEFUL_ENCOUNTER; i++)
|
||||
for (i = MON_DATA_CHAMPION_RIBBON; i <= MON_DATA_FILLER; i++)
|
||||
SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data));
|
||||
|
||||
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_STATUS, (&data));
|
||||
|
@ -3520,9 +3520,9 @@ static void CursorCb_Register(u8 taskId)
|
||||
{
|
||||
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
|
||||
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
|
||||
u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE);
|
||||
u8 isFatefulEncounter = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_FATEFUL_ENCOUNTER);
|
||||
|
||||
switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), species2, species, obedience))
|
||||
switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), species2, species, isFatefulEncounter))
|
||||
{
|
||||
case CANT_REGISTER_MON:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow);
|
||||
@ -3547,8 +3547,8 @@ static void CursorCb_Trade1(u8 taskId)
|
||||
{
|
||||
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
|
||||
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
|
||||
u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE);
|
||||
u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, obedience);
|
||||
u8 isFatefulEncounter = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_FATEFUL_ENCOUNTER);
|
||||
u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, isFatefulEncounter);
|
||||
|
||||
if (stringId != UR_TRADE_MSG_NONE)
|
||||
{
|
||||
|
106
src/pokemon.c
106
src/pokemon.c
@ -2615,12 +2615,12 @@ void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerP
|
||||
GetMonData(mon, MON_DATA_NICKNAME, dest->nickname);
|
||||
}
|
||||
|
||||
void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId)
|
||||
void CreateFatefulEncounterMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId)
|
||||
{
|
||||
bool32 obedient = TRUE;
|
||||
bool32 isFatefulEncounter = TRUE;
|
||||
|
||||
CreateMon(mon, species, level, fixedIV, hasFixedPersonality, fixedPersonality, otIdType, fixedOtId);
|
||||
SetMonData(mon, MON_DATA_OBEDIENCE, &obedient);
|
||||
SetMonData(mon, MON_DATA_FATEFUL_ENCOUNTER, &isFatefulEncounter);
|
||||
}
|
||||
|
||||
// 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]];
|
||||
}
|
||||
|
||||
void CreateObedientEnemyMon(void)
|
||||
void CreateFatefulEncounterEnemyMon(void)
|
||||
{
|
||||
s32 species = gSpecialVar_0x8004;
|
||||
s32 level = gSpecialVar_0x8005;
|
||||
s32 itemId = gSpecialVar_0x8006;
|
||||
|
||||
ZeroEnemyPartyMons();
|
||||
CreateObedientMon(&gEnemyParty[0], species, level, USE_RANDOM_IVS, 0, 0, 0, 0);
|
||||
CreateFatefulEncounterMon(&gEnemyParty[0], species, level, USE_RANDOM_IVS, 0, 0, 0, 0);
|
||||
if (itemId)
|
||||
{
|
||||
u8 heldItem[2];
|
||||
@ -3907,33 +3907,33 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
||||
case MON_DATA_EFFORT_RIBBON:
|
||||
retVal = substruct3->effortRibbon;
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_1:
|
||||
retVal = substruct3->giftRibbon1;
|
||||
case MON_DATA_MARINE_RIBBON:
|
||||
retVal = substruct3->marineRibbon;
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_2:
|
||||
retVal = substruct3->giftRibbon2;
|
||||
case MON_DATA_LAND_RIBBON:
|
||||
retVal = substruct3->landRibbon;
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_3:
|
||||
retVal = substruct3->giftRibbon3;
|
||||
case MON_DATA_SKY_RIBBON:
|
||||
retVal = substruct3->skyRibbon;
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_4:
|
||||
retVal = substruct3->giftRibbon4;
|
||||
case MON_DATA_COUNTRY_RIBBON:
|
||||
retVal = substruct3->countryRibbon;
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_5:
|
||||
retVal = substruct3->giftRibbon5;
|
||||
case MON_DATA_NATIONAL_RIBBON:
|
||||
retVal = substruct3->nationalRibbon;
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_6:
|
||||
retVal = substruct3->giftRibbon6;
|
||||
case MON_DATA_EARTH_RIBBON:
|
||||
retVal = substruct3->earthRibbon;
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_7:
|
||||
retVal = substruct3->giftRibbon7;
|
||||
case MON_DATA_WORLD_RIBBON:
|
||||
retVal = substruct3->worldRibbon;
|
||||
break;
|
||||
case MON_DATA_FILLER:
|
||||
retVal = substruct3->filler;
|
||||
break;
|
||||
case MON_DATA_FATEFUL_ENCOUNTER:
|
||||
retVal = substruct3->fatefulEncounter;
|
||||
break;
|
||||
case MON_DATA_OBEDIENCE:
|
||||
retVal = substruct3->obedient;
|
||||
break;
|
||||
case MON_DATA_SPECIES2:
|
||||
retVal = substruct0->species;
|
||||
if (substruct0->species && (substruct3->isEgg || boxMon->isBadEgg))
|
||||
@ -3974,13 +3974,13 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
||||
retVal += substruct3->victoryRibbon;
|
||||
retVal += substruct3->artistRibbon;
|
||||
retVal += substruct3->effortRibbon;
|
||||
retVal += substruct3->giftRibbon1;
|
||||
retVal += substruct3->giftRibbon2;
|
||||
retVal += substruct3->giftRibbon3;
|
||||
retVal += substruct3->giftRibbon4;
|
||||
retVal += substruct3->giftRibbon5;
|
||||
retVal += substruct3->giftRibbon6;
|
||||
retVal += substruct3->giftRibbon7;
|
||||
retVal += substruct3->marineRibbon;
|
||||
retVal += substruct3->landRibbon;
|
||||
retVal += substruct3->skyRibbon;
|
||||
retVal += substruct3->countryRibbon;
|
||||
retVal += substruct3->nationalRibbon;
|
||||
retVal += substruct3->earthRibbon;
|
||||
retVal += substruct3->worldRibbon;
|
||||
}
|
||||
break;
|
||||
case MON_DATA_RIBBONS:
|
||||
@ -3997,13 +3997,13 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
||||
| (substruct3->victoryRibbon << 17)
|
||||
| (substruct3->artistRibbon << 18)
|
||||
| (substruct3->effortRibbon << 19)
|
||||
| (substruct3->giftRibbon1 << 20)
|
||||
| (substruct3->giftRibbon2 << 21)
|
||||
| (substruct3->giftRibbon3 << 22)
|
||||
| (substruct3->giftRibbon4 << 23)
|
||||
| (substruct3->giftRibbon5 << 24)
|
||||
| (substruct3->giftRibbon6 << 25)
|
||||
| (substruct3->giftRibbon7 << 26);
|
||||
| (substruct3->marineRibbon << 20)
|
||||
| (substruct3->landRibbon << 21)
|
||||
| (substruct3->skyRibbon << 22)
|
||||
| (substruct3->countryRibbon << 23)
|
||||
| (substruct3->nationalRibbon << 24)
|
||||
| (substruct3->earthRibbon << 25)
|
||||
| (substruct3->worldRibbon << 26);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -4286,33 +4286,33 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
|
||||
case MON_DATA_EFFORT_RIBBON:
|
||||
SET8(substruct3->effortRibbon);
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_1:
|
||||
SET8(substruct3->giftRibbon1);
|
||||
case MON_DATA_MARINE_RIBBON:
|
||||
SET8(substruct3->marineRibbon);
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_2:
|
||||
SET8(substruct3->giftRibbon2);
|
||||
case MON_DATA_LAND_RIBBON:
|
||||
SET8(substruct3->landRibbon);
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_3:
|
||||
SET8(substruct3->giftRibbon3);
|
||||
case MON_DATA_SKY_RIBBON:
|
||||
SET8(substruct3->skyRibbon);
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_4:
|
||||
SET8(substruct3->giftRibbon4);
|
||||
case MON_DATA_COUNTRY_RIBBON:
|
||||
SET8(substruct3->countryRibbon);
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_5:
|
||||
SET8(substruct3->giftRibbon5);
|
||||
case MON_DATA_NATIONAL_RIBBON:
|
||||
SET8(substruct3->nationalRibbon);
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_6:
|
||||
SET8(substruct3->giftRibbon6);
|
||||
case MON_DATA_EARTH_RIBBON:
|
||||
SET8(substruct3->earthRibbon);
|
||||
break;
|
||||
case MON_DATA_GIFT_RIBBON_7:
|
||||
SET8(substruct3->giftRibbon7);
|
||||
case MON_DATA_WORLD_RIBBON:
|
||||
SET8(substruct3->worldRibbon);
|
||||
break;
|
||||
case MON_DATA_FILLER:
|
||||
SET8(substruct3->filler);
|
||||
break;
|
||||
case MON_DATA_FATEFUL_ENCOUNTER:
|
||||
SET8(substruct3->fatefulEncounter);
|
||||
break;
|
||||
case MON_DATA_OBEDIENCE:
|
||||
SET8(substruct3->obedient);
|
||||
break;
|
||||
case MON_DATA_IVS:
|
||||
{
|
||||
u32 ivs = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
|
||||
|
@ -38,9 +38,9 @@ static const struct UnknownStruct sBigMonSizeTable[] =
|
||||
|
||||
static const u8 sGiftRibbonsMonDataIds[] =
|
||||
{
|
||||
MON_DATA_GIFT_RIBBON_1, MON_DATA_GIFT_RIBBON_2, MON_DATA_GIFT_RIBBON_3,
|
||||
MON_DATA_GIFT_RIBBON_4, MON_DATA_GIFT_RIBBON_5, MON_DATA_GIFT_RIBBON_6,
|
||||
MON_DATA_GIFT_RIBBON_7
|
||||
MON_DATA_MARINE_RIBBON, MON_DATA_LAND_RIBBON, MON_DATA_SKY_RIBBON,
|
||||
MON_DATA_COUNTRY_RIBBON, MON_DATA_NATIONAL_RIBBON, MON_DATA_EARTH_RIBBON,
|
||||
MON_DATA_WORLD_RIBBON
|
||||
};
|
||||
|
||||
extern const u8 gText_DecimalPoint[];
|
||||
|
12
src/scrcmd.c
12
src/scrcmd.c
@ -2207,21 +2207,21 @@ bool8 ScrCmd_lockfortrainer(struct ScriptContext *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// This command will force the Pokémon to be obedient, you don't get to make it disobedient.
|
||||
bool8 ScrCmd_setmonobedient(struct ScriptContext *ctx)
|
||||
// This command will set a Pokémon's Fateful Encounter bit; there is no similar command to clear it.
|
||||
bool8 ScrCmd_setmonfatefulencounter(struct ScriptContext *ctx)
|
||||
{
|
||||
bool8 obedient = TRUE;
|
||||
bool8 isFatefulEncounter = TRUE;
|
||||
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
SetMonData(&gPlayerParty[partyIndex], MON_DATA_OBEDIENCE, &obedient);
|
||||
SetMonData(&gPlayerParty[partyIndex], MON_DATA_FATEFUL_ENCOUNTER, &isFatefulEncounter);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_checkmonobedience(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_checkmonfatefulencounter(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OBEDIENCE, NULL);
|
||||
gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_FATEFUL_ENCOUNTER, NULL);
|
||||
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
|
||||
if (partnerSpecies == SPECIES_DEOXYS || partnerSpecies == SPECIES_MEW)
|
||||
{
|
||||
if (!GetMonData(&gEnemyParty[partnerMonIdx], MON_DATA_OBEDIENCE))
|
||||
if (!GetMonData(&gEnemyParty[partnerMonIdx], MON_DATA_FATEFUL_ENCOUNTER))
|
||||
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 (!GetMonData(&playerParty[monIdx], MON_DATA_OBEDIENCE))
|
||||
if (!GetMonData(&playerParty[monIdx], MON_DATA_FATEFUL_ENCOUNTER))
|
||||
return CANT_TRADE_INVALID_MON;
|
||||
}
|
||||
|
||||
@ -2394,17 +2394,17 @@ s32 GetGameProgressForLinkTrade(void)
|
||||
return TRADE_BOTH_PLAYERS_READY;
|
||||
}
|
||||
|
||||
static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isObedientBitSet)
|
||||
static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isFatefulEncounter)
|
||||
{
|
||||
if (species == SPECIES_DEOXYS || species == SPECIES_MEW)
|
||||
{
|
||||
if (!isObedientBitSet)
|
||||
if (!isFatefulEncounter)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGnameSub rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isObedientBitSet)
|
||||
int GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGnameSub rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isFatefulEncounter)
|
||||
{
|
||||
bool8 playerHasNationalDex = rfuPlayer.hasNationalDex;
|
||||
bool8 playerIsChampion = rfuPlayer.isChampion;
|
||||
@ -2424,7 +2424,7 @@ int GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGname
|
||||
}
|
||||
}
|
||||
|
||||
if (IsDeoxysOrMewUntradable(playerSpecies, isObedientBitSet))
|
||||
if (IsDeoxysOrMewUntradable(playerSpecies, isFatefulEncounter))
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
int CanRegisterMonForTradingBoard(struct GFtgtGnameSub rfuPlayer, u16 species2, u16 species, u8 isObedientBitSet)
|
||||
int CanRegisterMonForTradingBoard(struct GFtgtGnameSub rfuPlayer, u16 species2, u16 species, u8 isFatefulEncounter)
|
||||
{
|
||||
bool8 hasNationalDex = rfuPlayer.hasNationalDex;
|
||||
|
||||
if (IsDeoxysOrMewUntradable(species, isObedientBitSet))
|
||||
if (IsDeoxysOrMewUntradable(species, isFatefulEncounter))
|
||||
return CANT_REGISTER_MON;
|
||||
|
||||
if (hasNationalDex)
|
||||
|
28
src/tv.c
28
src/tv.c
@ -2398,13 +2398,13 @@ u8 GetRibbonCount(struct Pokemon *pokemon)
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_VICTORY_RIBBON);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_ARTIST_RIBBON);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_EFFORT_RIBBON);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_1);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_2);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_3);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_4);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_5);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_6);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_7);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_MARINE_RIBBON);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_LAND_RIBBON);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_SKY_RIBBON);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_COUNTRY_RIBBON);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_NATIONAL_RIBBON);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_EARTH_RIBBON);
|
||||
nRibbons += GetMonData(pokemon, MON_DATA_WORLD_RIBBON);
|
||||
return nRibbons;
|
||||
}
|
||||
|
||||
@ -2420,13 +2420,13 @@ u8 TV_MonDataIdxToRibbon(u8 monDataIdx)
|
||||
if (monDataIdx == MON_DATA_VICTORY_RIBBON) return 22;
|
||||
if (monDataIdx == MON_DATA_ARTIST_RIBBON) return 23;
|
||||
if (monDataIdx == MON_DATA_EFFORT_RIBBON) return 24;
|
||||
if (monDataIdx == MON_DATA_GIFT_RIBBON_1) return 25;
|
||||
if (monDataIdx == MON_DATA_GIFT_RIBBON_2) return 26;
|
||||
if (monDataIdx == MON_DATA_GIFT_RIBBON_3) return 27;
|
||||
if (monDataIdx == MON_DATA_GIFT_RIBBON_4) return 28;
|
||||
if (monDataIdx == MON_DATA_GIFT_RIBBON_5) return 29;
|
||||
if (monDataIdx == MON_DATA_GIFT_RIBBON_6) return 30;
|
||||
if (monDataIdx == MON_DATA_GIFT_RIBBON_7) return 31;
|
||||
if (monDataIdx == MON_DATA_MARINE_RIBBON) return 25;
|
||||
if (monDataIdx == MON_DATA_LAND_RIBBON) return 26;
|
||||
if (monDataIdx == MON_DATA_SKY_RIBBON) return 27;
|
||||
if (monDataIdx == MON_DATA_COUNTRY_RIBBON) return 28;
|
||||
if (monDataIdx == MON_DATA_NATIONAL_RIBBON) return 29;
|
||||
if (monDataIdx == MON_DATA_EARTH_RIBBON) return 30;
|
||||
if (monDataIdx == MON_DATA_WORLD_RIBBON) return 31;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user