Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamax messages #3581

Merged
merged 7 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions asm/macros/battle_script.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,21 @@
.4byte \ptr
.endm

.macro trytrainerslidezmovemsg, battler:req
callnative BS_TryTrainerSlideZMoveMsg
.byte \battler
Bassoonian marked this conversation as resolved.
Show resolved Hide resolved
.endm

.macro trytrainerslidemegaevolutionmsg, battler:req
callnative BS_TryTrainerSlideMegaEvolutionMsg
.byte \battler
.endm

.macro trytrainerslidedynamaxmsg, battler:req
callnative BS_TryTrainerSlideDynamaxMsg
.byte \battler
.endm

@ various command changed to more readable macros
.macro cancelmultiturnmoves battler:req
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
Expand Down Expand Up @@ -2177,14 +2192,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
Expand Down
1 change: 1 addition & 0 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -10605,6 +10605,7 @@ BattleScript_EffectSteelsurge::

BattleScript_DynamaxBegins::
flushtextbox
trytrainerslidedynamaxmsg BS_ATTACKER
returnatktoball
pause B_WAIT_TIME_SHORT
returntoball BS_SCRIPTING
Expand Down
1 change: 1 addition & 0 deletions include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,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];
Expand Down
1 change: 1 addition & 0 deletions include/battle_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions include/constants/battle_script_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/battle_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -4015,6 +4015,7 @@ struct TrainerSlide
const u8 *msgMegaEvolution;
const u8 *msgZMove;
const u8 *msgBeforeFirstTurn;
const u8 *msgDynamax;
};

static const struct TrainerSlide sTrainerSlides[] =
Expand All @@ -4035,6 +4036,7 @@ static const struct TrainerSlide sTrainerSlides[] =
.msgMegaEvolution = sText_PowderExplodes,
.msgZMove = sText_Electromagnetism,
.msgBeforeFirstTurn = sText_GravityIntensified,
.msgDynamax = sText_TargetWokeUp,
},
*/
};
Expand Down Expand Up @@ -4220,6 +4222,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;
}
Expand Down
69 changes: 45 additions & 24 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -10637,30 +10637,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;
Expand Down Expand Up @@ -16285,3 +16261,48 @@ void BS_TryRelicSong(void)
else
gBattlescriptCurrInstr = cmd->nextInstr;
}

void BS_TryTrainerSlideZMoveMsg(void)
{
NATIVE_ARGS(u8 battler);
s32 i;

u8 battler = GetBattlerForBattleScript(cmd->battler);

if ((i = ShouldDoTrainerSlide(battler, TRAINER_SLIDE_Z_MOVE)))
{
gBattleScripting.battler = battler;
BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = (i == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet);
}
}

void BS_TryTrainerSlideMegaEvolutionMsg(void)
{
NATIVE_ARGS(u8 battler);
s32 i;

u8 battler = GetBattlerForBattleScript(cmd->battler);

if ((i = ShouldDoTrainerSlide(battler, TRAINER_SLIDE_MEGA_EVOLUTION)))
{
gBattleScripting.battler = battler;
BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = (i == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet);
}
}

void BS_TryTrainerSlideDynamaxMsg(void)
{
NATIVE_ARGS(u8 battler);
s32 i;

u8 battler = GetBattlerForBattleScript(cmd->battler);

if ((i = ShouldDoTrainerSlide(battler, TRAINER_SLIDE_DYNAMAX)))
{
gBattleScripting.battler = battler;
BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = (i == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet);
}
}
Loading