Fainting by poison in the overworld reverts forms

This commit is contained in:
Eduardo Quezada 2022-11-01 12:24:04 -03:00
parent 0a79390ec0
commit a57f6d184b
5 changed files with 26 additions and 23 deletions

View File

@ -320,11 +320,11 @@
#define FORM_CHANGE_ITEM_HOLD 1
#define FORM_CHANGE_ITEM_USE 2
#define FORM_CHANGE_MOVE 3 // Todo
#define FORM_CHANGE_WITHDRAW 4 //
#define FORM_CHANGE_BATTLE_BEGIN 5
#define FORM_CHANGE_BATTLE_END 6
#define FORM_CHANGE_BATTLE_SWITCH 7
#define FORM_CHANGE_BATTLE_FAINT 8
#define FORM_CHANGE_WITHDRAW 4 // Daycare done, Todo PC
#define FORM_CHANGE_FAINT 5
#define FORM_CHANGE_BATTLE_BEGIN 6
#define FORM_CHANGE_BATTLE_END 7
#define FORM_CHANGE_BATTLE_SWITCH 8
#define FORM_CHANGE_PRIMAL_REVERSION 9
#define MON_PIC_WIDTH 64

View File

@ -3247,7 +3247,7 @@ void FaintClearSetData(void)
gBattleMons[gActiveBattler].type3 = TYPE_MYSTERY;
Ai_UpdateFaintData(gActiveBattler);
TryFormChange(gBattlerPartyIndexes[gActiveBattler], GET_BATTLER_SIDE(gActiveBattler), FORM_CHANGE_BATTLE_FAINT);
TryFormChange(gBattlerPartyIndexes[gActiveBattler], GET_BATTLER_SIDE(gActiveBattler), FORM_CHANGE_FAINT);
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
UndoMegaEvolution(gBattlerPartyIndexes[gActiveBattler]);

View File

