Added SPECIES_FLAG_CANNOT_BE_TRADED

- Also corrected Cylarex's forms not having the legendary flag
This commit is contained in:
Eduardo Quezada 2022-09-09 08:59:53 -04:00
parent d699ea3334
commit 21df8c279b
8 changed files with 41 additions and 17 deletions

View file

@ -352,6 +352,7 @@
#define SPECIES_FLAG_GENDER_DIFFERENCE (1 << 6) #define SPECIES_FLAG_GENDER_DIFFERENCE (1 << 6)
#define SPECIES_FLAG_ALL_PERFECT_IVS (1 << 7) #define SPECIES_FLAG_ALL_PERFECT_IVS (1 << 7)
#define SPECIES_FLAG_SHINY_LOCKED (1 << 8) #define SPECIES_FLAG_SHINY_LOCKED (1 << 8)
#define SPECIES_FLAG_CANNOT_BE_TRADED (1 << 9)
#define LEGENDARY_PERFECT_IV_COUNT 3 #define LEGENDARY_PERFECT_IV_COUNT 3

View file

@ -99,8 +99,8 @@
#define UR_TRADE_MSG_NONE 0 #define UR_TRADE_MSG_NONE 0
#define UR_TRADE_MSG_NOT_MON_PARTNER_WANTS 1 #define UR_TRADE_MSG_NOT_MON_PARTNER_WANTS 1
#define UR_TRADE_MSG_NOT_EGG 2 #define UR_TRADE_MSG_NOT_EGG 2
#define UR_TRADE_MSG_MON_CANT_BE_TRADED_1 3 #define UR_TRADE_MSG_MON_CANT_BE_TRADED_NOW 3
#define UR_TRADE_MSG_MON_CANT_BE_TRADED_2 4 #define UR_TRADE_MSG_MON_CANT_BE_TRADED 4
#define UR_TRADE_MSG_PARTNERS_MON_CANT_BE_TRADED 5 #define UR_TRADE_MSG_PARTNERS_MON_CANT_BE_TRADED 5
#define UR_TRADE_MSG_EGG_CANT_BE_TRADED 6 #define UR_TRADE_MSG_EGG_CANT_BE_TRADED 6
#define UR_TRADE_MSG_PARTNER_CANT_ACCEPT_MON 7 #define UR_TRADE_MSG_PARTNER_CANT_ACCEPT_MON 7
@ -108,9 +108,10 @@
#define UR_TRADE_MSG_CANT_TRADE_WITH_PARTNER_2 9 #define UR_TRADE_MSG_CANT_TRADE_WITH_PARTNER_2 9
// Return values for CanRegisterMonForTradingBoard // Return values for CanRegisterMonForTradingBoard
#define CAN_REGISTER_MON 0 #define CAN_REGISTER_MON 0
#define CANT_REGISTER_MON 1 #define CANT_REGISTER_MON_NOW 1
#define CANT_REGISTER_EGG 2 #define CANT_REGISTER_MON 2
#define CANT_REGISTER_EGG 3
#endif //GUARD_CONSTANTS_TRADE_H #endif //GUARD_CONSTANTS_TRADE_H

View file

@ -464,6 +464,7 @@ extern const u8 gText_MailMessageWillBeLost[];
extern const u8 gText_MailTakenFromPkmn[]; extern const u8 gText_MailTakenFromPkmn[];
extern const u8 gText_NoMoreThanVar1Pkmn[]; extern const u8 gText_NoMoreThanVar1Pkmn[];
extern const u8 gText_PkmnCantBeTradedNow[]; extern const u8 gText_PkmnCantBeTradedNow[];
extern const u8 gText_PkmnCantBeTraded[];
extern const u8 gText_EggCantBeTradedNow[]; extern const u8 gText_EggCantBeTradedNow[];
extern const u8 gText_OnlyPkmnForBattle[]; extern const u8 gText_OnlyPkmnForBattle[];
extern const u8 gJPText_AreYouSureYouWantToSpinTradeMon[]; extern const u8 gJPText_AreYouSureYouWantToSpinTradeMon[];
@ -2154,7 +2155,6 @@ extern const u8 gText_Switch2[];
extern const u8 gText_Item[]; extern const u8 gText_Item[];
extern const u8 gText_NotPkmnOtherTrainerWants[]; extern const u8 gText_NotPkmnOtherTrainerWants[];
extern const u8 gText_ThatIsntAnEgg[]; extern const u8 gText_ThatIsntAnEgg[];
extern const u8 gText_PkmnCantBeTradedNow[];
extern const u8 gText_OtherTrainersPkmnCantBeTraded[]; extern const u8 gText_OtherTrainersPkmnCantBeTraded[];
extern const u8 gText_EggCantBeTradedNow[]; extern const u8 gText_EggCantBeTradedNow[];
extern const u8 gText_OtherTrainerCantAcceptPkmn[]; extern const u8 gText_OtherTrainerCantAcceptPkmn[];

