Converts a bunch of #if to regular conditions (#4071)

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
Bassoonian 2024-01-26 18:15:45 +01:00 committed by GitHub
parent d0a35eec1d
commit 80e6ca1df0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 90 additions and 169 deletions

View file

@ -13,11 +13,7 @@
#define DAYCARE_ONE_MON 2 #define DAYCARE_ONE_MON 2
#define DAYCARE_TWO_MONS 3 #define DAYCARE_TWO_MONS 3
#if P_EGG_HATCH_LEVEL >= GEN_4 #define EGG_HATCH_LEVEL ((P_EGG_HATCH_LEVEL >= GEN_4) ? 1 : 5)
#define EGG_HATCH_LEVEL 1
#else
#define EGG_HATCH_LEVEL 5
#endif
#define EGG_GENDER_MALE 0x8000 // used to create a male egg from a female-only parent species (e.g. Nidoran) #define EGG_GENDER_MALE 0x8000 // used to create a male egg from a female-only parent species (e.g. Nidoran)
#define DAYCARE_LEVEL_MENU_EXIT 5 #define DAYCARE_LEVEL_MENU_EXIT 5

View file

@ -108,11 +108,7 @@
#define PLAYER_NAME_LENGTH 7 #define PLAYER_NAME_LENGTH 7
#define MAIL_WORDS_COUNT 9 #define MAIL_WORDS_COUNT 9
#define EASY_CHAT_BATTLE_WORDS_COUNT 6 #define EASY_CHAT_BATTLE_WORDS_COUNT 6
#if B_EXPANDED_MOVE_NAMES == TRUE #define MOVE_NAME_LENGTH ((B_EXPANDED_MOVE_NAMES == TRUE) ? 16 : 12)
#define MOVE_NAME_LENGTH 16
#else
#define MOVE_NAME_LENGTH 12
#endif
#define NUM_QUESTIONNAIRE_WORDS 4 #define NUM_QUESTIONNAIRE_WORDS 4
#define QUIZ_QUESTION_LEN 9 #define QUIZ_QUESTION_LEN 9
#define WONDER_CARD_TEXT_LENGTH 40 #define WONDER_CARD_TEXT_LENGTH 40
@ -120,11 +116,7 @@
#define WONDER_CARD_BODY_TEXT_LINES 4 #define WONDER_CARD_BODY_TEXT_LINES 4
#define WONDER_NEWS_BODY_TEXT_LINES 10 #define WONDER_NEWS_BODY_TEXT_LINES 10
#define TYPE_NAME_LENGTH 6 #define TYPE_NAME_LENGTH 6
#if B_EXPANDED_ABILITY_NAMES == TRUE #define ABILITY_NAME_LENGTH ((B_EXPANDED_ABILITY_NAMES == TRUE) ? 16 : 12)
#define ABILITY_NAME_LENGTH 16
#else
#define ABILITY_NAME_LENGTH 12
#endif
#define TRAINER_NAME_LENGTH 10 #define TRAINER_NAME_LENGTH 10
#define MAX_STAMP_CARD_STAMPS 7 #define MAX_STAMP_CARD_STAMPS 7

View file

@ -649,11 +649,7 @@
#define CONFUSE_BERRY_HEAL_FRACTION 8 #define CONFUSE_BERRY_HEAL_FRACTION 8
#endif #endif
#if B_CONFUSE_BERRIES_HEAL >= GEN_7 #define CONFUSE_BERRY_HP_FRACTION ((B_CONFUSE_BERRIES_HEAL >= GEN_7) ? 4 : 2)
#define CONFUSE_BERRY_HP_FRACTION 4
#else
#define CONFUSE_BERRY_HP_FRACTION 2
#endif
#define ITEM_CHERI_BERRY 514 #define ITEM_CHERI_BERRY 514
#define ITEM_CHESTO_BERRY 515 #define ITEM_CHESTO_BERRY 515

View file

