sub_806ABAC

This commit is contained in:
DizzyEggg 2024-11-22 13:53:30 +01:00
parent 1de7c500e9
commit d4d2d809dd
6 changed files with 181 additions and 477 deletions

View File

@ -7,458 +7,6 @@
thumb_func_start sub_806A974
sub_806A974:
push {r4,r5,lr}
movs r5, 0
_0806A978:
ldr r0, _0806A9AC
ldr r0, [r0]
lsls r1, r5, 2
ldr r2, _0806A9B0
adds r0, r2
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityExists
lsls r0, 24
cmp r0, 0
beq _0806A99E
ldr r0, [r4, 0x70]
adds r0, 0x46
ldrb r1, [r0]
adds r0, r4, 0
bl sub_806CE68
_0806A99E:
adds r5, 0x1
cmp r5, 0x13
ble _0806A978
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_0806A9AC: .4byte gDungeon
_0806A9B0: .4byte 0x000135cc
thumb_func_end sub_806A974
thumb_func_start sub_806A9B4
sub_806A9B4:
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
bl EntityExists
lsls r0, 24
cmp r0, 0
beq _0806AA02
ldr r0, [r4, 0x70]
movs r1, 0x8C
lsls r1, 1
adds r0, r1
adds r1, r5, 0
bl sub_80935B8
cmp r0, 0
bne _0806A9E0
ldr r0, _0806A9DC
b _0806A9E6
.align 2, 0
_0806A9DC: .4byte gPtrLinkedMovesComeApartMessage
_0806A9E0:
cmp r0, 0x1
bne _0806A9F4
ldr r0, _0806A9F0
_0806A9E6:
ldr r1, [r0]
adds r0, r4, 0
bl LogMessageByIdWithPopupCheckUser
b _0806AA02
.align 2, 0
_0806A9F0: .4byte gPtrLinkMoveOneUseWarningMessage
_0806A9F4:
cmp r0, 0x2
bne _0806AA02
ldr r0, _0806AA08
ldr r1, [r0]
adds r0, r4, 0
bl LogMessageByIdWithPopupCheckUser
_0806AA02:
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_0806AA08: .4byte gPtrLinkMoveTwoUsesWarningMessage
thumb_func_end sub_806A9B4
thumb_func_start sub_806AA0C
sub_806AA0C:
push {r4,r5,lr}
lsls r0, 16
asrs r4, r0, 16
lsls r1, 24
lsrs r5, r1, 24
adds r0, r4, 0
bl IsExclusivePokemonUnlocked
lsls r0, 24
cmp r0, 0
beq _0806AA56
ldr r0, _0806AA5C
ldr r0, [r0]
ldr r1, _0806AA60
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
beq _0806AA40
adds r0, r4, 0
bl GetBaseSpecies
lsls r0, 16
movs r1, 0xCF
lsls r1, 17
cmp r0, r1
beq _0806AA56
_0806AA40:
cmp r4, 0x97
bne _0806AA68
ldr r0, _0806AA5C
ldr r0, [r0]
ldr r1, _0806AA64
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _0806AA56
cmp r5, 0
bne _0806AA68
_0806AA56:
movs r0, 0
b _0806AA6A
.align 2, 0
_0806AA5C: .4byte gDungeon
_0806AA60: .4byte 0x000037fd
_0806AA64: .4byte 0x000037ff
_0806AA68:
movs r0, 0x1
_0806AA6A:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_806AA0C
thumb_func_start sub_806AA70
sub_806AA70:
push {r4-r7,lr}
mov r7, r8
push {r7}
movs r7, 0
ldr r0, _0806AAB4
mov r8, r0
_0806AA7C:
mov r1, r8
ldr r0, [r1]
lsls r1, r7, 2
ldr r2, _0806AAB8
adds r0, r2
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityExists
lsls r0, 24
cmp r0, 0
beq _0806AB12
ldr r0, [r4, 0x70]
ldrb r2, [r0, 0xA]
ldrb r0, [r0, 0x7]
cmp r0, 0
beq _0806AAC4
mov r1, r8
ldr r0, [r1]
ldrb r0, [r0, 0x11]
cmp r0, 0x1
bne _0806AABC
adds r0, r4, 0
bl sub_8042B20
b _0806AB0A
.align 2, 0
_0806AAB4: .4byte gDungeon
_0806AAB8: .4byte 0x0001357c
_0806AABC:
adds r0, r4, 0
bl sub_8042B0C
b _0806AB0A
_0806AAC4:
cmp r2, 0
blt _0806AB12
movs r6, 0
ldr r1, _0806AB24
movs r0, 0x64
muls r0, r2
ldr r2, _0806AB28
adds r0, r2
ldr r1, [r1]
adds r5, r1, r0
mov r1, r8
ldr r0, [r1]
ldrb r0, [r0, 0x11]
cmp r0, 0
bne _0806AB04
movs r2, 0xA
ldrsh r0, [r5, r2]
bl sub_806A564
lsls r0, 24
cmp r0, 0
bne _0806AB04
movs r1, 0xA
ldrsh r0, [r5, r1]
bl sub_806A58C
lsls r0, 24
cmp r0, 0
beq _0806AB00
movs r6, 0x1
_0806AB00:
cmp r6, 0
beq _0806AB12
_0806AB04:
adds r0, r4, 0
bl sub_8042B0C
_0806AB0A:
adds r1, r4, 0
adds r1, 0x20
movs r0, 0
strb r0, [r1]
_0806AB12:
adds r7, 0x1
cmp r7, 0x3
ble _0806AA7C
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_0806AB24: .4byte gRecruitedPokemonRef
_0806AB28: .4byte 0x00008df8
thumb_func_end sub_806AA70
thumb_func_start sub_806AB2C
sub_806AB2C:
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
movs r4, 0
ldr r0, _0806ABA4
mov r9, r0
_0806AB3A:
mov r1, r9
ldr r0, [r1]
lsls r1, r4, 2
ldr r2, _0806ABA8
adds r0, r2
adds r0, r1
ldr r7, [r0]
adds r0, r7, 0
bl EntityExists
lsls r0, 24
adds r4, 0x1
mov r8, r4
cmp r0, 0
beq _0806AB92
ldr r5, [r7, 0x70]
movs r6, 0
_0806AB5C:
mov r1, r9
ldr r0, [r1]
lsls r1, r6, 2
ldr r2, _0806ABA8
adds r0, r2
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityExists
lsls r0, 24
cmp r0, 0
beq _0806AB8C
cmp r7, r4
beq _0806AB8C
adds r0, r5, 0
adds r0, 0x7C
ldrh r0, [r0]
ldrh r1, [r4, 0x26]
cmp r0, r1
bne _0806AB8C
adds r0, r5, 0
adds r0, 0x80
str r4, [r0]
_0806AB8C:
adds r6, 0x1
cmp r6, 0x13
ble _0806AB5C
_0806AB92:
mov r4, r8
cmp r4, 0x13
ble _0806AB3A
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_0806ABA4: .4byte gDungeon
_0806ABA8: .4byte 0x000135cc
thumb_func_end sub_806AB2C
thumb_func_start sub_806ABAC
sub_806ABAC:
push {r4-r6,lr}
adds r6, r0, 0
adds r4, r1, 0
ldr r5, [r4, 0x70]
adds r0, r4, 0
movs r1, 0x16
bl HasAbility
lsls r0, 24
cmp r0, 0
beq _0806ABD4
adds r0, r5, 0
adds r0, 0xAC
ldrb r0, [r0]
cmp r0, 0x4
bne _0806ABD4
adds r0, r6, 0
adds r1, r4, 0
bl EndBurnClassStatus
_0806ABD4:
adds r0, r4, 0
movs r1, 0x40
bl HasAbility
lsls r0, 24
cmp r0, 0
beq _0806ABF4
adds r0, r5, 0
adds r0, 0xBC
ldrb r0, [r0]
cmp r0, 0x2
bne _0806ABF4
adds r0, r6, 0
adds r1, r4, 0
bl EndCringeClassStatus
_0806ABF4:
adds r0, r4, 0
movs r1, 0x42
bl HasAbility
lsls r0, 24
cmp r0, 0
beq _0806AC14
adds r0, r5, 0
adds r0, 0xAC
ldrb r0, [r0]
cmp r0, 0x1
bne _0806AC14
adds r0, r6, 0
adds r1, r4, 0
bl EndBurnClassStatus
_0806AC14:
adds r0, r4, 0
movs r1, 0x29
bl HasAbility
lsls r0, 24
cmp r0, 0
beq _0806AC34
adds r0, r5, 0
adds r0, 0xBC
ldrb r0, [r0]
cmp r0, 0x7
bne _0806AC34
adds r0, r6, 0
adds r1, r4, 0
bl EndCringeClassStatus
_0806AC34:
adds r0, r4, 0
movs r1, 0x36
bl HasAbility
lsls r0, 24
cmp r0, 0
bne _0806AC50
adds r0, r4, 0
movs r1, 0x49
bl HasAbility
lsls r0, 24
cmp r0, 0
beq _0806AC72
_0806AC50:
adds r0, r4, 0
bl IsSleeping
lsls r0, 24
cmp r0, 0
bne _0806AC66
adds r0, r5, 0
adds r0, 0xA8
ldrb r0, [r0]
cmp r0, 0x4
bne _0806AC72
_0806AC66:
adds r0, r6, 0
adds r1, r4, 0
movs r2, 0
movs r3, 0x1
bl EndSleepClassStatus
_0806AC72:
adds r0, r4, 0
movs r1, 0x41
bl HasAbility
lsls r0, 24
cmp r0, 0
beq _0806AC92
adds r0, r5, 0
adds r0, 0xB0
ldrb r0, [r0]
cmp r0, 0x1
bne _0806AC92
adds r0, r6, 0
adds r1, r4, 0
bl EndFrozenClassStatus
_0806AC92:
adds r0, r4, 0
movs r1, 0x45
bl HasAbility
lsls r0, 24
cmp r0, 0
beq _0806ACB8
adds r0, r5, 0
adds r0, 0xAC
ldrb r0, [r0]
subs r0, 0x2
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bhi _0806ACB8
adds r0, r6, 0
adds r1, r4, 0
bl EndBurnClassStatus
_0806ACB8:
adds r0, r4, 0
movs r1, 0x25
bl HasAbility
lsls r0, 24
cmp r0, 0
beq _0806ACE0
adds r1, r5, 0
adds r1, 0xF6
movs r0, 0
strb r0, [r1]
adds r0, r5, 0
adds r0, 0xC4
ldrb r0, [r0]
cmp r0, 0xC
bne _0806ACE0
adds r0, r6, 0
adds r1, r4, 0
bl EndReflectClassStatus
_0806ACE0:
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_806ABAC
thumb_func_start sub_806ACE8
sub_806ACE8:
push {r4,r5,lr}