View file

@ -789,8 +789,8 @@ static const u8 *const sUnionRoomTradeMessages[] =
{ {
[UR_TRADE_MSG_NOT_MON_PARTNER_WANTS - 1] = gText_NotPkmnOtherTrainerWants, [UR_TRADE_MSG_NOT_MON_PARTNER_WANTS - 1] = gText_NotPkmnOtherTrainerWants,
[UR_TRADE_MSG_NOT_EGG - 1] = gText_ThatIsntAnEgg, [UR_TRADE_MSG_NOT_EGG - 1] = gText_ThatIsntAnEgg,
[UR_TRADE_MSG_MON_CANT_BE_TRADED_1 - 1] = gText_PkmnCantBeTradedNow, [UR_TRADE_MSG_MON_CANT_BE_TRADED_NOW - 1] = gText_PkmnCantBeTradedNow,
[UR_TRADE_MSG_MON_CANT_BE_TRADED_2 - 1] = gText_PkmnCantBeTradedNow, [UR_TRADE_MSG_MON_CANT_BE_TRADED - 1] = gText_PkmnCantBeTraded,
[UR_TRADE_MSG_PARTNERS_MON_CANT_BE_TRADED - 1] = gText_OtherTrainersPkmnCantBeTraded, [UR_TRADE_MSG_PARTNERS_MON_CANT_BE_TRADED - 1] = gText_OtherTrainersPkmnCantBeTraded,
[UR_TRADE_MSG_EGG_CANT_BE_TRADED -1] = gText_EggCantBeTradedNow, [UR_TRADE_MSG_EGG_CANT_BE_TRADED -1] = gText_EggCantBeTradedNow,
[UR_TRADE_MSG_PARTNER_CANT_ACCEPT_MON - 1] = gText_OtherTrainerCantAcceptPkmn, [UR_TRADE_MSG_PARTNER_CANT_ACCEPT_MON - 1] = gText_OtherTrainerCantAcceptPkmn,

View file

@ -25974,7 +25974,7 @@ const struct BaseStats gBaseStats[] =
.abilities = {ABILITY_TURBOBLAZE, ABILITY_NONE}, .abilities = {ABILITY_TURBOBLAZE, ABILITY_NONE},
.bodyColor = BODY_COLOR_GRAY, .bodyColor = BODY_COLOR_GRAY,
.noFlip = TRUE, .noFlip = TRUE,
.flags = SPECIES_FLAG_LEGENDARY, .flags = SPECIES_FLAG_LEGENDARY | SPECIES_FLAG_CANNOT_BE_TRADED,
}, },
[SPECIES_KYUREM_BLACK] = [SPECIES_KYUREM_BLACK] =
@ -25999,7 +25999,7 @@ const struct BaseStats gBaseStats[] =
.abilities = {ABILITY_TERAVOLT, ABILITY_NONE}, .abilities = {ABILITY_TERAVOLT, ABILITY_NONE},
.bodyColor = BODY_COLOR_GRAY, .bodyColor = BODY_COLOR_GRAY,
.noFlip = TRUE, .noFlip = TRUE,
.flags = SPECIES_FLAG_LEGENDARY, .flags = SPECIES_FLAG_LEGENDARY | SPECIES_FLAG_CANNOT_BE_TRADED,
}, },
[SPECIES_KELDEO_RESOLUTE] = [SPECIES_KELDEO_RESOLUTE] =
@ -26489,7 +26489,7 @@ const struct BaseStats gBaseStats[] =
.abilities = {ABILITY_PRISM_ARMOR, ABILITY_NONE}, .abilities = {ABILITY_PRISM_ARMOR, ABILITY_NONE},
.bodyColor = BODY_COLOR_YELLOW, .bodyColor = BODY_COLOR_YELLOW,
.noFlip = TRUE, .noFlip = TRUE,
.flags = SPECIES_FLAG_LEGENDARY, .flags = SPECIES_FLAG_LEGENDARY | SPECIES_FLAG_CANNOT_BE_TRADED,
}, },
[SPECIES_NECROZMA_DAWN_WINGS] = [SPECIES_NECROZMA_DAWN_WINGS] =
@ -26514,7 +26514,7 @@ const struct BaseStats gBaseStats[] =
.abilities = {ABILITY_PRISM_ARMOR, ABILITY_NONE}, .abilities = {ABILITY_PRISM_ARMOR, ABILITY_NONE},
.bodyColor = BODY_COLOR_BLUE, .bodyColor = BODY_COLOR_BLUE,
.noFlip = TRUE, .noFlip = TRUE,
.flags = SPECIES_FLAG_LEGENDARY, .flags = SPECIES_FLAG_LEGENDARY | SPECIES_FLAG_CANNOT_BE_TRADED,
}, },
[SPECIES_NECROZMA_ULTRA] = [SPECIES_NECROZMA_ULTRA] =
@ -26738,6 +26738,7 @@ const struct BaseStats gBaseStats[] =
.abilities = {ABILITY_AS_ONE_ICE_RIDER, ABILITY_NONE}, .abilities = {ABILITY_AS_ONE_ICE_RIDER, ABILITY_NONE},
.bodyColor = BODY_COLOR_WHITE, .bodyColor = BODY_COLOR_WHITE,
.noFlip = FALSE, .noFlip = FALSE,
.flags = SPECIES_FLAG_LEGENDARY | SPECIES_FLAG_CANNOT_BE_TRADED,
}, },
[SPECIES_CALYREX_SHADOW_RIDER] = [SPECIES_CALYREX_SHADOW_RIDER] =
@ -26762,6 +26763,7 @@ const struct BaseStats gBaseStats[] =
.abilities = {ABILITY_AS_ONE_SHADOW_RIDER, ABILITY_NONE}, .abilities = {ABILITY_AS_ONE_SHADOW_RIDER, ABILITY_NONE},
.bodyColor = BODY_COLOR_BLACK, .bodyColor = BODY_COLOR_BLACK,
.noFlip = FALSE, .noFlip = FALSE,
.flags = SPECIES_FLAG_LEGENDARY | SPECIES_FLAG_CANNOT_BE_TRADED,
}, },
#endif #endif
}; };

