OW Poison configs

This commit is contained in:
Bassoonian 2023-04-06 00:26:52 +02:00
parent 5fe79d83c1
commit dfee8a4759
5 changed files with 21 additions and 0 deletions

View File

@ -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.

View File

@ -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[];

View File

@ -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);

View File

@ -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);

View File

@ -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.");