View File

@ -91,6 +91,9 @@ typedef struct BurnClassStatus
/* 0x3 */ u8 unk4;
} BurnClassStatus;
// Useful when checking if a mon is poisoned without having to check for Poison and Bad Poison every time.
#define ENTITY_POISIONED(entityInfo)((entityInfo->burnClassStatus.status == STATUS_POISONED || entityInfo->burnClassStatus.status == STATUS_BADLY_POISONED))
// size: 0xC
typedef struct FrozenClassStatus
{

View File

@ -547,11 +547,10 @@ void CheriBerryItemAction(Entity *pokemon, Entity *target)
void PechaBerryItemAction(Entity *pokemon, Entity *target)
{
EntityInfo *entInfo = GetEntInfo(target);
if(entInfo->burnClassStatus.status == STATUS_POISONED || entInfo->burnClassStatus.status == STATUS_BADLY_POISONED)
if (ENTITY_POISIONED(entInfo))
EndBurnClassStatus(pokemon, target);
else
// Pointer to "But nothing happened!"
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80F89F4);
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80F89F4); // Pointer to "But nothing happened!"
}
void WarpSeedItemAction(Entity *pokemon, Entity *target)

View File

@ -20,6 +20,18 @@
#include "structs/str_dungeon.h"
#include "text_util.h"
#include "weather.h"
#include "file_system.h"
#include "tile_types.h"
#include "position_util.h"
#include "exclusive_pokemon.h"
#include "number_util.h"
#include "pokemon_3.h"
#include "code_8077274_1.h"
#include "code_806CD90.h"
#include "dungeon_capabilities.h"
#include "status_checks_1.h"
#include "dungeon_ai_movement.h"
#include "constants/iq_skill.h"
struct unkStruct_80F520C
{
@ -38,7 +50,7 @@ extern u8 *gUnknown_80FDCC8[];
extern void sub_8042900(Entity *r0);
extern void sub_8042968(Entity *r0);
extern void sub_806ABAC(Entity *, Entity *);
extern void EndAbilityImmuneStatus(Entity *, Entity *);
void sub_8041BBC(Entity *r0);
extern bool8 sub_8045888(Entity *);
extern void sub_806A2BC(Entity *, u8);
@ -155,7 +167,7 @@ void sub_8069F9C(Entity *pokemon, Entity *target, Move *move)
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0);
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FCC7C);
sub_8042900(target);
sub_806ABAC(pokemon, target);
EndAbilityImmuneStatus(pokemon, target);
}
}
}
@ -308,20 +320,6 @@ void sub_806A390(Entity *pokemon)
}
}
// New file?
#include "file_system.h"
#include "tile_types.h"
#include "position_util.h"
#include "number_util.h"
#include "pokemon_3.h"
#include "code_8077274_1.h"
#include "code_806CD90.h"
#include "dungeon_capabilities.h"
#include "status_checks_1.h"
#include "dungeon_ai_movement.h"
#include "constants/iq_skill.h"
extern void EntityUpdateStatusSprites(Entity *);
extern s32 sub_808F700(PokemonStruct1 *pokemon);
extern Entity *sub_80696A8(Entity *a0);
@ -505,6 +503,9 @@ bool8 sub_806A5A4(s16 r0)
extern const u8 *const gUnknown_80FD594;
extern const u8 *const gUnknown_80FD5B8;
extern const u8 *const gUnknown_80FEAC4;
extern const u8 *const gPtrLinkMoveTwoUsesWarningMessage;
extern const u8 *const gPtrLinkMoveOneUseWarningMessage;
extern const u8 *const gPtrLinkedMovesComeApartMessage;
void sub_806A5B8(Entity *entity)
{
@ -683,3 +684,157 @@ void sub_806A914(bool8 a0, bool8 a1, bool8 showRunAwayEffect)
}
}
}
void sub_806A974(void)
{
s32 i;
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *entity = gDungeon->activePokemon[i];
if (EntityExists(entity)) {
EntityInfo *info = GetEntInfo(entity);
sub_806CE68(entity, info->action.direction);
}
}
}
void sub_806A9B4(Entity *entity, s32 moveIndex)
{
if (EntityExists(entity)) {
EntityInfo *info = GetEntInfo(entity);
s32 ret = sub_80935B8(info->moves.moves, moveIndex);
if (ret == 0) {
LogMessageByIdWithPopupCheckUser(entity, gPtrLinkedMovesComeApartMessage);
}
else if (ret == 1) {
LogMessageByIdWithPopupCheckUser(entity, gPtrLinkMoveOneUseWarningMessage);
}
else if (ret == 2) {
LogMessageByIdWithPopupCheckUser(entity, gPtrLinkMoveTwoUsesWarningMessage);
}
}
}
// s16 again...
bool8 sub_806AA0C(s16 _species, bool32 _a1)
{
s32 species = _species;
bool8 a1 = _a1;
if (!IsExclusivePokemonUnlocked(_species))
return FALSE;
if (gDungeon->unk37FD && GetBaseSpecies(species) == MONSTER_DEOXYS_NORMAL)
return FALSE;
if (species == MONSTER_MEW) {
if (gDungeon->unk37FF || !a1)
return FALSE;
}
return TRUE;
}
extern void sub_8042B20(Entity *entity);
extern void sub_8042B0C(Entity *entity);
void sub_806AA70(void)
{
s32 i;
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
Entity *entity = gDungeon->teamPokemon[i];
if (EntityExists(entity)) {
EntityInfo *info = GetEntInfo(entity);
s32 teamIndex = info->teamIndex;
if (info->isTeamLeader) {
if (gDungeon->unk11 == 1) {
sub_8042B20(entity);
}
else {
sub_8042B0C(entity);
}
entity->isVisible = FALSE;
}
else {
if (teamIndex >= 0) {
bool8 unkBool = FALSE;
PokemonStruct2 *monStruct2Ptr = &gRecruitedPokemonRef->pokemon2[teamIndex];
if (gDungeon->unk11)
unkBool = TRUE;
else if (sub_806A564(monStruct2Ptr->unkA))
unkBool = TRUE;
else if (sub_806A58C(monStruct2Ptr->unkA))
unkBool = TRUE;
if (unkBool) {
sub_8042B0C(entity);
entity->isVisible = FALSE;
}
}
}
}
}
}
void sub_806AB2C(void)
{
s32 i, j;
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *entity1 = gDungeon->activePokemon[i];
if (EntityExists(entity1)) {
EntityInfo *info1 = GetEntInfo(entity1);
for (j = 0; j < DUNGEON_MAX_POKEMON; j++) {
Entity *entity2 = gDungeon->activePokemon[j];
if (EntityExists(entity2) && entity1 != entity2 && info1->aiTarget.aiTargetSpawnGenID == entity2->spawnGenID) {
info1->aiTarget.aiTarget = entity2;
}
}
}
}
}
void EndAbilityImmuneStatus(Entity *attacker, Entity *target)
{
EntityInfo *targetInfo = GetEntInfo(target);
if (HasAbility(target, ABILITY_LIMBER) && targetInfo->burnClassStatus.status == STATUS_PARALYSIS) {
EndBurnClassStatus(attacker, target);
}
if (HasAbility(target, ABILITY_OWN_TEMPO) && targetInfo->cringeClassStatus.status == STATUS_CONFUSED) {
EndCringeClassStatus(attacker, target);
}
if (HasAbility(target, ABILITY_WATER_VEIL) && targetInfo->burnClassStatus.status == STATUS_BURN) {
EndBurnClassStatus(attacker, target);
}
if (HasAbility(target, ABILITY_OBLIVIOUS) && targetInfo->cringeClassStatus.status == STATUS_INFATUATED) {
EndCringeClassStatus(attacker, target);
}
if ((HasAbility(target, ABILITY_INSOMNIA) || HasAbility(target, ABILITY_VITAL_SPIRIT))
&& (IsSleeping(target) || targetInfo->sleepClassStatus.status == STATUS_YAWNING))
{
EndSleepClassStatus(attacker, target, FALSE, TRUE);
}
if (HasAbility(target, ABILITY_MAGMA_ARMOR) && targetInfo->frozenClassStatus.status == STATUS_FROZEN) {
EndFrozenClassStatus(attacker, target);
}
if (HasAbility(target, ABILITY_IMMUNITY) && ENTITY_POISIONED(targetInfo)) {
EndBurnClassStatus(attacker, target);
}
if (HasAbility(target, ABILITY_FORECAST)) {
targetInfo->isColorChanged = FALSE;
if (targetInfo->reflectClassStatus.status == STATUS_CONVERSION2) {
EndReflectClassStatus(attacker, target);
}
}
}

