mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-23 05:00:12 +00:00
commit
05436da63b
@ -6018,7 +6018,7 @@ _08055790:
|
||||
adds r1, r4, 0
|
||||
mov r2, r8
|
||||
mov r3, r10
|
||||
bl sub_806D010
|
||||
bl HandleDealingDamage
|
||||
b _08055826
|
||||
.align 2, 0
|
||||
_080557AC: .4byte gDungeon
|
||||
@ -6139,7 +6139,7 @@ sub_8055864:
|
||||
adds r1, r7, 0
|
||||
add r2, sp, 0x10
|
||||
movs r3, 0
|
||||
bl sub_806D010
|
||||
bl HandleDealingDamage
|
||||
add r0, sp, 0x10
|
||||
ldrb r0, [r0, 0xF]
|
||||
cmp r0, 0
|
||||
@ -8611,7 +8611,7 @@ _08056C5A:
|
||||
bl GetMoveType
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl sub_8092354
|
||||
bl IsTypePhysical
|
||||
movs r1, 0
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
|
2123
asm/code_806CD90.s
2123
asm/code_806CD90.s
File diff suppressed because it is too large
Load Diff
@ -33,7 +33,7 @@ sub_806EAF4:
|
||||
ldr r1, [r1, 0x70]
|
||||
str r1, [sp, 0x7C]
|
||||
adds r0, r2, 0
|
||||
bl sub_8092354
|
||||
bl IsTypePhysical
|
||||
movs r2, 0
|
||||
str r2, [sp, 0x80]
|
||||
lsls r0, 24
|
||||
@ -1030,7 +1030,7 @@ DealDamageToEntity:
|
||||
add r0, sp, 0x10
|
||||
mov r1, r8
|
||||
movs r3, 0
|
||||
bl sub_806D010
|
||||
bl HandleDealingDamage
|
||||
add sp, 0x94
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
@ -1138,7 +1138,7 @@ _0806F414:
|
||||
adds r1, r7, 0
|
||||
add r2, sp, 0x10
|
||||
movs r3, 0
|
||||
bl sub_806D010
|
||||
bl HandleDealingDamage
|
||||
ldr r0, [sp, 0x4C]
|
||||
cmp r0, 0
|
||||
beq _0806F440
|
||||
|
@ -41,8 +41,8 @@ gUnknown_810AC6A: @ 810AC6A
|
||||
.byte 0x10
|
||||
.byte 0x05
|
||||
|
||||
.global gUnknown_810AC7C
|
||||
gUnknown_810AC7C: @ 810AC7C
|
||||
.global gIsTypePhysicalTable
|
||||
gIsTypePhysicalTable: @ 810AC7C
|
||||
.byte 0x01
|
||||
.byte 0x01
|
||||
.byte 0x00
|
||||
|
8
include/code_8041AD0.h
Normal file
8
include/code_8041AD0.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef GUARD_CODE_8041AD0_H
|
||||
#define GUARD_CODE_8041AD0_H
|
||||
|
||||
#include "structs/str_damage.h"
|
||||
|
||||
void sub_80420E8(Entity *pokemon, struct DamageStruct *dmgStruct);
|
||||
|
||||
#endif
|
25
include/code_8069D4C.h
Normal file
25
include/code_8069D4C.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef GUARD_CODE_8069D4C_H
|
||||
#define GUARD_CODE_8069D4C_H
|
||||
|
||||
struct unkStruct_8069D4C
|
||||
{
|
||||
s16 id;
|
||||
Position pos;
|
||||
s16 HP;
|
||||
u8 atk;
|
||||
u8 spAtk;
|
||||
u8 def;
|
||||
u8 spDef;
|
||||
u16 level;
|
||||
u32 exp;
|
||||
FixedPoint belly;
|
||||
FixedPoint maxBelly;
|
||||
Item heldItem;
|
||||
Move moves[MAX_MON_MOVES];
|
||||
u32 unk40; // strugglemoveFlags?
|
||||
HiddenPower hiddenPower;
|
||||
};
|
||||
|
||||
void sub_8069D4C(struct unkStruct_8069D4C *r0, Entity *target);
|
||||
|
||||
#endif
|
@ -30,4 +30,4 @@ enum IQSkillID
|
||||
NUM_IQ_SKILLS
|
||||
};
|
||||
|
||||
#endif // GUARD_CONSTANTS_IQ_SKILL_H
|
||||
#endif // GUARD_CONSTANTS_IQ_SKILL_H
|
||||
|
@ -60,4 +60,4 @@ enum TargetingFlag
|
||||
TARGETING_FLAG_EXPOSE = 0x600,
|
||||
};
|
||||
|
||||
#endif // GUARD_CONSTANTS_MOVE_H
|
||||
#endif // GUARD_CONSTANTS_MOVE_H
|
||||
|
@ -225,7 +225,7 @@ typedef struct EntityInfo
|
||||
u8 fill95[0x98 - 0x95];
|
||||
/* 0x98 */ u32 unk98;
|
||||
/* 0x9C */ u32 unk9C;
|
||||
/* 0xA0 */ u32 unkA0;
|
||||
/* 0xA0 */ s32 unkA0;
|
||||
/* 0xA4 */ u8 clientType;
|
||||
u8 fillA5[0xA8 - 0xA5];
|
||||
// Statuses are split into groups based on which ones can't overlap.
|
||||
@ -413,4 +413,9 @@ enum VisualFlag
|
||||
VISUAL_FLAG_RUN_AWAY = 2
|
||||
};
|
||||
|
||||
static inline EntityInfo *GetEntInfo(Entity *ent)
|
||||
{
|
||||
return ent->info;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
15
include/structs/str_damage.h
Normal file
15
include/structs/str_damage.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef GUARD_STR_DAMAGE_H
|
||||
#define GUARD_STR_DAMAGE_H
|
||||
|
||||
struct DamageStruct
|
||||
{
|
||||
s32 dmg;
|
||||
s32 residualDmgType;
|
||||
u32 typeEffectiveness;
|
||||
u8 type;
|
||||
bool8 isCrit;
|
||||
u8 unkE;
|
||||
u8 unkF;
|
||||
};
|
||||
|
||||
#endif
|
@ -7,7 +7,7 @@ void CopyStringtoBuffer(u8 *buffer, u8 *string);
|
||||
void BoundedCopyStringtoBuffer(u8 *buffer, u8 *string, s32 size);
|
||||
const char *GetUnformattedTypeString(u8 type);
|
||||
const char * GetFormattedTypeString(u8 type);
|
||||
u8 sub_8092354(u8 index);
|
||||
u8 IsTypePhysical(u8 index);
|
||||
u8 sub_8092364(u8 index);
|
||||
void CopyAbilityNametoBuffer(char *buffer, u8 index);
|
||||
u8 *GetAbilityDescription(u8 index);
|
||||
|
@ -253,7 +253,6 @@ SECTIONS {
|
||||
src/code_8069E0C.o(.text);
|
||||
asm/code_8069E0C.o(.text);
|
||||
src/code_806CD90.o(.text);
|
||||
asm/code_806CD90.o(.text);
|
||||
src/type_effectiveness.o(.text);
|
||||
src/code_806E8B0.o(.text);
|
||||
asm/code_806E8B0.o(.text);
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "code_803E46C.h"
|
||||
#include "code_804267C.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "code_8041AD0.h"
|
||||
#include "type_chart.h"
|
||||
#include "constants/direction.h"
|
||||
#include "constants/status.h"
|
||||
#include "constants/type.h"
|
||||
@ -12,14 +14,6 @@
|
||||
#include "structs/dungeon_entity.h"
|
||||
#include "structs/str_dungeon.h"
|
||||
|
||||
// size: 0xC
|
||||
struct unkStruct_80420E8
|
||||
{
|
||||
u32 unk0;
|
||||
u32 unk4;
|
||||
u32 unk8;
|
||||
};
|
||||
|
||||
// size: 0x1C
|
||||
typedef struct unkStruct_80416E0
|
||||
{
|
||||
@ -823,26 +817,26 @@ void nullsub_92(Entity *pokemon)
|
||||
{
|
||||
}
|
||||
|
||||
void sub_80420E8(Entity *pokemon, struct unkStruct_80420E8 *r1)
|
||||
void sub_80420E8(Entity *pokemon, struct DamageStruct *dmgStruct)
|
||||
{
|
||||
u32 temp;
|
||||
u32 typeEffectiveness;
|
||||
u32 arg;
|
||||
temp = r1->unk8;
|
||||
typeEffectiveness = dmgStruct->typeEffectiveness;
|
||||
if(gDungeon->unk16D != 0)
|
||||
temp = sub_806F62C(r1->unk8);
|
||||
switch(temp)
|
||||
typeEffectiveness = sub_806F62C(dmgStruct->typeEffectiveness);
|
||||
switch(typeEffectiveness)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
case EFFECTIVENESS_IMMUNE:
|
||||
arg = 8;
|
||||
break;
|
||||
case 1:
|
||||
case EFFECTIVENESS_RESIST:
|
||||
arg = 9;
|
||||
break;
|
||||
case 2:
|
||||
case EFFECTIVENESS_NEUTRAL:
|
||||
arg = 10;
|
||||
break;
|
||||
case 3:
|
||||
case EFFECTIVENESS_SUPER:
|
||||
arg = 11;
|
||||
break;
|
||||
}
|
||||
|
@ -1,25 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "pokemon_mid.h"
|
||||
#include "dungeon_util.h"
|
||||
|
||||
struct unkStruct_8069D4C
|
||||
{
|
||||
s16 id;
|
||||
Position pos;
|
||||
s16 HP;
|
||||
u8 atk;
|
||||
u8 spAtk;
|
||||
u8 def;
|
||||
u8 spDef;
|
||||
u16 level;
|
||||
u32 exp;
|
||||
FixedPoint belly;
|
||||
FixedPoint maxBelly;
|
||||
Item heldItem;
|
||||
Move moves[MAX_MON_MOVES];
|
||||
u32 unk40; // strugglemoveFlags?
|
||||
HiddenPower hiddenPower;
|
||||
};
|
||||
#include "code_8069D4C.h"
|
||||
|
||||
u32 sub_8069D18(Position *pos,Entity *entity)
|
||||
{
|
||||
|
@ -1,17 +1,45 @@
|
||||
#include "global.h"
|
||||
#include "code_806CD90.h"
|
||||
|
||||
#include "code_803E46C.h"
|
||||
#include "code_805D8C8.h"
|
||||
#include "constants/direction.h"
|
||||
#include "constants/status.h"
|
||||
#include "constants/ability.h"
|
||||
#include "constants/type.h"
|
||||
#include "constants/dungeon.h"
|
||||
#include "constants/iq_skill.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "code_803E668.h"
|
||||
#include "exclusive_pokemon.h"
|
||||
#include "code_8077274_1.h"
|
||||
#include "code_8069D4C.h"
|
||||
#include "code_8045A00.h"
|
||||
#include "position_util.h"
|
||||
#include "game_options.h"
|
||||
#include "dungeon_items.h"
|
||||
#include "status.h"
|
||||
#include "pokemon_mid.h"
|
||||
#include "pokemon.h"
|
||||
#include "random.h"
|
||||
#include "targeting.h"
|
||||
#include "sprite.h"
|
||||
#include "structs/str_dungeon.h"
|
||||
#include "tile_types.h"
|
||||
#include "dungeon_capabilities.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "text_util.h"
|
||||
#include "dungeon_visibility.h"
|
||||
#include "code_804267C.h"
|
||||
#include "move_effects_target.h"
|
||||
#include "dungeon_pokemon_attributes.h"
|
||||
#include "code_8041AD0.h"
|
||||
#include "type_chart.h"
|
||||
|
||||
extern u8 gUnknown_202F221;
|
||||
extern u8 gUnknown_202DFE8[];
|
||||
|
||||
extern void sub_806BFC0(EntityInfo *, u32);
|
||||
extern void sub_805239C(Entity *, const u8 *);
|
||||
|
||||
const u8 gUnknown_8106EEF[] = {0x03, 0x04, 0x05, 0x00, 0x00, 0x70, 0x6b, 0x73, 0x64, 0x69, 0x72, 0x30, 0x00 };
|
||||
|
||||
@ -228,3 +256,760 @@ u32 sub_806CF98(Entity *entity)
|
||||
entityInfo->unk204 = shadowSize;
|
||||
return shadowSize;
|
||||
}
|
||||
|
||||
static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *r5, bool32 isFalseSwipe, bool32 giveExp, s16 arg4_, s32 arg8);
|
||||
|
||||
extern void sub_807F43C(Entity *, Entity *);
|
||||
extern void sub_8041B18(Entity *pokemon);
|
||||
extern void sub_8041B90(Entity *pokemon);
|
||||
extern void sub_80522F4(Entity *, Entity *, const u8 *);
|
||||
extern void sub_8041D00(Entity *pokemon, Entity *target);
|
||||
extern void DealDamageToEntity(Entity *, s32, u32, u32);
|
||||
extern void SetShopkeeperAggression(Entity *, Entity *);
|
||||
extern void sub_8042238(Entity *pokemon, Entity *target);
|
||||
extern void sub_803ED30(s32, Entity *r0, u8, s32);
|
||||
extern bool8 sub_806A458(Entity *);
|
||||
extern bool8 sub_806F660(Entity *, Entity *);
|
||||
extern bool8 sub_806A58C(s16 a0);
|
||||
extern void sub_8071D4C(Entity *pokemon, Entity *target, s32 exp);
|
||||
extern void sub_8042148(Entity *pokemon);
|
||||
extern void sub_8068FE0(Entity *, u32, Entity *r2);
|
||||
extern void sub_80694C0(Entity *, s32, s32, u32);
|
||||
extern void sub_8042A24(Entity *r0);
|
||||
extern void sub_806A390(Entity *r0);
|
||||
extern void sub_806F63C(Entity *r0);
|
||||
extern void sub_8078084(Entity * pokemon);
|
||||
extern void sub_800DBBC(void);
|
||||
extern void sub_8045C28(Item *Item, u8 itemID, u32 param_3);
|
||||
extern void sub_80464C8(Entity *, Position *, Item *);
|
||||
extern bool8 DoEnemiesEvolveWhenKOed(u8 dungeon);
|
||||
extern bool8 sub_806FA5C(Entity *, Entity *, struct unkStruct_8069D4C *);
|
||||
extern void EntityUpdateStatusSprites(Entity *);
|
||||
extern bool8 sub_8045888(Entity *r0);
|
||||
extern void sub_8049ED4(void);
|
||||
|
||||
extern const s32 gUnknown_8106A4C;
|
||||
extern const s16 gUnknown_80F4E10;
|
||||
extern const s16 gUnknown_80F4E12;
|
||||
extern const s16 gUnknown_80F4E14;
|
||||
extern const s16 gUnknown_80F4E16;
|
||||
extern const s16 gUnknown_80F4E18;
|
||||
extern const s16 gUnknown_80F4E1A;
|
||||
extern const s16 gUnknown_80F4E1C;
|
||||
extern const s16 gUnknown_80F4E1E;
|
||||
extern const s16 gUnknown_80F4E20;
|
||||
extern const s16 gUnknown_80F4F8C;
|
||||
extern const u8 *const gUnknown_80FCFA4;
|
||||
extern const u8 *const gUnknown_80FCA90;
|
||||
extern const u8 *const gUnknown_80F9600;
|
||||
extern const u8 *const gUnknown_80F9614;
|
||||
extern const u8 *const gUnknown_80F9630;
|
||||
extern const u8 *const gUnknown_80F9654;
|
||||
extern const u8 *const gUnknown_80F9670;
|
||||
extern const u8 *const gUnknown_80F9614;
|
||||
extern const u8 *const gUnknown_80F9688;
|
||||
extern const u8 *const gUnknown_80FD484;
|
||||
extern const u8 *const gUnknown_80F96A8;
|
||||
extern const u8 *const gUnknown_8100548;
|
||||
extern const u8 *const gUnknown_80FD46C;
|
||||
extern const u8 *const gUnknown_810056C;
|
||||
extern const u8 *const gUnknown_80F9E44;
|
||||
extern const u8 *const gUnknown_80F9764[];
|
||||
extern const u8 *const gUnknown_80F9CC0[];
|
||||
extern const u8 *const gUnknown_80F9CEC[];
|
||||
extern const u8 *const gUnknown_80F9DAC[];
|
||||
extern const u8 *const gUnknown_80F9DF0[];
|
||||
extern const u8 *const gUnknown_80F9D8C[];
|
||||
extern const u8 *const gUnknown_80F9D84[];
|
||||
extern const u8 *const gUnknown_80F9D28[];
|
||||
|
||||
extern u8 gAvailablePokemonNames[];
|
||||
extern u32 gFormatData_202DE30;
|
||||
|
||||
void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, s32 giveExp, s16 arg4, bool32 arg8, s32 argC)
|
||||
{
|
||||
bool32 r9;
|
||||
// Some compiler weirdness, because it won't match without creating arg4 again
|
||||
s32 r10 = arg4;
|
||||
s32 returnDmg = 0;
|
||||
|
||||
if (HandleDealingDamageInternal(attacker, target, dmgStruct, isFalseSwipe, giveExp, r10, argC))
|
||||
return;
|
||||
if (dmgStruct->unkF)
|
||||
return;
|
||||
if (!EntityExists(attacker) || !EntityExists(target))
|
||||
return;
|
||||
if (GetEntityType(attacker) != ENTITY_MONSTER || GetEntityType(target) != ENTITY_MONSTER)
|
||||
return;
|
||||
|
||||
r9 = arg8;
|
||||
if (CheckVariousStatuses(target) || target->info->charging.chargingStatus != 0)
|
||||
r9 = FALSE;
|
||||
if (r9
|
||||
&& abs(attacker->pos.x - target->pos.x) <= 1 && abs(attacker->pos.y - target->pos.y) <= 1
|
||||
&& attacker != target
|
||||
&& IsTypePhysical(dmgStruct->type)
|
||||
&& target->info->protection.protectionStatus == STATUS_VITAL_THROW)
|
||||
{
|
||||
sub_8042730(target, attacker);
|
||||
sub_807F43C(target, attacker);
|
||||
}
|
||||
|
||||
if (target->info->charging.chargingStatus == STATUS_ENRAGED) {
|
||||
RaiseAttackStageTarget(attacker, target, gUnknown_8106A4C, 1);
|
||||
}
|
||||
|
||||
if (!EntityExists(attacker) || !EntityExists(target))
|
||||
return;
|
||||
|
||||
if (r9
|
||||
&& attacker != target
|
||||
&& abs(attacker->pos.x - target->pos.x) <= 1 && abs(attacker->pos.y - target->pos.y) <= 1)
|
||||
{
|
||||
bool32 isPhysical = IsTypePhysical(dmgStruct->type);
|
||||
if (target->info->protection.protectionStatus == STATUS_COUNTER && isPhysical) {
|
||||
sub_8041B18(target);
|
||||
returnDmg += 4;
|
||||
}
|
||||
if (target->info->protection.protectionStatus == STATUS_MINI_COUNTER && isPhysical) {
|
||||
sub_8041B18(target);
|
||||
returnDmg += 1;
|
||||
}
|
||||
if (target->info->protection.protectionStatus == STATUS_MIRROR_COAT && !isPhysical) {
|
||||
sub_8041B90(target);
|
||||
returnDmg += 4;
|
||||
}
|
||||
|
||||
if (HasAbility(target, ABILITY_ROUGH_SKIN))
|
||||
returnDmg += 2;
|
||||
|
||||
if (returnDmg) {
|
||||
struct DamageStruct sp;
|
||||
|
||||
sub_80522F4(attacker, target, gUnknown_80FCFA4);
|
||||
sp.dmg = (dmgStruct->dmg * returnDmg) / 4;
|
||||
sp.type = dmgStruct->type;
|
||||
sp.residualDmgType = 6;
|
||||
sp.typeEffectiveness = 2;
|
||||
sp.isCrit = FALSE;
|
||||
sp.unkE = 0;
|
||||
sp.unkF = 0;
|
||||
HandleDealingDamageInternal(target, attacker, &sp, FALSE, giveExp, r10, argC);
|
||||
}
|
||||
}
|
||||
if (!EntityExists(attacker) || !EntityExists(target))
|
||||
return;
|
||||
|
||||
// Check trapping / contact abilities
|
||||
if (r9
|
||||
&& attacker != target
|
||||
&& abs(attacker->pos.x - target->pos.x) <= 1 && abs(attacker->pos.y - target->pos.y) <= 1)
|
||||
{
|
||||
bool32 isPhysical = IsTypePhysical(dmgStruct->type);
|
||||
EntityInfo *attackerInfo = attacker->info;
|
||||
|
||||
if (HasAbility(target, ABILITY_ARENA_TRAP)
|
||||
&& !MonsterIsType(attacker, TYPE_FLYING)
|
||||
&& !HasAbility(attacker, ABILITY_LEVITATE)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E10)
|
||||
{
|
||||
attackerInfo->unk178 |= 1;
|
||||
}
|
||||
if (HasAbility(target, ABILITY_SHADOW_TAG)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E12)
|
||||
{
|
||||
attackerInfo->unk178 |= 2;
|
||||
}
|
||||
if (HasAbility(target, ABILITY_MAGNET_PULL)
|
||||
&& MonsterIsType(attacker, TYPE_STEEL)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E14)
|
||||
{
|
||||
attackerInfo->unk178 |= 4;
|
||||
}
|
||||
|
||||
if (HasAbility(target, ABILITY_STATIC)
|
||||
&& isPhysical
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E16)
|
||||
{
|
||||
attackerInfo->unk178 |= 8;
|
||||
}
|
||||
if (HasAbility(target, ABILITY_POISON_POINT)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E18)
|
||||
{
|
||||
attackerInfo->unk178 |= 0x20;
|
||||
}
|
||||
if (HasAbility(target, ABILITY_EFFECT_SPORE)
|
||||
&& isPhysical
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E1A)
|
||||
{
|
||||
s32 rnd = DungeonRandInt(3);
|
||||
if (rnd < 1)
|
||||
attackerInfo->unk178 |= 0x40;
|
||||
else if (rnd < 2)
|
||||
attackerInfo->unk178 |= 0x10;
|
||||
else
|
||||
attackerInfo->unk178 |= 0x80;
|
||||
}
|
||||
if (HasAbility(target, ABILITY_FLAME_BODY)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E1C)
|
||||
{
|
||||
attackerInfo->unk178 |= 0x100;
|
||||
}
|
||||
if (HasAbility(target, ABILITY_CUTE_CHARM)
|
||||
&& isPhysical
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E1E)
|
||||
{
|
||||
attackerInfo->unk178 |= 0x200;
|
||||
}
|
||||
if (HasAbility(target, ABILITY_STENCH)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E20)
|
||||
{
|
||||
attackerInfo->unk178 |= 0x400;
|
||||
}
|
||||
}
|
||||
if (!EntityExists(attacker) || !EntityExists(target))
|
||||
return;
|
||||
|
||||
// Destiny Bond
|
||||
if (r9) {
|
||||
EntityInfo *targetInfo = GetEntInfo(target);
|
||||
if (targetInfo->linked.linkedStatus == STATUS_DESTINY_BOND) {
|
||||
Entity *destBondTarget = gDungeon->allPokemon[targetInfo->linked.unkD8];
|
||||
if (destBondTarget == NULL) {
|
||||
targetInfo->linked.linkedStatus = 0;
|
||||
}
|
||||
else if (destBondTarget->info->unk98 != targetInfo->linked.unkD4) {
|
||||
targetInfo->linked.linkedStatus = 0;
|
||||
}
|
||||
else {
|
||||
sub_8041D00(destBondTarget, target);
|
||||
DealDamageToEntity(destBondTarget, dmgStruct->dmg, 0xC, 0x1F9);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ZeroOutItem(Item *item)
|
||||
{
|
||||
item->id = 0;
|
||||
item->quantity = 0;
|
||||
item->flags = 0;
|
||||
}
|
||||
|
||||
static inline bool8 ItemSticky(Item *item)
|
||||
{
|
||||
return (item->flags & ITEM_FLAG_STICKY);
|
||||
}
|
||||
|
||||
static inline bool8 ItemExists(Item *item)
|
||||
{
|
||||
return (item->flags & ITEM_FLAG_EXISTS);
|
||||
}
|
||||
|
||||
static inline bool8 ItemInShop(Item *item)
|
||||
{
|
||||
return (item->flags & ITEM_FLAG_IN_SHOP);
|
||||
}
|
||||
|
||||
static inline u8 ItemId(Item *item)
|
||||
{
|
||||
return item->id;
|
||||
}
|
||||
|
||||
static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 arg4_, s32 arg8)
|
||||
{
|
||||
s32 hpBefore, hpChange;
|
||||
EntityInfo *targetData;
|
||||
s32 arg4 = arg4_;
|
||||
bool32 var_24 = FALSE;
|
||||
bool32 r10 = FALSE;
|
||||
s32 r8 = 0;
|
||||
Tile *unkTile = NULL;
|
||||
|
||||
dmgStruct->unkF = 0;
|
||||
if (GetEntityType(target) != ENTITY_MONSTER) {
|
||||
dmgStruct->unkF = 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
targetData = GetEntInfo(target);
|
||||
TrySendImmobilizeSleepEndMsg(attacker, target);
|
||||
SetShopkeeperAggression(attacker, target);
|
||||
if (GetEntityType(attacker) == ENTITY_MONSTER
|
||||
&& attacker->info->moveStatus.moveStatus == STATUS_SET_DAMAGE
|
||||
&& dmgStruct->unkE == 0)
|
||||
{
|
||||
dmgStruct->dmg = gUnknown_80F4F8C;
|
||||
}
|
||||
|
||||
if (arg4 != 0x20E && HasAbility(target, ABILITY_STURDY) && dmgStruct->dmg == 9999) {
|
||||
SetMessageArgument(gUnknown_202DFE8, target, 0);
|
||||
sub_80522F4(attacker, target, gUnknown_80FCA90);
|
||||
sub_8042238(attacker, target);
|
||||
dmgStruct->unkF = 1;
|
||||
return FALSE;
|
||||
}
|
||||
if (targetData->immobilize.immobilizeStatus == STATUS_FROZEN) {
|
||||
SetMessageArgument(gUnknown_202DFE8, target, 0);
|
||||
sub_80522F4(attacker, target, gUnknown_80F9600);
|
||||
sub_8042238(attacker, target);
|
||||
dmgStruct->unkF = 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((targetData->sleep.sleep == STATUS_SLEEP || targetData->sleep.sleep == STATUS_NAPPING || targetData->sleep.sleep == STATUS_NIGHTMARE)
|
||||
&& targetData->sleep.sleepTurns == 0x7F)
|
||||
{
|
||||
WakeUpPokemon(target);
|
||||
}
|
||||
|
||||
if ((HasAbility(target, ABILITY_VOLT_ABSORB) && dmgStruct->type == TYPE_ELECTRIC)) {
|
||||
HealTargetHP(attacker, target, dmgStruct->dmg, 0, 0);
|
||||
dmgStruct->unkF = 1;
|
||||
return FALSE;
|
||||
}
|
||||
else if (HasAbility(target, ABILITY_WATER_ABSORB) && dmgStruct->type == TYPE_WATER) {
|
||||
HealTargetHP(attacker, target, dmgStruct->dmg, 0, 0);
|
||||
dmgStruct->unkF = 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (targetData->unk152 == 0) {
|
||||
if (dmgStruct->isCrit) {
|
||||
sub_80522F4(attacker, target, gUnknown_80F9614);
|
||||
}
|
||||
switch (dmgStruct->typeEffectiveness) {
|
||||
case EFFECTIVENESS_IMMUNE:
|
||||
sub_80522F4(attacker, target, gUnknown_80F9630);
|
||||
break;
|
||||
case EFFECTIVENESS_RESIST:
|
||||
sub_80522F4(attacker, target, gUnknown_80F9654);
|
||||
break;
|
||||
case EFFECTIVENESS_SUPER:
|
||||
sub_80522F4(attacker, target, gUnknown_80F9670);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetMessageArgument(gAvailablePokemonNames, attacker, 0);
|
||||
SetMessageArgument(gAvailablePokemonNames + 0x50, target, 0);
|
||||
if (dmgStruct->dmg == 0) {
|
||||
if (sub_8045888(attacker) && sub_8045888(target)) {
|
||||
if (targetData->unk152 == 0) {
|
||||
sub_80522F4(attacker, target, gUnknown_80F9688);
|
||||
}
|
||||
sub_8042238(attacker, target);
|
||||
}
|
||||
else {
|
||||
if (targetData->unk152 == 0) {
|
||||
sub_80522F4(attacker, target, gUnknown_80F9688);
|
||||
}
|
||||
sub_803E708(0x1E, 0x18);
|
||||
}
|
||||
dmgStruct->unkF = 1;
|
||||
return FALSE;
|
||||
}
|
||||
else if (dmgStruct->dmg == 9999) {
|
||||
if (arg8 != 0 && sub_8045888(target)) {
|
||||
unkTile = GetTileAtEntitySafe(target);
|
||||
sub_803E708(0x14, 0x18);
|
||||
unkTile->unk4 |= 4;
|
||||
sub_8049ED4();
|
||||
}
|
||||
if (targetData->unk152 == 0) {
|
||||
sub_80522F4(attacker, target, gUnknown_80F96A8);
|
||||
}
|
||||
targetData->unkA0 = 999;
|
||||
}
|
||||
else {
|
||||
const u8 *str;
|
||||
|
||||
gFormatData_202DE30 = dmgStruct->dmg;
|
||||
str = gUnknown_80F9764[dmgStruct->residualDmgType];
|
||||
|
||||
// Needed to match - the line can be safely removed
|
||||
dmgStruct++;dmgStruct--;
|
||||
|
||||
targetData->unkA0 += dmgStruct->dmg;
|
||||
if (targetData->unkA0 > 999)
|
||||
targetData->unkA0 = 999;
|
||||
|
||||
if (sub_8045888(target)) {
|
||||
if (dmgStruct->residualDmgType != 14) {
|
||||
sub_803ED30(-dmgStruct->dmg, target, 1, -1);
|
||||
}
|
||||
if (targetData->unk152 == 0 && str != NULL) {
|
||||
sub_80522F4(attacker, target, str);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (targetData->unk152 == 0 && str != NULL) {
|
||||
sub_80522F4(attacker, target, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((dmgStruct->residualDmgType != 14 || targetData->HP <= 1) && unkTile == NULL && sub_8045888(target)) {
|
||||
if ((attacker->pos.x != target->pos.x || attacker->pos.y != target->pos.y) && GetEntityType(attacker) == ENTITY_MONSTER) {
|
||||
bool32 unkBool = FALSE;
|
||||
if (targetData->isTeamLeader) {
|
||||
if (gGameOptionsRef->damageTurn != 0 && !sub_806A458(target)) {
|
||||
if (CanSeeTarget(target, attacker))
|
||||
unkBool = TRUE;
|
||||
else
|
||||
unkBool = FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
unkBool = FALSE;
|
||||
}
|
||||
if (targetData->eyesightStatus.eyesightStatus == STATUS_BLINKER || targetData->eyesightStatus.eyesightStatus == STATUS_CROSS_EYED)
|
||||
unkBool = FALSE;
|
||||
if (unkBool) {
|
||||
EntityInfo *info = GetEntInfo(target);
|
||||
info->action.direction = (GetDirectionTowardsPosition(&target->pos, &attacker->pos) & DIRECTION_MASK);
|
||||
}
|
||||
TargetTileInFront(target);
|
||||
}
|
||||
sub_806CDD4(target, 6, target->info->action.direction);
|
||||
sub_80420E8(target, dmgStruct);
|
||||
var_24 = TRUE;
|
||||
}
|
||||
|
||||
// HP goes down
|
||||
hpBefore = targetData->HP;
|
||||
if (targetData->HP > dmgStruct->dmg)
|
||||
targetData->HP -= dmgStruct->dmg;
|
||||
else
|
||||
targetData->HP = 0;
|
||||
|
||||
if (targetData->protection.protectionStatus == STATUS_ENDURING) {
|
||||
if (targetData->HP == 0) {
|
||||
targetData->HP = 1;
|
||||
sub_80522F4(attacker, target, gUnknown_8100548);
|
||||
}
|
||||
}
|
||||
else if (isFalseSwipe == TRUE && targetData->HP == 0) {
|
||||
targetData->HP = 1;
|
||||
sub_80522F4(attacker, target, gUnknown_810056C);
|
||||
}
|
||||
|
||||
hpChange = hpBefore - targetData->HP;
|
||||
if (hpChange < 0)
|
||||
hpChange = 0;
|
||||
|
||||
if (var_24 || unkTile != NULL)
|
||||
sub_803E708(0xA, 0x18);
|
||||
|
||||
if (targetData->HP != 0) {
|
||||
if (var_24) {
|
||||
sub_806CE68(target, 8);
|
||||
}
|
||||
if (HasHeldItem(target, ITEM_JOY_RIBBON) && hpChange > 0 && dmgStruct->dmg != 9999) {
|
||||
sub_8071D4C(attacker, target, hpChange);
|
||||
}
|
||||
|
||||
if (unkTile != NULL)
|
||||
{
|
||||
unkTile->unk4 &= ~(0x4);
|
||||
sub_8049ED4();
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// 0 HP
|
||||
if (targetData->transformStatus.transformStatus == STATUS_TRANSFORMED) {
|
||||
SendTransformEndMessage(attacker, target);
|
||||
}
|
||||
|
||||
if (unkTile != NULL) {
|
||||
sub_803E708(0x14, 0x18);
|
||||
target->unk22 = 2;
|
||||
sub_803E708(0xA, 0x18);
|
||||
unkTile->unk4 &= ~(0x4);
|
||||
sub_8049ED4();
|
||||
}
|
||||
else if (var_24) {
|
||||
target->unk22 = 1;
|
||||
sub_803E708(0x1E, 0x18);
|
||||
}
|
||||
|
||||
r8 = 1;
|
||||
if (EntityExists(attacker) && GetEntityType(attacker) == ENTITY_MONSTER && attacker != target)
|
||||
r8 = 0;
|
||||
|
||||
targetData->unk14C = 0;
|
||||
SetMessageArgument(gAvailablePokemonNames, attacker, 0);
|
||||
SetMessageArgument(gAvailablePokemonNames + 0x50, target, 0);
|
||||
if (dmgStruct->residualDmgType == 19 || dmgStruct->residualDmgType == 20) {
|
||||
if (targetData->isNotTeamMember) {
|
||||
sub_80522F4(attacker, target, gUnknown_80F9E44);
|
||||
}
|
||||
else {
|
||||
sub_805239C(attacker, gUnknown_80F9E44);
|
||||
}
|
||||
}
|
||||
else if (targetData->isNotTeamMember)
|
||||
{
|
||||
if (targetData->clientType == CLIENT_TYPE_CLIENT) {
|
||||
sub_805239C(attacker, gUnknown_80F9DF0[r8]);
|
||||
}
|
||||
else {
|
||||
sub_80522F4(attacker, target, gUnknown_80F9CC0[r8]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
PokemonStruct2 *recruitedMon = &gRecruitedPokemonRef->pokemon2[targetData->teamIndex];
|
||||
if (targetData->isTeamLeader || (targetData->joinedAt.joinedAt == DUNGEON_JOIN_LOCATION_PARTNER && gDungeon->unk65C == 0)) {
|
||||
sub_805239C(attacker, gUnknown_80F9CEC[r8]);
|
||||
}
|
||||
else if (IsClientOrTeamBase(targetData->joinedAt.joinedAt)) {
|
||||
sub_805239C(attacker, gUnknown_80F9DAC[r8]);
|
||||
}
|
||||
else if (targetData->clientType == CLIENT_TYPE_CLIENT) {
|
||||
sub_805239C(attacker, gUnknown_80F9DF0[r8]);
|
||||
}
|
||||
else if (sub_806A58C(recruitedMon->unkA)) {
|
||||
if (gDungeon->unk65D != 0) {
|
||||
sub_805239C(attacker, gUnknown_80F9D8C[r8]);
|
||||
}
|
||||
else {
|
||||
sub_805239C(attacker, gUnknown_80F9D84[r8]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sub_805239C(attacker, gUnknown_80F9D28[r8]);
|
||||
}
|
||||
}
|
||||
|
||||
if (targetData->immobilize.immobilizeStatus == STATUS_WRAP || targetData->immobilize.immobilizeStatus == STATUS_WRAPPED) {
|
||||
sub_8076CB4(targetData->unk9C);
|
||||
}
|
||||
|
||||
// Try revive items
|
||||
if (targetData->heldItem.flags & ITEM_FLAG_EXISTS) {
|
||||
// This do/while 0 loop has no effect other than matching asm, and can be removed.
|
||||
do
|
||||
{
|
||||
if (!(ItemSticky(&targetData->heldItem)) && !(ItemInShop(&targetData->heldItem)) && ItemId(&targetData->heldItem) == ITEM_REVIVER_ORB) {
|
||||
sub_8042148(target);
|
||||
target->unk22 = 0;
|
||||
targetData->HP = targetData->maxHPStat;
|
||||
targetData->unk158 = 0;
|
||||
targetData->unk14C = 1;
|
||||
targetData->belly = targetData->maxBelly;
|
||||
if (targetData->isTeamLeader) {
|
||||
gDungeon->unk679 = 0;
|
||||
gDungeon->itemHoldersIdentified = 0;
|
||||
}
|
||||
ZeroOutItem(&targetData->heldItem);
|
||||
if (targetData->waitingStruct.waitingStatus == STATUS_SNATCH) {
|
||||
SendWaitingEndMessage(attacker, target, STATUS_SNATCH);
|
||||
}
|
||||
else if (targetData->waitingStruct.waitingStatus == STATUS_DECOY) {
|
||||
SendWaitingEndMessage(attacker, target, STATUS_DECOY);
|
||||
}
|
||||
sub_8078084(target);
|
||||
sub_806BFC0(targetData, 0);
|
||||
sub_800DBBC();
|
||||
sub_806A390(target);
|
||||
sub_806CCB4(target, sub_806CEBC(target));
|
||||
EntityUpdateStatusSprites(target);
|
||||
SetMessageArgument(gUnknown_202DFE8, target, 0);
|
||||
sub_805239C(attacker, gUnknown_80FD46C);
|
||||
sub_806F63C(target);
|
||||
return FALSE;
|
||||
}
|
||||
} while(0);
|
||||
}
|
||||
|
||||
if (targetData->isTeamLeader)
|
||||
{
|
||||
Item *heldItem = &targetData->heldItem;
|
||||
if (ItemExists(heldItem) && !(ItemSticky(heldItem)) && ItemId(heldItem) == ITEM_POSSESS_ORB ) {
|
||||
s32 i;
|
||||
Entity *teamMember;
|
||||
|
||||
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
|
||||
teamMember = gDungeon->teamPokemon[i];
|
||||
if (EntityExists(teamMember)
|
||||
&& teamMember != target
|
||||
&& CanSeeTarget(target, teamMember)
|
||||
&& abs(teamMember->pos.x - target->pos.x) <= 1 && abs(teamMember->pos.y - target->pos.y) <= 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i != MAX_TEAM_MEMBERS) {
|
||||
Position monPos; // r4
|
||||
|
||||
sub_8042148(target);
|
||||
|
||||
monPos = teamMember->pos;
|
||||
sub_8068FE0(teamMember, 0x221, target);
|
||||
sub_80694C0(target, monPos.x, monPos.y, 1);
|
||||
sub_804535C(target, NULL);
|
||||
target->unk22 = 0;
|
||||
targetData->HP = targetData->maxHPStat;
|
||||
sub_8042A24(target);
|
||||
targetData->unk158 = 0;
|
||||
targetData->unk14C = 1;
|
||||
targetData->belly = targetData->maxBelly;
|
||||
if (targetData->isTeamLeader) {
|
||||
gDungeon->unk679 = 0;
|
||||
gDungeon->itemHoldersIdentified = 0;
|
||||
}
|
||||
ZeroOutItem(heldItem);
|
||||
if (targetData->waitingStruct.waitingStatus == STATUS_SNATCH) {
|
||||
SendWaitingEndMessage(attacker, target, STATUS_SNATCH);
|
||||
}
|
||||
else if (targetData->waitingStruct.waitingStatus == STATUS_DECOY) {
|
||||
SendWaitingEndMessage(attacker, target, STATUS_DECOY);
|
||||
}
|
||||
sub_8078084(target);
|
||||
sub_806BFC0(targetData, 0);
|
||||
sub_800DBBC();
|
||||
sub_806A390(target);
|
||||
sub_806CCB4(target, sub_806CEBC(target));
|
||||
EntityUpdateStatusSprites(target);
|
||||
SetMessageArgument(gAvailablePokemonNames, target, 0);
|
||||
SetMessageArgument(gAvailablePokemonNames + 0x50, teamMember, 0);
|
||||
sub_805239C(attacker, gUnknown_80FD484);
|
||||
sub_806F63C(target);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (IQSkillIsEnabled(target, IQ_ITEM_MASTER)) {
|
||||
s32 i; // r3
|
||||
Item *reviverSeed = NULL; // r4
|
||||
if (ItemExists(&targetData->heldItem) && !ItemSticky(&targetData->heldItem) && ItemId(&targetData->heldItem) == ITEM_REVIVER_SEED)
|
||||
reviverSeed = &targetData->heldItem;
|
||||
if (reviverSeed == NULL && !targetData->isNotTeamMember) {
|
||||
for (i = 0; i < INVENTORY_SIZE; i++) {
|
||||
Item *bagItem = &gTeamInventoryRef->teamItems[i];
|
||||
if (!(bagItem->flags & ITEM_FLAG_EXISTS))
|
||||
continue;
|
||||
if (bagItem->flags & ITEM_FLAG_STICKY)
|
||||
continue;
|
||||
if (bagItem->id == ITEM_REVIVER_SEED) {
|
||||
reviverSeed = bagItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (reviverSeed != NULL) {
|
||||
sub_8042148(target);
|
||||
sub_8045C28(reviverSeed, ITEM_PLAIN_SEED, 2);
|
||||
target->unk22 = 0;
|
||||
targetData->HP = targetData->maxHPStat;
|
||||
targetData->unk158 = 0;
|
||||
targetData->unk14C = 1;
|
||||
targetData->belly = targetData->maxBelly;
|
||||
if (targetData->isTeamLeader) {
|
||||
gDungeon->unk679 = 0;
|
||||
gDungeon->itemHoldersIdentified = 0;
|
||||
}
|
||||
if (targetData->waitingStruct.waitingStatus == STATUS_SNATCH) {
|
||||
SendWaitingEndMessage(attacker, target, STATUS_SNATCH);
|
||||
}
|
||||
else if (targetData->waitingStruct.waitingStatus == STATUS_DECOY) {
|
||||
SendWaitingEndMessage(attacker, target, STATUS_DECOY);
|
||||
}
|
||||
sub_8078084(target);
|
||||
sub_806BFC0(targetData, 0);
|
||||
sub_800DBBC();
|
||||
sub_806A390(target);
|
||||
sub_806CCB4(target, sub_806CEBC(target));
|
||||
EntityUpdateStatusSprites(target);
|
||||
SetMessageArgument(gUnknown_202DFE8, target, 0);
|
||||
sub_805239C(attacker, gUnknown_80FD46C);
|
||||
sub_806F63C(target);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!targetData->isTeamLeader && ItemExists(&targetData->heldItem)) {
|
||||
sub_80464C8(target, &target->pos, &targetData->heldItem);
|
||||
ZeroOutItem(&targetData->heldItem);
|
||||
}
|
||||
if (targetData->bossFlag) {
|
||||
gDungeon->bossSongIndex = 999;
|
||||
}
|
||||
|
||||
// Give exp
|
||||
r10 = FALSE;
|
||||
if (GetEntityType(attacker) == ENTITY_MONSTER) {
|
||||
EntityInfo *attackerData = GetEntInfo(attacker);
|
||||
s32 exp = CalculateEXPGain(targetData->id, targetData->level);
|
||||
switch (targetData->unkFB) {
|
||||
case 2:
|
||||
exp *= 3;
|
||||
exp /= 2;
|
||||
break;
|
||||
case 0:
|
||||
exp /= 2;
|
||||
break;
|
||||
}
|
||||
if (exp == 0)
|
||||
exp = 1;
|
||||
if (attackerData->isTeamLeader) {
|
||||
sub_80980B4(targetData->id);
|
||||
}
|
||||
if (targetData->grudge) {
|
||||
attackerData->unk14B = 1;
|
||||
}
|
||||
|
||||
if (giveExp == TRUE) {
|
||||
if (!attackerData->isNotTeamMember) {
|
||||
if (targetData->isNotTeamMember) {
|
||||
s32 i;
|
||||
|
||||
sub_8071D4C(attacker, attacker, exp);
|
||||
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
|
||||
Entity *teamMember = gDungeon->teamPokemon[i];
|
||||
if (EntityExists(teamMember) && teamMember != attacker) {
|
||||
sub_8071D4C(attacker, teamMember, exp);
|
||||
}
|
||||
}
|
||||
r10 = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (DoEnemiesEvolveWhenKOed(gDungeon->dungeonLocation.id)) {
|
||||
attackerData->unk149 = 1;
|
||||
gDungeon->unkD = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (EntityExists(attacker) && GetEntityType(attacker) == ENTITY_MONSTER && !attacker->info->isTeamLeader)
|
||||
r10 = FALSE;
|
||||
|
||||
if (r10) {
|
||||
struct unkStruct_8069D4C sp;
|
||||
|
||||
sub_8069D4C(&sp, target);
|
||||
if (sub_806F660(attacker, target)) {
|
||||
if (!sub_806FA5C(attacker, target, &sp)) {
|
||||
sub_8068FE0(target, 0x1F5, attacker);
|
||||
}
|
||||
else {
|
||||
gUnknown_202F221 = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sub_8068FE0(target, arg4, attacker);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sub_8068FE0(target, arg4, attacker);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ void sub_806E8B0(Entity * pokemon, Entity * target, u8 param_3, s32 *param_4, s3
|
||||
r8 = 1;
|
||||
sp_0x4 = 1;
|
||||
sp_0x8 = 1;
|
||||
r10 = sub_8092354(param_3) == 0;
|
||||
r10 = IsTypePhysical(param_3) == 0;
|
||||
|
||||
|
||||
if (HasAbility(pokemon, ABILITY_GUTS)) {
|
||||
|
@ -900,7 +900,7 @@ bool8 UseAttack(Entity *a0)
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
|
||||
Entity *mon = gDungeon->allPokemon[i];
|
||||
if (EntityExists(mon)) {
|
||||
EntityInfo *monInfo = mon->info;
|
||||
EntityInfo *monInfo = GetEntInfo(mon);
|
||||
if (monInfo->numMoveTiles == 0) {
|
||||
if (monInfo->waiting) {
|
||||
monInfo->waiting = FALSE;
|
||||
@ -942,9 +942,7 @@ bool8 UseAttack(Entity *a0)
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
|
||||
Entity *mon = gDungeon->allPokemon[i];
|
||||
if (EntityExists(mon)) {
|
||||
// r6 / r7 reg swap
|
||||
EntityInfo *monInfo_ = mon->info;
|
||||
EntityInfo *monInfo = monInfo_;
|
||||
EntityInfo *monInfo = GetEntInfo(mon);
|
||||
Unk_Entity_x184 *strPtr = &monInfo->unk184[monInfo->notMoving];
|
||||
|
||||
#ifndef NONMATCHING
|
||||
@ -975,7 +973,7 @@ bool8 UseAttack(Entity *a0)
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
|
||||
Entity *mon = gDungeon->allPokemon[i];
|
||||
if (EntityExists(mon)) {
|
||||
EntityInfo *monInfo = mon->info;
|
||||
EntityInfo *monInfo = GetEntInfo(mon);
|
||||
monInfo->numMoveTiles = 0;
|
||||
nullsub_97(mon);
|
||||
if (monInfo->flags & 0x2000) {
|
||||
@ -996,7 +994,7 @@ bool8 UseAttack(Entity *a0)
|
||||
if (sub_8044B28())
|
||||
break;
|
||||
|
||||
monInfo = mon->info;
|
||||
monInfo = GetEntInfo(mon);
|
||||
if ((j == 0 && !monInfo->isTeamLeader) || (j != 0 && monInfo->isTeamLeader))
|
||||
continue;
|
||||
|
||||
|
@ -1572,9 +1572,7 @@ void SendMuzzledEndMessage(Entity * pokemon, Entity * target)
|
||||
|
||||
bool8 TrySendImmobilizeSleepEndMsg(Entity * pokemon, Entity * target)
|
||||
{
|
||||
// entityInfoMatch needed to match
|
||||
EntityInfo *entityInfoMatch = target->info;
|
||||
EntityInfo *entityInfo = entityInfoMatch;
|
||||
EntityInfo *entityInfo = GetEntInfo(target);
|
||||
bool32 msg = FALSE;
|
||||
|
||||
if (entityInfo->immobilize.immobilizeStatus == STATUS_PETRIFIED) {
|
||||
|
@ -93,7 +93,7 @@ const char * const gFormattedTypeStrings[NUM_POKEMON_TYPES] =
|
||||
|
||||
extern u8 *gAbilityNames[];
|
||||
extern u8 *AbilityDescriptions[];
|
||||
extern u8 gUnknown_810AC7C[];
|
||||
extern u8 gIsTypePhysicalTable[];
|
||||
extern u8 gUnknown_810AC6A[];
|
||||
|
||||
extern u32 gUnknown_810983C[26]; // TODO: verify size later
|
||||
@ -169,9 +169,9 @@ const char * GetFormattedTypeString(u8 type)
|
||||
return gFormattedTypeStrings[type];
|
||||
}
|
||||
|
||||
u8 sub_8092354(u8 index)
|
||||
u8 IsTypePhysical(u8 index)
|
||||
{
|
||||
return gUnknown_810AC7C[index];
|
||||
return gIsTypePhysicalTable[index];
|
||||
}
|
||||
|
||||
u8 sub_8092364(u8 index)
|
||||
|
Loading…
Reference in New Issue
Block a user