Decomped ScrappyShouldActivate

This commit is contained in:
AnonymousRandomPerson 2025-09-21 22:24:41 -04:00
parent 8cefad5398
commit f303fbba9d
9 changed files with 87 additions and 89 deletions

View File

@ -1,11 +1,12 @@
#pragma once
.public AFTERMATH_CHANCE
.public AbilityIsActiveVeneer
.public DUNGEON_PTR
.public DefenderAbilityIsActive__0230A940
.public DungeonRandOutcome__022EAB20
.public ExclusiveItemEffectIsActive__0230A9B8
.public GetTypeMatchup
.public GhostImmunityIsActive
.public IsTypeIneffectiveAgainstGhost
.public ScrappyShouldActivate
.public TYPE_MATCHUP_COMBINATOR_TABLE
.public TryAftermathExplosion
.public ov29_02352838

View File

@ -0,0 +1,2 @@
#pragma once
.public ExclusiveItemEffectIsActive__0230A9B8

View File

@ -102,88 +102,3 @@ _0230AB4C: .word ov29_02352838
_0230AB50: .word DUNGEON_PTR
_0230AB54: .word TYPE_MATCHUP_COMBINATOR_TABLE
arm_func_end GetTypeMatchupBothTypes
arm_func_start ScrappyShouldActivate
ScrappyShouldActivate: ; 0x0230AB58
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}
mov r6, #0
mov sl, r0
mov sb, r1
mov r8, r2
mov r5, #0x57
mov fp, r6
mov r4, #1
b _0230ABDC
_0230AB7C:
mov r0, sl
mov r1, r5
ldr r7, [sb, #0xb4]
bl AbilityIsActiveVeneer
cmp r0, #0
beq _0230ABB4
add r0, r7, r6
ldrb r0, [r0, #0x5e]
cmp r0, #0xe
bne _0230ABB4
cmp r8, #1
cmpne r8, #7
moveq r0, r4
beq _0230ABB8
_0230ABB4:
mov r0, fp
_0230ABB8:
cmp r0, #0
ldrne r1, _0230ABEC ; =DUNGEON_PTR
movne r0, #1
ldrne r1, [r1]
strneb r0, [r1, #0x1cc]
ldmneia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
add r0, r6, #1
mov r0, r0, lsl #0x10
mov r6, r0, asr #0x10
_0230ABDC:
cmp r6, #2
blt _0230AB7C
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
.align 2, 0
_0230ABEC: .word DUNGEON_PTR
arm_func_end ScrappyShouldActivate
arm_func_start IsTypeIneffectiveAgainstGhost
IsTypeIneffectiveAgainstGhost: ; 0x0230ABF0
cmp r0, #1
cmpne r0, #7
moveq r0, #1
movne r0, #0
bx lr
arm_func_end IsTypeIneffectiveAgainstGhost
arm_func_start GhostImmunityIsActive
GhostImmunityIsActive: ; 0x0230AC04
stmdb sp!, {r3, lr}
ldr r3, [r1, #0xb4]
add r1, r3, r2
ldrb r1, [r1, #0x5e]
cmp r1, #0xe
bne _0230AC50
ldrb r1, [r3, #0xfe]
cmp r1, #0
bne _0230AC38
mov r1, #0x45
bl ExclusiveItemEffectIsActive__0230A9B8
cmp r0, #0
beq _0230AC40
_0230AC38:
mov r0, #1
b _0230AC44
_0230AC40:
mov r0, #0
_0230AC44:
cmp r0, #0
moveq r0, #1
ldmeqia sp!, {r3, pc}
_0230AC50:
mov r0, #0
ldmia sp!, {r3, pc}
arm_func_end GhostImmunityIsActive

42
asm/overlay_29_0230ABF0.s Normal file
View File

@ -0,0 +1,42 @@
.include "asm/macros.inc"
.include "overlay_29_0230ABF0.inc"
.text
arm_func_start IsTypeIneffectiveAgainstGhost
IsTypeIneffectiveAgainstGhost: ; 0x0230ABF0
cmp r0, #1
cmpne r0, #7
moveq r0, #1
movne r0, #0
bx lr
arm_func_end IsTypeIneffectiveAgainstGhost
arm_func_start GhostImmunityIsActive
GhostImmunityIsActive: ; 0x0230AC04
stmdb sp!, {r3, lr}
ldr r3, [r1, #0xb4]
add r1, r3, r2
ldrb r1, [r1, #0x5e]
cmp r1, #0xe
bne _0230AC50
ldrb r1, [r3, #0xfe]
cmp r1, #0
bne _0230AC38
mov r1, #0x45
bl ExclusiveItemEffectIsActive__0230A9B8
cmp r0, #0
beq _0230AC40
_0230AC38:
mov r0, #1
b _0230AC44
_0230AC40:
mov r0, #0
_0230AC44:
cmp r0, #0
moveq r0, #1
ldmeqia sp!, {r3, pc}
_0230AC50:
mov r0, #0
ldmia sp!, {r3, pc}
arm_func_end GhostImmunityIsActive

View File

@ -3,6 +3,7 @@
#include "dungeon_mode.h"
// Checks if a monster is levitating (has the effect of Levitate and Gravity is not active).
bool8 LevitateIsActive(struct entity* entity);
// Checks if a monster is a given type.
bool8 MonsterIsType(struct entity *entity, enum type_id type_id);

View File

@ -0,0 +1,10 @@
#ifndef PMDSKY_OVERLAY_29_0230AB58_H
#define PMDSKY_OVERLAY_29_0230AB58_H
#include "dungeon_mode.h"
// Checks whether Scrappy should activate.
// Scrappy activates when the ability is active on the attacker, the move type is Normal or Fighting, and the defender is a Ghost type.
bool8 ScrappyShouldActivate(struct entity *attacker, struct entity *defender, enum type_id attack_type);
#endif //PMDSKY_OVERLAY_29_0230AB58_H

View File

@ -478,6 +478,8 @@ Overlay OVY_29
Object src/overlay_29_0230A994.o
Object src/overlay_29_0230A9DC.o
Object asm/overlay_29_0230AA0C.o
Object src/overlay_29_0230AB58.o
Object asm/overlay_29_0230ABF0.o
Object src/type_effectiveness.o
Object asm/overlay_29_0230AD04.o
Object src/dungeon_damage.o

View File

@ -5,14 +5,13 @@
#include "move_orb_effects.h"
#include "overlay_29_02308FBC.h"
#include "overlay_29_0230A994.h"
#include "overlay_29_0230AB58.h"
#include "overlay_29_02318A4C.h"
#include "type_effectiveness.h"
#include "weather.h"
#define NUM_EFFECTIVENESS 4
extern bool8 ScrappyShouldActivate(struct entity *attacker, struct entity *defender, enum type_id attack_type);
s32 WeightWeakTypePicker(struct entity *user, struct entity *target, enum type_id move_type)
{
s32 weight = 1;

26
src/overlay_29_0230AB58.c Normal file
View File

@ -0,0 +1,26 @@
#include "overlay_29_0230AB58.h"
#include "dungeon.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util_static.h"
bool8 ScrappyShouldActivate(struct entity *attacker, struct entity *defender, enum type_id attack_type)
{
for (s16 i = 0; i < 2; i++)
{
bool8 scrappy_should_activate;
struct monster *defender_monster = GetEntInfo(defender);
if (AbilityIsActiveVeneer(attacker, ABILITY_SCRAPPY) &&
defender_monster->types[i] == TYPE_GHOST &&
(attack_type == TYPE_NORMAL || attack_type == TYPE_FIGHTING))
scrappy_should_activate = TRUE;
else
scrappy_should_activate = FALSE;
if (scrappy_should_activate)
{
DUNGEON_PTR[0]->last_damage_calc.scrappy_activated = TRUE;
return TRUE;
}
}
return FALSE;
}