This commit is contained in:
Kermalis 2024-11-07 13:06:53 -05:00
parent 8152820e76
commit d96bb4a9aa
13 changed files with 73 additions and 72 deletions

View File

@ -39,7 +39,7 @@ _080727A8:
movs r4, 0xC movs r4, 0xC
ldrsh r3, [r0, r4] ldrsh r3, [r0, r4]
mov r0, sp mov r0, sp
bl sub_808E0AC bl GetMovesLearnedAtLevel
adds r7, r0, 0 adds r7, r0, 0
add r4, sp, 0x20 add r4, sp, 0x20
movs r1, 0x8C movs r1, 0x8C

View File

@ -6,7 +6,7 @@
u32 sub_8057144(Entity * pokemon); u32 sub_8057144(Entity * pokemon);
bool8 sub_80571F0(Entity * pokemon, Move *move); bool8 sub_80571F0(Entity * pokemon, Move *move);
bool8 sub_805727C(Entity * pokemon, Entity * target, s32 chance); bool8 sub_805727C(Entity * pokemon, Entity * target, s32 chance);
bool8 sub_8057308(Entity *pokemon, s32 chance); bool8 RollSecondaryEffect(Entity *pokemon, s32 chance);
bool8 CanAIUseMove(Entity *pokemon, s32 moveIndex, bool8 hasPPChecker); bool8 CanAIUseMove(Entity *pokemon, s32 moveIndex, bool8 hasPPChecker);
bool8 CanMonsterUseMove(Entity *pokemon, Move *move, bool8 hasPPChecker); bool8 CanMonsterUseMove(Entity *pokemon, Move *move, bool8 hasPPChecker);

View File

@ -9,7 +9,7 @@ struct DamageStruct
u8 type; u8 type;
bool8 isCrit; bool8 isCrit;
u8 unkE; u8 unkE;
u8 unkF; bool8 tookNoDamage;
}; };
#endif #endif

View File

@ -376,8 +376,8 @@ extern void sub_8046F84(s32 itemFlag);
extern bool8 sub_8083C50(void); extern bool8 sub_8083C50(void);
extern void sub_8068FE0(Entity *, u32, Entity *r2); extern void sub_8068FE0(Entity *, u32, Entity *r2);
extern void sub_806BFC0(EntityInfo *, u32); extern void sub_806BFC0(EntityInfo *, u32);
extern s32 sub_808E0AC(u16* a1, s16 species, s32 a3, s32 IQPoints); extern s32 GetMovesLearnedAtLevel(u16* a1, s16 species, s32 a3, s32 IQPoints);
extern s32 sub_808E0AC(u16* a1, s16 species, s32 a3, s32 IQPoints); extern s32 GetMovesLearnedAtLevel(u16* a1, s16 species, s32 a3, s32 IQPoints);
extern bool8 IsKeepMoney(u8 dungeon); extern bool8 IsKeepMoney(u8 dungeon);
extern void sub_8042B0C(Entity *); extern void sub_8042B0C(Entity *);
@ -387,7 +387,7 @@ extern u8 gUnknown_202F1A8;
extern s32 gDungeonBrightness; extern s32 gDungeonBrightness;
extern Entity *gLeaderPointer; extern Entity *gLeaderPointer;
void sub_8044124(void); void EnforceMaxItemsAndMoney(void);
void sub_8043FD0(void); void sub_8043FD0(void);
void sub_806B404(void); void sub_806B404(void);
u8 sub_8043D10(void); u8 sub_8043D10(void);
@ -489,7 +489,7 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
} }
gDungeon->unk674 = 0; gDungeon->unk674 = 0;
sub_8044124(); EnforceMaxItemsAndMoney();
} }
if (!r6) { if (!r6) {
if (gDungeon->unk678 == 1) { if (gDungeon->unk678 == 1) {
@ -1163,7 +1163,7 @@ void sub_8043FD0(void)
monStruct->offense.def[0] = def; monStruct->offense.def[0] = def;
monStruct->offense.def[1] = spDef; monStruct->offense.def[1] = spDef;
movesCount = sub_808E0AC(learnedMoves, monStruct->speciesNum, monStruct->level, 999); movesCount = GetMovesLearnedAtLevel(learnedMoves, monStruct->speciesNum, monStruct->level, 999);
if (movesCount == 0) if (movesCount == 0)
continue; continue;
@ -1181,7 +1181,7 @@ void sub_8043FD0(void)
} }
} }
void sub_8044124(void) void EnforceMaxItemsAndMoney(void)
{ {
s32 i; s32 i;

View File

@ -3088,7 +3088,7 @@ void sub_8060D24(UNUSED ActionContainer *a0)
sub_803EAF0(0, NULL); sub_803EAF0(0, NULL);
} }
extern bool8 sub_804ACE4(Position *pos); extern bool8 PosHasItem(Position *pos);
s32 sub_8060D64(s16 *a0, bool8 a1, bool8 a2, bool8 a3, Entity *a4) s32 sub_8060D64(s16 *a0, bool8 a1, bool8 a2, bool8 a3, Entity *a4)
{ {
@ -3104,7 +3104,7 @@ s32 sub_8060D64(s16 *a0, bool8 a1, bool8 a2, bool8 a3, Entity *a4)
} }
} }
if (a2 && sub_804ACE4(&a4->pos)) { if (a2 && PosHasItem(&a4->pos)) {
a0[count++] = 2; a0[count++] = 2;
} }

