Dynamax messages (#3581)

* Dynamax messages

* Convert various to callnative

* Remove battler argument from callnatives

* Rename i variable

* Fix missing else
This commit is contained in:
Bassoonian 2023-11-21 19:18:18 +01:00 committed by GitHub
parent b9edbb429b
commit a7beed5b25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 75 additions and 40 deletions

View file

@ -1529,6 +1529,18 @@
.4byte \ptr
.endm
.macro trytrainerslidezmovemsg
callnative BS_TryTrainerSlideZMoveMsg
.endm
.macro trytrainerslidemegaevolutionmsg
callnative BS_TryTrainerSlideMegaEvolutionMsg
.endm
.macro trytrainerslidedynamaxmsg
callnative BS_TryTrainerSlideDynamaxMsg
.endm
@ various command changed to more readable macros
.macro cancelmultiturnmoves battler:req
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
@ -2188,14 +2200,6 @@
various \battler, VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES
.endm
.macro trytrainerslidezmovemsg battler:req
various \battler, VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE
.endm
.macro trytrainerslidemegaevolutionmsg battler:req
various \battler, VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER, \stat | \stages << 3 | \down << 7

View file

@ -7826,7 +7826,7 @@ BattleScript_FocusPunchSetUp::
BattleScript_MegaEvolution::
flushtextbox
trytrainerslidemegaevolutionmsg BS_ATTACKER
trytrainerslidemegaevolutionmsg
printstring STRINGID_MEGAEVOREACTING
BattleScript_MegaEvolutionAfterString:
waitmessage B_WAIT_TIME_LONG
@ -7842,7 +7842,7 @@ BattleScript_MegaEvolutionAfterString:
BattleScript_WishMegaEvolution::
flushtextbox
trytrainerslidemegaevolutionmsg BS_ATTACKER
trytrainerslidemegaevolutionmsg
printstring STRINGID_FERVENTWISHREACHED
goto BattleScript_MegaEvolutionAfterString
@ -7870,7 +7870,7 @@ BattleScript_PrimalReversionRet::
BattleScript_UltraBurst::
flushtextbox
trytrainerslidezmovemsg BS_ATTACKER
trytrainerslidezmovemsg
printstring STRINGID_ULTRABURSTREACTING
waitmessage B_WAIT_TIME_LONG
setbyte gIsCriticalHit, 0
@ -10089,7 +10089,7 @@ BattleScript_JabocaRowapBerryActivate_Dmg:
@ z moves / effects
BattleScript_ZMoveActivateDamaging::
flushtextbox
trytrainerslidezmovemsg BS_ATTACKER
trytrainerslidezmovemsg
printstring STRINGID_ZPOWERSURROUNDS
playanimation BS_ATTACKER, B_ANIM_ZMOVE_ACTIVATE, NULL
printstring STRINGID_ZMOVEUNLEASHED
@ -10098,7 +10098,7 @@ BattleScript_ZMoveActivateDamaging::
BattleScript_ZMoveActivateStatus::
flushtextbox
trytrainerslidezmovemsg BS_ATTACKER
trytrainerslidezmovemsg
savetarget
printstring STRINGID_ZPOWERSURROUNDS
playanimation BS_ATTACKER, B_ANIM_ZMOVE_ACTIVATE, NULL
@ -10689,6 +10689,7 @@ BattleScript_EffectSteelsurge::
BattleScript_DynamaxBegins::
flushtextbox
trytrainerslidedynamaxmsg
returnatktoball
pause B_WAIT_TIME_SHORT
returntoball BS_SCRIPTING

View file

@ -726,6 +726,7 @@ struct BattleStruct
bool8 trainerSlideMegaEvolutionMsgDone;
bool8 trainerSlideZMoveMsgDone;
bool8 trainerSlideBeforeFirstTurnMsgDone;
bool8 trainerSlideDynamaxMsgDone;
u32 aiDelayTimer; // Counts number of frames AI takes to choose an action.
u32 aiDelayFrames; // Number of frames it took to choose an action.
bool8 transformZeroToHero[PARTY_SIZE][NUM_BATTLE_SIDES];

View file

@ -238,6 +238,7 @@ enum
TRAINER_SLIDE_MEGA_EVOLUTION,
TRAINER_SLIDE_Z_MOVE,
TRAINER_SLIDE_BEFORE_FIRST_TURN,
TRAINER_SLIDE_DYNAMAX,
};
void BufferStringBattle(u16 stringID, u32 battler);

