Added new trainer slide-in msg conditions

Now they can say something:
-When their last Pokémon's HP is between 25% and 50%.
-When a critical hit is dealt to their first Pokémon for the first time.
-When a super effective hit is dealt to their first Pokémon for the first time.
-When a STAB move is used against (but doesn't faint) the opponent's Pokémon.
-When the Player's Pokémon's move doesn't affect the opponent's Pokémon.
-When they're about to trigger a Mega Evolution.
-When they're about to trigger a Z-Move.

Misc. changes:
-Split GetEnemyMonCount for readability's sake.
-Optimized the size allocated to trainerSlideLowHpMsgDone.
This commit is contained in:
LOuroboros 2023-02-17 12:53:24 -03:00
parent 6e134bb7dc
commit 3a91a5c930
9 changed files with 356 additions and 178 deletions

View File

@ -2049,6 +2049,14 @@
.4byte \jumpInstr
.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

@ -7763,6 +7763,8 @@ BattleScript_FocusPunchSetUp::
end2
BattleScript_MegaEvolution::
printstring STRINGID_EMPTYSTRING3
trytrainerslidemegaevolutionmsg BS_ATTACKER
printstring STRINGID_MEGAEVOREACTING
waitmessage B_WAIT_TIME_LONG
setbyte gIsCriticalHit, 0
@ -7777,6 +7779,8 @@ BattleScript_MegaEvolution::
end2
BattleScript_WishMegaEvolution::
printstring STRINGID_EMPTYSTRING3
trytrainerslidemegaevolutionmsg BS_ATTACKER
printstring STRINGID_FERVENTWISHREACHED
waitmessage B_WAIT_TIME_LONG
setbyte gIsCriticalHit, 0
@ -9989,6 +9993,8 @@ BattleScript_JabocaRowapBerryActivate_Dmg:
@ z moves / effects
BattleScript_ZMoveActivateDamaging::
printstring STRINGID_EMPTYSTRING3
trytrainerslidezmovemsg BS_ATTACKER
printstring STRINGID_ZPOWERSURROUNDS
playanimation BS_ATTACKER, B_ANIM_ZMOVE_ACTIVATE, NULL
printstring STRINGID_ZMOVEUNLEASHED
@ -9996,6 +10002,8 @@ BattleScript_ZMoveActivateDamaging::
return
BattleScript_ZMoveActivateStatus::
printstring STRINGID_EMPTYSTRING3
trytrainerslidezmovemsg BS_ATTACKER
savetarget
printstring STRINGID_ZPOWERSURROUNDS
playanimation BS_ATTACKER, B_ANIM_ZMOVE_ACTIVATE, NULL

View File

@ -620,7 +620,7 @@ struct BattleStruct
struct MegaEvolutionData mega;
struct ZMoveData zmove;
const u8 *trainerSlideMsg;
bool8 trainerSlideLowHpMsgDone;
bool8 trainerSlideLowHpMsgDone:1;
u8 introState;
u8 ateBerry[2]; // array id determined by side, each party pokemon as bit
u8 stolenStats[NUM_BATTLE_STATS]; // hp byte is used for which stats to raise, other inform about by how many stages
@ -655,6 +655,13 @@ struct BattleStruct
u16 overwrittenAbilities[MAX_BATTLERS_COUNT]; // abilities overwritten during battle (keep separate from battle history in case of switching)
bool8 allowedToChangeFormInWeather[PARTY_SIZE][2]; // For each party member and side, used by Ice Face.
u8 battleBondTransformed[NUM_BATTLE_SIDES]; // Bitfield for each party.
bool8 trainerSlideHalfHpMsgDone:1;
u8 trainerSlideFirstCriticalHitMsgState:2;
u8 trainerSlideFirstSuperEffectiveHitMsgState:2;
u8 trainerSlideFirstSTABMoveMsgState:2;
u8 trainerSlidePlayerMonUnaffectedMsgState:2;
bool8 trainerSlideMegaEvolutionMsgDone:1;
bool8 trainerSlideZMoveMsgDone:1;
};
#define F_DYNAMIC_TYPE_1 (1 << 6)

View File

@ -229,6 +229,13 @@ enum
TRAINER_SLIDE_LAST_SWITCHIN,
TRAINER_SLIDE_LAST_LOW_HP,
TRAINER_SLIDE_FIRST_DOWN,
TRAINER_SLIDE_LAST_HALF_HP,
TRAINER_SLIDE_FIRST_CRITICAL_HIT,
TRAINER_SLIDE_FIRST_SUPER_EFFECTIVE_HIT,
TRAINER_SLIDE_FIRST_STAB_MOVE,
TRAINER_SLIDE_PLAYER_MON_UNAFFECTED,
TRAINER_SLIDE_MEGA_EVOLUTION,
TRAINER_SLIDE_Z_MOVE,
};
void BufferStringBattle(u16 stringID);