@ -202,11 +202,7 @@
#define AFFECTION_FIVE_HEARTS 5 // Max friendship #define AFFECTION_FIVE_HEARTS 5 // Max friendship
// Friendship value that the majority of species use. // Friendship value that the majority of species use.
#if P_UPDATED_FRIENDSHIP >= GEN_8 #define STANDARD_FRIENDSHIP ((P_UPDATED_FRIENDSHIP >= GEN_8) ? 50 : 70)
#define STANDARD_FRIENDSHIP 50
#else
#define STANDARD_FRIENDSHIP 70
#endif
#define MAX_FRIENDSHIP 255 #define MAX_FRIENDSHIP 255
#define MAX_SHEEN 255 #define MAX_SHEEN 255
@ -215,17 +211,9 @@
#define MAX_PER_STAT_IVS 31 #define MAX_PER_STAT_IVS 31
#define MAX_IV_MASK 31 #define MAX_IV_MASK 31
#define USE_RANDOM_IVS (MAX_PER_STAT_IVS + 1) #define USE_RANDOM_IVS (MAX_PER_STAT_IVS + 1)
#if P_EV_CAP >= GEN_6 #define MAX_PER_STAT_EVS ((P_EV_CAP >= GEN_6) ? 252 : 255)
#define MAX_PER_STAT_EVS 252
#else
#define MAX_PER_STAT_EVS 255
#endif
#define MAX_TOTAL_EVS 510 #define MAX_TOTAL_EVS 510
#if I_VITAMIN_EV_CAP >= GEN_8 #define EV_ITEM_RAISE_LIMIT ((I_VITAMIN_EV_CAP >= GEN_8) ? MAX_PER_STAT_EVS : 100)
#define EV_ITEM_RAISE_LIMIT MAX_PER_STAT_EVS
#else
#define EV_ITEM_RAISE_LIMIT 100
#endif
// Move category defines. // Move category defines.
#define BATTLE_CATEGORY_PHYSICAL 0 #define BATTLE_CATEGORY_PHYSICAL 0

View file

@ -133,10 +133,8 @@ static u32 GetWildAiFlags(void)
if (avgLevel >= 80) if (avgLevel >= 80)
flags |= AI_FLAG_HP_AWARE; flags |= AI_FLAG_HP_AWARE;
#if B_VAR_WILD_AI_FLAGS != 0 if (B_VAR_WILD_AI_FLAGS != 0 && VarGet(B_VAR_WILD_AI_FLAGS) != 0)
if (VarGet(B_VAR_WILD_AI_FLAGS) != 0)
flags |= VarGet(B_VAR_WILD_AI_FLAGS); flags |= VarGet(B_VAR_WILD_AI_FLAGS);
#endif
return flags; return flags;
} }

View file