View File

@ -334,7 +334,7 @@ void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *
if (HandleDealingDamageInternal(attacker, target, dmgStruct, isFalseSwipe, giveExp, r10, argC)) if (HandleDealingDamageInternal(attacker, target, dmgStruct, isFalseSwipe, giveExp, r10, argC))
return; return;
if (dmgStruct->unkF) if (dmgStruct->tookNoDamage)
return; return;
if (!EntityExists(attacker) || !EntityExists(target)) if (!EntityExists(attacker) || !EntityExists(target))
return; return;
@ -392,7 +392,7 @@ void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *
sp.typeEffectiveness = 2; sp.typeEffectiveness = 2;
sp.isCrit = FALSE; sp.isCrit = FALSE;
sp.unkE = 0; sp.unkE = 0;
sp.unkF = 0; sp.tookNoDamage = FALSE;
HandleDealingDamageInternal(target, attacker, &sp, FALSE, giveExp, r10, argC); HandleDealingDamageInternal(target, attacker, &sp, FALSE, giveExp, r10, argC);
} }
} }
@ -503,9 +503,9 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc
s32 r8 = 0; s32 r8 = 0;
Tile *unkTile = NULL; Tile *unkTile = NULL;
dmgStruct->unkF = 0; dmgStruct->tookNoDamage = FALSE;
if (GetEntityType(target) != ENTITY_MONSTER) { if (GetEntityType(target) != ENTITY_MONSTER) {
dmgStruct->unkF = 1; dmgStruct->tookNoDamage = TRUE;
return FALSE; return FALSE;
} }
@ -523,14 +523,14 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc
SetMessageArgument(gFormatBuffer_Monsters[1], target, 0); SetMessageArgument(gFormatBuffer_Monsters[1], target, 0);
TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80FCA90); TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80FCA90);
sub_8042238(attacker, target); sub_8042238(attacker, target);
dmgStruct->unkF = 1; dmgStruct->tookNoDamage = TRUE;
return FALSE; return FALSE;
} }
if (targetData->immobilize.immobilizeStatus == STATUS_FROZEN) { if (targetData->immobilize.immobilizeStatus == STATUS_FROZEN) {
SetMessageArgument(gFormatBuffer_Monsters[1], target, 0); SetMessageArgument(gFormatBuffer_Monsters[1], target, 0);
TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80F9600); TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80F9600);
sub_8042238(attacker, target); sub_8042238(attacker, target);
dmgStruct->unkF = 1; dmgStruct->tookNoDamage = TRUE;
return FALSE; return FALSE;
} }
@ -542,12 +542,12 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc
if ((HasAbility(target, ABILITY_VOLT_ABSORB) && dmgStruct->type == TYPE_ELECTRIC)) { if ((HasAbility(target, ABILITY_VOLT_ABSORB) && dmgStruct->type == TYPE_ELECTRIC)) {
HealTargetHP(attacker, target, dmgStruct->dmg, 0, 0); HealTargetHP(attacker, target, dmgStruct->dmg, 0, 0);
dmgStruct->unkF = 1; dmgStruct->tookNoDamage = TRUE;
return FALSE; return FALSE;
} }
else if (HasAbility(target, ABILITY_WATER_ABSORB) && dmgStruct->type == TYPE_WATER) { else if (HasAbility(target, ABILITY_WATER_ABSORB) && dmgStruct->type == TYPE_WATER) {
HealTargetHP(attacker, target, dmgStruct->dmg, 0, 0); HealTargetHP(attacker, target, dmgStruct->dmg, 0, 0);
dmgStruct->unkF = 1; dmgStruct->tookNoDamage = TRUE;
return FALSE; return FALSE;
} }
@ -583,7 +583,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc
} }
sub_803E708(0x1E, 0x18); sub_803E708(0x1E, 0x18);
} }
dmgStruct->unkF = 1; dmgStruct->tookNoDamage = TRUE;
return FALSE; return FALSE;
} }
else if (dmgStruct->dmg == 9999) { else if (dmgStruct->dmg == 9999) {

View File

@ -150,7 +150,7 @@ static inline void SetDamageOne(struct DamageStruct *dmgStruct, u8 moveType)
dmgStruct->type = moveType; dmgStruct->type = moveType;
dmgStruct->isCrit = FALSE; dmgStruct->isCrit = FALSE;
dmgStruct->unkE = 0; dmgStruct->unkE = 0;
dmgStruct->unkF = 0; dmgStruct->tookNoDamage = FALSE;
} }
void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s32 critChance, struct DamageStruct *dmgStruct, s32 arg8, u16 moveId, bool8 arg_10) void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s32 critChance, struct DamageStruct *dmgStruct, s32 arg8, u16 moveId, bool8 arg_10)
@ -447,11 +447,11 @@ void DealDamageToEntity(Entity *entity, s32 dmg, s32 r6, s16 r4)
dmgStruct.residualDmgType = r6; dmgStruct.residualDmgType = r6;
dmgStruct.isCrit = FALSE; dmgStruct.isCrit = FALSE;
dmgStruct.unkE = 0; dmgStruct.unkE = 0;
dmgStruct.unkF = 0; dmgStruct.tookNoDamage = FALSE;
HandleDealingDamage(&spEntity, entity, &dmgStruct, FALSE, FALSE, r4_, FALSE, 0); HandleDealingDamage(&spEntity, entity, &dmgStruct, FALSE, FALSE, r4_, FALSE, 0);
} }
void sub_806F370(Entity *pokemon, Entity *target, s32 dmg, s32 r9, u8 *arg_0, u8 moveType, s16 arg_8, s32 arg_C, s32 arg_10, s32 arg_14) void sub_806F370(Entity *pokemon, Entity *target, s32 dmg, s32 giveExp, bool8 *tookNoDamage, u8 moveType, s16 arg_8, s32 residualDmgType, s32 arg_10, s32 arg_14)
{ {
s32 i; s32 i;
struct DamageStruct dmgStruct; struct DamageStruct dmgStruct;
@ -459,7 +459,7 @@ void sub_806F370(Entity *pokemon, Entity *target, s32 dmg, s32 r9, u8 *arg_0, u8
s32 dmgNew = dmg; s32 dmgNew = dmg;
dmgStruct.typeEffectiveness = EFFECTIVENESS_NEUTRAL; dmgStruct.typeEffectiveness = EFFECTIVENESS_NEUTRAL;
dmgStruct.residualDmgType = arg_C; dmgStruct.residualDmgType = residualDmgType;
dmgStruct.type = moveType; dmgStruct.type = moveType;
dmgStruct.isCrit = FALSE; dmgStruct.isCrit = FALSE;
dmgStruct.unkE = 0; dmgStruct.unkE = 0;
@ -480,14 +480,14 @@ void sub_806F370(Entity *pokemon, Entity *target, s32 dmg, s32 r9, u8 *arg_0, u8
dmgStruct.dmg = dmgNew; dmgStruct.dmg = dmgNew;
if (dmgNew == 0) { if (dmgNew == 0) {
dmgStruct.unkF = 1; dmgStruct.tookNoDamage = TRUE;
} }
else { else {
dmgStruct.unkF = 0; dmgStruct.tookNoDamage = FALSE;
} }
HandleDealingDamage(pokemon, target, &dmgStruct, FALSE, r9, arg_8_, arg_10, arg_14); HandleDealingDamage(pokemon, target, &dmgStruct, FALSE, giveExp, arg_8_, arg_10, arg_14);
if (arg_0 != NULL) { if (tookNoDamage != NULL) {
*arg_0 = dmgStruct.unkF; *tookNoDamage = dmgStruct.tookNoDamage;
} }
} }

View File

@ -36,6 +36,7 @@ void xxx_init_struct_8094924_save_809486C(struct unkStruct_8094924 *r0, u8 *r1,
MemoryClear8(r1, size); MemoryClear8(r1, size);
} }
// Related to reading/writing bits
void nullsub_102(struct unkStruct_8094924 *r0) void nullsub_102(struct unkStruct_8094924 *r0)
{ {

View File

@ -61,13 +61,13 @@ extern s32 sub_800E710(s16 a0, u16 a1);
extern void sub_800E3AC(s32 a0, Position *pos, s32 a2); extern void sub_800E3AC(s32 a0, Position *pos, s32 a2);
extern void sub_8041168(Entity *entity, Entity *entity2, Move *,Position *); extern void sub_8041168(Entity *entity, Entity *entity2, Move *,Position *);
extern Entity *sub_80696A8(Entity *a0); extern Entity *sub_80696A8(Entity *a0);
extern Entity *sub_804AD0C(Position *pos); extern Entity *GetMonsterAtPos(Position *pos);
extern Entity *sub_80696FC(Entity *); extern Entity *sub_80696FC(Entity *);
extern Entity *sub_806977C(Entity *); extern Entity *sub_806977C(Entity *);
extern void sub_806F2BC(Entity *attacker, Entity *target, u8 moveType, s32 a2, struct DamageStruct *dmgStruct); extern void sub_806F2BC(Entity *attacker, Entity *target, u8 moveType, s32 a2, struct DamageStruct *dmgStruct);
extern void sub_806ACE8(Entity *entity, Move *move); extern void sub_806ACE8(Entity *entity, Move *move);
extern s32 sub_8057070(Move *move); extern s32 sub_8057070(Move *move);
extern bool8 sub_805755C(Entity* pokemon,u16 param_2); extern bool8 MoveRequiresCharging(Entity* pokemon,u16 param_2);
extern s32 sub_800ED20(u16 param_1); extern s32 sub_800ED20(u16 param_1);
extern bool32 sub_8058F04(Entity *pokemon, Entity *target, Move *move, s32 param_4); extern bool32 sub_8058F04(Entity *pokemon, Entity *target, Move *move, s32 param_4);
extern void sub_8042930(Entity *r0); extern void sub_8042930(Entity *r0);
@ -514,7 +514,7 @@ static void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move
TrySendImmobilizeSleepEndMsg(attacker, currTarget); TrySendImmobilizeSleepEndMsg(attacker, currTarget);
r4 = FALSE; r4 = FALSE;
if (!MoveMatchesChargingStatus(attacker, move)) { if (!MoveMatchesChargingStatus(attacker, move)) {
r4 = (sub_805755C(attacker, move->id) != 0); r4 = (MoveRequiresCharging(attacker, move->id) != 0);
} }
if (!lightRodRedirect) { if (!lightRodRedirect) {
@ -1621,7 +1621,7 @@ static void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move
} }
} }
else { else {
if (MoveCausesPaused(move) && sub_8057308(attacker, 0)) { if (MoveCausesPaused(move) && RollSecondaryEffect(attacker, 0)) {
gUnknown_202F222 = 1; gUnknown_202F222 = 1;
} }
} }
@ -1707,10 +1707,10 @@ static s32 TryHitTarget(Entity *attacker, Entity *target, Move *move, struct Dam
else { else {
TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80F9688); // It took no damage! TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80F9688); // It took no damage!
} }
dmgStruct->unkF = 1; dmgStruct->tookNoDamage = TRUE;
} }
if (dmgStruct->unkF != 0) { if (dmgStruct->tookNoDamage) {
return 0; return 0;
} }
@ -1728,7 +1728,7 @@ s32 sub_8055864(Entity *attacker, Entity *target, Move *move, s32 param_4, s32 i
sub_806F2BC(attacker, target, moveType, param_4, &dmgStruct); sub_806F2BC(attacker, target, moveType, param_4, &dmgStruct);
HandleDealingDamage(attacker, target, &dmgStruct, FALSE, TRUE, sub_8057600(move, itemId), TRUE, 0); HandleDealingDamage(attacker, target, &dmgStruct, FALSE, TRUE, sub_8057600(move, itemId), TRUE, 0);
if (dmgStruct.unkF != 0) { if (dmgStruct.tookNoDamage) {
return 0; return 0;
} }
@ -2592,7 +2592,7 @@ void sub_80566F8(Entity *attacker, Move *move, s32 a2, bool8 a3, s32 itemId, s32
break; break;
} }
if (sub_805755C(attacker, move->id) && !MoveMatchesChargingStatus(attacker, move)) { if (MoveRequiresCharging(attacker, move->id) && !MoveMatchesChargingStatus(attacker, move)) {
var_34 = -1; var_34 = -1;
} }
else { else {
@ -2833,7 +2833,7 @@ static void SetTargetsForMove(Entity **targetsArray, Entity *attacker, Move *mov
direction &= DIRECTION_MASK; direction &= DIRECTION_MASK;
unkPositon.x = attacker->pos.x + gAdjacentTileOffsets[direction].x ; unkPositon.x = attacker->pos.x + gAdjacentTileOffsets[direction].x ;
unkPositon.y = attacker->pos.y + gAdjacentTileOffsets[direction].y; unkPositon.y = attacker->pos.y + gAdjacentTileOffsets[direction].y;
targetEntity = sub_804AD0C(&unkPositon); targetEntity = GetMonsterAtPos(&unkPositon);
if (targetEntity != NULL) { if (targetEntity != NULL) {
arrId = SetNewTarget(arrId, targetsArray, targetFlags, attacker, targetEntity, move, canHitPartner); arrId = SetNewTarget(arrId, targetsArray, targetFlags, attacker, targetEntity, move, canHitPartner);
} }
@ -3087,7 +3087,7 @@ u32 sub_8057144(Entity * pokemon)
for (j = 0; j < MAX_MON_MOVES; j++) for (j = 0; j < MAX_MON_MOVES; j++)
{ {
if (moves[j].moveFlags & MOVE_FLAG_EXISTS if (moves[j].moveFlags & MOVE_FLAG_EXISTS
&& !sub_805755C(pokemon, moves[j].id) && !MoveRequiresCharging(pokemon, moves[j].id)
&& moves[j].id != MOVE_SKETCH && moves[j].id != MOVE_SKETCH
&& nMoves < 80) { && nMoves < 80) {
moveStack[nMoves++] = &moves[j]; moveStack[nMoves++] = &moves[j];
@ -3175,7 +3175,7 @@ bool8 sub_805727C(Entity * pokemon, Entity * target, s32 chance)
return uVar2; return uVar2;
} }
bool8 sub_8057308(Entity *pokemon, s32 chance) bool8 RollSecondaryEffect(Entity *pokemon, s32 chance)
{ {
if(!EntityExists(pokemon)) if(!EntityExists(pokemon))
return FALSE; return FALSE;

View File

@ -201,19 +201,19 @@ extern s32 sub_80556BC(Entity *, Entity *, u8, Move *, u32, u32);
// move_util.h // move_util.h
extern bool8 sub_805727C(Entity *, Entity *, s16); extern bool8 sub_805727C(Entity *, Entity *, s16);
bool8 sub_8057308(Entity *pokemon, s32 chance); bool8 RollSecondaryEffect(Entity *pokemon, s32 chance);
bool8 sub_80571F0(Entity * pokemon, Move *move); bool8 sub_80571F0(Entity * pokemon, Move *move);
extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32);
extern u32 HandleDamagingMove(Entity *, Entity *, Move *, u32, u32); extern u32 HandleDamagingMove(Entity *, Entity *, Move *, u32, u32);
u8 sub_8057620(u32 param_1); u8 ToItemID(u32 param_1);
extern s16 sub_8094828(u16, u8); extern s16 sub_8094828(u16, u8);
extern void DealDamageToEntity(Entity *, s32, u32, u32); extern void DealDamageToEntity(Entity *, s32, u32, u32);
extern s16 gUnknown_80F4DB4; extern s16 gUnknown_80F4DB4;
extern u32 gUnknown_8106A4C; extern u32 gUnknown_8106A4C;
bool8 sub_805755C(Entity* pokemon, u16 moveID) bool8 MoveRequiresCharging(Entity* pokemon, u16 moveID)
{ {
if ((moveID == MOVE_SOLARBEAM) && (GetApparentWeather(pokemon) == WEATHER_SUNNY)) { if ((moveID == MOVE_SOLARBEAM) && (GetApparentWeather(pokemon) == WEATHER_SUNNY)) {
return FALSE; return FALSE;
@ -261,10 +261,10 @@ void sub_8057588(Entity * pokemon, u8 param_2)
s16 sub_8057600(Move *move, s32 itemID) s16 sub_8057600(Move *move, s32 itemID)
{ {
return sub_8094828(move->id, sub_8057620(itemID)); return sub_8094828(move->id, ToItemID(itemID));
} }
u8 sub_8057620(u32 itemID) u8 ToItemID(u32 itemID)
{ {
if(itemID == ITEM_NOTHING) if(itemID == ITEM_NOTHING)
return ITEM_NOTHING; return ITEM_NOTHING;
@ -664,7 +664,7 @@ bool8 sub_8057E6C(Entity *pokemon, Entity *target, Move *move, u32 param_4)
SendThawedMessage(pokemon,target); SendThawedMessage(pokemon,target);
if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) {
flag = TRUE; flag = TRUE;
if (sub_8057308(pokemon, 0)) { if (RollSecondaryEffect(pokemon, 0)) {
entityInfo->unk155 = 1; entityInfo->unk155 = 1;
} }
} }
@ -1062,7 +1062,7 @@ bool8 sub_80586DC(Entity * pokemon, Entity * target, Move * move, u32 param_4)
hasLiquidOoze = HasAbility(target, ABILITY_LIQUID_OOZE); hasLiquidOoze = HasAbility(target, ABILITY_LIQUID_OOZE);
uVar3 = HandleDamagingMove(pokemon,target,move,0x100,param_4); uVar3 = HandleDamagingMove(pokemon,target,move,0x100,param_4);
flag = uVar3 != 0 ? TRUE : FALSE; flag = uVar3 != 0 ? TRUE : FALSE;
if (flag && sub_8057308(pokemon, 0)) { if (flag && RollSecondaryEffect(pokemon, 0)) {
newHP = uVar3 / 2; newHP = uVar3 / 2;
entityInfo = GetEntInfo(pokemon); entityInfo = GetEntInfo(pokemon);
flag = TRUE; flag = TRUE;
@ -1151,7 +1151,7 @@ bool8 sub_80588B8(Entity *pokemon, Entity *target, Move *move, u32 param_4)
if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0) if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0)
{ {
flag = TRUE; flag = TRUE;
if(sub_8057308(pokemon, 0)) if(RollSecondaryEffect(pokemon, 0))
{ {
gUnknown_202F219 = 1; gUnknown_202F219 = 1;
} }
@ -1178,7 +1178,7 @@ bool8 sub_8058930(Entity *pokemon, Entity *target, Move *move, u32 param_4)
if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0) if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0)
{ {
flag = TRUE; flag = TRUE;
if(sub_8057308(pokemon, gUnknown_80F4DD6)) if(RollSecondaryEffect(pokemon, gUnknown_80F4DD6))
{ {
entityInfo = GetEntInfo(pokemon); entityInfo = GetEntInfo(pokemon);
RaiseMovementSpeedTarget(pokemon, pokemon, 0, TRUE); RaiseMovementSpeedTarget(pokemon, pokemon, 0, TRUE);
@ -1212,7 +1212,7 @@ bool8 sub_8058A18(Entity *pokemon, Entity *target, Move *move, u32 param_4)
if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0) if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0)
{ {
flag = TRUE; flag = TRUE;
if(sub_8057308(pokemon, 0)) if(RollSecondaryEffect(pokemon, 0))
{ {
gUnknown_202F21A = 1; gUnknown_202F21A = 1;
} }
@ -1351,7 +1351,7 @@ bool8 sub_8058CEC(Entity *pokemon, Entity *target, Move *move, u32 param_4)
if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0) if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0)
{ {
flag = TRUE; flag = TRUE;
if(sub_8057308(pokemon, 0)) if(RollSecondaryEffect(pokemon, 0))
{ {
LowerAttackStageTarget(pokemon, pokemon, gUnknown_8106A50, 2, 0, FALSE); LowerAttackStageTarget(pokemon, pokemon, gUnknown_8106A50, 2, 0, FALSE);
} }
@ -1432,7 +1432,7 @@ bool8 sub_8058E5C(Entity *pokemon, Entity *target, Move *move, s32 param_4)
iVar3 = 1; iVar3 = 1;
} }
flag = TRUE; flag = TRUE;
if ((!HasAbility(pokemon, ABILITY_ROCK_HEAD)) && sub_8057308(pokemon, 0)) { if ((!HasAbility(pokemon, ABILITY_ROCK_HEAD)) && RollSecondaryEffect(pokemon, 0)) {
sub_806F370(pokemon,pokemon,iVar3,0,0,0,0x1fd,0x14,1,0); sub_806F370(pokemon,pokemon,iVar3,0,0,0,0x1fd,0x14,1,0);
} }
} }
@ -1601,7 +1601,7 @@ bool8 sub_80591E4(Entity *pokemon, Entity *target, Move *move, s32 param_4)
EntityInfo *entityInfo = GetEntInfo(pokemon); EntityInfo *entityInfo = GetEntInfo(pokemon);
flag = TRUE; flag = TRUE;
SetExpMultplier(entityInfo); SetExpMultplier(entityInfo);
if (sub_8057308(pokemon,0)) { if (RollSecondaryEffect(pokemon,0)) {
if (hasLiquidOoze) { if (hasLiquidOoze) {
DealDamageToEntity(pokemon,iVar4,0xd,0x1fa); DealDamageToEntity(pokemon,iVar4,0xd,0x1fa);
} }
@ -1707,7 +1707,7 @@ bool8 sub_805946C(Entity * pokemon,Entity * target,Move * move,u32 param_4)
flag = FALSE; flag = FALSE;
if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) {
flag = TRUE; flag = TRUE;
if ((!HasAbility(pokemon, ABILITY_ROCK_HEAD)) && (sub_8057308(pokemon,0) != 0)) { if ((!HasAbility(pokemon, ABILITY_ROCK_HEAD)) && (RollSecondaryEffect(pokemon,0) != 0)) {
HP = GetEntInfo(pokemon)->maxHPStat; HP = GetEntInfo(pokemon)->maxHPStat;
if (HP < 0) { if (HP < 0) {
HP = HP + 7; HP = HP + 7;
@ -2464,7 +2464,7 @@ bool8 sub_805A464(Entity *pokemon, Entity *target, Move *move, u32 param_4)
flag = FALSE; flag = FALSE;
if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) {
flag = TRUE; flag = TRUE;
if (sub_8057308(pokemon, 0) != 0) { if (RollSecondaryEffect(pokemon, 0) != 0) {
if (!EntityExists(target)) { if (!EntityExists(target)) {
pos.x = 0; pos.x = 0;
pos.y = 0; pos.y = 0;

View File

@ -696,7 +696,7 @@ const u8* DecompressMoveID(const u8* src, u16* moveID)
return src; return src;
} }
s32 sub_808E0AC(u16* a1, s16 species, s32 a3, s32 IQPoints) s32 GetMovesLearnedAtLevel(u16* dst, s16 species, s32 level, s32 IQPoints)
{ {
const u8* stream; const u8* stream;
u16 moveID; // moveID u16 moveID; // moveID
@ -720,20 +720,20 @@ s32 sub_808E0AC(u16* a1, s16 species, s32 a3, s32 IQPoints)
stream = DecompressMoveID(stream, &moveID); stream = DecompressMoveID(stream, &moveID);
v12 = *stream++; v12 = *stream++;
if (v12 > a3) if (v12 > level)
break; break;
if (v12 == a3) { if (v12 == level) {
bool8 cond = 1; bool8 cond = TRUE;
// NOTE: these moves require IQ to be > 333 // NOTE: these moves require IQ to be > 333
if ((moveID == MOVE_FRENZY_PLANT) && (IQPoints < gFrenzyPlantIQReq)) cond = 0; if ((moveID == MOVE_FRENZY_PLANT) && (IQPoints < gFrenzyPlantIQReq)) cond = FALSE;
if ((moveID == MOVE_HYDRO_CANNON) && (IQPoints < gHydroCannonIQReq)) cond = 0; if ((moveID == MOVE_HYDRO_CANNON) && (IQPoints < gHydroCannonIQReq)) cond = FALSE;
if ((moveID == MOVE_BLAST_BURN) && (IQPoints < gBlastBurnIQReq)) cond = 0; if ((moveID == MOVE_BLAST_BURN) && (IQPoints < gBlastBurnIQReq)) cond = FALSE;
if ((moveID == MOVE_VOLT_TACKLE) && (IQPoints < gVoltTackleIQReq)) cond = 0; if ((moveID == MOVE_VOLT_TACKLE) && (IQPoints < gVoltTackleIQReq)) cond = FALSE;
if (cond) { if (cond) {
if (count < 16) { if (count < 16) {
*a1++ = moveID; *dst++ = moveID;
++count; ++count;
} }
} }
@ -928,7 +928,7 @@ void sub_808E490(Move* a1, s16 species)
{ {
u16 buffer[0x10]; // of moveIDs u16 buffer[0x10]; // of moveIDs
s32 i; s32 i;
s32 count = sub_808E0AC(buffer, species, 1, 999); s32 count = GetMovesLearnedAtLevel(buffer, species, 1, 999);
if (count == 0) { if (count == 0) {
count = 1; count = 1;
buffer[0] = MOVE_ITEM_TOSS; buffer[0] = MOVE_ITEM_TOSS;

View File

@ -79,7 +79,7 @@ extern void SqueezedStatusTarget(Entity *, Entity *, s32, bool32);
extern void sub_8075C58(Entity *, Entity *, s32, s32); extern void sub_8075C58(Entity *, Entity *, s32, s32);
extern void DealDamageToEntity(Entity *, s32, u32, u32); extern void DealDamageToEntity(Entity *, s32, u32, u32);
extern bool8 sub_805755C(Entity* pokemon,u16 moveID); extern bool8 MoveRequiresCharging(Entity* pokemon,u16 moveID);
extern void sub_80783C4(Entity *, Entity *, u32); extern void sub_80783C4(Entity *, Entity *, u32);
@ -431,7 +431,7 @@ bool8 MimicMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4
for(moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) for(moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
{ {
movePtr = &targetEntityInfo->moves.moves[moveIndex]; movePtr = &targetEntityInfo->moves.moves[moveIndex];
if (((movePtr->moveFlags & MOVE_FLAG_EXISTS)) && !sub_805755C(pokemon,movePtr->id)) { if (((movePtr->moveFlags & MOVE_FLAG_EXISTS)) && !MoveRequiresCharging(pokemon,movePtr->id)) {
if ((movePtr->id != MOVE_MIMIC) && (movePtr->id != MOVE_ASSIST) && (movePtr->id != MOVE_SKETCH) && (movePtr->id != MOVE_MIRROR_MOVE) && if ((movePtr->id != MOVE_MIMIC) && (movePtr->id != MOVE_ASSIST) && (movePtr->id != MOVE_SKETCH) && (movePtr->id != MOVE_MIRROR_MOVE) &&
(movePtr->id != MOVE_ENCORE) && ((movePtr->moveFlags & MOVE_FLAG_LAST_USED))) { (movePtr->id != MOVE_ENCORE) && ((movePtr->moveFlags & MOVE_FLAG_LAST_USED))) {
entityInfo->mimicMoveIDs[moveCounter] = movePtr->id; entityInfo->mimicMoveIDs[moveCounter] = movePtr->id;
@ -517,9 +517,9 @@ bool8 sub_805B668(Entity * pokemon, Entity * target, Move *move, s32 param_4)
if (newHP < 1) { if (newHP < 1) {
newHP = 1; newHP = 1;
} }
if (sub_8057308(pokemon,0) != 0) { if (RollSecondaryEffect(pokemon,0) != 0) {
SetExpMultplier(GetEntInfo(pokemon)); SetExpMultplier(GetEntInfo(pokemon));
if (sub_8057308(pokemon,0) != 0) { if (RollSecondaryEffect(pokemon,0) != 0) {
if (hasLiquidOoze) { if (hasLiquidOoze) {
DealDamageToEntity(pokemon,newHP,0xd,0x1fa); DealDamageToEntity(pokemon,newHP,0xd,0x1fa);
} }
@ -637,7 +637,7 @@ bool8 sub_805B968(Entity * pokemon, Entity * target, Move * move, s32 param_4)
flag = FALSE; flag = FALSE;
if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) {
flag = TRUE; flag = TRUE;
if (sub_8057308(pokemon,0) != 0) { if (RollSecondaryEffect(pokemon,0) != 0) {
entityHP = GetEntInfo(pokemon)->maxHPStat; entityHP = GetEntInfo(pokemon)->maxHPStat;
if (entityHP < 0) { if (entityHP < 0) {
entityHP = entityHP + 3; entityHP = entityHP + 3;

View File

@ -90,7 +90,7 @@ extern void sub_8049BB0(s32, s32);
void sub_8042A14(Position *); void sub_8042A14(Position *);
extern void sub_8049ED4(void); extern void sub_8049ED4(void);
bool8 sub_804ACE4(Position *pos) bool8 PosHasItem(Position *pos)
{ {
struct Tile *tile; struct Tile *tile;
Entity *entity; Entity *entity;
@ -103,7 +103,7 @@ bool8 sub_804ACE4(Position *pos)
return FALSE; return FALSE;
} }
Entity *sub_804AD0C(Position *pos) Entity *GetMonsterAtPos(Position *pos)
{ {
struct Tile *tile; struct Tile *tile;
Entity *entity; Entity *entity;