Implemented Perish Body

Inspired by Raguzero's implementation.
This commit is contained in:
LOuroboros 2020-12-11 19:00:30 -03:00
parent 7d8b8083e8
commit 2b0702ec04
5 changed files with 34 additions and 1 deletions

View File

@ -5733,6 +5733,13 @@ BattleScript_PerishSongTakesLife::
tryfaintmon BS_ATTACKER, FALSE, NULL
end2
BattleScript_PerishBodyActivates::
call BattleScript_AbilityPopUp
printstring STRINGID_PKMNSWILLPERISHIN3TURNS
waitmessage 0x40
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
return
BattleScript_PerishSongCountGoesDown::
printstring STRINGID_PKMNPERISHCOUNTFELL
waitmessage 0x40

View File

@ -354,5 +354,6 @@ extern const u8 BattleScript_BattlerAbilityStatRaiseOnSwitchIn[];
extern const u8 BattleScript_CottonDownActivates[];
extern const u8 BattleScript_BallFetch[];
extern const u8 BattleScript_SandSpitActivates[];
extern const u8 BattleScript_PerishBodyActivates[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -561,8 +561,9 @@
#define STRINGID_FETCHEDPOKEBALL 557
#define STRINGID_BATTLERABILITYRAISEDSTAT 558
#define STRINGID_ASANDSTORMKICKEDUP 559
#define STRINGID_PKMNSWILLPERISHIN3TURNS 560
#define BATTLESTRINGS_COUNT 560
#define BATTLESTRINGS_COUNT 561
//// multichoice message IDs
// switch in ability message

View File

@ -688,9 +688,11 @@ static const u8 sText_ScreenCleanerActivates[] = _("All screens on the field wer
static const u8 sText_FetchedPokeBall[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} found\na {B_LAST_ITEM}!");
static const u8 sText_BattlerAbilityRaisedStat[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nraised its {B_BUFF1}!");
static const u8 sText_ASandstormKickedUp[] = _("A sandstorm kicked up!");
static const u8 sText_PkmnsWillPerishIn3Turns[] = _("Both Pokémon will perish\nin three turns!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
[STRINGID_PKMNSWILLPERISHIN3TURNS - 12] = sText_PkmnsWillPerishIn3Turns,
[STRINGID_ASANDSTORMKICKEDUP - 12] = sText_ASandstormKickedUp,
[STRINGID_BATTLERABILITYRAISEDSTAT - 12] = sText_BattlerAbilityRaisedStat,
[STRINGID_FETCHEDPOKEBALL - 12] = sText_FetchedPokeBall,

View File

@ -4663,6 +4663,28 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
effect++;
}
break;
case ABILITY_PERISH_BODY:
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
&& TARGET_TURN_DAMAGED
&& IsBattlerAlive(battler)
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
&& !(gStatuses3[gBattlerAttacker] & STATUS3_PERISH_SONG))
{
if (!(gStatuses3[battler] & STATUS3_PERISH_SONG))
{
gStatuses3[battler] |= STATUS3_PERISH_SONG;
gDisableStructs[battler].perishSongTimer = 3;
gDisableStructs[battler].perishSongTimerStartValue = 3;
}
gStatuses3[gBattlerAttacker] |= STATUS3_PERISH_SONG;
gDisableStructs[gBattlerAttacker].perishSongTimer = 3;
gDisableStructs[gBattlerAttacker].perishSongTimerStartValue = 3;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_PerishBodyActivates;
effect++;
}
break;
}
break;
case ABILITYEFFECT_MOVE_END_ATTACKER: // Same as above, but for attacker