View File

@ -89,174 +89,176 @@
#define CMP_NO_COMMON_BITS 5
// Cmd_various
#define VARIOUS_CANCEL_MULTI_TURN_MOVES 0
#define VARIOUS_SET_MAGIC_COAT_TARGET 1
#define VARIOUS_IS_RUNNING_IMPOSSIBLE 2
#define VARIOUS_GET_MOVE_TARGET 3
#define VARIOUS_GET_BATTLER_FAINTED 4
#define VARIOUS_RESET_SWITCH_IN_ABILITY_BITS 5
#define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6
#define VARIOUS_RESET_PLAYER_FAINTED 7
#define VARIOUS_PALACE_FLAVOR_TEXT 8
#define VARIOUS_ARENA_JUDGMENT_WINDOW 9
#define VARIOUS_ARENA_OPPONENT_MON_LOST 10
#define VARIOUS_ARENA_PLAYER_MON_LOST 11
#define VARIOUS_ARENA_BOTH_MONS_LOST 12
#define VARIOUS_EMIT_YESNOBOX 13
#define VARIOUS_DRAW_ARENA_REF_TEXT_BOX 14
#define VARIOUS_ERASE_ARENA_REF_TEXT_BOX 15
#define VARIOUS_ARENA_JUDGMENT_STRING 16
#define VARIOUS_ARENA_WAIT_STRING 17
#define VARIOUS_WAIT_CRY 18
#define VARIOUS_RETURN_OPPONENT_MON1 19
#define VARIOUS_RETURN_OPPONENT_MON2 20
#define VARIOUS_VOLUME_DOWN 21
#define VARIOUS_VOLUME_UP 22
#define VARIOUS_SET_ALREADY_STATUS_MOVE_ATTEMPT 23
#define VARIOUS_PALACE_TRY_ESCAPE_STATUS 24
#define VARIOUS_SET_TELEPORT_OUTCOME 25
#define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 26
#define VARIOUS_STAT_TEXT_BUFFER 27
#define VARIOUS_SWITCHIN_ABILITIES 28
#define VARIOUS_SAVE_TARGET 29
#define VARIOUS_RESTORE_TARGET 30
#define VARIOUS_INSTANT_HP_DROP 31
#define VARIOUS_CLEAR_STATUS 32
#define VARIOUS_RESTORE_PP 33
#define VARIOUS_TRY_ACTIVATE_MOXIE 34
#define VARIOUS_TRY_ACTIVATE_FELL_STINGER 35
#define VARIOUS_PLAY_MOVE_ANIMATION 36
#define VARIOUS_SET_LUCKY_CHANT 37
#define VARIOUS_SUCKER_PUNCH_CHECK 38
#define VARIOUS_SET_SIMPLE_BEAM 39
#define VARIOUS_TRY_ENTRAINMENT 40
#define VARIOUS_SET_LAST_USED_ABILITY 41
#define VARIOUS_TRY_HEAL_PULSE 42
#define VARIOUS_TRY_QUASH 43
#define VARIOUS_INVERT_STAT_STAGES 44
#define VARIOUS_SET_TERRAIN 45
#define VARIOUS_TRY_ME_FIRST 46
#define VARIOUS_JUMP_IF_BATTLE_END 47
#define VARIOUS_TRY_ELECTRIFY 48
#define VARIOUS_TRY_REFLECT_TYPE 49
#define VARIOUS_TRY_SOAK 50
#define VARIOUS_HANDLE_MEGA_EVO 51
#define VARIOUS_TRY_LAST_RESORT 52
#define VARIOUS_ARGUMENT_STATUS_EFFECT 53
#define VARIOUS_TRY_HIT_SWITCH_TARGET 54
#define VARIOUS_TRY_AUTOTOMIZE 55
#define VARIOUS_TRY_COPYCAT 56
#define VARIOUS_ABILITY_POPUP 57
#define VARIOUS_DEFOG 58
#define VARIOUS_JUMP_IF_TARGET_ALLY 59
#define VARIOUS_TRY_SYNCHRONOISE 60
#define VARIOUS_PSYCHO_SHIFT 61
#define VARIOUS_CURE_STATUS 62
#define VARIOUS_POWER_TRICK 63
#define VARIOUS_AFTER_YOU 64
#define VARIOUS_BESTOW 65
#define VARIOUS_ARGUMENT_TO_MOVE_EFFECT 66
#define VARIOUS_JUMP_IF_NOT_GROUNDED 67
#define VARIOUS_HANDLE_TRAINER_SLIDE_MSG 68
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_FIRST_OFF 69
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_LAST_ON 70
#define VARIOUS_SET_AURORA_VEIL 71
#define VARIOUS_TRY_THIRD_TYPE 72
#define VARIOUS_ACUPRESSURE 73
#define VARIOUS_SET_POWDER 74
#define VARIOUS_SPECTRAL_THIEF 75
#define VARIOUS_GRAVITY_ON_AIRBORNE_MONS 76
#define VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS 77
#define VARIOUS_JUMP_IF_ROAR_FAILS 78
#define VARIOUS_TRY_INSTRUCT 79
#define VARIOUS_JUMP_IF_NOT_BERRY 80
#define VARIOUS_TRACE_ABILITY 81
#define VARIOUS_UPDATE_NICK 82
#define VARIOUS_TRY_ILLUSION_OFF 83
#define VARIOUS_SET_SPRITEIGNORE0HP 84
#define VARIOUS_HANDLE_FORM_CHANGE 85
#define VARIOUS_GET_STAT_VALUE 86
#define VARIOUS_JUMP_IF_FULL_HP 87
#define VARIOUS_LOSE_TYPE 88
#define VARIOUS_TRY_ACTIVATE_SOULHEART 89
#define VARIOUS_TRY_ACTIVATE_RECEIVER 90
#define VARIOUS_TRY_ACTIVATE_BEAST_BOOST 91
#define VARIOUS_TRY_FRISK 92
#define VARIOUS_JUMP_IF_SHIELDS_DOWN_PROTECTED 93
#define VARIOUS_TRY_FAIRY_LOCK 94
#define VARIOUS_JUMP_IF_NO_ALLY 95
#define VARIOUS_POISON_TYPE_IMMUNITY 96
#define VARIOUS_JUMP_IF_NO_HOLD_EFFECT 97
#define VARIOUS_INFATUATE_WITH_BATTLER 98
#define VARIOUS_SET_LAST_USED_ITEM 99
#define VARIOUS_PARALYZE_TYPE_IMMUNITY 100
#define VARIOUS_JUMP_IF_ABSENT 101
#define VARIOUS_DESTROY_ABILITY_POPUP 102
#define VARIOUS_TOTEM_BOOST 103
#define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 104
#define VARIOUS_MOVEEND_ITEM_EFFECTS 105
#define VARIOUS_TERRAIN_SEED 106
#define VARIOUS_MAKE_INVISIBLE 107
#define VARIOUS_ROOM_SERVICE 108
#define VARIOUS_JUMP_IF_TERRAIN_AFFECTED 109
#define VARIOUS_EERIE_SPELL_PP_REDUCE 110
#define VARIOUS_JUMP_IF_TEAM_HEALTHY 111
#define VARIOUS_TRY_HEAL_QUARTER_HP 112
#define VARIOUS_REMOVE_TERRAIN 113
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 114
#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 115
#define VARIOUS_GET_ROTOTILLER_TARGETS 116
#define VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED 117
#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 118
#define VARIOUS_CONSUME_BERRY 119
#define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 120
#define VARIOUS_HANDLE_PRIMAL_REVERSION 121
#define VARIOUS_APPLY_PLASMA_FISTS 122
#define VARIOUS_JUMP_IF_SPECIES 123
#define VARIOUS_UPDATE_ABILITY_POPUP 124
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 125
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 126
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 127
#define VARIOUS_PHOTON_GEYSER_CHECK 128
#define VARIOUS_SHELL_SIDE_ARM_CHECK 129
#define VARIOUS_TRY_NO_RETREAT 130
#define VARIOUS_TRY_TAR_SHOT 131
#define VARIOUS_CAN_TAR_SHOT_WORK 132
#define VARIOUS_CHECK_POLTERGEIST 133
#define VARIOUS_SET_OCTOLOCK 134
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 135
#define VARIOUS_TRY_END_NEUTRALIZING_GAS 136
#define VARIOUS_JUMP_IF_UNDER_200 137
#define VARIOUS_SET_SKY_DROP 138
#define VARIOUS_CLEAR_SKY_DROP 139
#define VARIOUS_SKY_DROP_YAWN 140
#define VARIOUS_JUMP_IF_CANT_FLING 141
#define VARIOUS_JUMP_IF_HOLD_EFFECT 142
#define VARIOUS_CURE_CERTAIN_STATUSES 143
#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 144
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 145
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 146
#define VARIOUS_SAVE_BATTLER_ITEM 147
#define VARIOUS_RESTORE_BATTLER_ITEM 148
#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 149
#define VARIOUS_SET_BEAK_BLAST 150
#define VARIOUS_SWAP_SIDE_STATUSES 151
#define VARIOUS_SET_Z_EFFECT 152
#define VARIOUS_TRY_SYMBIOSIS 153
#define VARIOUS_CAN_TELEPORT 154
#define VARIOUS_GET_BATTLER_SIDE 155
#define VARIOUS_CHECK_PARENTAL_BOND_COUNTER 156
#define VARIOUS_SWAP_STATS 157
#define VARIOUS_JUMP_IF_ROD 158
#define VARIOUS_JUMP_IF_ABSORB 159
#define VARIOUS_JUMP_IF_MOTOR 160
#define VARIOUS_TEATIME_INVUL 161
#define VARIOUS_TEATIME_TARGETS 162
#define VARIOUS_TRY_WIND_RIDER_POWER 163
#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 164
#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 165
#define VARIOUS_JUMP_IF_NO_VALID_TARGETS 166
#define VARIOUS_JUMP_IF_EMERGENCY_EXITED 167
#define VARIOUS_CANCEL_MULTI_TURN_MOVES 0
#define VARIOUS_SET_MAGIC_COAT_TARGET 1
#define VARIOUS_IS_RUNNING_IMPOSSIBLE 2
#define VARIOUS_GET_MOVE_TARGET 3
#define VARIOUS_GET_BATTLER_FAINTED 4
#define VARIOUS_RESET_SWITCH_IN_ABILITY_BITS 5
#define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6
#define VARIOUS_RESET_PLAYER_FAINTED 7
#define VARIOUS_PALACE_FLAVOR_TEXT 8
#define VARIOUS_ARENA_JUDGMENT_WINDOW 9
#define VARIOUS_ARENA_OPPONENT_MON_LOST 10
#define VARIOUS_ARENA_PLAYER_MON_LOST 11
#define VARIOUS_ARENA_BOTH_MONS_LOST 12
#define VARIOUS_EMIT_YESNOBOX 13
#define VARIOUS_DRAW_ARENA_REF_TEXT_BOX 14
#define VARIOUS_ERASE_ARENA_REF_TEXT_BOX 15
#define VARIOUS_ARENA_JUDGMENT_STRING 16
#define VARIOUS_ARENA_WAIT_STRING 17
#define VARIOUS_WAIT_CRY 18
#define VARIOUS_RETURN_OPPONENT_MON1 19
#define VARIOUS_RETURN_OPPONENT_MON2 20
#define VARIOUS_VOLUME_DOWN 21
#define VARIOUS_VOLUME_UP 22
#define VARIOUS_SET_ALREADY_STATUS_MOVE_ATTEMPT 23
#define VARIOUS_PALACE_TRY_ESCAPE_STATUS 24
#define VARIOUS_SET_TELEPORT_OUTCOME 25
#define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 26
#define VARIOUS_STAT_TEXT_BUFFER 27
#define VARIOUS_SWITCHIN_ABILITIES 28
#define VARIOUS_SAVE_TARGET 29
#define VARIOUS_RESTORE_TARGET 30
#define VARIOUS_INSTANT_HP_DROP 31
#define VARIOUS_CLEAR_STATUS 32
#define VARIOUS_RESTORE_PP 33
#define VARIOUS_TRY_ACTIVATE_MOXIE 34
#define VARIOUS_TRY_ACTIVATE_FELL_STINGER 35
#define VARIOUS_PLAY_MOVE_ANIMATION 36
#define VARIOUS_SET_LUCKY_CHANT 37
#define VARIOUS_SUCKER_PUNCH_CHECK 38
#define VARIOUS_SET_SIMPLE_BEAM 39
#define VARIOUS_TRY_ENTRAINMENT 40
#define VARIOUS_SET_LAST_USED_ABILITY 41
#define VARIOUS_TRY_HEAL_PULSE 42
#define VARIOUS_TRY_QUASH 43
#define VARIOUS_INVERT_STAT_STAGES 44
#define VARIOUS_SET_TERRAIN 45
#define VARIOUS_TRY_ME_FIRST 46
#define VARIOUS_JUMP_IF_BATTLE_END 47
#define VARIOUS_TRY_ELECTRIFY 48
#define VARIOUS_TRY_REFLECT_TYPE 49
#define VARIOUS_TRY_SOAK 50
#define VARIOUS_HANDLE_MEGA_EVO 51
#define VARIOUS_TRY_LAST_RESORT 52
#define VARIOUS_ARGUMENT_STATUS_EFFECT 53
#define VARIOUS_TRY_HIT_SWITCH_TARGET 54
#define VARIOUS_TRY_AUTOTOMIZE 55
#define VARIOUS_TRY_COPYCAT 56
#define VARIOUS_ABILITY_POPUP 57
#define VARIOUS_DEFOG 58
#define VARIOUS_JUMP_IF_TARGET_ALLY 59
#define VARIOUS_TRY_SYNCHRONOISE 60
#define VARIOUS_PSYCHO_SHIFT 61
#define VARIOUS_CURE_STATUS 62
#define VARIOUS_POWER_TRICK 63
#define VARIOUS_AFTER_YOU 64
#define VARIOUS_BESTOW 65
#define VARIOUS_ARGUMENT_TO_MOVE_EFFECT 66
#define VARIOUS_JUMP_IF_NOT_GROUNDED 67
#define VARIOUS_HANDLE_TRAINER_SLIDE_MSG 68
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_FIRST_OFF 69
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_LAST_ON 70
#define VARIOUS_SET_AURORA_VEIL 71
#define VARIOUS_TRY_THIRD_TYPE 72
#define VARIOUS_ACUPRESSURE 73
#define VARIOUS_SET_POWDER 74
#define VARIOUS_SPECTRAL_THIEF 75
#define VARIOUS_GRAVITY_ON_AIRBORNE_MONS 76
#define VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS 77
#define VARIOUS_JUMP_IF_ROAR_FAILS 78
#define VARIOUS_TRY_INSTRUCT 79
#define VARIOUS_JUMP_IF_NOT_BERRY 80
#define VARIOUS_TRACE_ABILITY 81
#define VARIOUS_UPDATE_NICK 82
#define VARIOUS_TRY_ILLUSION_OFF 83
#define VARIOUS_SET_SPRITEIGNORE0HP 84
#define VARIOUS_HANDLE_FORM_CHANGE 85
#define VARIOUS_GET_STAT_VALUE 86
#define VARIOUS_JUMP_IF_FULL_HP 87
#define VARIOUS_LOSE_TYPE 88
#define VARIOUS_TRY_ACTIVATE_SOULHEART 89
#define VARIOUS_TRY_ACTIVATE_RECEIVER 90
#define VARIOUS_TRY_ACTIVATE_BEAST_BOOST 91
#define VARIOUS_TRY_FRISK 92
#define VARIOUS_JUMP_IF_SHIELDS_DOWN_PROTECTED 93
#define VARIOUS_TRY_FAIRY_LOCK 94
#define VARIOUS_JUMP_IF_NO_ALLY 95
#define VARIOUS_POISON_TYPE_IMMUNITY 96
#define VARIOUS_JUMP_IF_NO_HOLD_EFFECT 97
#define VARIOUS_INFATUATE_WITH_BATTLER 98
#define VARIOUS_SET_LAST_USED_ITEM 99
#define VARIOUS_PARALYZE_TYPE_IMMUNITY 100
#define VARIOUS_JUMP_IF_ABSENT 101
#define VARIOUS_DESTROY_ABILITY_POPUP 102
#define VARIOUS_TOTEM_BOOST 103
#define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 104
#define VARIOUS_MOVEEND_ITEM_EFFECTS 105
#define VARIOUS_TERRAIN_SEED 106
#define VARIOUS_MAKE_INVISIBLE 107
#define VARIOUS_ROOM_SERVICE 108
#define VARIOUS_JUMP_IF_TERRAIN_AFFECTED 109
#define VARIOUS_EERIE_SPELL_PP_REDUCE 110
#define VARIOUS_JUMP_IF_TEAM_HEALTHY 111
#define VARIOUS_TRY_HEAL_QUARTER_HP 112
#define VARIOUS_REMOVE_TERRAIN 113
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 114
#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 115
#define VARIOUS_GET_ROTOTILLER_TARGETS 116
#define VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED 117
#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 118
#define VARIOUS_CONSUME_BERRY 119
#define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 120
#define VARIOUS_HANDLE_PRIMAL_REVERSION 121
#define VARIOUS_APPLY_PLASMA_FISTS 122
#define VARIOUS_JUMP_IF_SPECIES 123
#define VARIOUS_UPDATE_ABILITY_POPUP 124
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 125
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 126
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 127
#define VARIOUS_PHOTON_GEYSER_CHECK 128
#define VARIOUS_SHELL_SIDE_ARM_CHECK 129
#define VARIOUS_TRY_NO_RETREAT 130
#define VARIOUS_TRY_TAR_SHOT 131
#define VARIOUS_CAN_TAR_SHOT_WORK 132
#define VARIOUS_CHECK_POLTERGEIST 133
#define VARIOUS_SET_OCTOLOCK 134
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 135
#define VARIOUS_TRY_END_NEUTRALIZING_GAS 136
#define VARIOUS_JUMP_IF_UNDER_200 137
#define VARIOUS_SET_SKY_DROP 138
#define VARIOUS_CLEAR_SKY_DROP 139
#define VARIOUS_SKY_DROP_YAWN 140
#define VARIOUS_JUMP_IF_CANT_FLING 141
#define VARIOUS_JUMP_IF_HOLD_EFFECT 142
#define VARIOUS_CURE_CERTAIN_STATUSES 143
#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 144
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 145
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 146
#define VARIOUS_SAVE_BATTLER_ITEM 147
#define VARIOUS_RESTORE_BATTLER_ITEM 148
#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 149
#define VARIOUS_SET_BEAK_BLAST 150
#define VARIOUS_SWAP_SIDE_STATUSES 151
#define VARIOUS_SET_Z_EFFECT 152
#define VARIOUS_TRY_SYMBIOSIS 153
#define VARIOUS_CAN_TELEPORT 154
#define VARIOUS_GET_BATTLER_SIDE 155
#define VARIOUS_CHECK_PARENTAL_BOND_COUNTER 156
#define VARIOUS_SWAP_STATS 157
#define VARIOUS_JUMP_IF_ROD 158
#define VARIOUS_JUMP_IF_ABSORB 159
#define VARIOUS_JUMP_IF_MOTOR 160
#define VARIOUS_TEATIME_INVUL 161
#define VARIOUS_TEATIME_TARGETS 162
#define VARIOUS_TRY_WIND_RIDER_POWER 163
#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 164
#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 165
#define VARIOUS_JUMP_IF_NO_VALID_TARGETS 166
#define VARIOUS_JUMP_IF_EMERGENCY_EXITED 167
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE 168
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION 169
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -3868,6 +3868,16 @@ void BattleTurnPassed(void)
BattleScriptExecute(BattleScript_ArenaTurnBeginning);
else if (ShouldDoTrainerSlide(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), gTrainerBattleOpponent_A, TRAINER_SLIDE_LAST_LOW_HP))
BattleScriptExecute(BattleScript_TrainerSlideMsgEnd2);
else if (ShouldDoTrainerSlide(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), gTrainerBattleOpponent_A, TRAINER_SLIDE_LAST_HALF_HP))
BattleScriptExecute(BattleScript_TrainerSlideMsgEnd2);
else if (ShouldDoTrainerSlide(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), gTrainerBattleOpponent_A, TRAINER_SLIDE_FIRST_CRITICAL_HIT))
BattleScriptExecute(BattleScript_TrainerSlideMsgEnd2);
else if (ShouldDoTrainerSlide(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), gTrainerBattleOpponent_A, TRAINER_SLIDE_FIRST_SUPER_EFFECTIVE_HIT))
BattleScriptExecute(BattleScript_TrainerSlideMsgEnd2);
else if (ShouldDoTrainerSlide(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), gTrainerBattleOpponent_A, TRAINER_SLIDE_FIRST_STAB_MOVE))
BattleScriptExecute(BattleScript_TrainerSlideMsgEnd2);
else if (ShouldDoTrainerSlide(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), gTrainerBattleOpponent_A, TRAINER_SLIDE_PLAYER_MON_UNAFFECTED))
BattleScriptExecute(BattleScript_TrainerSlideMsgEnd2);
}
u8 IsRunningFromBattleImpossible(void)

