From b8e95f9faba4eb82d39986f71364eab242a6780e Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Sat, 20 Sep 2025 22:23:01 -0400 Subject: [PATCH] Decomped DefenderAbilityIsActive --- asm/include/overlay_29_022F9194.inc | 10 ++-- asm/include/overlay_29_023018AC.inc | 3 +- asm/include/overlay_29_02308FE0.inc | 54 +++++++++---------- asm/include/overlay_29_023118D8.inc | 6 +-- asm/include/overlay_29_0232145C.inc | 53 +++++++++--------- ...9_02332A0C.inc => overlay_29_02332A70.inc} | 25 ++------- asm/overlay_29_022F9194.s | 48 ----------------- asm/overlay_29_023018AC.s | 48 ----------------- asm/overlay_29_02308FE0.s | 48 ----------------- asm/overlay_29_023118D8.s | 33 ------------ asm/overlay_29_0232145C.s | 48 ----------------- ...ay_29_02332A0C.s => overlay_29_02332A70.s} | 35 +----------- include/overlay_29_022F9720.h | 6 +++ include/overlay_29_02301A60.h | 6 +++ include/overlay_29_0230A994.h | 6 +++ include/overlay_29_02311BF8.h | 6 +++ include/overlay_29_02322DB8.h | 6 +++ include/overlay_29_023329E8.h | 6 +++ main.lsf | 2 +- src/dungeon_damage.c | 6 +-- src/overlay_29_022F9720.c | 18 +++++++ src/overlay_29_02301A60.c | 18 +++++++ src/overlay_29_0230A994.c | 18 +++++++ src/overlay_29_02311BF8.c | 25 +++++++++ src/overlay_29_02322DB8.c | 18 +++++++ src/overlay_29_023329E8.c | 25 +++++++++ 26 files changed, 229 insertions(+), 348 deletions(-) rename asm/include/{overlay_29_02332A0C.inc => overlay_29_02332A70.inc} (60%) rename asm/{overlay_29_02332A0C.s => overlay_29_02332A70.s} (92%) diff --git a/asm/include/overlay_29_022F9194.inc b/asm/include/overlay_29_022F9194.inc index 1936adce..11fdd59a 100644 --- a/asm/include/overlay_29_022F9194.inc +++ b/asm/include/overlay_29_022F9194.inc @@ -2,24 +2,24 @@ .public AbilityIsActiveVeneer .public CASTFORM_WEATHER_ATTRIBUTE_TABLE .public DUNGEON_PTR +.public DefenderAbilityIsActive__022F96CC .public DungeonRandInt .public EntityIsValid__022F7364 .public GetAbility .public GetApparentWeather .public GetMoveTypeForMonster .public GetType -.public IsMonster__022F9720 .public IsSecretBazaarNpcBehavior .public IsSecretFloor .public LogMessageByIdWithPopupCheckUser .public LogMessageByIdWithPopupCheckUserTarget .public LowerSpeed .public MonsterIsType -.public ov10_022C4C6E -.public ov10_022C4C70 -.public ov29_022E6260 -.public ov29_022E647C .public SetPreprocessorArgsIdVal .public SubstitutePlaceholderStringTags .public TryEndStatusWithAbility .public WEATHER_BALL_TYPE_TABLE +.public ov10_022C4C6E +.public ov10_022C4C70 +.public ov29_022E6260 +.public ov29_022E647C diff --git a/asm/include/overlay_29_023018AC.inc b/asm/include/overlay_29_023018AC.inc index ba00d5d7..1943e4de 100644 --- a/asm/include/overlay_29_023018AC.inc +++ b/asm/include/overlay_29_023018AC.inc @@ -1,7 +1,6 @@ #pragma once -.public AbilityIsActive +.public DefenderAbilityIsActive__02301A0C .public GetApparentWeather .public IsExperienceLocked -.public IsMonster__02301A60 .public LogMessageByIdWithPopupCheckUserTarget .public SubstitutePlaceholderStringTags diff --git a/asm/include/overlay_29_02308FE0.inc b/asm/include/overlay_29_02308FE0.inc index f3845179..942c0ccc 100644 --- a/asm/include/overlay_29_02308FE0.inc +++ b/asm/include/overlay_29_02308FE0.inc @@ -1,6 +1,5 @@ #pragma once .public AbilityIsActiveVeneer -.public abs .public ActivateMotorDrive .public AddExpSpecial .public AdvanceFrame @@ -11,14 +10,15 @@ .public ChangeDungeonMusic .public ChangeMonsterAnimation .public DAMAGE_STRING_IDS -.public DisplayAnimatedNumbers .public DUNGEON_PTR +.public DefenderAbilityIsActive__0230A940 +.public DisplayAnimatedNumbers .public DungeonRandOutcome__022EAB20 .public EndCurseClassStatus .public EndInvisibleClassStatus .public EntityIsValid__02308FBC -.public ExclusiveItemEffectIsActive__0230A9B8 .public ExclusiveItemEffectIsActiveWithLogging +.public ExclusiveItemEffectIsActive__0230A9B8 .public FreeOtherWrappedMonsters .public GetActiveTeamMember .public GetDirectionTowardsPosition @@ -30,7 +30,6 @@ .public IsBlinded .public IsCurrentMissionType .public IsExperienceLocked -.public IsMonster__0230A994 .public IsMonsterIdInNormalRangeVeneer .public IsSecretBazaarNpcBehavior .public IsSpecialStoryAlly @@ -42,6 +41,30 @@ .public LogMessageByIdWithPopupCheckUserTarget .public MoveMonsterToPos .public MusicTableIdxToMusicId +.public PlayEffectAnimationEntity +.public RecruitCheck +.public RemoveHolderForItemInBag +.public RestorePpAllMovesSetFlags +.public RestoreRandomMovePP +.public SET_DAMAGE_STATUS_DAMAGE +.public SetMessageLogPreprocessorArgsNumberVal +.public SetMonsterFlag2 +.public SetPokemonBattled +.public ShouldDisplayEntityWrapper +.public SpawnDroppedItemWrapper +.public SubInitMonster +.public SubstitutePlaceholderStringTags +.public TYPE_DAMAGE_NEGATING_EXCLUSIVE_ITEM_EFFECTS +.public TryEndPetrifiedOrSleepStatus +.public TryIncreaseHp +.public TryRecruit +.public TrySpawnEnemyItemDrop +.public UpdateAiTargetPos +.public UpdateEntityPixelPos +.public UpdateShopkeeperModeAfterAttack +.public UpdateStatusIconFlags +.public UpdateTrapsVisibility +.public abs .public ov10_022BDC68 .public ov10_022BDE50 .public ov10_022BF964 @@ -95,27 +118,4 @@ .public ov29_02353234 .public ov29_023535D4 .public ov29_0237CA6C -.public PlayEffectAnimationEntity -.public RecruitCheck -.public RemoveHolderForItemInBag -.public RestorePpAllMovesSetFlags -.public RestoreRandomMovePP -.public SET_DAMAGE_STATUS_DAMAGE -.public SetMessageLogPreprocessorArgsNumberVal -.public SetMonsterFlag2 -.public SetPokemonBattled -.public ShouldDisplayEntityWrapper -.public SpawnDroppedItemWrapper .public sub_0204AF00 -.public SubInitMonster -.public SubstitutePlaceholderStringTags -.public TryEndPetrifiedOrSleepStatus -.public TryIncreaseHp -.public TryRecruit -.public TrySpawnEnemyItemDrop -.public TYPE_DAMAGE_NEGATING_EXCLUSIVE_ITEM_EFFECTS -.public UpdateAiTargetPos -.public UpdateEntityPixelPos -.public UpdateShopkeeperModeAfterAttack -.public UpdateStatusIconFlags -.public UpdateTrapsVisibility diff --git a/asm/include/overlay_29_023118D8.inc b/asm/include/overlay_29_023118D8.inc index 048facb6..eac98ebc 100644 --- a/asm/include/overlay_29_023118D8.inc +++ b/asm/include/overlay_29_023118D8.inc @@ -1,5 +1,5 @@ #pragma once -.public AbilityIsActiveVeneer +.public DefenderAbilityIsActive__02311B94 .public EntityIsValid__023118B4 .public ExclusiveItemEffectIsActiveWithLogging .public InflictSleepStatusSingle @@ -7,8 +7,8 @@ .public IsProtectedFromNegativeStatus .public ItemIsActive__02311BF8 .public LogMessageByIdWithPopupCheckUserTarget -.public ov29_022E3E74 -.public ov29_02304A48 .public SafeguardIsActive .public SubstitutePlaceholderStringTags .public TryActivateQuickFeet +.public ov29_022E3E74 +.public ov29_02304A48 diff --git a/asm/include/overlay_29_0232145C.inc b/asm/include/overlay_29_0232145C.inc index 08581034..ecd226c9 100644 --- a/asm/include/overlay_29_0232145C.inc +++ b/asm/include/overlay_29_0232145C.inc @@ -9,6 +9,7 @@ .public BuildMoveTargetList .public CalcStatusDuration .public CanMonsterUseMove +.public DefenderAbilityIsActive__02322D64 .public DungeonRandInt .public EndFrozenClassStatus .public EndLeechSeedClassStatus @@ -24,15 +25,15 @@ .public GetMoveNbStrikes .public GetNaturePowerVariant .public GravityIsActive +.public INTIMIDATOR_ACTIVATION_CHANCE .public InitMove .public InitMoveCheckId -.public INTIMIDATOR_ACTIVATION_CHANCE .public IqSkillIsEnabled .public Is2TurnsMove .public IsChargingTwoTurnMove .public IsFloorOver -.public IsMonster__02322DB8 .public IsMonsterSleeping +.public IsMonster__02322DB8 .public IsTrappingMove .public LogMessageByIdWithPopupCheckUser .public LogMessageWithPopupCheckUser @@ -42,6 +43,30 @@ .public MonsterCannotAttack .public NATURE_POWER_TABLE .public NIGHTMARE_TURN_RANGE +.public ResetTriggerFlags +.public SLEEP_TURN_RANGE +.public SetPreprocessorArgsIdVal +.public SetPreprocessorArgsStringToName +.public StringFromId +.public SubstitutePlaceholderStringTags +.public TryInflictBlinkerStatus +.public TryInflictBurnStatus +.public TryInflictConfusedStatus +.public TryInflictConstrictionStatus +.public TryInflictCringeStatus +.public TryInflictFrozenStatus +.public TryInflictInfatuatedStatus +.public TryInflictInvisibleStatus +.public TryInflictNightmareStatus +.public TryInflictParalysisStatus +.public TryInflictPausedStatus +.public TryInflictPerishSongStatus +.public TryInflictPoisonedStatus +.public TryInflictShadowHoldStatus +.public TryInflictSleepStatus +.public TrySealMove +.public TryWarp +.public UpdateAiTargetPos .public ov10_022BFD6C .public ov10_022C4584 .public ov10_022C4714 @@ -62,28 +87,4 @@ .public ov29_02344B9C .public ov29_0235370C .public ov29_0237CA68 -.public ResetTriggerFlags -.public SetPreprocessorArgsIdVal -.public SetPreprocessorArgsStringToName -.public SLEEP_TURN_RANGE -.public StringFromId .public sub_0201D1B0 -.public SubstitutePlaceholderStringTags -.public TryInflictBlinkerStatus -.public TryInflictBurnStatus -.public TryInflictConfusedStatus -.public TryInflictConstrictionStatus -.public TryInflictCringeStatus -.public TryInflictFrozenStatus -.public TryInflictInfatuatedStatus -.public TryInflictInvisibleStatus -.public TryInflictNightmareStatus -.public TryInflictParalysisStatus -.public TryInflictPausedStatus -.public TryInflictPerishSongStatus -.public TryInflictPoisonedStatus -.public TryInflictShadowHoldStatus -.public TryInflictSleepStatus -.public TrySealMove -.public TryWarp -.public UpdateAiTargetPos diff --git a/asm/include/overlay_29_02332A0C.inc b/asm/include/overlay_29_02332A70.inc similarity index 60% rename from asm/include/overlay_29_02332A0C.inc rename to asm/include/overlay_29_02332A70.inc index 3825ac7e..10ae242b 100644 --- a/asm/include/overlay_29_02332A0C.inc +++ b/asm/include/overlay_29_02332A70.inc @@ -1,18 +1,11 @@ #pragma once -.public AbilityIsActiveVeneer -.public abs .public ApplyDamageAndEffects .public CalcDamage .public CanAttackInDirection -.public CanLayTrap -.public CanSeeTarget -.public CeilFixedPoint -.public Conversion2IsActive -.public DisplayAnimatedNumbers .public DUNGEON_PTR +.public DefenderAbilityIsActive__02332A0C +.public DisplayAnimatedNumbers .public EntityIsValid__0232E840 -.public EntityIsValid__02333FAC -.public GetApparentWeather .public GetDamageSourceWrapper .public GetDirectionTowardsPosition .public GetMessageLogPreprocessorArgs @@ -20,20 +13,12 @@ .public GetMoveCritChance .public GetMovePower .public GetMoveTypeForMonster -.public GetTileAtEntity -.public IsCurrentFixedRoomBossFight -.public IsTileGround .public LogMessageByIdQuietCheckUserTarget .public LogMessageByIdWithPopupCheckUserTarget -.public MirrorMoveIsActive -.public MistIsActive -.public MonsterHasNegativeStatus -.public MonsterHasQuarterHp -.public MonsterIsType .public MoveHitCheck -.public ov10_022C6322 +.public SetPreprocessorArgsStringToName +.public ShouldDisplayEntityWrapper +.public abs .public ov29_022E576C .public ov29_02304A48 .public ov29_0230D088 -.public SetPreprocessorArgsStringToName -.public ShouldDisplayEntityWrapper diff --git a/asm/overlay_29_022F9194.s b/asm/overlay_29_022F9194.s index adb505c8..49512a8f 100644 --- a/asm/overlay_29_022F9194.s +++ b/asm/overlay_29_022F9194.s @@ -428,51 +428,3 @@ _022F96C4: .word WEATHER_BALL_TYPE_TABLE _022F96C8: .word 0x00000C19 #endif arm_func_end TryActivateTraceAndColorChange - - arm_func_start DefenderAbilityIsActive__022F96CC -DefenderAbilityIsActive__022F96CC: ; 0x022F96CC -#ifdef JAPAN - stmdb sp!, {r4, r5, r6, lr} - mov r6, r0 - mov r5, r1 - mov r4, r2 - cmp r6, r5 -#else - stmdb sp!, {r3, r4, r5, r6, r7, lr} - mov r7, r0 - mov r6, r1 - mov r5, r2 - mov r4, r3 - cmp r7, r6 -#endif - beq _022F9710 - bl IsMonster__022F9720 - cmp r0, #0 -#ifdef JAPAN - beq _022F9710 - mov r0, r6 -#else - cmpne r4, #0 - beq _022F9710 - mov r0, r7 -#endif - mov r1, #0x53 - bl AbilityIsActiveVeneer - cmp r0, #0 - movne r0, #0 -#ifdef JAPAN - ldmneia sp!, {r4, r5, r6, pc} -_022F9710: - mov r0, r5 - mov r1, r4 - bl AbilityIsActiveVeneer - ldmia sp!, {r4, r5, r6, pc} -#else - ldmneia sp!, {r3, r4, r5, r6, r7, pc} -_022F9710: - mov r0, r6 - mov r1, r5 - bl AbilityIsActiveVeneer - ldmia sp!, {r3, r4, r5, r6, r7, pc} -#endif - arm_func_end DefenderAbilityIsActive__022F96CC diff --git a/asm/overlay_29_023018AC.s b/asm/overlay_29_023018AC.s index 5e258a51..9729a2ac 100644 --- a/asm/overlay_29_023018AC.s +++ b/asm/overlay_29_023018AC.s @@ -125,51 +125,3 @@ _02301A08: .word 0x00000976 _02301A08: .word 0x00000C37 #endif arm_func_end LeafGuardIsActive - - arm_func_start DefenderAbilityIsActive__02301A0C -DefenderAbilityIsActive__02301A0C: ; 0x02301A0C -#ifdef JAPAN - stmdb sp!, {r4, r5, r6, lr} - mov r6, r0 - mov r5, r1 - mov r4, r2 - cmp r6, r5 -#else - stmdb sp!, {r3, r4, r5, r6, r7, lr} - mov r7, r0 - mov r6, r1 - mov r5, r2 - mov r4, r3 - cmp r7, r6 -#endif - beq _02301A50 - bl IsMonster__02301A60 - cmp r0, #0 -#ifdef JAPAN - beq _02301A50 - mov r0, r6 -#else - cmpne r4, #0 - beq _02301A50 - mov r0, r7 -#endif - mov r1, #0x53 - bl AbilityIsActive - cmp r0, #0 - movne r0, #0 -#ifdef JAPAN - ldmneia sp!, {r4, r5, r6, pc} -_02301A50: - mov r0, r5 - mov r1, r4 - bl AbilityIsActive - ldmia sp!, {r4, r5, r6, pc} -#else - ldmneia sp!, {r3, r4, r5, r6, r7, pc} -_02301A50: - mov r0, r6 - mov r1, r5 - bl AbilityIsActive - ldmia sp!, {r3, r4, r5, r6, r7, pc} -#endif - arm_func_end DefenderAbilityIsActive__02301A0C diff --git a/asm/overlay_29_02308FE0.s b/asm/overlay_29_02308FE0.s index 27ba993a..0564aa0b 100644 --- a/asm/overlay_29_02308FE0.s +++ b/asm/overlay_29_02308FE0.s @@ -3514,51 +3514,3 @@ _0230B3A8: .word 0x02353E40 _0230A938: .word ov10_022C593C _0230A93C: .word ov29_0237CA6C arm_func_end ApplyDamage - - arm_func_start DefenderAbilityIsActive__0230A940 -DefenderAbilityIsActive__0230A940: ; 0x0230A940 -#ifdef JAPAN - stmdb sp!, {r4, r5, r6, lr} - mov r6, r0 - mov r5, r1 - mov r4, r2 - cmp r6, r5 -#else - stmdb sp!, {r3, r4, r5, r6, r7, lr} - mov r7, r0 - mov r6, r1 - mov r5, r2 - mov r4, r3 - cmp r7, r6 -#endif - beq _0230A984 - bl IsMonster__0230A994 - cmp r0, #0 -#ifdef JAPAN - beq _0230A984 - mov r0, r6 -#else - cmpne r4, #0 - beq _0230A984 - mov r0, r7 -#endif - mov r1, #0x53 - bl AbilityIsActiveVeneer - cmp r0, #0 - movne r0, #0 -#ifdef JAPAN - ldmneia sp!, {r4, r5, r6, pc} -_0230A984: - mov r0, r5 - mov r1, r4 - bl AbilityIsActiveVeneer - ldmia sp!, {r4, r5, r6, pc} -#else - ldmneia sp!, {r3, r4, r5, r6, r7, pc} -_0230A984: - mov r0, r6 - mov r1, r5 - bl AbilityIsActiveVeneer - ldmia sp!, {r3, r4, r5, r6, r7, pc} -#endif - arm_func_end DefenderAbilityIsActive__0230A940 diff --git a/asm/overlay_29_023118D8.s b/asm/overlay_29_023118D8.s index 88b9a9a9..c52c0ea8 100644 --- a/asm/overlay_29_023118D8.s +++ b/asm/overlay_29_023118D8.s @@ -216,36 +216,3 @@ _02311B88: .word 0x00000DA6 + IS_PROTECTED_FROM_SLEEP_CLASS_STATUS_OFFSET _02311B8C: .word 0x00000DB1 + IS_PROTECTED_FROM_SLEEP_CLASS_STATUS_OFFSET _02311B90: .word 0x00000DC2 + IS_PROTECTED_FROM_SLEEP_CLASS_STATUS_OFFSET arm_func_end IsProtectedFromSleepClassStatus - - arm_func_start DefenderAbilityIsActive__02311B94 -DefenderAbilityIsActive__02311B94: ; 0x02311B94 - stmdb sp!, {r3, r4, r5, lr} - mov r5, r1 - mov r4, r2 - cmp r0, r5 - beq _02311BE8 - cmp r0, #0 - moveq r1, #0 - beq _02311BC8 - ldr r1, [r0] - cmp r1, #1 - moveq r1, #1 - movne r1, #0 - and r1, r1, #0xff -_02311BC8: - cmp r1, #0 -#ifndef JAPAN - cmpne r3, #0 -#endif - beq _02311BE8 - mov r1, #0x53 - bl AbilityIsActiveVeneer - cmp r0, #0 - movne r0, #0 - ldmneia sp!, {r3, r4, r5, pc} -_02311BE8: - mov r0, r5 - mov r1, r4 - bl AbilityIsActiveVeneer - ldmia sp!, {r3, r4, r5, pc} - arm_func_end DefenderAbilityIsActive__02311B94 diff --git a/asm/overlay_29_0232145C.s b/asm/overlay_29_0232145C.s index 30965885..f30ffef7 100644 --- a/asm/overlay_29_0232145C.s +++ b/asm/overlay_29_0232145C.s @@ -1845,51 +1845,3 @@ _02322D58: .word ov29_0235370C _02322D5C: .word 0x00000EA9 + OV29_02322374_DATA_OFFSET _02322D60: .word 0x000001F6 arm_func_end ov29_02322374 - - arm_func_start DefenderAbilityIsActive__02322D64 -DefenderAbilityIsActive__02322D64: ; 0x02322D64 -#ifdef JAPAN - stmdb sp!, {r4, r5, r6, lr} - mov r6, r0 - mov r5, r1 - mov r4, r2 - cmp r6, r5 -#else - stmdb sp!, {r3, r4, r5, r6, r7, lr} - mov r7, r0 - mov r6, r1 - mov r5, r2 - mov r4, r3 - cmp r7, r6 -#endif - beq _02322DA8 - bl IsMonster__02322DB8 - cmp r0, #0 -#ifdef JAPAN - beq _02322DA8 - mov r0, r6 -#else - cmpne r4, #0 - beq _02322DA8 - mov r0, r7 -#endif - mov r1, #0x53 - bl AbilityIsActiveVeneer - cmp r0, #0 - movne r0, #0 -#ifdef JAPAN - ldmneia sp!, {r4, r5, r6, pc} -_02322DA8: - mov r0, r5 - mov r1, r4 - bl AbilityIsActiveVeneer - ldmia sp!, {r4, r5, r6, pc} -#else - ldmneia sp!, {r3, r4, r5, r6, r7, pc} -_02322DA8: - mov r0, r6 - mov r1, r5 - bl AbilityIsActiveVeneer - ldmia sp!, {r3, r4, r5, r6, r7, pc} -#endif - arm_func_end DefenderAbilityIsActive__02322D64 diff --git a/asm/overlay_29_02332A0C.s b/asm/overlay_29_02332A70.s similarity index 92% rename from asm/overlay_29_02332A0C.s rename to asm/overlay_29_02332A70.s index d507e705..2b44f860 100644 --- a/asm/overlay_29_02332A0C.s +++ b/asm/overlay_29_02332A70.s @@ -1,41 +1,8 @@ .include "asm/macros.inc" - .include "overlay_29_02332A0C.inc" + .include "overlay_29_02332A70.inc" .text - arm_func_start DefenderAbilityIsActive__02332A0C -DefenderAbilityIsActive__02332A0C: ; 0x02332A0C - stmdb sp!, {r3, r4, r5, lr} - mov r5, r1 - mov r4, r2 - cmp r0, r5 - beq _02332A60 - cmp r0, #0 - moveq r1, #0 - beq _02332A40 - ldr r1, [r0] - cmp r1, #1 - moveq r1, #1 - movne r1, #0 - and r1, r1, #0xff -_02332A40: - cmp r1, #0 -#ifndef JAPAN - cmpne r3, #0 -#endif - beq _02332A60 - mov r1, #0x53 - bl AbilityIsActiveVeneer - cmp r0, #0 - movne r0, #0 - ldmneia sp!, {r3, r4, r5, pc} -_02332A60: - mov r0, r5 - mov r1, r4 - bl AbilityIsActiveVeneer - ldmia sp!, {r3, r4, r5, pc} - arm_func_end DefenderAbilityIsActive__02332A0C - arm_func_start DoMoveDamageInlined DoMoveDamageInlined: ; 0x02332A70 stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} diff --git a/include/overlay_29_022F9720.h b/include/overlay_29_022F9720.h index bf61f757..7d53ac6c 100644 --- a/include/overlay_29_022F9720.h +++ b/include/overlay_29_022F9720.h @@ -3,6 +3,12 @@ #include "dungeon_mode.h" +// Checks if a defender has an active ability that isn't disabled by an attacker's Mold Breaker. +#ifdef JAPAN +bool8 DefenderAbilityIsActive__022F96CC(struct entity *attacker, struct entity *defender, enum ability_id ability_id); +#else +bool8 DefenderAbilityIsActive__022F96CC(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled); +#endif // Checks if an entity is a monster (entity type 1). bool8 IsMonster__022F9720(struct entity *entity); diff --git a/include/overlay_29_02301A60.h b/include/overlay_29_02301A60.h index 88bcc5d4..f8d25043 100644 --- a/include/overlay_29_02301A60.h +++ b/include/overlay_29_02301A60.h @@ -3,6 +3,12 @@ #include "dungeon_mode.h" +// Checks if a defender has an active ability that isn't disabled by an attacker's Mold Breaker. +#ifdef JAPAN +bool8 DefenderAbilityIsActive__02301A0C(struct entity *attacker, struct entity *defender, enum ability_id ability_id); +#else +bool8 DefenderAbilityIsActive__02301A0C(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled); +#endif // Checks if an entity is a monster (entity type 1). bool8 IsMonster__02301A60(struct entity *entity); diff --git a/include/overlay_29_0230A994.h b/include/overlay_29_0230A994.h index 51b8068a..0360636e 100644 --- a/include/overlay_29_0230A994.h +++ b/include/overlay_29_0230A994.h @@ -3,6 +3,12 @@ #include "dungeon_mode.h" +// Checks if a defender has an active ability that isn't disabled by an attacker's Mold Breaker. +#ifdef JAPAN +bool8 DefenderAbilityIsActive__0230A940(struct entity *attacker, struct entity *defender, enum ability_id ability_id); +#else +bool8 DefenderAbilityIsActive__0230A940(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled); +#endif // Checks if an entity is a monster (entity type 1). bool8 IsMonster__0230A994(struct entity *entity); // Checks if a monster is a team member under the effects of a certain exclusive item effect. diff --git a/include/overlay_29_02311BF8.h b/include/overlay_29_02311BF8.h index 82978e93..03713217 100644 --- a/include/overlay_29_02311BF8.h +++ b/include/overlay_29_02311BF8.h @@ -3,6 +3,12 @@ #include "dungeon_mode.h" +// Checks if a defender has an active ability that isn't disabled by an attacker's Mold Breaker. +#ifdef JAPAN +bool8 DefenderAbilityIsActive__02311B94(struct entity *attacker, struct entity *defender, enum ability_id ability_id); +#else +bool8 DefenderAbilityIsActive__02311B94(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled); +#endif // Checks if a monster is holding a certain item that isn't disabled by Klutz. bool8 ItemIsActive__02311BF8(struct entity *entity, enum item_id item_id); diff --git a/include/overlay_29_02322DB8.h b/include/overlay_29_02322DB8.h index e6b7268b..1fd5e8e1 100644 --- a/include/overlay_29_02322DB8.h +++ b/include/overlay_29_02322DB8.h @@ -3,6 +3,12 @@ #include "dungeon_mode.h" +// Checks if a defender has an active ability that isn't disabled by an attacker's Mold Breaker. +#ifdef JAPAN +bool8 DefenderAbilityIsActive__02322D64(struct entity *attacker, struct entity *defender, enum ability_id ability_id); +#else +bool8 DefenderAbilityIsActive__02322D64(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled); +#endif // Checks if an entity is a monster (entity type 1). bool8 IsMonster__02322DB8(struct entity *entity); diff --git a/include/overlay_29_023329E8.h b/include/overlay_29_023329E8.h index 2207f7d0..24c31c92 100644 --- a/include/overlay_29_023329E8.h +++ b/include/overlay_29_023329E8.h @@ -5,5 +5,11 @@ // Checks if a monster is a team member under the effects of a certain exclusive item effect. bool8 ExclusiveItemEffectIsActive__023329E8(struct entity *entity, enum exclusive_item_effect_id effect_id); +// Checks if a defender has an active ability that isn't disabled by an attacker's Mold Breaker. +#ifdef JAPAN +bool8 DefenderAbilityIsActive__02332A0C(struct entity *attacker, struct entity *defender, enum ability_id ability_id); +#else +bool8 DefenderAbilityIsActive__02332A0C(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled); +#endif #endif //PMDSKY_OVERLAY_29_023329E8_H diff --git a/main.lsf b/main.lsf index 993fddff..a5983448 100644 --- a/main.lsf +++ b/main.lsf @@ -564,7 +564,7 @@ Overlay OVY_29 Object src/overlay_29_0232E840.o Object asm/overlay_29_0232E864.o Object src/overlay_29_023329E8.o - Object asm/overlay_29_02332A0C.o + Object asm/overlay_29_02332A70.o Object src/move_checks.o Object src/weather.o Object asm/overlay_29_02334D58.o diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index 3c044795..98d28673 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -3,6 +3,7 @@ #include "dungeon_pokemon_attributes.h" #include "dungeon_util_static.h" #include "overlay_29_02308FBC.h" +#include "overlay_29_0230A994.h" #include "overlay_29_02318A4C.h" #include "weather.h" @@ -14,11 +15,6 @@ enum flash_fire_status { FLASH_FIRE_STATUS_NOT_MAXED = 2 }; -#ifdef JAPAN -extern bool8 DefenderAbilityIsActive__0230A940(struct entity *attacker, struct entity *defender, enum ability_id ability_id); -#else -extern bool8 DefenderAbilityIsActive__0230A940(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled); -#endif extern enum flash_fire_status FlashFireShouldActivate(struct entity *attacker, struct entity *defender); extern enum type_matchup GetTypeMatchup(struct entity *attacker, struct entity *defender, s16 target_type_idx, enum type_id attack_type); extern bool8 LevitateIsActive(struct entity* entity); diff --git a/src/overlay_29_022F9720.c b/src/overlay_29_022F9720.c index 3160106e..c95548a3 100644 --- a/src/overlay_29_022F9720.c +++ b/src/overlay_29_022F9720.c @@ -1,6 +1,24 @@ #include "overlay_29_022F9720.h" +#include "dungeon_pokemon_attributes.h" #include "dungeon_util_static.h" +#ifdef JAPAN +bool8 DefenderAbilityIsActive__022F96CC(struct entity *attacker, struct entity *defender, enum ability_id ability_id) +#else +bool8 DefenderAbilityIsActive__022F96CC(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled) +#endif +{ + if (attacker != defender && + IsMonster__022F9720(attacker) && +#ifndef JAPAN + attacker_ability_enabled && +#endif + AbilityIsActiveVeneer(attacker, ABILITY_MOLD_BREAKER)) + return FALSE; + + return AbilityIsActiveVeneer(defender, ability_id); +} + bool8 IsMonster__022F9720(struct entity *entity) { if (entity == NULL) diff --git a/src/overlay_29_02301A60.c b/src/overlay_29_02301A60.c index cbfeea33..6b45510b 100644 --- a/src/overlay_29_02301A60.c +++ b/src/overlay_29_02301A60.c @@ -1,5 +1,23 @@ #include "overlay_29_02301A60.h" #include "dungeon_util_static.h" +#include "dungeon_pokemon_attributes.h" + +#ifdef JAPAN +bool8 DefenderAbilityIsActive__02301A0C(struct entity *attacker, struct entity *defender, enum ability_id ability_id) +#else +bool8 DefenderAbilityIsActive__02301A0C(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled) +#endif +{ + if (attacker != defender && + IsMonster__02301A60(attacker) && +#ifndef JAPAN + attacker_ability_enabled && +#endif + AbilityIsActive(attacker, ABILITY_MOLD_BREAKER)) + return FALSE; + + return AbilityIsActive(defender, ability_id); +} bool8 IsMonster__02301A60(struct entity *entity) { diff --git a/src/overlay_29_0230A994.c b/src/overlay_29_0230A994.c index 3009fd2d..c1d278ad 100644 --- a/src/overlay_29_0230A994.c +++ b/src/overlay_29_0230A994.c @@ -1,7 +1,25 @@ #include "overlay_29_0230A994.h" +#include "dungeon_pokemon_attributes.h" #include "dungeon_util_static.h" #include "exclusive_item.h" +#ifdef JAPAN +bool8 DefenderAbilityIsActive__0230A940(struct entity *attacker, struct entity *defender, enum ability_id ability_id) +#else +bool8 DefenderAbilityIsActive__0230A940(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled) +#endif +{ + if (attacker != defender && + IsMonster__0230A994(attacker) && +#ifndef JAPAN + attacker_ability_enabled && +#endif + AbilityIsActiveVeneer(attacker, ABILITY_MOLD_BREAKER)) + return FALSE; + + return AbilityIsActiveVeneer(defender, ability_id); +} + bool8 IsMonster__0230A994(struct entity *entity) { if (entity == NULL) diff --git a/src/overlay_29_02311BF8.c b/src/overlay_29_02311BF8.c index 6a5224cd..33f1cbeb 100644 --- a/src/overlay_29_02311BF8.c +++ b/src/overlay_29_02311BF8.c @@ -1,6 +1,31 @@ #include "overlay_29_02311BF8.h" #include "dungeon_items.h" #include "dungeon_pokemon_attributes.h" +#include "dungeon_util_static.h" + +#ifdef JAPAN +bool8 DefenderAbilityIsActive__02311B94(struct entity *attacker, struct entity *defender, enum ability_id ability_id) +#else +bool8 DefenderAbilityIsActive__02311B94(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled) +#endif +{ + if (attacker != defender) + { + bool8 is_monster; + if (attacker == NULL) + is_monster = FALSE; + else + is_monster = GetEntityType(attacker) == ENTITY_MONSTER; + if (is_monster && +#ifndef JAPAN + attacker_ability_enabled && +#endif + AbilityIsActiveVeneer(attacker, ABILITY_MOLD_BREAKER)) + return FALSE; + } + + return AbilityIsActiveVeneer(defender, ability_id); +} bool8 ItemIsActive__02311BF8(struct entity *entity, enum item_id item_id) { diff --git a/src/overlay_29_02322DB8.c b/src/overlay_29_02322DB8.c index 3c668291..e903466f 100644 --- a/src/overlay_29_02322DB8.c +++ b/src/overlay_29_02322DB8.c @@ -1,6 +1,24 @@ #include "overlay_29_02322DB8.h" +#include "dungeon_pokemon_attributes.h" #include "dungeon_util_static.h" +#ifdef JAPAN +bool8 DefenderAbilityIsActive__02322D64(struct entity *attacker, struct entity *defender, enum ability_id ability_id) +#else +bool8 DefenderAbilityIsActive__02322D64(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled) +#endif +{ + if (attacker != defender && + IsMonster__02322DB8(attacker) && +#ifndef JAPAN + attacker_ability_enabled && +#endif + AbilityIsActiveVeneer(attacker, ABILITY_MOLD_BREAKER)) + return FALSE; + + return AbilityIsActiveVeneer(defender, ability_id); +} + bool8 IsMonster__02322DB8(struct entity *entity) { if (entity == NULL) diff --git a/src/overlay_29_023329E8.c b/src/overlay_29_023329E8.c index c38a137d..f895b130 100644 --- a/src/overlay_29_023329E8.c +++ b/src/overlay_29_023329E8.c @@ -1,4 +1,5 @@ #include "overlay_29_023329E8.h" +#include "dungeon_pokemon_attributes.h" #include "dungeon_util_static.h" #include "exclusive_item.h" @@ -10,3 +11,27 @@ bool8 ExclusiveItemEffectIsActive__023329E8(struct entity *entity, enum exclusiv return FALSE; } + +#ifdef JAPAN +bool8 DefenderAbilityIsActive__02332A0C(struct entity *attacker, struct entity *defender, enum ability_id ability_id) +#else +bool8 DefenderAbilityIsActive__02332A0C(struct entity *attacker, struct entity *defender, enum ability_id ability_id, bool8 attacker_ability_enabled) +#endif +{ + if (attacker != defender) + { + bool8 is_monster; + if (attacker == NULL) + is_monster = FALSE; + else + is_monster = GetEntityType(attacker) == ENTITY_MONSTER; + if (is_monster && +#ifndef JAPAN + attacker_ability_enabled && +#endif + AbilityIsActiveVeneer(attacker, ABILITY_MOLD_BREAKER)) + return FALSE; + } + + return AbilityIsActiveVeneer(defender, ability_id); +}