@ -1453,11 +1453,10 @@ static u32 GetSwitchinStatusDamage(u32 battler)
{ {
if (status & STATUS1_BURN) if (status & STATUS1_BURN)
{ {
#if B_BURN_DAMAGE >= GEN_7 if (B_BURN_DAMAGE >= GEN_7)
statusDamage = maxHP / 16; statusDamage = maxHP / 16;
#else else
statusDamage = maxHP / 8; statusDamage = maxHP / 8;
#endif
if(ability == ABILITY_HEATPROOF) if(ability == ABILITY_HEATPROOF)
statusDamage = statusDamage / 2; statusDamage = statusDamage / 2;
if (statusDamage == 0) if (statusDamage == 0)
@ -1465,11 +1464,10 @@ static u32 GetSwitchinStatusDamage(u32 battler)
} }
else if (status & STATUS1_FROSTBITE) else if (status & STATUS1_FROSTBITE)
{ {
#if B_BURN_DAMAGE >= GEN_7 if (B_BURN_DAMAGE >= GEN_7)
statusDamage = maxHP / 16; statusDamage = maxHP / 16;
#else else
statusDamage = maxHP / 8; statusDamage = maxHP / 8;
#endif
if (statusDamage == 0) if (statusDamage == 0)
statusDamage = 1; statusDamage = 1;
} }

View file

@ -1303,7 +1303,7 @@ static void InitPoisonGasCloudAnim(struct Sprite *sprite)
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
#if B_UPDATED_MOVE_DATA >= GEN_5 if (B_UPDATED_MOVE_DATA >= GEN_5)
{ {
s16 x, y; s16 x, y;
SetAverageBattlerPositions(gBattleAnimTarget, gBattleAnimArgs[7], &x, &y); SetAverageBattlerPositions(gBattleAnimTarget, gBattleAnimArgs[7], &x, &y);
@ -1313,8 +1313,7 @@ static void InitPoisonGasCloudAnim(struct Sprite *sprite)
sprite->data[4] = y + gBattleAnimArgs[4]; sprite->data[4] = y + gBattleAnimArgs[4];
sprite->data[7] |= GetBattlerSpriteBGPriority(gBattleAnimTarget) << 8; sprite->data[7] |= GetBattlerSpriteBGPriority(gBattleAnimTarget) << 8;
} }
#else else if (gBattleAnimArgs[7])
if (gBattleAnimArgs[7])
{ {
sprite->data[1] = sprite->x + gBattleAnimArgs[1]; sprite->data[1] = sprite->x + gBattleAnimArgs[1];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[3]; sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[3];
@ -1330,7 +1329,6 @@ static void InitPoisonGasCloudAnim(struct Sprite *sprite)
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + gBattleAnimArgs[4]; sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + gBattleAnimArgs[4];
sprite->data[7] |= GetBattlerSpriteBGPriority(gBattleAnimTarget) << 8; sprite->data[7] |= GetBattlerSpriteBGPriority(gBattleAnimTarget) << 8;
} }
#endif
if (IsContest()) if (IsContest())
{ {

View file

@ -946,11 +946,10 @@ void BS_TrySetStatus1(void)
case STATUS1_SLEEP: case STATUS1_SLEEP:
if (CanSleep(gBattlerTarget)) if (CanSleep(gBattlerTarget))
{ {
#if B_SLEEP_TURNS >= GEN_5 if (B_SLEEP_TURNS >= GEN_5)
gBattleMons[gBattlerTarget].status1 |= STATUS1_SLEEP_TURN((Random() % 3) + 2); gBattleMons[gBattlerTarget].status1 |= STATUS1_SLEEP_TURN((Random() % 3) + 2);
#else else
gBattleMons[gBattlerTarget].status1 |= STATUS1_SLEEP_TURN((Random() % 4) + 3); gBattleMons[gBattlerTarget].status1 |= STATUS1_SLEEP_TURN((Random() % 4) + 3);
#endif
gBattleCommunication[MULTISTRING_CHOOSER] = 4; gBattleCommunication[MULTISTRING_CHOOSER] = 4;
effect++; effect++;
} }

View file

@ -2027,13 +2027,11 @@ u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer
} }
CalculateMonStats(&party[i]); CalculateMonStats(&party[i]);
#if B_TRAINER_CLASS_POKE_BALLS >= GEN_7 if (B_TRAINER_CLASS_POKE_BALLS >= GEN_7 && ball == -1)
if (ball == -1)
{ {
ball = gTrainerClasses[trainer->trainerClass].ball ?: ITEM_POKE_BALL; ball = gTrainerClasses[trainer->trainerClass].ball ?: ITEM_POKE_BALL;
SetMonData(&party[i], MON_DATA_POKEBALL, &ball); SetMonData(&party[i], MON_DATA_POKEBALL, &ball);
} }
#endif
} }
} }

View file

@ -14488,15 +14488,14 @@ static void Cmd_pickup(void)
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem); SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem);
} }
} }
#if P_SHUCKLE_BERRY_JUICE == GEN_2 else if (P_SHUCKLE_BERRY_JUICE == GEN_2
else if (species == SPECIES_SHUCKLE && species == SPECIES_SHUCKLE
&& heldItem == ITEM_ORAN_BERRY && heldItem == ITEM_ORAN_BERRY
&& (Random() % 16) == 0) && (Random() % 16) == 0)
{ {
heldItem = ITEM_BERRY_JUICE; heldItem = ITEM_BERRY_JUICE;
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem); SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem);
} }
#endif
} }
} }

