Added yet another trainer slide condition

Now a trainer NPC can also say something before the first turn of a battle starts for good.
This commit is contained in:
LOuroboros 2023-03-02 06:14:42 -03:00
parent 8a036e6007
commit ff15856820
4 changed files with 15 additions and 0 deletions

View file

@ -669,6 +669,7 @@ struct BattleStruct
u8 trainerSlidePlayerMonUnaffectedMsgState:2;
bool8 trainerSlideMegaEvolutionMsgDone:1;
bool8 trainerSlideZMoveMsgDone:1;
bool8 trainerSlideBeforeFirstTurnMsgDone:1;
};
#define F_DYNAMIC_TYPE_1 (1 << 6)

View file

@ -236,6 +236,7 @@ enum
TRAINER_SLIDE_PLAYER_MON_UNAFFECTED,
TRAINER_SLIDE_MEGA_EVOLUTION,
TRAINER_SLIDE_Z_MOVE,
TRAINER_SLIDE_BEFORE_FIRST_TURN,
};
void BufferStringBattle(u16 stringID);

View file

@ -3776,6 +3776,9 @@ static void TryDoEventsBeforeFirstTurn(void)
StopCryAndClearCrySongs();
BattleScriptExecute(BattleScript_ArenaTurnBeginning);
}
if ((i = ShouldDoTrainerSlide(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), TRAINER_SLIDE_BEFORE_FIRST_TURN)))
BattleScriptExecute(i == 1 ? BattleScript_TrainerASlideMsgEnd2 : BattleScript_TrainerBSlideMsgEnd2);
}
static void HandleEndTurn_ContinueBattle(void)

View file

@ -3881,6 +3881,7 @@ struct TrainerSlide
const u8 *msgPlayerMonUnaffected;
const u8 *msgMegaEvolution;
const u8 *msgZMove;
const u8 *msgBeforeFirstTurn;
};
static const struct TrainerSlide sTrainerSlides[] =
@ -3899,6 +3900,7 @@ static const struct TrainerSlide sTrainerSlides[] =
.msgPlayerMonUnaffected = sText_ButNoEffect,
.msgMegaEvolution = sText_PowderExplodes,
.msgZMove = sText_Electromagnetism,
.msgBeforeFirstTurn = sText_GravityIntensified,
},
*/
};
@ -4044,6 +4046,14 @@ u32 ShouldDoTrainerSlide(u32 battlerId, u32 which)
return TRUE;
}
break;
case TRAINER_SLIDE_BEFORE_FIRST_TURN:
if (sTrainerSlides[i].msgBeforeFirstTurn != NULL && !gBattleStruct->trainerSlideBeforeFirstTurnMsgDone)
{
gBattleStruct->trainerSlideBeforeFirstTurnMsgDone = TRUE;
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgBeforeFirstTurn;
return TRUE;
}
break;
}
break;
}