View file

@ -3587,9 +3587,12 @@ static void CursorCb_Register(u8 taskId)
switch (CanRegisterMonForTradingBoard(*(struct RfuGameCompatibilityData *)GetHostRfuGameData(), species2, species, isEventLegal)) switch (CanRegisterMonForTradingBoard(*(struct RfuGameCompatibilityData *)GetHostRfuGameData(), species2, species, isEventLegal))
{ {
case CANT_REGISTER_MON: case CANT_REGISTER_MON_NOW:
StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow); StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow);
break; break;
case CANT_REGISTER_MON:
StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTraded);
break;
case CANT_REGISTER_EGG: case CANT_REGISTER_EGG:
StringExpandPlaceholders(gStringVar4, gText_EggCantBeTradedNow); StringExpandPlaceholders(gStringVar4, gText_EggCantBeTradedNow);
break; break;

View file

@ -478,6 +478,7 @@ const u8 gText_PauseUntilPress[] = _("{PAUSE_UNTIL_PRESS}");
const u8 gJPText_AreYouSureYouWantToSpinTradeMon[] = _("{STR_VAR_1}を ぐるぐるこうかんに\nだして よろしいですか?"); const u8 gJPText_AreYouSureYouWantToSpinTradeMon[] = _("{STR_VAR_1}を ぐるぐるこうかんに\nだして よろしいですか?");
ALIGNED(4) const u8 gText_OnlyPkmnForBattle[] = _("That's your only\nPOKéMON for battle."); ALIGNED(4) const u8 gText_OnlyPkmnForBattle[] = _("That's your only\nPOKéMON for battle.");
ALIGNED(4) const u8 gText_PkmnCantBeTradedNow[] = _("That POKéMON can't be traded\nnow."); ALIGNED(4) const u8 gText_PkmnCantBeTradedNow[] = _("That POKéMON can't be traded\nnow.");
ALIGNED(4) const u8 gText_PkmnCantBeTraded[] = _("That POKéMON can't be traded.");
ALIGNED(4) const u8 gText_EggCantBeTradedNow[] = _("An EGG can't be traded now."); ALIGNED(4) const u8 gText_EggCantBeTradedNow[] = _("An EGG can't be traded now.");
ALIGNED(4) const u8 gText_OtherTrainersPkmnCantBeTraded[] = _("The other TRAINER's POKéMON\ncan't be traded now."); ALIGNED(4) const u8 gText_OtherTrainersPkmnCantBeTraded[] = _("The other TRAINER's POKéMON\ncan't be traded now.");
ALIGNED(4) const u8 gText_OtherTrainerCantAcceptPkmn[] = _("The other TRAINER can't accept\nthat POKéMON now."); ALIGNED(4) const u8 gText_OtherTrainerCantAcceptPkmn[] = _("The other TRAINER can't accept\nthat POKéMON now.");

View file