View File

@ -3868,6 +3868,13 @@ struct TrainerSlide
const u8 *msgLastSwitchIn;
const u8 *msgLastLowHp;
const u8 *msgFirstDown;
const u8 *msgLastHalfHp;
const u8 *msgFirstCriticalHit;
const u8 *msgFirstSuperEffectiveHit;
const u8 *msgFirstSTABMove;
const u8 *msgPlayerMonUnaffected;
const u8 *msgMegaEvolution;
const u8 *msgZMove;
};
static const struct TrainerSlide sTrainerSlides[] =
@ -3879,20 +3886,39 @@ static const struct TrainerSlide sTrainerSlides[] =
.msgLastSwitchIn = sText_AarghAlmostHadIt,
.msgLastLowHp = sText_BoxIsFull,
.msgFirstDown = sText_123Poof,
.msgLastHalfHp = sText_ShootSoClose,
.msgFirstCriticalHit = sText_CriticalHit,
.msgFirstSuperEffectiveHit = sText_SuperEffective,
.msgFirstSTABMove = sText_ABoosted,
.msgPlayerMonUnaffected = sText_ButNoEffect,
.msgMegaEvolution = sText_PowderExplodes,
.msgZMove = sText_Electromagnetism,
},
*/
};
static u32 GetEnemyMonCount(bool32 onlyAlive)
static u32 GetAliveEnemyMonCount(void)
{
u32 i, count = 0;
for (i = 0; i < PARTY_SIZE; i++)
{
u32 species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES2, NULL);
if (species != SPECIES_NONE
&& species != SPECIES_EGG
&& (!onlyAlive || GetMonData(&gEnemyParty[i], MON_DATA_HP, NULL)))
if (species != SPECIES_NONE && species != SPECIES_EGG && GetMonData(&gEnemyParty[i], MON_DATA_HP, NULL))
count++;
}
return count;
}
static u32 GetTotalEnemyMonCount(void)
{
u32 i, count = 0;
for (i = 0; i < PARTY_SIZE; i++)
{
u32 species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES2, NULL);
if (species != SPECIES_NONE && species != SPECIES_EGG)
count++;
}
@ -3914,7 +3940,7 @@ bool32 ShouldDoTrainerSlide(u32 battlerId, u32 trainerId, u32 which)
switch (which)
{
case TRAINER_SLIDE_LAST_SWITCHIN:
if (sTrainerSlides[i].msgLastSwitchIn != NULL && GetEnemyMonCount(TRUE) == 1)
if (sTrainerSlides[i].msgLastSwitchIn != NULL && GetAliveEnemyMonCount() == 1)
{
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgLastSwitchIn;
return TRUE;
@ -3922,9 +3948,9 @@ bool32 ShouldDoTrainerSlide(u32 battlerId, u32 trainerId, u32 which)
break;
case TRAINER_SLIDE_LAST_LOW_HP:
if (sTrainerSlides[i].msgLastLowHp != NULL
&& GetEnemyMonCount(TRUE) == 1
&& gBattleMons[battlerId].hp <= (gBattleMons[battlerId].maxHP / 4)
&& !gBattleStruct->trainerSlideLowHpMsgDone)
&& GetAliveEnemyMonCount() == 1
&& gBattleMons[battlerId].hp <= (gBattleMons[battlerId].maxHP / 4)
&& !gBattleStruct->trainerSlideLowHpMsgDone)
{
gBattleStruct->trainerSlideLowHpMsgDone = TRUE;
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgLastLowHp;
@ -3932,12 +3958,77 @@ bool32 ShouldDoTrainerSlide(u32 battlerId, u32 trainerId, u32 which)
}
break;
case TRAINER_SLIDE_FIRST_DOWN:
if (sTrainerSlides[i].msgFirstDown != NULL && GetEnemyMonCount(TRUE) == GetEnemyMonCount(FALSE) - 1)
if (sTrainerSlides[i].msgFirstDown != NULL && GetAliveEnemyMonCount() == GetTotalEnemyMonCount() - 1)
{
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgFirstDown;
return TRUE;
}
break;
case TRAINER_SLIDE_LAST_HALF_HP:
if (sTrainerSlides[i].msgLastHalfHp != NULL
&& GetAliveEnemyMonCount() == 1
&& (gBattleMons[battlerId].hp <= (gBattleMons[battlerId].maxHP / 2) && gBattleMons[battlerId].hp > (gBattleMons[battlerId].maxHP / 4))
&& !gBattleStruct->trainerSlideHalfHpMsgDone)
{
gBattleStruct->trainerSlideHalfHpMsgDone = TRUE;
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgLastHalfHp;
return TRUE;
}
break;
case TRAINER_SLIDE_FIRST_CRITICAL_HIT:
if (sTrainerSlides[i].msgFirstCriticalHit != NULL && gBattleStruct->trainerSlideFirstCriticalHitMsgState == 1)
{
gBattleStruct->trainerSlideFirstCriticalHitMsgState = 2;
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgFirstCriticalHit;
return TRUE;
}
break;
case TRAINER_SLIDE_FIRST_SUPER_EFFECTIVE_HIT:
if (sTrainerSlides[i].msgFirstSuperEffectiveHit != NULL
&& gBattleStruct->trainerSlideFirstSuperEffectiveHitMsgState == 1
&& gBattleMons[battlerId].hp)
{
gBattleStruct->trainerSlideFirstSuperEffectiveHitMsgState = 2;
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgFirstSuperEffectiveHit;
return TRUE;
}
break;
case TRAINER_SLIDE_FIRST_STAB_MOVE:
if (sTrainerSlides[i].msgFirstSTABMove != NULL
&& gBattleStruct->trainerSlideFirstSTABMoveMsgState == 1
&& GetAliveEnemyMonCount() == GetTotalEnemyMonCount())
{
gBattleStruct->trainerSlideFirstSTABMoveMsgState = 2;
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgFirstSTABMove;
return TRUE;
}
break;
case TRAINER_SLIDE_PLAYER_MON_UNAFFECTED:
if (sTrainerSlides[i].msgPlayerMonUnaffected != NULL
&& gBattleStruct->trainerSlidePlayerMonUnaffectedMsgState == 1
&& GetAliveEnemyMonCount() == GetTotalEnemyMonCount())
{
gBattleStruct->trainerSlidePlayerMonUnaffectedMsgState = 2;
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgPlayerMonUnaffected;
return TRUE;
}
break;
case TRAINER_SLIDE_MEGA_EVOLUTION:
if (sTrainerSlides[i].msgMegaEvolution != NULL && !gBattleStruct->trainerSlideMegaEvolutionMsgDone)
{
gBattleStruct->trainerSlideMegaEvolutionMsgDone = TRUE;
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgMegaEvolution;
return TRUE;
}
break;
case TRAINER_SLIDE_Z_MOVE:
if (sTrainerSlides[i].msgZMove != NULL && !gBattleStruct->trainerSlideZMoveMsgDone)
{
gBattleStruct->trainerSlideZMoveMsgDone = TRUE;
gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgZMove;
return TRUE;
}
break;
}
break;
}

