Skip to content

Commit

Permalink
move all of the BattlePokemon flags to ClearBattleMonFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
BluRosie committed Jan 25, 2025
1 parent 3b1bba0 commit d61fb66
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
9 changes: 2 additions & 7 deletions asm/battle/battle_hooks.s
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,8 @@ ldr r1, [sp,#(4+8*4)] // pushed 8 registers, sp+4 originally
bl ClearBattleMonFlags
pop {r0-r7}

add r1, r7, r6
strb r2, [r1, r0]
add r0, #1
strb r2, [r1, r0]

ldr r3, =0x0224E9A0 | 1
bx r3
ldr r0, =0x0224E70E | 1
bx r0

.pool

Expand Down
7 changes: 7 additions & 0 deletions asm/include/battle_commands.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1399,4 +1399,11 @@
.long (((\arg_2 - .) / 4) - 1)
.endm

.macro CheckShouldNotTurnOffMultiStatAnim battlerCategory, label
// need to skip the stat animation turning off in case of defiant and competitive so the animation shows properly
CheckAbility CHECK_OPCODE_HAVE, \battlerCategory, ABILITY_DEFIANT, \label
CheckAbility CHECK_OPCODE_HAVE, \battlerCategory, ABILITY_COMPETITIVE, \label
.endm


.endif
3 changes: 3 additions & 0 deletions bytereplacement
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ arm9 0203DFF4 8A 02

#endif

# restore the original code to the initial hook for ClearBattleMonFlags_hook
# since we moved it
0012 0224E998 B9 19 0A 54 40 1C 0A 54

#ifndef IMPLEMENT_CAPTURE_EXPERIENCE

Expand Down
2 changes: 1 addition & 1 deletion hooks
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ arm9 TT_TrainerTypeSexGet 020735F8 1

#reset battlemon switch in flags (now really really do it)
# smack in the middle of BattleSystem_GetBattleMon
0012 ClearBattleMonFlags_hook 0224E998 3
0012 ClearBattleMonFlags_hook 0224E6B2 0
# need to do it in the middle of InitFaintedWork too
0012 ClearBattleMonFlags_hook2 0225155C 0

Expand Down
11 changes: 11 additions & 0 deletions src/battle/battle_pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,11 +1017,22 @@ void BattleEndRevertFormChange(struct BattleSystem *bw)
void LONG_CALL ClearBattleMonFlags(struct BattleStruct *sp, int client)
{
int i;
// code from aero's pr
sp->battlemon[client].appear_check_flag = 0;
sp->battlemon[client].slow_start_flag = 0;
sp->battlemon[client].slow_start_end_flag = 0;

sp->battlemon[client].sheer_force_flag = 0;
sp->battlemon[client].imposter_flag = 0;
sp->battlemon[client].critical_hits = 0;
sp->battlemon[client].air_balloon_flag = 0;
sp->battlemon[client].potentially_affected_by_psychic_terrain_move_used_flag = 0;
sp->battlemon[client].ability_activated_flag = 0;
sp->battlemon[client].tera_type = 0;
sp->battlemon[client].is_currently_terastallized = 0;
sp->battlemon[client].is_currently_dynamaxed = 0;
sp->battlemon[client].has_dynamaxed_before = 0;
sp->battlemon[client].type3 = 0;
sp->oneTurnFlag[client].parental_bond_flag = 0;
sp->oneTurnFlag[client].parental_bond_is_active = 0;

Expand Down

0 comments on commit d61fb66

Please sign in to comment.