@ -1504,6 +1504,10 @@ static u8 CheckValidityOfTradeMons(u8 *aliveMons, u8 playerPartyCount, u8 player
return PARTNER_MON_INVALID; return PARTNER_MON_INVALID;
} }
// Can't trade specific species
if (gBaseStats[partnerSpecies].flags & SPECIES_FLAG_CANNOT_BE_TRADED)
return PARTNER_MON_INVALID;
// Partner cant trade Egg or non-Hoenn mon if player doesn't have National Dex // Partner cant trade Egg or non-Hoenn mon if player doesn't have National Dex
if (!IsNationalPokedexEnabled()) if (!IsNationalPokedexEnabled())
{ {
@ -2360,6 +2364,10 @@ static u32 CanTradeSelectedMon(struct Pokemon *playerParty, int partyCount, int
return CANT_TRADE_INVALID_MON; return CANT_TRADE_INVALID_MON;
} }
// Can't trade specific species
if (gBaseStats[species[monIdx]].flags & SPECIES_FLAG_CANNOT_BE_TRADED)
return CANT_TRADE_INVALID_MON;
// Make Eggs not count for numMonsLeft // Make Eggs not count for numMonsLeft
for (i = 0; i < partyCount; i++) for (i = 0; i < partyCount; i++)
{ {
@ -2450,7 +2458,11 @@ int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct Rf
// Cannot trade illegitimate Deoxys/Mew // Cannot trade illegitimate Deoxys/Mew
if (IsDeoxysOrMewUntradable(playerSpecies, isEventLegal)) if (IsDeoxysOrMewUntradable(playerSpecies, isEventLegal))
return UR_TRADE_MSG_MON_CANT_BE_TRADED_2; return UR_TRADE_MSG_MON_CANT_BE_TRADED;
// Can't trade specific species
if (gBaseStats[playerSpecies].flags & SPECIES_FLAG_CANNOT_BE_TRADED)
return UR_TRADE_MSG_MON_CANT_BE_TRADED;
if (partnerSpecies == SPECIES_EGG) if (partnerSpecies == SPECIES_EGG)
{ {
@ -2469,7 +2481,7 @@ int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct Rf
// If the player is trading an Egg then the partner must also be trading an Egg // If the player is trading an Egg then the partner must also be trading an Egg
// Odd that this wasn't checked earlier, as by this point we know either the partner doesn't have an Egg or that both do. // Odd that this wasn't checked earlier, as by this point we know either the partner doesn't have an Egg or that both do.
if (playerSpecies2 == SPECIES_EGG && playerSpecies2 != partnerSpecies) if (playerSpecies2 == SPECIES_EGG && playerSpecies2 != partnerSpecies)
return UR_TRADE_MSG_MON_CANT_BE_TRADED_1; return UR_TRADE_MSG_MON_CANT_BE_TRADED_NOW;
// If the player doesn't have the National Dex then Eggs and non-Hoenn Pokémon can't be traded // If the player doesn't have the National Dex then Eggs and non-Hoenn Pokémon can't be traded
if (!playerHasNationalDex) if (!playerHasNationalDex)
@ -2478,7 +2490,7 @@ int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct Rf
return UR_TRADE_MSG_EGG_CANT_BE_TRADED; return UR_TRADE_MSG_EGG_CANT_BE_TRADED;
if (!IsSpeciesInHoennDex(playerSpecies2)) if (!IsSpeciesInHoennDex(playerSpecies2))
return UR_TRADE_MSG_MON_CANT_BE_TRADED_2; return UR_TRADE_MSG_MON_CANT_BE_TRADED_NOW;
if (!IsSpeciesInHoennDex(partnerSpecies)) if (!IsSpeciesInHoennDex(partnerSpecies))
return UR_TRADE_MSG_PARTNERS_MON_CANT_BE_TRADED; return UR_TRADE_MSG_PARTNERS_MON_CANT_BE_TRADED;
@ -2497,6 +2509,10 @@ int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData player, u16 sp
bool8 hasNationalDex = player.hasNationalDex; bool8 hasNationalDex = player.hasNationalDex;
if (IsDeoxysOrMewUntradable(species, isEventLegal)) if (IsDeoxysOrMewUntradable(species, isEventLegal))
return CANT_REGISTER_MON_NOW;
// Can't trade specific species
if (gBaseStats[species].flags & SPECIES_FLAG_CANNOT_BE_TRADED)
return CANT_REGISTER_MON; return CANT_REGISTER_MON;
if (hasNationalDex) if (hasNationalDex)
@ -2509,7 +2525,7 @@ int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData player, u16 sp
if (IsSpeciesInHoennDex(species2)) if (IsSpeciesInHoennDex(species2))
return CAN_REGISTER_MON; return CAN_REGISTER_MON;
return CANT_REGISTER_MON; return CANT_REGISTER_MON_NOW;
} }
// Spin Trade wasnt fully implemented, but this checks if a mon would be valid to Spin Trade // Spin Trade wasnt fully implemented, but this checks if a mon would be valid to Spin Trade