Implement Relic Song's form change

Meloetta transforms into its pirouette form after using Relic Song, unless it has Sheer Force or the move has no effect. It also has a chance to put both targets to sleep.
This commit is contained in:
BuffelSaft 2021-11-03 17:23:33 +13:00
parent 11e93aee69
commit 74c85b5818
9 changed files with 58 additions and 10 deletions

View file

@ -367,7 +367,7 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectGeomancy @ EFFECT_GEOMANCY
.4byte BattleScript_EffectFairyLock @ EFFECT_FAIRY_LOCK
.4byte BattleScript_EffectAllySwitch @ EFFECT_ALLY_SWITCH
.4byte BattleScript_EffectSleepHit @ EFFECT_SLEEP_HIT
.4byte BattleScript_EffectRelicSong @ EFFECT_RELIC_SONG
.4byte BattleScript_EffectAttackerDefenseDownHit @ EFFECT_ATTACKER_DEFENSE_DOWN_HIT
.4byte BattleScript_EffectHit @ EFFECT_BODY_PRESS
.4byte BattleScript_EffectEerieSpell @ EFFECT_EERIE_SPELL
@ -734,9 +734,30 @@ BattleScript_EffectAttackerDefenseDownHit:
setmoveeffect MOVE_EFFECT_DEF_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
goto BattleScript_EffectHit
BattleScript_EffectSleepHit:
setmoveeffect MOVE_EFFECT_SLEEP
goto BattleScript_EffectHit
BattleScript_EffectRelicSong:
setmoveeffect MOVE_EFFECT_RELIC_SONG | MOVE_EFFECT_CERTAIN
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
seteffectwithchance
argumentstatuseffect
tryfaintmon BS_TARGET, FALSE, NULL
goto BattleScript_MoveEnd
BattleScript_EffectAllySwitch:
attackcanceler
@ -6939,6 +6960,17 @@ BattleScript_AttackerFormChangeEnd3::
call BattleScript_AttackerFormChange
end3
BattleScript_AttackerFormChangeMoveEffect::
waitmessage 1
handleformchange BS_ATTACKER, 0
handleformchange BS_ATTACKER, 1
playanimation BS_ATTACKER, B_ANIM_FORM_CHANGE, NULL
waitanimation
printstring STRINGID_PKMNTRANSFORMED
waitmessage B_WAIT_TIME_LONG
handleformchange BS_ATTACKER, 2
end3
BattleScript_BallFetch::
call BattleScript_AbilityPopUp
printstring STRINGID_FETCHEDPOKEBALL

View file

@ -404,5 +404,6 @@ extern const u8 BattleScript_PrimalReversion[];
extern const u8 BattleScript_HyperspaceFuryRemoveProtect[];
extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTactics[];
extern const u8 BattleScript_WanderingSpiritActivates[];
extern const u8 BattleScript_AttackerFormChangeMoveEffect[];
#endif // GUARD_BATTLE_SCRIPTS_H

View file

@ -357,7 +357,8 @@
#define MOVE_EFFECT_INCINERATE 0x44
#define MOVE_EFFECT_BUG_BITE 0x45
#define MOVE_EFFECT_RECOIL_HP_25 0x46
#define NUM_MOVE_EFFECTS 0x47
#define MOVE_EFFECT_RELIC_SONG 0x47
#define NUM_MOVE_EFFECTS 0x48
#define MOVE_EFFECT_AFFECTS_USER 0x4000
#define MOVE_EFFECT_CERTAIN 0x8000

View file

@ -47,6 +47,8 @@
#define SPECIES_GRENINJA_ASH 10017
#define SPECIES_HOOPA 0
#define SPECIES_HOOPA_UNBOUND 10018
#define SPECIES_MELOETTA 0
#define SPECIES_MELOETTA_PIROUETTE 10019
#endif
// Items with peculiar battle effects.

View file

@ -350,7 +350,7 @@
#define EFFECT_GEOMANCY 344
#define EFFECT_FAIRY_LOCK 345
#define EFFECT_ALLY_SWITCH 346
#define EFFECT_SLEEP_HIT 347
#define EFFECT_RELIC_SONG 347
#define EFFECT_ATTACKER_DEFENSE_DOWN_HIT 348
#define EFFECT_BODY_PRESS 349
#define EFFECT_EERIE_SPELL 350

View file

@ -4305,7 +4305,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
if (!IsBattlerGrounded(battlerDef))
score += 3;
break;
case EFFECT_SLEEP_HIT: // Relic Song
case EFFECT_RELIC_SONG:
#if (defined SPECIES_MELOETTA && defined SPECIES_MELOETTA_PIROUETTE)
if (AI_DATA->atkSpecies == SPECIES_MELOETTA && gBattleMons[battlerDef].defense < gBattleMons[battlerDef].spDefense)
score += 3; // Change to pirouette if can do more damage

View file

@ -3393,6 +3393,13 @@ void SetMoveEffect(bool32 primary, u32 certain)
gBattlescriptCurrInstr = BattleScript_MoveEffectBugBite;
}
break;
case MOVE_EFFECT_RELIC_SONG:
if (gBattleMons[gBattlerAttacker].species == SPECIES_MELOETTA)
{
gBattleMons[gBattlerAttacker].species = SPECIES_MELOETTA_PIROUETTE;
BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeMoveEffect);
}
break;
}
}
}
@ -8282,6 +8289,9 @@ static void Cmd_various(void)
case VARIOUS_ARGUMENT_STATUS_EFFECT:
switch (gBattleMoves[gCurrentMove].argument)
{
case STATUS1_SLEEP:
gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP;
break;
case STATUS1_BURN:
gBattleScripting.moveEffect = MOVE_EFFECT_BURN;
break;

View file

@ -8957,6 +8957,7 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
{
{SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU},
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND},
{SPECIES_MELOETTA_PIROUETTE, SPECIES_MELOETTA},
{SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH},
{SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN},
{SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED},
@ -8971,8 +8972,8 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
{SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT},
};
if (isSwitchingOut) // Don't revert Mimikyu Busted or Ash-Greninja when switching out
i = 2;
if (isSwitchingOut) // Don't revert Mimikyu, Greninja, Meloetta when switching out
i = 3;
else
i = 0;

View file

@ -8614,7 +8614,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_RELIC_SONG] =
{
.effect = EFFECT_SLEEP_HIT,
.effect = EFFECT_RELIC_SONG,
.power = 75,
.type = TYPE_NORMAL,
.accuracy = 100,
@ -8624,6 +8624,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST,
.split = SPLIT_SPECIAL,
.argument = STATUS1_SLEEP,
},
[MOVE_SECRET_SWORD] =