View file

@ -1164,8 +1164,7 @@ void PrepareStringBattle(u16 stringId, u32 battler)
else else
SET_STATCHANGER(STAT_SPATK, 2, FALSE); SET_STATCHANGER(STAT_SPATK, 2, FALSE);
} }
#if B_UPDATED_INTIMIDATE >= GEN_8 else if (B_UPDATED_INTIMIDATE >= GEN_8 && stringId == STRINGID_PKMNCUTSATTACKWITH && targetAbility == ABILITY_RATTLED
else if (stringId == STRINGID_PKMNCUTSATTACKWITH && targetAbility == ABILITY_RATTLED
&& CompareStat(gBattlerTarget, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN)) && CompareStat(gBattlerTarget, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN))
{ {
gBattlerAbility = gBattlerTarget; gBattlerAbility = gBattlerTarget;
@ -1173,7 +1172,6 @@ void PrepareStringBattle(u16 stringId, u32 battler)
gBattlescriptCurrInstr = BattleScript_AbilityRaisesDefenderStat; gBattlescriptCurrInstr = BattleScript_AbilityRaisesDefenderStat;
SET_STATCHANGER(STAT_SPEED, 1, FALSE); SET_STATCHANGER(STAT_SPEED, 1, FALSE);
} }
#endif
// Signal for the trainer slide-in system. // Signal for the trainer slide-in system.
if ((stringId == STRINGID_ITDOESNTAFFECT || stringId == STRINGID_PKMNWASNTAFFECTED || stringId == STRINGID_PKMNUNAFFECTED) if ((stringId == STRINGID_ITDOESNTAFFECT || stringId == STRINGID_PKMNWASNTAFFECTED || stringId == STRINGID_PKMNUNAFFECTED)
@ -8802,11 +8800,12 @@ static inline u32 CalcMoveBasePowerAfterModifiers(u32 move, u32 battlerAtk, u32
break; break;
case ABILITY_TRANSISTOR: case ABILITY_TRANSISTOR:
if (moveType == TYPE_ELECTRIC) if (moveType == TYPE_ELECTRIC)
#if B_TRANSISTOR_BOOST >= GEN_9 {
modifier = uq4_12_multiply(modifier, UQ_4_12(5325 / 4096)); if (B_TRANSISTOR_BOOST >= GEN_9)
#else modifier = uq4_12_multiply(modifier, UQ_4_12(5325 / 4096));
modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); else
#endif modifier = uq4_12_multiply(modifier, UQ_4_12(1.5));
}
break; break;
case ABILITY_DRAGONS_MAW: case ABILITY_DRAGONS_MAW:
if (moveType == TYPE_DRAGON) if (moveType == TYPE_DRAGON)
@ -10958,11 +10957,10 @@ bool32 IsAlly(u32 battlerAtk, u32 battlerDef)
bool32 IsGen6ExpShareEnabled(void) bool32 IsGen6ExpShareEnabled(void)
{ {
#if I_EXP_SHARE_FLAG <= TEMP_FLAGS_END if (I_EXP_SHARE_FLAG <= TEMP_FLAGS_END)
return FALSE; return FALSE;
#else
return FlagGet(I_EXP_SHARE_FLAG); return FlagGet(I_EXP_SHARE_FLAG);
#endif
} }
bool32 MoveHasMoveEffect(u32 move, u32 moveEffect) bool32 MoveHasMoveEffect(u32 move, u32 moveEffect)

View file

@ -1053,12 +1053,8 @@ void Bike_HandleBumpySlopeJump(void)
bool32 IsRunningDisallowed(u8 metatile) bool32 IsRunningDisallowed(u8 metatile)
{ {
#if OW_RUNNING_INDOORS == GEN_3 if ((OW_RUNNING_INDOORS == GEN_3 && !gMapHeader.allowRunning) || IsRunningDisallowedByMetatile(metatile) == TRUE)
if (!gMapHeader.allowRunning || IsRunningDisallowedByMetatile(metatile) == TRUE)
#else
if (IsRunningDisallowedByMetatile(metatile) == TRUE)
#endif
return TRUE; return TRUE;
else
return FALSE; return FALSE;
} }

View file

@ -8,27 +8,13 @@
#define EVO_HELD_ITEM_FIELD_FUNC ItemUseOutOfBattle_CannotUse #define EVO_HELD_ITEM_FIELD_FUNC ItemUseOutOfBattle_CannotUse
#endif #endif
#if I_GEM_BOOST_POWER >= GEN_6 #define GEM_BOOST_PARAM ((I_GEM_BOOST_POWER >= GEN_6) ? 30 : 50)
#define GEM_BOOST_PARAM 30 #define TYPE_BOOST_PARAM ((I_TYPE_BOOST_POWER >= GEN_4) ? 20 : 10) // For non Pokémon-specific type-boosting held items.
#else #define POWER_ITEM_BOOST ((I_POWER_ITEM_BOOST >= GEN_7) ? 8 : 4)
#define GEM_BOOST_PARAM 50
#endif
#if I_TYPE_BOOST_POWER >= GEN_4 // For non Pokémon-specific type-boosting held items. #define X_ITEM_STAGES ((B_X_ITEMS_BUFF >= GEN_7) ? 2 : 1)
#define TYPE_BOOST_PARAM 20
#else
#define TYPE_BOOST_PARAM 10
#endif
#if I_POWER_ITEM_BOOST >= GEN_7 #define TREASURE_FACTOR ((I_SELL_VALUE_FRACTION >= GEN_9) ? 2 : 1)
#define POWER_ITEM_BOOST 8
#else
#define POWER_ITEM_BOOST 4
#endif
#define X_ITEM_STAGES (B_X_ITEMS_BUFF >= GEN_7) ? 2 : 1
#define TREASURE_FACTOR (I_SELL_VALUE_FRACTION >= GEN_9) ? 2: 1
// Shared Item Description entries // Shared Item Description entries

View file

@ -194,9 +194,7 @@ static void TransferEggMoves(void)
// Check if you can inherit from them // Check if you can inherit from them
if (GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[k].mon, MON_DATA_SPECIES) != GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[i].mon, MON_DATA_SPECIES) if (GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[k].mon, MON_DATA_SPECIES) != GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[i].mon, MON_DATA_SPECIES)
#if P_EGG_MOVE_TRANSFER >= GEN_9 && (P_EGG_MOVE_TRANSFER < GEN_9 || GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[i].mon, MON_DATA_HELD_ITEM) != ITEM_MIRROR_HERB)
&& GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[i].mon, MON_DATA_HELD_ITEM) != ITEM_MIRROR_HERB
#endif
) )
continue; continue;
@ -492,9 +490,7 @@ static s32 GetParentToInheritNature(struct DayCare *daycare)
for (i = 0; i < DAYCARE_MON_COUNT; i++) for (i = 0; i < DAYCARE_MON_COUNT; i++)
{ {
if (ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE if (ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE
#if P_NATURE_INHERITANCE == GEN_3 && (P_NATURE_INHERITANCE != GEN_3 || GetBoxMonGender(&daycare->mons[i].mon) == MON_FEMALE || IS_DITTO(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES)))
&& (GetBoxMonGender(&daycare->mons[i].mon) == MON_FEMALE || IS_DITTO(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES)))
#endif
) { ) {
slot = i; slot = i;
numWithEverstone++; numWithEverstone++;
@ -503,11 +499,11 @@ static s32 GetParentToInheritNature(struct DayCare *daycare)
if (numWithEverstone >= DAYCARE_MON_COUNT) if (numWithEverstone >= DAYCARE_MON_COUNT)
return Random() & 1; return Random() & 1;
#if P_NATURE_INHERITANCE > GEN_4
return slot; if (P_NATURE_INHERITANCE > GEN_4)
#else return slot;
return Random() & 1 ? slot : -1; return Random() & 1 ? slot : -1;
#endif
} }
static void _TriggerPendingDaycareEgg(struct DayCare *daycare) static void _TriggerPendingDaycareEgg(struct DayCare *daycare)
@ -858,27 +854,28 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
numEggMoves = GetEggMoves(egg, sHatchedEggEggMoves); numEggMoves = GetEggMoves(egg, sHatchedEggEggMoves);
#if P_MOTHER_EGG_MOVE_INHERITANCE >= GEN_6 if (P_MOTHER_EGG_MOVE_INHERITANCE >= GEN_6)
for (i = 0; i < MAX_MON_MOVES; i++)
{ {
if (sHatchedEggMotherMoves[i] != MOVE_NONE) for (i = 0; i < MAX_MON_MOVES; i++)
{ {
for (j = 0; j < numEggMoves; j++) if (sHatchedEggMotherMoves[i] != MOVE_NONE)
{ {
if (sHatchedEggMotherMoves[i] == sHatchedEggEggMoves[j]) for (j = 0; j < numEggMoves; j++)
{ {
if (GiveMoveToMon(egg, sHatchedEggMotherMoves[i]) == MON_HAS_MAX_MOVES) if (sHatchedEggMotherMoves[i] == sHatchedEggEggMoves[j])
DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggMotherMoves[i]); {
break; if (GiveMoveToMon(egg, sHatchedEggMotherMoves[i]) == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggMotherMoves[i]);
break;
}
} }
} }
} else
else {
{ break;
break; }
} }
} }
#endif
for (i = 0; i < MAX_MON_MOVES; i++) for (i = 0; i < MAX_MON_MOVES; i++)
{ {
@ -899,23 +896,26 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
break; break;
} }
} }
#if P_TM_INHERITANCE < GEN_6
for (i = 0; i < MAX_MON_MOVES; i++) if (P_TM_INHERITANCE < GEN_6)
{ {
if (sHatchedEggFatherMoves[i] != MOVE_NONE) for (i = 0; i < MAX_MON_MOVES; i++)
{ {
for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) if (sHatchedEggFatherMoves[i] != MOVE_NONE)
{ {
u16 moveId = ItemIdToBattleMoveId(ITEM_TM01 + j); for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++)
if (sHatchedEggFatherMoves[i] == moveId && CanLearnTeachableMove(GetMonData(egg, MON_DATA_SPECIES_OR_EGG), moveId))
{ {
if (GiveMoveToMon(egg, sHatchedEggFatherMoves[i]) == MON_HAS_MAX_MOVES) u16 moveId = ItemIdToBattleMoveId(ITEM_TM01 + j);
DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggFatherMoves[i]); if (sHatchedEggFatherMoves[i] == moveId && CanLearnTeachableMove(GetMonData(egg, MON_DATA_SPECIES_OR_EGG), moveId))
{
if (GiveMoveToMon(egg, sHatchedEggFatherMoves[i]) == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggFatherMoves[i]);
}
} }
} }
} }
} }
#endif
for (i = 0; i < MAX_MON_MOVES; i++) for (i = 0; i < MAX_MON_MOVES; i++)
{ {
if (sHatchedEggFatherMoves[i] == MOVE_NONE) if (sHatchedEggFatherMoves[i] == MOVE_NONE)
@ -1046,12 +1046,10 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent
eggSpecies = SPECIES_NIDORAN_M; eggSpecies = SPECIES_NIDORAN_M;
else if (eggSpecies == SPECIES_ILLUMISE && daycare->offspringPersonality & EGG_GENDER_MALE) else if (eggSpecies == SPECIES_ILLUMISE && daycare->offspringPersonality & EGG_GENDER_MALE)
eggSpecies = SPECIES_VOLBEAT; eggSpecies = SPECIES_VOLBEAT;
#if P_NIDORAN_M_DITTO_BREED >= GEN_5 else if (P_NIDORAN_M_DITTO_BREED >= GEN_5 && eggSpecies == SPECIES_NIDORAN_M && !(daycare->offspringPersonality & EGG_GENDER_MALE))
else if (eggSpecies == SPECIES_NIDORAN_M && !(daycare->offspringPersonality & EGG_GENDER_MALE))
eggSpecies = SPECIES_NIDORAN_F; eggSpecies = SPECIES_NIDORAN_F;
else if (eggSpecies == SPECIES_VOLBEAT && !(daycare->offspringPersonality & EGG_GENDER_MALE)) else if (P_NIDORAN_M_DITTO_BREED >= GEN_5 && eggSpecies == SPECIES_VOLBEAT && !(daycare->offspringPersonality & EGG_GENDER_MALE))
eggSpecies = SPECIES_ILLUMISE; eggSpecies = SPECIES_ILLUMISE;
#endif
else if (eggSpecies == SPECIES_MANAPHY) else if (eggSpecies == SPECIES_MANAPHY)
eggSpecies = SPECIES_PHIONE; eggSpecies = SPECIES_PHIONE;
else if (eggSpecies == SPECIES_SINISTEA_ANTIQUE) else if (eggSpecies == SPECIES_SINISTEA_ANTIQUE)

View file

@ -45,9 +45,9 @@ static void FaintFromFieldPoison(u8 partyIdx)
struct Pokemon *pokemon = &gPlayerParty[partyIdx]; struct Pokemon *pokemon = &gPlayerParty[partyIdx];
u32 status = STATUS1_NONE; u32 status = STATUS1_NONE;
#if OW_POISON_DAMAGE < GEN_4 if (OW_POISON_DAMAGE < GEN_4)
AdjustFriendship(pokemon, FRIENDSHIP_EVENT_FAINT_FIELD_PSN); AdjustFriendship(pokemon, FRIENDSHIP_EVENT_FAINT_FIELD_PSN);
#endif
SetMonData(pokemon, MON_DATA_STATUS, &status); SetMonData(pokemon, MON_DATA_STATUS, &status);
GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1); GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1);
StringGet_Nickname(gStringVar1); StringGet_Nickname(gStringVar1);
@ -56,11 +56,7 @@ static void FaintFromFieldPoison(u8 partyIdx)
static bool32 MonFaintedFromPoison(u8 partyIdx) static bool32 MonFaintedFromPoison(u8 partyIdx)
{ {
struct Pokemon *pokemon = &gPlayerParty[partyIdx]; struct Pokemon *pokemon = &gPlayerParty[partyIdx];
#if OW_POISON_DAMAGE < GEN_4 if (IsMonValidSpecies(pokemon) && GetMonData(pokemon, MON_DATA_HP) == ((OW_POISON_DAMAGE < GEN_4) ? 0 : 1) && GetAilmentFromStatus(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
if (IsMonValidSpecies(pokemon) && GetMonData(pokemon, MON_DATA_HP) == 0 && GetAilmentFromStatus(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
#else
if (IsMonValidSpecies(pokemon) && GetMonData(pokemon, MON_DATA_HP) == 1 && GetAilmentFromStatus(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
#endif
return TRUE; return TRUE;
return FALSE; return FALSE;
@ -134,16 +130,13 @@ s32 DoPoisonFieldEffect(void)
{ {
// Apply poison damage // Apply poison damage
hp = GetMonData(pokemon, MON_DATA_HP); hp = GetMonData(pokemon, MON_DATA_HP);
#if OW_POISON_DAMAGE < GEN_4 if (OW_POISON_DAMAGE < GEN_4 && (hp == 0 || --hp == 0))
if (hp == 0 || --hp == 0)
{ {
TryFormChange(i, B_SIDE_PLAYER, FORM_CHANGE_FAINT); TryFormChange(i, B_SIDE_PLAYER, FORM_CHANGE_FAINT);
numFainted++; numFainted++;
} }
#else else if (OW_POISON_DAMAGE >= GEN_4 && (hp == 1 || --hp == 1))
if (hp == 1 || --hp == 1)
numFainted++; numFainted++;
#endif
SetMonData(pokemon, MON_DATA_HP, &hp); SetMonData(pokemon, MON_DATA_HP, &hp);
numPoisoned++; numPoisoned++;

View file

@ -2115,11 +2115,7 @@ static void Task_ItemContext_Sell(u8 taskId)
} }
} }
#if I_SELL_VALUE_FRACTION >= GEN_9 #define ITEM_SELL_FACTOR ((I_SELL_VALUE_FRACTION >= GEN_9) ? 4 : 2)
#define ITEM_SELL_FACTOR 4
#else
#define ITEM_SELL_FACTOR 2
#endif
static void DisplaySellItemPriceAndConfirm(u8 taskId) static void DisplaySellItemPriceAndConfirm(u8 taskId)
{ {

View file

@ -1040,12 +1040,15 @@ void Task_UseDigEscapeRopeOnField(u8 taskId)
static void ItemUseOnFieldCB_EscapeRope(u8 taskId) static void ItemUseOnFieldCB_EscapeRope(u8 taskId)
{ {
Overworld_ResetStateAfterDigEscRope(); Overworld_ResetStateAfterDigEscRope();
#if I_KEY_ESCAPE_ROPE < GEN_8 if (I_KEY_ESCAPE_ROPE < GEN_8)
{
RemoveUsedItem(); RemoveUsedItem();
#else }
else
{
CopyItemName(gSpecialVar_ItemId, gStringVar2); CopyItemName(gSpecialVar_ItemId, gStringVar2);
StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2); StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2);
#endif }
gTasks[taskId].data[0] = 0; gTasks[taskId].data[0] = 0;
DisplayItemMessageOnField(taskId, gStringVar4, Task_UseDigEscapeRopeOnField); DisplayItemMessageOnField(taskId, gStringVar4, Task_UseDigEscapeRopeOnField);
} }

View file

@ -57,11 +57,7 @@
#include "constants/union_room.h" #include "constants/union_room.h"
#include "constants/weather.h" #include "constants/weather.h"
#if P_FRIENDSHIP_EVO_THRESHOLD >= GEN_9 #define FRIENDSHIP_EVO_THRESHOLD ((P_FRIENDSHIP_EVO_THRESHOLD >= GEN_9) ? 160 : 220)
#define FRIENDSHIP_EVO_THRESHOLD 160
#else
#define FRIENDSHIP_EVO_THRESHOLD 220
#endif
struct SpeciesItem struct SpeciesItem
{ {
@ -3557,10 +3553,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
break; break;
} }
dataSigned += evChange; dataSigned += evChange;
#if I_EV_LOWERING_BERRY_JUMP == GEN_4 if (I_BERRY_EV_JUMP == GEN_4 && dataSigned > 100)
if (dataSigned > 100)
dataSigned = 100; dataSigned = 100;
#endif
if (dataSigned < 0) if (dataSigned < 0)
dataSigned = 0; dataSigned = 0;
} }
@ -3744,10 +3738,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
break; break;
} }
dataSigned += evChange; dataSigned += evChange;
#if I_BERRY_EV_JUMP == GEN_4 if (I_BERRY_EV_JUMP == GEN_4 && dataSigned > 100)
if (dataSigned > 100)
dataSigned = 100; dataSigned = 100;
#endif
if (dataSigned < 0) if (dataSigned < 0)
dataSigned = 0; dataSigned = 0;
} }
@ -4085,10 +4077,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s
// Prevent evolution with Everstone, unless we're just viewing the party menu with an evolution item // Prevent evolution with Everstone, unless we're just viewing the party menu with an evolution item
if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE
&& mode != EVO_MODE_ITEM_CHECK && mode != EVO_MODE_ITEM_CHECK
#if P_KADABRA_EVERSTONE >= GEN_4 && (P_KADABRA_EVERSTONE < GEN_4 || species != SPECIES_KADABRA))
&& species != SPECIES_KADABRA
#endif
)
return SPECIES_NONE; return SPECIES_NONE;
switch (mode) switch (mode)