Power Construct

This commit is contained in:
DizzyEggg 2020-07-16 15:40:56 +02:00
parent 759bde46bb
commit 42f48d1a61
3 changed files with 21 additions and 0 deletions

View File

@ -538,6 +538,7 @@ struct BattleStruct
bool8 friskedAbility; // If identifies two mons, show the ability pop-up only once.
u8 sameMoveTurns[MAX_BATTLERS_COUNT]; // For Metronome, number of times the same moves has been SUCCESFULLY used.
u16 moveEffect2; // For Knock Off
u16 changedSpecies[PARTY_SIZE]; // For Zygarde or future forms when multiple mons can change into the same pokemon.
};
#define GET_MOVE_TYPE(move, typeArg) \

View File

@ -19,6 +19,9 @@
#define SPECIES_MINIOR 10003
#define SPECIES_WISHIWASHI 0
#define SPECIES_WISHIWASHI_SCHOOL 10004
#define SPECIES_ZYGARDE 0 // 50%
#define SPECIES_ZYGARDE_10 10005 // 10 %
#define SPECIES_ZYGARDE_COMPLETE 10006 // 100 %
// Items with peculiar battle effects. Remove them if they're properly placed in constant/items.h
#define ITEM_GRISEOUS_ORB 0

View File

@ -3357,6 +3357,16 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
if ((effect = ShouldChangeFormHpBased(battler)))
BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeEnd3);
break;
case ABILITY_POWER_CONSTRUCT:
if ((gBattleMons[battler].species == SPECIES_ZYGARDE || gBattleMons[battler].species == SPECIES_ZYGARDE_10)
&& gBattleMons[battler].hp <= gBattleMons[battler].maxHP / 2)
{
gBattleStruct->changedSpecies[gBattlerPartyIndexes[battler]] = gBattleMons[battler].species;
gBattleMons[battler].species = SPECIES_ZYGARDE_COMPLETE;
BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeEnd3);
effect++;
}
break;
}
}
break;
@ -6851,6 +6861,13 @@ void UndoMegaEvolution(u32 monId)
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleStruct->mega.playerEvolvedSpecies);
CalculateMonStats(&gPlayerParty[monId]);
}
// While not exactly a mega evolution, Zygarde follows the same rules.
else if (GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, NULL) == SPECIES_ZYGARDE_COMPLETE)
{
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleStruct->changedSpecies[monId]);
gBattleStruct->changedSpecies[monId] = 0;
CalculateMonStats(&gPlayerParty[monId]);
}
}
void UndoFormChange(u32 monId, u32 side)