View file

@ -245,8 +245,6 @@
#define VARIOUS_STORE_HEALING_WISH 152
#define VARIOUS_HIT_SWITCH_TARGET_FAILED 153
#define VARIOUS_TRY_REVIVAL_BLESSING 154
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE 155
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION 156
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View file

@ -4033,6 +4033,7 @@ struct TrainerSlide
const u8 *msgMegaEvolution;
const u8 *msgZMove;
const u8 *msgBeforeFirstTurn;
const u8 *msgDynamax;
};
static const struct TrainerSlide sTrainerSlides[] =
@ -4053,6 +4054,7 @@ static const struct TrainerSlide sTrainerSlides[] =
.msgMegaEvolution = sText_PowderExplodes,
.msgZMove = sText_Electromagnetism,
.msgBeforeFirstTurn = sText_GravityIntensified,
.msgDynamax = sText_TargetWokeUp,
},
*/
};
@ -4238,6 +4240,14 @@ u32 ShouldDoTrainerSlide(u32 battler, u32 which)
return TRUE;
}
break;
case TRAINER_SLIDE_DYNAMAX:
if (sTrainerSlides[i].msgDynamax != NULL && !gBattleStruct->trainerSlideDynamaxMsgDone)
{
gBattleStruct->trainerSlideDynamaxMsgDone = TRUE;
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgDynamax;
return TRUE;
}
break;
}
break;
}

View file

@ -10641,30 +10641,6 @@ static void Cmd_various(void)
}
return;
}
case VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE:
{
VARIOUS_ARGS();
if ((i = ShouldDoTrainerSlide(battler, TRAINER_SLIDE_Z_MOVE)))
{
gBattleScripting.battler = battler;
BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = (i == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet);
return;
}
break;
}
case VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION:
{
VARIOUS_ARGS();
if ((i = ShouldDoTrainerSlide(battler, TRAINER_SLIDE_MEGA_EVOLUTION)))
{
gBattleScripting.battler = battler;
BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = (i == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet);
return;
}
break;
}
} // End of switch (cmd->id)
gBattlescriptCurrInstr = cmd->nextInstr;
@ -16290,7 +16266,6 @@ void BS_TryRelicSong(void)
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_SetPledge(void)
{
NATIVE_ARGS(const u8 *jumpInstr);
@ -16401,3 +16376,48 @@ void BS_SetPledgeStatus(void)
else
gBattlescriptCurrInstr = BattleScript_MoveEnd;
}
void BS_TryTrainerSlideZMoveMsg(void)
{
NATIVE_ARGS();
s32 shouldSlide;
if ((shouldSlide = ShouldDoTrainerSlide(gBattlerAttacker, TRAINER_SLIDE_Z_MOVE)))
{
gBattleScripting.battler = gBattlerAttacker;
BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = (shouldSlide == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet);
}
else
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_TryTrainerSlideMegaEvolutionMsg(void)
{
NATIVE_ARGS();
s32 shouldSlide;
if ((shouldSlide = ShouldDoTrainerSlide(gBattlerAttacker, TRAINER_SLIDE_MEGA_EVOLUTION)))
{
gBattleScripting.battler = gBattlerAttacker;
BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = (shouldSlide == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet);
}
else
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_TryTrainerSlideDynamaxMsg(void)
{
NATIVE_ARGS();
s32 shouldSlide;
if ((shouldSlide = ShouldDoTrainerSlide(gBattlerAttacker, TRAINER_SLIDE_DYNAMAX)))
{
gBattleScripting.battler = gBattlerAttacker;
BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = (shouldSlide == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet);
}
else
gBattlescriptCurrInstr = cmd->nextInstr;
}