View File

@ -2540,6 +2540,11 @@ static void Cmd_critmessage(void)
if (gIsCriticalHit == TRUE && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
{
PrepareStringBattle(STRINGID_CRITICALHIT, gBattlerAttacker);
// Signal for the trainer slide-in system.
if (GetBattlerSide(gBattlerTarget) != B_SIDE_PLAYER && gBattleStruct->trainerSlideFirstCriticalHitMsgState != 2)
gBattleStruct->trainerSlideFirstCriticalHitMsgState = 1;
gBattleCommunication[MSG_DISPLAY] = 1;
}
gBattlescriptCurrInstr = cmd->nextInstr;
@ -2619,7 +2624,13 @@ static void Cmd_resultmessage(void)
{
case MOVE_RESULT_SUPER_EFFECTIVE:
if (!gMultiHitCounter) // Don't print effectiveness on each hit in a multi hit attack
{
// Signal for the trainer slide-in system.
if (GetBattlerSide(gBattlerTarget) != B_SIDE_PLAYER && gBattleStruct->trainerSlideFirstSuperEffectiveHitMsgState != 2)
gBattleStruct->trainerSlideFirstSuperEffectiveHitMsgState = 1;
stringId = STRINGID_SUPEREFFECTIVE;
}
break;
case MOVE_RESULT_NOT_VERY_EFFECTIVE:
if (!gMultiHitCounter)
@ -11040,6 +11051,30 @@ static void Cmd_various(void)
gBattlescriptCurrInstr = cmd->nextInstr;
return;
}
case VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE:
{
VARIOUS_ARGS();
if (ShouldDoTrainerSlide(gActiveBattler, gTrainerBattleOpponent_A, TRAINER_SLIDE_Z_MOVE))
{
gBattleScripting.battler = gActiveBattler;
BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = BattleScript_TrainerSlideMsgRet;
return;
}
break;
}
case VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION:
{
VARIOUS_ARGS();
if (ShouldDoTrainerSlide(gActiveBattler, gTrainerBattleOpponent_A, TRAINER_SLIDE_MEGA_EVOLUTION))
{
gBattleScripting.battler = gActiveBattler;
BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = BattleScript_TrainerSlideMsgRet;
return;
}
break;
}
} // End of switch (cmd->id)
gBattlescriptCurrInstr = cmd->nextInstr;

View File

@ -1607,6 +1607,12 @@ void PrepareStringBattle(u16 stringId, u8 battler)
}
#endif
// Signal for the trainer slide-in system.
if ((stringId == STRINGID_ITDOESNTAFFECT || stringId == STRINGID_PKMNWASNTAFFECTED || stringId == STRINGID_PKMNUNAFFECTED)
&& GetBattlerSide(gBattlerTarget) == B_SIDE_OPPONENT
&& gBattleStruct->trainerSlidePlayerMonUnaffectedMsgState != 2)
gBattleStruct->trainerSlidePlayerMonUnaffectedMsgState = 1;
gActiveBattler = battler;
BtlController_EmitPrintString(BUFFER_A, stringId);
MarkBattlerForControllerExec(gActiveBattler);
@ -9884,6 +9890,10 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat
}
}
// Signal for the trainer slide-in system.
if (GetBattlerSide(battlerDef) != B_SIDE_PLAYER && modifier && gBattleStruct->trainerSlideFirstSTABMoveMsgState != 2)
gBattleStruct->trainerSlideFirstSTABMoveMsgState = 1;
return modifier;
}