diff --git a/include/config/overworld.h b/include/config/overworld.h index 7831858d2..f62588b5f 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -4,6 +4,9 @@ // Movement config #define OW_RUNNING_INDOORS GEN_LATEST // In Gen4+, players are allowed to run indoors. +// Other settings +#define OW_POISON_DAMAGE GEN_LATEST // In Gen4, Pokémon no longer faint from Poison in the overworld. In Gen5+, they no longer take damage at all. + // Overworld flags // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. // Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature. diff --git a/include/strings.h b/include/strings.h index 959bb8c22..984247b21 100644 --- a/include/strings.h +++ b/include/strings.h @@ -180,6 +180,7 @@ extern const u8 gText_Confirm3[]; extern const u8 gText_Cancel4[]; extern const u8 gText_IsThisTheCorrectTime[]; extern const u8 gText_PkmnFainted_FldPsn[]; +extern const u8 gText_PkmnSurvived_FldPsn[]; extern const u8 gText_Coins[]; extern const u8 gText_Silver[]; extern const u8 gText_Gold[]; diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 96e9173c9..b784a2ab8 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -565,11 +565,13 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior) if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FORCED_MOVE) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior)) { + #if OW_POISON_DAMAGE < GEN_5 if (UpdatePoisonStepCounter() == TRUE) { ScriptContext_SetupScript(EventScript_FieldPoison); return TRUE; } + #endif if (ShouldEggHatch()) { IncrementGameStat(GAME_STAT_HATCHED_EGGS); diff --git a/src/field_poison.c b/src/field_poison.c index f254a6d14..89463a1e3 100644 --- a/src/field_poison.c +++ b/src/field_poison.c @@ -44,7 +44,9 @@ static void FaintFromFieldPoison(u8 partyIdx) struct Pokemon *pokemon = &gPlayerParty[partyIdx]; u32 status = STATUS1_NONE; +#if OW_POISON_DAMAGE < GEN_4 AdjustFriendship(pokemon, FRIENDSHIP_EVENT_FAINT_FIELD_PSN); +#endif SetMonData(pokemon, MON_DATA_STATUS, &status); GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1); StringGet_Nickname(gStringVar1); @@ -53,7 +55,11 @@ static void FaintFromFieldPoison(u8 partyIdx) static bool32 MonFaintedFromPoison(u8 partyIdx) { struct Pokemon *pokemon = &gPlayerParty[partyIdx]; +#if OW_POISON_DAMAGE < GEN_4 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 FALSE; @@ -73,7 +79,11 @@ static void Task_TryFieldPoisonWhiteOut(u8 taskId) if (MonFaintedFromPoison(tPartyIdx)) { FaintFromFieldPoison(tPartyIdx); + #if OW_POISON_DAMAGE < GEN_4 ShowFieldMessage(gText_PkmnFainted_FldPsn); + #else + ShowFieldMessage(gText_PkmnSurvived_FldPsn); + #endif tState++; return; } @@ -127,7 +137,11 @@ s32 DoPoisonFieldEffect(void) { // Apply poison damage hp = GetMonData(pokemon, MON_DATA_HP); + #if OW_POISON_DAMAGE < GEN_4 if (hp == 0 || --hp == 0) + #else + if (hp == 1 || --hp == 1) + #endif numFainted++; SetMonData(pokemon, MON_DATA_HP, &hp); diff --git a/src/strings.c b/src/strings.c index 8815212e0..d297c4535 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1192,6 +1192,7 @@ const u8 gText_IcePunch48BP[] = _("ICE PUNCH{CLEAR_TO 0x4E}48BP"); const u8 gText_ThunderPunch48BP[] = _("THUNDERPUNCH{CLEAR_TO 0x4E}48BP"); const u8 gText_FirePunch48BP[] = _("FIRE PUNCH{CLEAR_TO 0x4E}48BP"); const u8 gText_PkmnFainted_FldPsn[] = _("{STR_VAR_1} fainted…\p\n"); +const u8 gText_PkmnSurvived_FldPsn[] = _("{STR_VAR_1} survived the poisoning.\nThe poison faded away!\p"); const u8 gText_Marco[] = _("MARCO"); const u8 gText_TrainerCardName[] = _("NAME: "); const u8 gText_TrainerCardIDNo[] = _("IDNo.");