@ -116,20 +116,20 @@ static const struct FormChange sArceusFormChangeTable[] = {
static const struct FormChange sDarmanitanFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_DARMANITAN},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_DARMANITAN},
{FORM_CHANGE_FAINT, SPECIES_DARMANITAN},
{FORM_CHANGE_BATTLE_END, SPECIES_DARMANITAN},
{FORM_CHANGE_END},
};
static const struct FormChange sDarmanitanGalarianFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_DARMANITAN_GALARIAN},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_DARMANITAN_GALARIAN},
{FORM_CHANGE_FAINT, SPECIES_DARMANITAN_GALARIAN},
{FORM_CHANGE_BATTLE_END, SPECIES_DARMANITAN_GALARIAN},
{FORM_CHANGE_END},
};
static const struct FormChange sMeloettaFormChangeTable[] = {
{FORM_CHANGE_BATTLE_FAINT, SPECIES_MELOETTA},
{FORM_CHANGE_FAINT, SPECIES_MELOETTA},
{FORM_CHANGE_BATTLE_END, SPECIES_MELOETTA},
{FORM_CHANGE_END},
};
@ -170,14 +170,14 @@ static const struct FormChange sGenesectFormChangeTable[] = {
#if P_GEN_6_POKEMON == TRUE
static const struct FormChange sGreninjaBattleBondFormChangeTable[] = {
{FORM_CHANGE_BATTLE_FAINT, SPECIES_GRENINJA_BATTLE_BOND},
{FORM_CHANGE_FAINT, SPECIES_GRENINJA_BATTLE_BOND},
{FORM_CHANGE_BATTLE_END, SPECIES_GRENINJA_BATTLE_BOND},
{FORM_CHANGE_END},
};
static const struct FormChange sAegislashFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_AEGISLASH},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_AEGISLASH},
{FORM_CHANGE_FAINT, SPECIES_AEGISLASH},
{FORM_CHANGE_BATTLE_END, SPECIES_AEGISLASH},
{FORM_CHANGE_END},
};
@ -205,7 +205,7 @@ static const struct FormChange sOricorioFormChangeTable[] = {
};
static const struct FormChange sWishiwashiFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_WISHIWASHI},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_WISHIWASHI},
{FORM_CHANGE_FAINT, SPECIES_WISHIWASHI},
{FORM_CHANGE_BATTLE_END, SPECIES_WISHIWASHI},
{FORM_CHANGE_END},
};
@ -233,50 +233,50 @@ static const struct FormChange sSilvallyFormChangeTable[] = {
};
static const struct FormChange sMimikyuFormChangeTable[] = {
{FORM_CHANGE_BATTLE_FAINT, SPECIES_MIMIKYU},
{FORM_CHANGE_FAINT, SPECIES_MIMIKYU},
{FORM_CHANGE_BATTLE_END, SPECIES_MIMIKYU},
{FORM_CHANGE_END},
};
static const struct FormChange sMiniorRedFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_MINIOR_CORE_RED},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_MINIOR_CORE_RED},
{FORM_CHANGE_FAINT, SPECIES_MINIOR_CORE_RED},
{FORM_CHANGE_BATTLE_END, SPECIES_MINIOR_CORE_RED},
{FORM_CHANGE_END},
};
static const struct FormChange sMiniorBlueFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_MINIOR_CORE_BLUE},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_MINIOR_CORE_BLUE},
{FORM_CHANGE_FAINT, SPECIES_MINIOR_CORE_BLUE},
{FORM_CHANGE_BATTLE_END, SPECIES_MINIOR_CORE_BLUE},
{FORM_CHANGE_END},
};
static const struct FormChange sMiniorGreenFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_MINIOR_CORE_GREEN},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_MINIOR_CORE_GREEN},
{FORM_CHANGE_FAINT, SPECIES_MINIOR_CORE_GREEN},
{FORM_CHANGE_BATTLE_END, SPECIES_MINIOR_CORE_GREEN},
{FORM_CHANGE_END},
};
static const struct FormChange sMiniorIndigoFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_MINIOR_CORE_INDIGO},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_MINIOR_CORE_INDIGO},
{FORM_CHANGE_FAINT, SPECIES_MINIOR_CORE_INDIGO},
{FORM_CHANGE_BATTLE_END, SPECIES_MINIOR_CORE_INDIGO},
{FORM_CHANGE_END},
};
static const struct FormChange sMiniorOrangeFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_MINIOR_CORE_ORANGE},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_MINIOR_CORE_ORANGE},
{FORM_CHANGE_FAINT, SPECIES_MINIOR_CORE_ORANGE},
{FORM_CHANGE_BATTLE_END, SPECIES_MINIOR_CORE_ORANGE},
{FORM_CHANGE_END},
};
static const struct FormChange sMiniorVioletFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_MINIOR_CORE_VIOLET},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_MINIOR_CORE_VIOLET},
{FORM_CHANGE_FAINT, SPECIES_MINIOR_CORE_VIOLET},
{FORM_CHANGE_BATTLE_END, SPECIES_MINIOR_CORE_VIOLET},
{FORM_CHANGE_END},
};
static const struct FormChange sMiniorYellowFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_MINIOR_CORE_YELLOW},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_MINIOR_CORE_YELLOW},
{FORM_CHANGE_FAINT, SPECIES_MINIOR_CORE_YELLOW},
{FORM_CHANGE_BATTLE_END, SPECIES_MINIOR_CORE_YELLOW},
{FORM_CHANGE_END},
};
@ -286,14 +286,14 @@ static const struct FormChange sMiniorYellowFormChangeTable[] = {
#if P_GEN_8_POKEMON == TRUE
static const struct FormChange sCramorantFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_CRAMORANT},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_CRAMORANT},
{FORM_CHANGE_FAINT, SPECIES_CRAMORANT},
{FORM_CHANGE_BATTLE_END, SPECIES_CRAMORANT},
{FORM_CHANGE_END},
};
static const struct FormChange sMorpekoFormChangeTable[] = {
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_MORPEKO},
{FORM_CHANGE_BATTLE_FAINT, SPECIES_MORPEKO},
{FORM_CHANGE_FAINT, SPECIES_MORPEKO},
{FORM_CHANGE_BATTLE_END, SPECIES_MORPEKO},
{FORM_CHANGE_END},
};

View File

@ -128,7 +128,10 @@ s32 DoPoisonFieldEffect(void)
// Apply poison damage
hp = GetMonData(pokemon, MON_DATA_HP);
if (hp == 0 || --hp == 0)
{
TryFormChange(i, B_SIDE_PLAYER, FORM_CHANGE_FAINT);
numFainted++;
}
SetMonData(pokemon, MON_DATA_HP, &hp);
numPoisoned++;

View File

@ -8404,7 +8404,7 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32
break;
case FORM_CHANGE_WITHDRAW:
case FORM_CHANGE_BATTLE_SWITCH:
case FORM_CHANGE_BATTLE_FAINT:
case FORM_CHANGE_FAINT:
targetSpecies = formChanges[i].targetSpecies;
break;
}