View File

@ -250,8 +250,7 @@ u32 GetAIUseItemProbability(Entity *targetPokemon, Item *item, u32 itemTargetFla
}
break;
case ITEM_PECHA_BERRY:
if (pokemonInfo->burnClassStatus.status != STATUS_POISONED &&
pokemonInfo->burnClassStatus.status != STATUS_BADLY_POISONED)
if (!ENTITY_POISIONED(pokemonInfo))
{
return 0;
}

View File

@ -191,7 +191,7 @@ extern void MudWaterSportEffect(u32);
extern void CalcDamage(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32);
extern void sub_806A6E8(Entity *);
extern void sub_806ABAC(Entity *, Entity *);
extern void EndAbilityImmuneStatus(Entity *, Entity *);
extern u8 sub_806F4A4(Entity *, u32);
extern void sub_807DF38(Entity *pokemon, Entity *target, DungeonPos *pos, u32,
u8 moveType, s16);
@ -1639,8 +1639,8 @@ bool8 SkillSwapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param
if (pokeEntityData->expMultiplier == EXP_HALVED) {
pokeEntityData->expMultiplier = EXP_REGULAR;
}
sub_806ABAC(pokemon,pokemon);
sub_806ABAC(pokemon,target);
EndAbilityImmuneStatus(pokemon,pokemon);
EndAbilityImmuneStatus(pokemon,target);
flag = TRUE;
}
return flag;
@ -2409,7 +2409,7 @@ bool8 RolePlayMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_
gDungeon->unkC = 1;
SetExpMultplier(entityInfo);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC81C);
sub_806ABAC(pokemon, pokemon);
EndAbilityImmuneStatus(pokemon, pokemon);
return TRUE;
}
}