diff --git a/asm/include/overlay_29_02334CAC.inc b/asm/include/overlay_29_02334CAC.inc deleted file mode 100644 index 3f59c932..00000000 --- a/asm/include/overlay_29_02334CAC.inc +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once - diff --git a/asm/overlay_29_02334CAC.s b/asm/overlay_29_02334CAC.s deleted file mode 100644 index 9410188a..00000000 --- a/asm/overlay_29_02334CAC.s +++ /dev/null @@ -1,34 +0,0 @@ - .include "asm/macros.inc" - .include "overlay_29_02334CAC.inc" - - .text - - arm_func_start HasLastUsedMove -HasLastUsedMove: ; 0x02334CAC - stmdb sp!, {r3, lr} - mov r3, #0 - mov r1, r3 - mov r2, #1 - b _02334CE8 -_02334CC0: - ldrb ip, [r0, r3, lsl #3] - tst ip, #1 - movne lr, r2 - moveq lr, r1 - tst lr, #0xff - beq _02334CE4 - tst ip, #0x10 - movne r0, #1 - ldmneia sp!, {r3, pc} -_02334CE4: - add r3, r3, #1 -_02334CE8: - cmp r3, #4 - blt _02334CC0 - ldrb r0, [r0, #0x20] - tst r0, #0x10 - movne r0, #1 - moveq r0, #0 - and r0, r0, #0xff - ldmia sp!, {r3, pc} - arm_func_end HasLastUsedMove diff --git a/include/dungeon_mode.h b/include/dungeon_mode.h index 6eb106a1..b82046c4 100644 --- a/include/dungeon_mode.h +++ b/include/dungeon_mode.h @@ -10,6 +10,7 @@ #define NUM_PICKED_IQ_SKILLS 3 #define MAX_MON_MOVES 4 +#define STRUGGLE_MOVE_INDEX 4 #define STAT_MULTIPLIER_THRESHOLD 0.249 // one tick less than 0.25 #define DEFAULT_STAT_STAGE 10 diff --git a/include/move_checks.h b/include/move_checks.h index 2f029db3..09d89999 100644 --- a/include/move_checks.h +++ b/include/move_checks.h @@ -16,5 +16,8 @@ bool8 EntityIsValid__02333FAC(struct entity *entity); // move: Move pointer // return: True if it makes sense to use the move, false if it would be redundant given the effects it causes and the effects that the target already has. bool8 StatusCheckerCheckOnTarget(struct entity *attacker, struct entity *target, struct move *move); +// Determines whether a monster has used any of its moves on this floor. +// This function takes in the monster's move list and checks if any moves have the f_last_used flag set. +bool8 HasLastUsedMove(struct move *moves); #endif //PMDSKY_MOVE_CHECKS_H diff --git a/main.lsf b/main.lsf index 0a2c13cb..14dc6b31 100644 --- a/main.lsf +++ b/main.lsf @@ -544,7 +544,6 @@ Overlay OVY_29 Object src/overlay_29_023329E8.o Object asm/overlay_29_02332A0C.o Object src/move_checks.o - Object asm/overlay_29_02334CAC.o Object src/weather.o Object asm/overlay_29_02334D58.o Object src/overlay_29_023350D8.o diff --git a/src/move_checks.c b/src/move_checks.c index f56fa05a..2e32b4ac 100644 --- a/src/move_checks.c +++ b/src/move_checks.c @@ -17,7 +17,6 @@ #include "trap.h" #include "weather.h" -extern bool8 HasLastUsedMove(struct move *moves); extern bool8 GendersEqualNotGenderless(s16 monster1, s16 monster2); // https://decomp.me/scratch/TnODN @@ -1783,7 +1782,7 @@ bool8 StatusCheckerCheckOnTarget(struct entity *attacker, struct entity *target, break; case MOVE_BLOCK: case MOVE_MEAN_LOOK: - case MOVE_SPIDER_WEB: // Remove? + case MOVE_SPIDER_WEB: if (target_data->frozen_class_status.freeze == STATUS_FROZEN_SHADOW_HOLD) return FALSE; break; @@ -1822,7 +1821,7 @@ bool8 StatusCheckerCheckOnTarget(struct entity *attacker, struct entity *target, return FALSE; break; case MOVE_FLASH: - case MOVE_KINESIS: // Remove? + case MOVE_KINESIS: case MOVE_SAND_ATTACK: if (target_data->stat_modifiers.hit_chance_stages[STAT_STAGE_ACCURACY] < 1) return FALSE; @@ -1881,7 +1880,7 @@ bool8 StatusCheckerCheckOnTarget(struct entity *attacker, struct entity *target, break; case MOVE_COPYCAT: case MOVE_MIMIC: - case MOVE_SKETCH: // Remove? + case MOVE_SKETCH: if (!HasLastUsedMove(target_data->moves.moves)) return FALSE; break; @@ -2007,3 +2006,17 @@ bool8 StatusCheckerCheckOnTarget(struct entity *attacker, struct entity *target, return TRUE; } + +bool8 HasLastUsedMove(struct move *moves) +{ + s32 i; + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (MoveExists(&moves[i]) && moves[i].flags0 & MOVE_FLAG_LAST_USED) + return TRUE; + } + + if (moves[STRUGGLE_MOVE_INDEX].flags0 & MOVE_FLAG_LAST_USED) + return TRUE; + return FALSE; +}