From 679e10b0a95cc5ff5073325fa31ae9abc23095ad Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 3 Nov 2025 11:38:35 +0100 Subject: [PATCH] ActivateFlashFire --- asm/include/overlay_29_0230AD04.inc | 2 +- asm/include/overlay_29_0230BBAC.inc | 2 +- asm/include/overlay_29_02325644.inc | 2 +- asm/overlay_29_0230AD04.s | 2 +- asm/overlay_29_0230BBAC.s | 2 +- asm/overlay_29_02313CE4.s | 27 --------------------------- asm/overlay_29_02325644.s | 2 +- include/overlay_29_02313814.h | 3 ++- src/dungeon_damage.c | 4 ++-- src/move_orb_effects.c | 26 -------------------------- src/overlay_29_02313814.c | 22 +++++++++++++++++++++- 11 files changed, 31 insertions(+), 63 deletions(-) delete mode 100644 src/move_orb_effects.c diff --git a/asm/include/overlay_29_0230AD04.inc b/asm/include/overlay_29_0230AD04.inc index b2ccddb8..190bdd97 100644 --- a/asm/include/overlay_29_0230AD04.inc +++ b/asm/include/overlay_29_0230AD04.inc @@ -11,7 +11,7 @@ .public ExclusiveItemEffectIsActive__0230A9B8 .public FixedPoint32To64 .public FixedPoint64IsZero -.public FlashFireShouldActivate +.public GetFlashFireStatus .public GetApparentWeather .public GetTypeMatchup .public GhostImmunityIsActive diff --git a/asm/include/overlay_29_0230BBAC.inc b/asm/include/overlay_29_0230BBAC.inc index 9ef5a2ab..8b19023c 100644 --- a/asm/include/overlay_29_0230BBAC.inc +++ b/asm/include/overlay_29_0230BBAC.inc @@ -39,7 +39,7 @@ .public FixedPoint64CmpLt .public FixedPoint64ToInt .public FixedRoomIsSubstituteRoom -.public FlashFireShouldActivate +.public GetFlashFireStatus .public GendersEqualNotGenderless .public GendersNotEqualNotGenderless .public GenerateStandardItem diff --git a/asm/include/overlay_29_02325644.inc b/asm/include/overlay_29_02325644.inc index 4c9615c7..669df375 100644 --- a/asm/include/overlay_29_02325644.inc +++ b/asm/include/overlay_29_02325644.inc @@ -35,7 +35,7 @@ .public FACADE_DAMAGE_MULTIPLIER .public FLAME_WHEEL_BURN_CHANCE .public FLAMETHROWER_BURN_CHANCE -.public FlashFireShouldActivate +.public GetFlashFireStatus .public FOCUS_PUNCH_DAMAGE_MULTIPLIER .public FormatMoveStringMore .public GetApparentWeather diff --git a/asm/overlay_29_0230AD04.s b/asm/overlay_29_0230AD04.s index 19702152..efba6e62 100644 --- a/asm/overlay_29_0230AD04.s +++ b/asm/overlay_29_0230AD04.s @@ -308,7 +308,7 @@ _0230B14C: bne _0230B198 mov r0, sl mov r1, sb - bl FlashFireShouldActivate + bl GetFlashFireStatus cmp r0, #0 beq _0230B198 ldr r1, _0230B798 ; =DUNGEON_PTR diff --git a/asm/overlay_29_0230BBAC.s b/asm/overlay_29_0230BBAC.s index 0e17ae4b..c72dc8a9 100644 --- a/asm/overlay_29_0230BBAC.s +++ b/asm/overlay_29_0230BBAC.s @@ -1132,7 +1132,7 @@ _0230CB78: bne _0230CC78 mov r0, sl mov r1, sb - bl FlashFireShouldActivate + bl GetFlashFireStatus movs r4, r0 beq _0230CC78 ldrb r0, [r7, #0x15c + CALC_DAMAGE_OFFSET] diff --git a/asm/overlay_29_02313CE4.s b/asm/overlay_29_02313CE4.s index 6f927cb5..1fb2870c 100644 --- a/asm/overlay_29_02313CE4.s +++ b/asm/overlay_29_02313CE4.s @@ -3,33 +3,6 @@ .text - arm_func_start ActivateFlashFire -ActivateFlashFire: ; 0x02313CE4 - stmdb sp!, {r3, r4, r5, lr} - mov r5, r1 - mov r0, r5 - bl EntityIsValid__023118B4 - cmp r0, #0 - ldmeqia sp!, {r3, r4, r5, pc} - mov r0, #0 - ldr r4, [r5, #0xb4] - mov r1, r5 - mov r2, r0 - bl SubstitutePlaceholderStringTags - ldrsh r0, [r4, #0x30] - add r1, r0, #1 - cmp r1, #2 - movge r1, #2 - cmp r0, r1 - beq _02313D34 - mov r0, r5 - strh r1, [r4, #0x30] - bl ov29_022E4338 -_02313D34: - mov r0, r5 - bl UpdateStatusIconFlags - ldmia sp!, {r3, r4, r5, pc} - arm_func_end ActivateFlashFire arm_func_start ApplyOffensiveStatMultiplier ApplyOffensiveStatMultiplier: ; 0x02313D40 diff --git a/asm/overlay_29_02325644.s b/asm/overlay_29_02325644.s index 4a462a3e..83de1a89 100644 --- a/asm/overlay_29_02325644.s +++ b/asm/overlay_29_02325644.s @@ -1710,7 +1710,7 @@ DoMoveWillOWisp: ; 0x02326B24 sub sp, sp, #4 mov r6, r0 mov r5, r1 - bl FlashFireShouldActivate + bl GetFlashFireStatus movs r4, r0 beq _02326B94 ldr r3, [r5, #0xb4] diff --git a/include/overlay_29_02313814.h b/include/overlay_29_02313814.h index 9b793560..151b381a 100644 --- a/include/overlay_29_02313814.h +++ b/include/overlay_29_02313814.h @@ -25,6 +25,7 @@ void BoostOffensiveStat(struct entity *user, struct entity *target, struct StatI void BoostDefensiveStat(struct entity *user, struct entity *target, struct StatIndex stat, s32 nStagesRaw); // Checks whether Flash Fire should activate, assuming the defender is being hit by a Fire-type move. // This checks that the defender is valid and Flash Fire is active, and that Normalize isn't active on the attacker. -enum flash_fire_status FlashFireShouldActivate(struct entity *attacker, struct entity *defender); +enum flash_fire_status GetFlashFireStatus(struct entity *attacker, struct entity *defender); +void ActivateFlashFire(struct entity *pokemon, struct entity *target); #endif //PMDSKY_OVERLAY_29_02313814_H diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index 5d072205..a3074c83 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -2,7 +2,7 @@ #include "dungeon_logic_3.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_util_static.h" -#include "move_orb_effects.h" +#include "overlay_29_02313814.h" #include "overlay_29_02308FBC.h" #include "overlay_29_0230A994.h" #include "overlay_29_0230AB58.h" @@ -28,7 +28,7 @@ s32 WeightWeakTypePicker(struct entity *user, struct entity *target, enum type_i if (move_type == TYPE_NORMAL || move_type == TYPE_FIGHTING) check_exposed = TRUE; - if (move_type == TYPE_FIRE && FlashFireShouldActivate(user, target) != FLASH_FIRE_STATUS_NONE) + if (move_type == TYPE_FIRE && GetFlashFireStatus(user, target) != FLASH_FIRE_STATUS_NONE) return 0; #ifdef JAPAN diff --git a/src/move_orb_effects.c b/src/move_orb_effects.c deleted file mode 100644 index 146d110f..00000000 --- a/src/move_orb_effects.c +++ /dev/null @@ -1,26 +0,0 @@ -#include "move_orb_effects.h" -#include "dungeon_pokemon_attributes.h" -#include "dungeon_util_static.h" -#include "overlay_29_023118B4.h" -#include "overlay_29_02311BF8.h" - -enum flash_fire_status FlashFireShouldActivate(struct entity *attacker, struct entity *defender) -{ - if (!EntityIsValid__023118B4(defender)) - return FLASH_FIRE_STATUS_NONE; - - if (AbilityIsActiveVeneer(attacker, ABILITY_NORMALIZE)) - return FLASH_FIRE_STATUS_NONE; - -#ifdef JAPAN - if (!DefenderAbilityIsActive__02311B94(attacker, defender, ABILITY_FLASH_FIRE)) -#else - if (!DefenderAbilityIsActive__02311B94(attacker, defender, ABILITY_FLASH_FIRE, TRUE)) -#endif - return FLASH_FIRE_STATUS_NONE; - - if (GetEntInfo(defender)->stat_modifiers.flash_fire_boost >= 2) - return FLASH_FIRE_STATUS_MAXED; - - return FLASH_FIRE_STATUS_NOT_MAXED; -} diff --git a/src/overlay_29_02313814.c b/src/overlay_29_02313814.c index 9ac9a6c6..2b3a3269 100644 --- a/src/overlay_29_02313814.c +++ b/src/overlay_29_02313814.c @@ -15,6 +15,7 @@ extern void ov29_022E4F1C(struct entity *user, struct StatIndex); extern void ov29_022E4D28(struct entity *user, struct StatIndex); extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id); extern void UpdateStatusIconFlags(struct entity *); +extern void ov29_022E4338(struct entity *); #ifdef JAPAN #define JPN_MSG_OFFSET -0x2C0 @@ -254,7 +255,7 @@ void BoostDefensiveStat(struct entity *user, struct entity *target, struct StatI UpdateStatusIconFlags(target); } -enum flash_fire_status FlashFireShouldActivate(struct entity *attacker, struct entity *defender) +enum flash_fire_status GetFlashFireStatus(struct entity *attacker, struct entity *defender) { if (!EntityIsValid__023118B4(defender)) return FLASH_FIRE_STATUS_NONE; @@ -274,3 +275,22 @@ enum flash_fire_status FlashFireShouldActivate(struct entity *attacker, struct e return FLASH_FIRE_STATUS_NOT_MAXED; } + +void ActivateFlashFire(struct entity *pokemon, struct entity *target) +{ + s32 flashFireBoost; + + if (EntityIsValid__023118B4(target)) { + struct monster * entityInfo = GetEntInfo(target); + SubstitutePlaceholderStringTags(0,target,0); + flashFireBoost = entityInfo->stat_modifiers.flash_fire_boost; + if (++flashFireBoost >= 2) { + flashFireBoost = 2; + } + if (entityInfo->stat_modifiers.flash_fire_boost != flashFireBoost) { + entityInfo->stat_modifiers.flash_fire_boost = flashFireBoost; + ov29_022E4338(target); + } + UpdateStatusIconFlags(target); + } +}