From cdaa211c580b746f0e732afb4c3a3a0c4622d02c Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 3 Dec 2024 19:19:22 +0100 Subject: [PATCH] use f248 for modifiers --- data/data_80F4E2C.s | 159 ---------------------- include/dungeon_battle_data.h | 33 +++++ include/structs/dungeon_entity.h | 2 +- src/code_8048480.c | 3 +- src/code_8069E0C.c | 2 +- src/code_8073CF0.c | 32 ++--- src/code_8077274_1.c | 33 ++--- src/dungeon_battle_data.c | 36 +++++ src/dungeon_move.c | 22 +-- src/dungeon_serializer.c | 4 +- src/move_actions.c | 226 +++++++++++++++---------------- src/move_effects_target.c | 3 +- src/status.c | 14 +- 13 files changed, 225 insertions(+), 344 deletions(-) diff --git a/data/data_80F4E2C.s b/data/data_80F4E2C.s index 770a9421f..1e5d8bac0 100644 --- a/data/data_80F4E2C.s +++ b/data/data_80F4E2C.s @@ -3,165 +3,6 @@ - .global gUnknown_80F4EF0 -gUnknown_80F4EF0: @ 80F4EF0 -@ replacing .incbin "baserom.gba", 0x000f4ef0, 0x4 -.byte 0x0a, 0x00 -.byte 0x0a, 0x00 - - .global gUnknown_80F4EF4 -gUnknown_80F4EF4: @ 80F4EF4 -@ replacing .incbin "baserom.gba", 0x000f4ef4, 0x4 -.byte 0x0a, 0x00 -.byte 0x0a, 0x00 - - .global gUnknown_80F4EF8 -gUnknown_80F4EF8: @ 80F4EF8 -@ replacing .incbin "baserom.gba", 0x000f4ef8, 0x4 -.byte 0x03, 0x00 -.byte 0x05, 0x00 - - .global gUnknown_80F4EFC -gUnknown_80F4EFC: @ 80F4EFC -@ replacing .incbin "baserom.gba", 0x000f4efc, 0x4 -.byte 0x7f, 0x00 -.byte 0x7f, 0x00 - - .global gUnknown_80F4F00 -gUnknown_80F4F00: @ 80F4F00 -@ replacing .incbin "baserom.gba", 0x000f4f00, 0x4 -.byte 0x04, 0x00 -.byte 0x06, 0x00 - - .global gUnknown_80F4F04 -gUnknown_80F4F04: @ 80F4F04 -@ replacing .incbin "baserom.gba", 0x000f4f04, 0x4 -.byte 0x7f, 0x00 -.byte 0x7f, 0x00 - - .global gUnknown_80F4F08 -gUnknown_80F4F08: @ 80F4F08 -@ replacing .incbin "baserom.gba", 0x000f4f08, 0x4 -.byte 0x0a, 0x00 -.byte 0x0a, 0x00 - - .global gUnknown_80F4F0C -gUnknown_80F4F0C: @ 80F4F0C -@ replacing .incbin "baserom.gba", 0x000f4f0c, 0x4 -.byte 0x0a, 0x00 -.byte 0x0a, 0x00 - - .global gUnknown_80F4F10 -gUnknown_80F4F10: @ 80F4F10 -@ replacing .incbin "baserom.gba", 0x000f4f10, 0x8 -.byte 0x7f, 0x00 -.byte 0x7f, 0x00 -.byte 0x0a, 0x00 -.byte 0x0a, 0x00 - - .global gUnknown_80F4F18 -gUnknown_80F4F18: @ 80F4F18 -@ replacing .incbin "baserom.gba", 0x000f4f18, 0x4 -.byte 0x02, 0x00 -.byte 0x05, 0x00 - - .global gUnknown_80F4F1C -gUnknown_80F4F1C: @ 80F4F1C -@ replacing .incbin "baserom.gba", 0x000f4f1c, 0x4 -.byte 0x0a, 0x00 -.byte 0x0a, 0x00 - - .global gUnknown_80F4F20 -gUnknown_80F4F20: @ 80F4F20 -@ replacing .incbin "baserom.gba", 0x000f4f20, 0x4 -.byte 0x0a, 0x00 -.byte 0x0a, 0x00 - - .global gUnknown_80F4F24 -gUnknown_80F4F24: @ 80F4F24 -@ replacing .incbin "baserom.gba", 0x000f4f24, 0x4 -.byte 0x0f, 0x00 -.byte 0x14, 0x00 - - .global gUnknown_80F4F28 -gUnknown_80F4F28: @ 80F4F28 -@ replacing .incbin "baserom.gba", 0x000f4f28, 0x4 -.byte 0x02, 0x00 -.byte 0x02, 0x00 - - .global gUnknown_80F4F2C -gUnknown_80F4F2C: @ 80F4F2C -@ replacing .incbin "baserom.gba", 0x000f4f2c, 0x4 -.byte 0x04, 0x00 -.byte 0x08, 0x00 - - .global gUnknown_80F4F30 -gUnknown_80F4F30: @ 80F4F30 -@ replacing .incbin "baserom.gba", 0x000f4f30, 0x2 -.byte 0xfa, 0x00 - - .global gUnknown_80F4F32 -gUnknown_80F4F32: @ 80F4F32 -@ replacing .incbin "baserom.gba", 0x000f4f32, 0x2 -.byte 0x14, 0x00 - - .global gUnknown_80F4F34 -gUnknown_80F4F34: @ 80F4F34 -@ replacing .incbin "baserom.gba", 0x000f4f34, 0x2 -.byte 0x0a, 0x00 - - .global gUnknown_80F4F36 -gUnknown_80F4F36: @ 80F4F36 -@ replacing .incbin "baserom.gba", 0x000f4f36, 0x2 -.byte 0x02, 0x00 - - .global gUnknown_80F4F38 -gUnknown_80F4F38: @ 80F4F38 -@ replacing .incbin "baserom.gba", 0x000f4f38, 0x2 -.byte 0x02, 0x00 - - .global gUnknown_80F4F3A -gUnknown_80F4F3A: @ 80F4F3A -@ replacing .incbin "baserom.gba", 0x000f4f3a, 0x2 -.byte 0x02, 0x00 - - .global gUnknown_80F4F3C -gUnknown_80F4F3C: @ 80F4F3C -@ replacing .incbin "baserom.gba", 0x000f4f3c, 0x2 -.byte 0x05, 0x00 - - .global gUnknown_80F4F3E -gUnknown_80F4F3E: @ 80F4F3E -@ replacing .incbin "baserom.gba", 0x000f4f3e, 0x2 -.byte 0x0a, 0x00 - - .global gUnknown_80F4F40 -gUnknown_80F4F40: @ 80F4F40 -@ replacing .incbin "baserom.gba", 0x000f4f40, 0x2 -.byte 0x02, 0x00 - - .global gUnknown_80F4F42 -gUnknown_80F4F42: @ 80F4F42 -@ replacing .incbin "baserom.gba", 0x000f4f42, 0x4 -.byte 0x14, 0x00 -.byte 0x5f, 0x00 - - .global gUnknown_80F4F46 -gUnknown_80F4F46: @ 80F4F46 -@ replacing .incbin "baserom.gba", 0x000f4f46, 0x2 -.byte 0x0c, 0x00 - - .global gSolarBeamMovePower -gSolarBeamMovePower: @ 80F4F48 -@ replacing .incbin "baserom.gba", 0x000f4f48, 0x4 -.4byte 0x0200 - - .global gUnknown_80F4F4C -gUnknown_80F4F4C: @ 80F4F4C -@ replacing .incbin "baserom.gba", 0x000f4f4c, 0x4 -.byte 0x00, 0x02 -.byte 0x00, 0x00 - .global gUnknown_80F4F50 gUnknown_80F4F50: @ 80F4F50 @ replacing .incbin "baserom.gba", 0x000f4f50, 0x4 diff --git a/include/dungeon_battle_data.h b/include/dungeon_battle_data.h index 50f0d6034..fc68ecd3f 100644 --- a/include/dungeon_battle_data.h +++ b/include/dungeon_battle_data.h @@ -1,6 +1,8 @@ #ifndef GUARD_DUNGEON_BATTLE_DATA_H #define GUARD_DUNGEON_BATTLE_DATA_H +#include "math.h" + extern const s16 gFreezeTurnRange[2]; extern const s16 gBurnTurnRange[2]; extern const s16 gPoisonTurnRange[2]; @@ -46,5 +48,36 @@ extern const s16 gObserverOrbPausedTurnRange[2]; extern const s16 gInvisibleTurnRange[2]; extern const s16 gMirrorCoatTurnRange[2]; extern const s16 gPerishSongTurnRange[2]; +extern const s16 gDestinyBondTurnRange[2]; +extern const s16 gEncoreTurnRange[2]; +extern const s16 gEnduringTurnRange[2]; +extern const s16 gTransformedTurnRange[2]; +extern const s16 gInfatuatedTurnRange[2]; +extern const s16 gMobileTurnRange[2]; +extern const s16 gBlinkerTurnRange[2]; +extern const s16 gCrossEyedTurnRange[2]; +extern const s16 gEyedropsTurnRange[2]; +extern const s16 gMirrorMoveTurnRange[2]; +extern const s16 gMuzzledTurnRange[2]; +extern const s16 gConversion2TurnRange[2]; +extern const s16 gVitalThrowTurnRange[2]; +extern const s16 gYawnTurnRange[2]; +extern const s16 gSleepFromYawnTurnRange[2]; + +extern const s16 gSpeedBoostActivationFrame; + +extern const s16 gBurnDmgCountdown; +extern const s16 gPoisonDmgCountdown; +extern const s16 gBadPoisonDmgCountdown; +extern const s16 gConstrictionDmgCountdown; +extern const s16 gWrapDmgCountdown; +extern const s16 gIngrainHealCountdown; +extern const s16 gCurseDmgCountdown; +extern const s16 gLeechSeedDmgCountdown; + +extern const s16 gMoveWeatherDuration; +extern const s16 gGinsengPlus3BoostChance; +extern const s24_8 gSolarBeamModifier; +extern const s24_8 gSkyAttackModifier; #endif diff --git a/include/structs/dungeon_entity.h b/include/structs/dungeon_entity.h index 73c900c3d..316147f99 100644 --- a/include/structs/dungeon_entity.h +++ b/include/structs/dungeon_entity.h @@ -289,7 +289,7 @@ typedef struct EntityInfo /* 0x108 */ u8 speedUpCounters[NUM_SPEED_COUNTERS]; /* 0x10D */ u8 speedDownCounters[NUM_SPEED_COUNTERS]; /* 0x112 */ u8 stockpileStage; - /* 0x113 */ u8 unk113; + /* 0x113 */ u8 speedBoostFrames; // Frames counter, when it reaches the value in gSpeedBoostActivationFrame(250 by default), it resets to 0 and pokemon gets a speed boost. // When non-zero, an AI Pokémon will move in a random direction every turn when it is a room. // There is a chance of this flag being set when a wild Pokémon spawns. The chance depends on the dungeon's randomMovementChance. /* 0x114 */ u32 moveRandomly; diff --git a/src/code_8048480.c b/src/code_8048480.c index c1c83019d..02c7469c0 100644 --- a/src/code_8048480.c +++ b/src/code_8048480.c @@ -37,7 +37,6 @@ extern s16 gUnknown_80F4FB8; extern s16 gUnknown_80F4FBA; extern s16 gUnknown_80F4FBC; extern s16 gUnknown_80F4FBE; -extern s16 gUnknown_80F4F46; // 0xC extern s16 gUnknown_80F4FA2; extern s16 gUnknown_80F4FA4; // 0x14 extern s16 gUnknown_80F4FA6; // 0x2D @@ -631,7 +630,7 @@ void GinsengItemAction(Entity *pokemon, Entity * target) s32 moveBoost = 1; EntityInfo *entityInfo = GetEntInfo(target); - if (DungeonRandInt(100) < gUnknown_80F4F46) { + if (DungeonRandInt(100) < gGinsengPlus3BoostChance) { moveBoost = 3; } diff --git a/src/code_8069E0C.c b/src/code_8069E0C.c index ebfa049f4..509a5209d 100644 --- a/src/code_8069E0C.c +++ b/src/code_8069E0C.c @@ -1874,7 +1874,7 @@ void ResetMonEntityData(EntityInfo *entInfo, bool8 setStatsToOne) entInfo->flashFireBoost = 0; entInfo->stockpileStage = 0; entInfo->perishSongTurns = 0; - entInfo->unk113 = 0; + entInfo->speedBoostFrames = 0; entInfo->grudge = 0; entInfo->expMultiplier = EXP_HALVED; entInfo->exposed = FALSE; diff --git a/src/code_8073CF0.c b/src/code_8073CF0.c index 39d01a8c5..c9bcb873e 100644 --- a/src/code_8073CF0.c +++ b/src/code_8073CF0.c @@ -33,6 +33,7 @@ #include "code_8077274_1.h" #include "dungeon_pokemon_attributes.h" #include "math.h" +#include "dungeon_battle_data.h" extern bool8 sub_8044B28(void); extern void sub_8075708(Entity *entity); @@ -87,24 +88,15 @@ extern const s16 gWarpScarfActivationChances[]; extern const s16 gUnknown_80F4FC8[]; extern const s16 gUnknown_80F4F8E; extern const s16 gUnknown_80F4E0C; -extern const s16 gUnknown_80F4F32; -extern const s16 gUnknown_80F4F34; extern const s16 gUnknown_80F4F70; extern const s16 gUnknown_80F4F72; -extern const s16 gUnknown_80F4F30; -extern const s16 gUnknown_80F4F38; extern const s16 gUnknown_80F4FC4; extern const s16 gUnknown_80F4FC0; -extern const s16 gUnknown_80F4F3A; -extern const s16 gUnknown_80F4F3C; extern const s16 gUnknown_80F4FB2; -extern const s16 gUnknown_80F4F3E; extern const s16 gUnknown_80F4FB4; -extern const s16 gUnknown_80F4F40; extern const s16 gUnknown_80F4F74; extern const s16 gUnknown_80F4FC2; extern const s16 gUnknown_80F4F76; -extern const s16 gUnknown_80F4F36; extern s48_16 gUnknown_80F54F4[8]; extern const s32 gUnknown_80F60DC[]; @@ -414,9 +406,9 @@ void sub_8074094(Entity *entity) sub_8079F20(entity, entity, 1, 0); } if (AbilityIsActive(entity, ABILITY_SPEED_BOOST)) { - entityInfo->unk113++; - if (entityInfo->unk113 >= gUnknown_80F4F30) { - entityInfo->unk113 = 0; + entityInfo->speedBoostFrames++; + if (entityInfo->speedBoostFrames >= gSpeedBoostActivationFrame) { + entityInfo->speedBoostFrames = 0; RaiseMovementSpeedTarget(entity, entity, 0x7F, FALSE); } } @@ -434,7 +426,7 @@ void sub_8074094(Entity *entity) UseAttack(NULL); if (!EntityExists(entity) || sub_8044B28()) return; - entityInfo->burnClassStatus.damageCountdown = gUnknown_80F4F32; + entityInfo->burnClassStatus.damageCountdown = gBurnDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); DealDamageToEntity(entity, gUnknown_80F4F70, 1, 0x208); } @@ -447,7 +439,7 @@ void sub_8074094(Entity *entity) UseAttack(NULL); if (!EntityExists(entity) || sub_8044B28()) return; - entityInfo->burnClassStatus.damageCountdown = gUnknown_80F4F34; + entityInfo->burnClassStatus.damageCountdown = gPoisonDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); DealDamageToEntity(entity, gUnknown_80F4F72, 3, 0x20A); } @@ -459,7 +451,7 @@ void sub_8074094(Entity *entity) s32 turns = entityInfo->burnClassStatus.unk4; if (entityInfo->burnClassStatus.unk4 < 29) entityInfo->burnClassStatus.unk4++; - entityInfo->burnClassStatus.damageCountdown = gUnknown_80F4F36; + entityInfo->burnClassStatus.damageCountdown = gBadPoisonDmgCountdown; if (turns >= 29) turns = 29; @@ -479,7 +471,7 @@ void sub_8074094(Entity *entity) UseAttack(NULL); if (!EntityExists(entity) || sub_8044B28()) return; - entityInfo->frozenClassStatus.damageCountdown = gUnknown_80F4F38; + entityInfo->frozenClassStatus.damageCountdown = gConstrictionDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); sub_8041C4C(entity, entityInfo->frozenClassStatus.unk4); DealDamageToEntity(entity, gUnknown_80F4F74, 2, 0x209); @@ -492,7 +484,7 @@ void sub_8074094(Entity *entity) UseAttack(NULL); if (!EntityExists(entity) || sub_8044B28()) return; - entityInfo->frozenClassStatus.damageCountdown = gUnknown_80F4F3A; + entityInfo->frozenClassStatus.damageCountdown = gWrapDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); DealDamageToEntity(entity, gUnknown_80F4F76, 5, 0x20B); } @@ -504,7 +496,7 @@ void sub_8074094(Entity *entity) UseAttack(NULL); if (!EntityExists(entity) || sub_8044B28()) return; - entityInfo->frozenClassStatus.damageCountdown = gUnknown_80F4F3C; + entityInfo->frozenClassStatus.damageCountdown = gIngrainHealCountdown; HealTargetHP(entity, entity, gUnknown_80F4FB2, 0, TRUE); } } @@ -514,7 +506,7 @@ void sub_8074094(Entity *entity) s32 dmg = entityInfo->maxHPStat / 4; if (dmg == 0) dmg = 1; - entityInfo->curseClassStatus.damageCountdown = gUnknown_80F4F3E; + entityInfo->curseClassStatus.damageCountdown = gCurseDmgCountdown; UseAttack(NULL); if (!EntityExists(entity) || sub_8044B28()) return; @@ -531,7 +523,7 @@ void sub_8074094(Entity *entity) s32 hp = gUnknown_80F4FB4; Entity *target = gDungeon->activePokemon[entityInfo->leechSeedClassStatus.unk8]; - entityInfo->leechSeedClassStatus.damageCountdown = gUnknown_80F4F40; + entityInfo->leechSeedClassStatus.damageCountdown = gLeechSeedDmgCountdown; if (target == NULL) { entityInfo->leechSeedClassStatus.status = 0; } diff --git a/src/code_8077274_1.c b/src/code_8077274_1.c index 15f56247a..06cdd46e7 100644 --- a/src/code_8077274_1.c +++ b/src/code_8077274_1.c @@ -74,7 +74,6 @@ extern u8 *gUnknown_80FA888[]; extern u8 *gUnknown_80FA8A8[]; extern u8 *gUnknown_80FA868[]; extern s16 gUnknown_80F4F78; -extern s16 gUnknown_80F4F2C[]; extern s32 gUnknown_80F4F7A; extern u8 *gUnknown_80FA6E8[]; extern u8 *gUnknown_80FA708[]; @@ -90,17 +89,13 @@ extern u8 *gUnknown_80FBD18[]; extern u8 *gUnknown_80FBD3C[]; extern u8 *gUnknown_80FBCF0[]; extern u8 *gUnknown_80FBCC8[]; -extern s16 gUnknown_80F4F24[]; extern u8 *gUnknown_80FBCA4[]; extern u8 *gUnknown_80FBC7C[]; extern u8 *gPtrForecastPreventsConversion2Message[]; -extern s16 gUnknown_80F4F20[]; extern u8 *gUnknown_80FBC5C[]; extern u8 *gUnknown_80FBC38[]; -extern s16 gUnknown_80F4F18[]; extern u8 *gUnknown_80FBC14[]; extern u8 *gUnknown_80FBBF0[]; -extern s16 gUnknown_80F4EF8[]; extern u8 *gUnknown_80FBAE4[]; extern u8 *gUnknown_80FBAC0[]; extern u8 *gUnknown_80FB9B0[]; @@ -136,11 +131,8 @@ extern u8 *gUnknown_80FDBD0[]; extern u8 *gUnknown_80FDBF0[]; extern u8 *gUnknown_80FB880[]; extern u8 *gUnknown_80FB89C[]; -extern s16 gUnknown_80F4F10[]; extern u8 *gUnknown_80FB834[]; extern u8 *gUnknown_80FB85C[]; -extern s16 gUnknown_80F4F0C[]; -extern s16 gUnknown_80F4F08[]; extern u8 *gUnknown_80FB810[]; extern u8 *gUnknown_80FB7F4[]; extern u8 *gUnknown_80FC028[]; @@ -151,12 +143,9 @@ extern u8 *gUnknown_80FBF9C[]; extern u8 *gUnknown_80FBFB8[]; extern u8 *gUnknown_80FBF04[]; extern u8 *gUnknown_80FBEC0[]; -extern s16 gUnknown_80F4EFC[]; extern u8 *gUnknown_80FBEE4[]; -extern s16 gUnknown_80F4F04[]; extern u8 *gUnknown_80FBF50[]; extern u8 *gUnknown_80FBF28[]; -extern s16 gUnknown_80F4F1C[]; extern u8 *gUnknown_80FBF68[]; extern u8 *gUnknown_80FBF84[]; @@ -212,7 +201,7 @@ void MuzzleTarget(Entity *pokemon, Entity *target) SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); if (entityInfo->muzzled.muzzled != TRUE) { entityInfo->muzzled.muzzled = TRUE; - entityInfo->muzzled.turns = CalculateStatusTurns(target,gUnknown_80F4F1C, TRUE) + 1; + entityInfo->muzzled.turns = CalculateStatusTurns(target,gMuzzledTurnRange, TRUE) + 1; nullsub_86(target); TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FBF68); } @@ -269,7 +258,7 @@ void TransformStatusTarget(Entity * pokemon, Entity * target) entityInfo->apparentID = apparentID; target->axObj.spriteFile = sprite; entityInfo->invisibleClassStatus.status = STATUS_TRANSFORMED; - entityInfo->invisibleClassStatus.turns = CalculateStatusTurns(target, gUnknown_80F4EFC, TRUE) + 1; + entityInfo->invisibleClassStatus.turns = CalculateStatusTurns(target, gTransformedTurnRange, TRUE) + 1; sub_806CF98(target); nullsub_87(target); sub_806CCB4(target, sub_806CEBC(target)); @@ -295,7 +284,7 @@ void MobileStatusTarget(Entity * pokemon, Entity * target) SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); if (entityInfo->invisibleClassStatus.status != STATUS_MOBILE) { entityInfo->invisibleClassStatus.status = STATUS_MOBILE; - entityInfo->invisibleClassStatus.turns = CalculateStatusTurns(target,gUnknown_80F4F04, FALSE) + 1; + entityInfo->invisibleClassStatus.turns = CalculateStatusTurns(target,gMobileTurnRange, FALSE) + 1; nullsub_88(target); TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBF28); } @@ -380,7 +369,7 @@ void BlindTarget(Entity *pokemon, Entity *target) SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); if (entityInfo->blinkerClassStatus.status != STATUS_BLINKER) { entityInfo->blinkerClassStatus.status = STATUS_BLINKER; - entityInfo->blinkerClassStatus.turns = CalculateStatusTurns(target,gUnknown_80F4F08, TRUE) + 1; + entityInfo->blinkerClassStatus.turns = CalculateStatusTurns(target,gBlinkerTurnRange, TRUE) + 1; sub_8041E0C(target); TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB7F4); sub_803E46C(0x31); @@ -409,7 +398,7 @@ void CrossEyeVisionTarget(Entity *pokemon, Entity *target) sub_8041E1C(target); TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB834); entityInfo->blinkerClassStatus.status = STATUS_CROSS_EYED; - entityInfo->blinkerClassStatus.turns = CalculateStatusTurns(target,gUnknown_80F4F0C, TRUE) + 1; + entityInfo->blinkerClassStatus.turns = CalculateStatusTurns(target,gCrossEyedTurnRange, TRUE) + 1; sub_803F580(0x1); sub_8049ED4(); sub_8040A84(); @@ -433,7 +422,7 @@ void RestoreVisionTarget(Entity *pokemon, Entity *target) SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); if (entityInfo->blinkerClassStatus.status != STATUS_EYEDROPS) { entityInfo->blinkerClassStatus.status = STATUS_EYEDROPS; - entityInfo->blinkerClassStatus.turns = CalculateStatusTurns(target,gUnknown_80F4F10, FALSE) + 1; + entityInfo->blinkerClassStatus.turns = CalculateStatusTurns(target,gEyedropsTurnRange, FALSE) + 1; sub_8041E3C(target); TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB880); sub_803E46C(0x31); @@ -917,7 +906,7 @@ void EndureStatusTarget(Entity * pokemon, Entity * target) SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); if (entityInfo->reflectClassStatus.status != STATUS_ENDURING) { entityInfo->reflectClassStatus.status = STATUS_ENDURING; - entityInfo->reflectClassStatus.turns = CalculateStatusTurns(target, gUnknown_80F4EF8, FALSE) + 1; + entityInfo->reflectClassStatus.turns = CalculateStatusTurns(target, gEnduringTurnRange, FALSE) + 1; nullsub_65(target); TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBBF0); } @@ -937,7 +926,7 @@ void MirrorMoveStatusTarget(Entity * pokemon, Entity * target) SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); if (entityInfo->reflectClassStatus.status != STATUS_MIRROR_MOVE) { entityInfo->reflectClassStatus.status = STATUS_MIRROR_MOVE; - entityInfo->reflectClassStatus.turns = CalculateStatusTurns(target, gUnknown_80F4F18, FALSE) + 1; + entityInfo->reflectClassStatus.turns = CalculateStatusTurns(target, gMirrorMoveTurnRange, FALSE) + 1; nullsub_66(target); TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBC38); } @@ -962,7 +951,7 @@ void Conversion2StatusTarget(Entity * pokemon, Entity * target) SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); if (entityInfo->reflectClassStatus.status != STATUS_CONVERSION2) { entityInfo->reflectClassStatus.status = STATUS_CONVERSION2; - entityInfo->reflectClassStatus.turns = CalculateStatusTurns(target, gUnknown_80F4F20, FALSE) + 1; + entityInfo->reflectClassStatus.turns = CalculateStatusTurns(target, gConversion2TurnRange, FALSE) + 1; nullsub_67(target); TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBC7C); } @@ -983,7 +972,7 @@ void VitalThrowStatusTarget(Entity * pokemon, Entity * target) SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); if (entityInfo->reflectClassStatus.status != STATUS_VITAL_THROW) { entityInfo->reflectClassStatus.status = STATUS_VITAL_THROW; - entityInfo->reflectClassStatus.turns = CalculateStatusTurns(target, gUnknown_80F4F24, FALSE) + 1; + entityInfo->reflectClassStatus.turns = CalculateStatusTurns(target, gVitalThrowTurnRange, FALSE) + 1; nullsub_68(target); TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBCC8); } @@ -1179,7 +1168,7 @@ void EndSleepClassStatus(Entity * pokemon, Entity * target, bool8 param_3, bool8 case STATUS_YAWNING: if (param_3) { entityInfo->sleepClassStatus.status = STATUS_NONE; - SleepStatusTarget(pokemon,target,CalculateStatusTurns(target, gUnknown_80F4F2C, TRUE) + 1, TRUE); + SleepStatusTarget(pokemon,target,CalculateStatusTurns(target, gSleepFromYawnTurnRange, TRUE) + 1, TRUE); return; } TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FA734); diff --git a/src/dungeon_battle_data.c b/src/dungeon_battle_data.c index 2b2b1c87e..bd39d0c16 100644 --- a/src/dungeon_battle_data.c +++ b/src/dungeon_battle_data.c @@ -1,5 +1,6 @@ #include "global.h" #include "dungeon_battle_data.h" +#include "math.h" const s16 gFreezeTurnRange[2] = {3, 5}; const s16 gBurnTurnRange[2] = {0x7F, 0x7F}; @@ -50,3 +51,38 @@ const s16 gObserverOrbPausedTurnRange[2] = {10, 12}; const s16 gInvisibleTurnRange[2] = {10, 20}; const s16 gMirrorCoatTurnRange[2] = {10, 12}; const s16 gPerishSongTurnRange[2] = {3, 3}; +const s16 gDestinyBondTurnRange[2] = {10, 10}; +const s16 gEncoreTurnRange[2] = {10, 10}; +const s16 gEnduringTurnRange[2] = {3, 5}; +const s16 gTransformedTurnRange[2] = {0x7F, 0x7F}; +const s16 gInfatuatedTurnRange[2] = {4, 6}; +const s16 gMobileTurnRange[2] = {0x7F, 0x7F}; +const s16 gBlinkerTurnRange[2] = {10, 10}; +const s16 gCrossEyedTurnRange[2] = {10, 10}; +const s16 gEyedropsTurnRange[2] = {0x7F, 0x7F}; +UNUSED static const s16 sUnusedTurnRange5[2] = {10, 10}; +const s16 gMirrorMoveTurnRange[2] = {2, 5}; +const s16 gMuzzledTurnRange[2] = {10, 10}; +const s16 gConversion2TurnRange[2] = {10, 10}; +const s16 gVitalThrowTurnRange[2] = {15, 20}; +const s16 gYawnTurnRange[2] = {2, 2}; +const s16 gSleepFromYawnTurnRange[2] = {4, 8}; + +const s16 gSpeedBoostActivationFrame = 250; + +const s16 gBurnDmgCountdown = 20; +const s16 gPoisonDmgCountdown = 10; +const s16 gBadPoisonDmgCountdown = 2; +const s16 gConstrictionDmgCountdown = 2; +const s16 gWrapDmgCountdown = 2; +const s16 gIngrainHealCountdown = 5; +const s16 gCurseDmgCountdown = 10; +const s16 gLeechSeedDmgCountdown = 2; + +const s16 gMoveWeatherDuration = 20; + +UNUSED static const s16 sUnusedConfig1 = 95; + +const s16 gGinsengPlus3BoostChance = 12; +const s24_8 gSolarBeamModifier = IntToF248_2(2.0); +const s24_8 gSkyAttackModifier = IntToF248_2(2.0); diff --git a/src/dungeon_move.c b/src/dungeon_move.c index 2a6ce44ea..a7c69c5df 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -45,7 +45,7 @@ extern void sub_80429C8(Entity *r0); extern bool8 sub_8045888(Entity *r0); extern void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 arg4, bool32 arg8, s32 argC); -extern void CalcDamage(Entity *, Entity *, u8, u32, u32, struct DamageStruct *dmgStruct, u32, u16, u32); +extern void CalcDamage(Entity *, Entity *, u8, u32, u32, struct DamageStruct *dmgStruct, s24_8, u16, u32); extern s16 sub_8057600(Move *move, s32 itemID); extern void sub_803ED30(s32, Entity *r0, u8, s32); extern void sub_8042238(Entity *pokemon, Entity *target); @@ -302,7 +302,7 @@ extern bool8 SnoreMoveAction(Entity *pokemon, Entity *target, Move *move, s32 pa extern bool8 MetronomeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); extern bool8 Conversion2MoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -s32 HandleDamagingMove(Entity *, Entity *, Move *, s32, s32); +s32 HandleDamagingMove(Entity *, Entity *, Move *, s24_8, s32); static s32 TryHitTarget(Entity *attacker, Entity *target, Move *move, struct DamageStruct *dmgStruct, s16 unk); static void TriggerTargetAbilityEffect(Entity *attacker); static bool8 AccuracyCalc(Entity *attacker, Entity *target, Move *move, s32 accuracyType, bool8 selfAlwaysHits); @@ -716,13 +716,13 @@ static void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move case MOVE_WIDE_SLASH: case MOVE_SPIN_SLASH: case MOVE_BLOOP_SLASH: - moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, 0x100, itemId) != 0); + moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, IntToF248_2(1), itemId) != 0); break; case MOVE_REGULAR_ATTACK: - moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, 0x80, itemId) != 0); + moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, IntToF248_2(0.5), itemId) != 0); break; case MOVE_NOTHING: - moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, 0, itemId) != 0); + moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, IntToF248_2(0), itemId) != 0); break; case MOVE_EARTHQUAKE: moveHadEffect = EarthquakeMoveAction(attacker, currTarget, move, itemId); @@ -764,7 +764,7 @@ static void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move case MOVE_CROSS_CHOP: case MOVE_RAZOR_LEAF: case MOVE_LEAF_BLADE: - moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, 0x100, itemId) != 0); + moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, IntToF248_2(1), itemId) != 0); break; case MOVE_FISSURE: moveHadEffect = FissureMoveAction(attacker, currTarget, move, itemId); @@ -1655,10 +1655,10 @@ static void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move bool32 HandleRegularDamagingMove(Entity *attacker, Entity *target, Move *move, s32 itemId) { - return (HandleDamagingMove(attacker, target, move, 0x100, itemId) != 0); + return (HandleDamagingMove(attacker, target, move, IntToF248_2(1), itemId) != 0); } -s32 HandleDamagingMove(Entity *attacker, Entity *target, Move *move, s32 r9, s32 itemId) +s32 HandleDamagingMove(Entity *attacker, Entity *target, Move *move, s24_8 modifier, s32 itemId) { struct DamageStruct dmgStruct; s16 unk; @@ -1666,19 +1666,19 @@ s32 HandleDamagingMove(Entity *attacker, Entity *target, Move *move, s32 r9, s32 s32 movePower = GetMovePower(attacker, move); s32 critChance = GetMoveCritChance(move); - CalcDamage(attacker, target, moveType, movePower, critChance, &dmgStruct, r9, move->id, 1); + CalcDamage(attacker, target, moveType, movePower, critChance, &dmgStruct, modifier, move->id, 1); unk = sub_8057600(move, itemId); return TryHitTarget(attacker, target, move, &dmgStruct, unk); } -s32 sub_80556BC(Entity *attacker, Entity *target, u8 moveType, Move *move, s32 r9, s32 itemId) +s32 sub_80556BC(Entity *attacker, Entity *target, u8 moveType, Move *move, s24_8 modifier, s32 itemId) { struct DamageStruct dmgStruct; s16 unk; s32 movePower = GetMovePower(attacker, move); s32 critChance = GetMoveCritChance(move); - CalcDamage(attacker, target, moveType, movePower, critChance, &dmgStruct, r9, move->id, 1); + CalcDamage(attacker, target, moveType, movePower, critChance, &dmgStruct, modifier, move->id, 1); unk = sub_8057600(move, itemId); return TryHitTarget(attacker, target, move, &dmgStruct, unk); } diff --git a/src/dungeon_serializer.c b/src/dungeon_serializer.c index 9de009126..a7ec95d5a 100644 --- a/src/dungeon_serializer.c +++ b/src/dungeon_serializer.c @@ -362,7 +362,7 @@ static void WriteMonster(DataSerializer *seri, Entity *src) WriteSpeedCounters(seri, info->speedUpCounters, NUM_SPEED_COUNTERS); WriteSpeedCounters(seri, info->speedDownCounters, NUM_SPEED_COUNTERS); WriteU8(seri, info->stockpileStage); - WriteU8(seri, info->unk113); + WriteU8(seri, info->speedBoostFrames); WriteU8(seri, info->moveRandomly); WriteMoves(seri, &info->moves); WriteBelly(seri, &info->belly); @@ -1046,7 +1046,7 @@ static void ReadMonster(DataSerializer *seri, bool8 isTeamMember, s32 index) ReadSpeedCounters(seri, entInfo.speedUpCounters, NUM_SPEED_COUNTERS); ReadSpeedCounters(seri, entInfo.speedDownCounters, NUM_SPEED_COUNTERS); entInfo.stockpileStage = ReadU8(seri); - entInfo.unk113 = ReadU8(seri); + entInfo.speedBoostFrames = ReadU8(seri); entInfo.moveRandomly = ReadU8(seri); ReadMoves(seri, &entInfo.moves); ReadBelly(seri, &entInfo.belly); diff --git a/src/move_actions.c b/src/move_actions.c index 3b986f829..1264cbe66 100644 --- a/src/move_actions.c +++ b/src/move_actions.c @@ -47,24 +47,23 @@ extern s16 gUnknown_80F4DE8; extern u8 *gUnknown_80FAD6C[]; extern s16 gUnknown_80F4DE4; extern u8 *gUnknown_80FBD58[]; -extern u32 gUnknown_80F51B4[]; +extern s24_8 gUnknown_80F51B4[]; extern s16 gUnknown_80F4DC0; extern s16 gUnknown_80F4DF8; extern s16 gUnknown_80F4DD0; extern s16 gUnknown_80F4DBC; extern u8 *gUnknown_80FACC4[]; extern s16 gUnknown_80F4DF4; -extern u32 gUnknown_80F4F4C; extern u8 gUnknown_202F21A; extern s16 gUnknown_80F500A[]; extern s16 gUnknown_80F4DD6; extern u8 gUnknown_202F219; -extern u32 gUnknown_80F51A4[]; +extern s24_8 gUnknown_80F51A4[]; extern u8 *gUnknown_80FACA4[]; -extern u32 gUnknown_80F4F54; +extern s24_8 gUnknown_80F4F54; extern u8 *gUnknown_80FD104[]; extern s16 gUnknown_80F4DD4; -extern u32 gUnknown_80F4F6C; +extern s24_8 gUnknown_80F4F6C; extern u32 gUnknown_80F4DE6; extern u32 gUnknown_80F4DEE; extern u32 gUnknown_80F4DC2; @@ -72,7 +71,7 @@ extern u8 *gUnknown_80FD294[]; extern u8 *gUnknown_80FD2B4[]; extern u8 *gUnknown_80FAC74[]; extern u8 *gUnknown_80FAC54[]; -extern u32 gUnknown_80F4F50; +extern s24_8 gUnknown_80F4F50; extern s16 gUnknown_80F4DB8; extern s16 gUnknown_80F4DBA; extern s16 gUnknown_80F55BC[]; @@ -81,7 +80,6 @@ extern u8 *gUnknown_80FADD8[]; extern s16 gUnknown_80F4E02; extern s16 gUnknown_80F4E04; extern s16 gUnknown_80F4DB6; -extern u16 gUnknown_80F4F42; extern u8 *gUnknown_80FAC88; extern u8 *gUnknown_80FD018[]; extern u8 *gUnknown_80FCFBC[]; @@ -99,19 +97,17 @@ extern u32 gUnknown_8106A50; extern s16 gUnknown_80F4E08; extern u8 *gUnknown_80FD14C[]; extern u8 *gUnknown_80FAD4C[]; -extern u32 gUnknown_80F4F68; +extern s24_8 gUnknown_80F4F68; extern s16 gUnknown_80F502A[]; -extern s16 gUnknown_80F4F28[]; -extern u32 gUnknown_8106A54[]; +extern s24_8 gUnknown_8106A54[]; extern s16 gUnknown_80F4DF0; extern s16 gUnknown_80F4DE0; extern s16 gUnknown_80F4DC4; extern u8 *gUnknown_80FCF78[]; extern s16 gUnknown_80F4DF0; -extern u32 gUnknown_80F4F5C; +extern s24_8 gUnknown_80F4F5C; extern u8 *gUnknown_80FACFC[]; extern s16 gUnknown_80F4F7C; -extern s32 gSolarBeamMovePower; extern u8 *gUnknown_80FACE4[]; extern u8 *gUnknown_80FEB8C[]; extern u32 gUnknown_8106A4C; @@ -121,7 +117,7 @@ extern s16 gUnknown_80F4DEC; extern s16 gUnknown_80F4E00; extern u8 *gUnknown_80FD128[]; extern u8 *gUnknown_80FAD2C[]; -extern u32 gUnknown_80F4F64; +extern s24_8 gUnknown_80F4F64; extern u8 gSecretPowerTable[]; extern s16 gUnknown_80F4E06; extern u8 *gUnknown_80FC74C[]; @@ -133,7 +129,6 @@ extern u8 *gUnknown_80FC81C[]; extern u8 *gUnknown_80FC854[]; extern u8 *gUnknown_80FCF7C[]; extern u8 *gUnknown_80FC730[]; -extern u16 gUnknown_80F4F42; extern s16 gUnknown_80F4DF2; extern u8 *gUnknown_80FC770[]; extern s32 gUnknown_80F51D4[]; @@ -153,7 +148,7 @@ extern s16 gUnknown_80F4DFE; extern u8 *gUnknown_81004EC[]; extern s16 gUnknown_80F4DFC; extern u8 *gUnknown_80FC7C8[]; -extern u32 gUnknown_80F4F60; +extern s24_8 gUnknown_80F4F60; extern u8 *gUnknown_80FAD10[]; extern s16 gUnknown_80F4DCC; extern s16 gUnknown_80F4DBE; @@ -200,7 +195,7 @@ bool8 RollSecondaryEffect(Entity *pokemon, s32 chance); bool8 sub_80571F0(Entity * pokemon, Move *move); 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 *, s24_8, u32); u8 ToItemID(u32 param_1); extern s16 sub_8094828(u16, u8); extern void DealDamageToEntity(Entity *, s32, u32, u32); @@ -272,7 +267,7 @@ bool8 IronTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon, target, gUnknown_80F4DB4)) { LowerDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, FALSE); @@ -297,7 +292,7 @@ bool8 sub_805768C(Entity *pokemon, Entity *target, Move *move, s32 param_4) bool8 YawnMoveAction(Entity * pokemon, Entity *target, Move *move, s32 param_4) { - YawnedStatusTarget(pokemon, target, CalculateStatusTurns(target,gUnknown_80F4F28,TRUE) + 1); + YawnedStatusTarget(pokemon, target, CalculateStatusTurns(target,gYawnTurnRange,TRUE) + 1); return TRUE; } @@ -363,7 +358,7 @@ bool32 CharmMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) bool32 RainDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - gDungeon->weather.unkE267[WEATHER_RAIN] = gUnknown_80F4F42; + gDungeon->weather.unkE267[WEATHER_RAIN] = gMoveWeatherDuration; if (sub_807EAA0(1,0) == 0) { // The weather remains unchanged TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCF74); @@ -373,7 +368,7 @@ bool32 RainDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para bool32 HailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - gDungeon->weather.unkE267[WEATHER_HAIL]= gUnknown_80F4F42; + gDungeon->weather.unkE267[WEATHER_HAIL] = gMoveWeatherDuration; if (sub_807EAA0(1,0) == 0) { // The weather remains unchanged TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCF80); @@ -392,7 +387,7 @@ bool32 BubbleMoveAction(Entity *pokemon, Entity *target, Move * move, u32 param_ bool32 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,target, gUnknown_80F4DB6)) { LowerMovementSpeedTarget(pokemon, target, 1, FALSE); @@ -532,7 +527,7 @@ bool8 SnoreMoveAction(Entity *pokemon, Entity *target, Move * move, u32 param_4) flag = FALSE; if (IsSleeping(pokemon)) { - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4E0A)) { CringeStatusTarget(pokemon,target,FALSE); @@ -556,7 +551,7 @@ bool8 RockSlideMoveAction(Entity *pokemon, Entity *target, Move * move, u32 para bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4DF6)) { CringeStatusTarget(pokemon,target,FALSE); @@ -581,17 +576,17 @@ bool32 WeatherBallMoveAction(Entity * pokemon, Entity * target, Move * move, u32 bool8 WhirlpoolMoveAction(Entity * pokemon, Entity * target, Move * move, u32 param_4) { - u32 uVar3; + s24_8 modifier; bool8 flag; u8 chargeStatus; flag = FALSE; chargeStatus = GetEntInfo(target)->bideClassStatus.status; - uVar3 = 0x100; + modifier = IntToF248_2(1); if (chargeStatus == STATUS_DIVING) { - uVar3 = 0x200; + modifier = IntToF248_2(2); } - if (HandleDamagingMove(pokemon,target,move,uVar3,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,modifier,param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4E08)) { SqueezedStatusTarget(pokemon,target,0x3b,FALSE); @@ -658,7 +653,7 @@ bool8 OverheatMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_ flag = FALSE; entityInfo = GetEntInfo(pokemon); SendThawedMessage(pokemon,target); - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if (RollSecondaryEffect(pokemon, 0)) { entityInfo->unk155 = 1; @@ -672,7 +667,7 @@ bool8 AuroraBeamMoveAction(Entity *pokemon, Entity *target, Move *move, u32 para bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4E04)) { @@ -699,7 +694,7 @@ bool8 OctazookaMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4E02)) { @@ -800,7 +795,7 @@ bool8 FlameWheelMoveAction(Entity *pokemon, Entity *target, Move *move, u32 para flag = FALSE; SendThawedMessage(pokemon, target); - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DB8)) { @@ -817,7 +812,7 @@ bool8 BasicFireMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param flag = FALSE; SendThawedMessage(pokemon, target); - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DBA)) { @@ -844,14 +839,14 @@ bool8 DoubleTeamMoveAction(Entity *pokemon, Entity *target, Move *move, u32 para bool8 GustMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; - u32 r3; + s32 modifierInt; EntityInfo *targetInfo; - r3 = 1; + modifierInt = 1; targetInfo = GetEntInfo(target); if(targetInfo->bideClassStatus.status == STATUS_FLYING || targetInfo->bideClassStatus.status == STATUS_BOUNCING) - r3 = 2; - flag = HandleDamagingMove(pokemon,target,move,r3 << 8,param_4) ? TRUE : FALSE; + modifierInt = 2; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),param_4) ? TRUE : FALSE; return flag; } @@ -917,7 +912,7 @@ bool8 ShadowBallMoveAction(Entity *pokemon, Entity *target, Move *move, u32 para bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DC2)) { @@ -932,7 +927,7 @@ bool8 BiteMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DEE)) { @@ -947,7 +942,7 @@ bool8 ThunderMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4 bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DE6)) { @@ -981,12 +976,12 @@ bool8 EndeavorMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_ bool8 FacadeMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; - u32 r5; + s24_8 modifier; - r5 = 0x80 << 1; + modifier = IntToF248_2(1); if((GetEntInfo(pokemon)->burnClassStatus.status) != STATUS_NONE) - r5 = gUnknown_80F4F6C; - flag = HandleDamagingMove(pokemon,target,move,r5,param_4) ? TRUE : FALSE; + modifier = gUnknown_80F4F6C; + flag = HandleDamagingMove(pokemon,target,move,modifier,param_4) ? TRUE : FALSE; return flag; } @@ -995,7 +990,7 @@ bool8 sub_8058580(Entity *pokemon, Entity *target, Move *move, u32 param_4) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DD4)) { @@ -1016,7 +1011,7 @@ bool8 BrickBreakMoveAction(Entity *pokemon, Entity *target, Move *move, u32 para flag = TRUE; } - flag |= (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0); + flag |= (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0); return flag; } @@ -1025,7 +1020,7 @@ bool8 RockTombMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_ bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -1059,7 +1054,7 @@ bool8 GigaDrainMoveAction(Entity * pokemon, Entity * target, Move * move, u32 pa EntityInfo *entityInfo; hasLiquidOoze = AbilityIsActive(target, ABILITY_LIQUID_OOZE); - uVar3 = HandleDamagingMove(pokemon,target,move,0x100,param_4); + uVar3 = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4); flag = uVar3 != 0 ? TRUE : FALSE; if (flag && RollSecondaryEffect(pokemon, 0)) { newHP = uVar3 / 2; @@ -1107,11 +1102,11 @@ bool8 SmellingSaltMoveAction(Entity * pokemon, Entity * target, Move * move, u32 bool8 flag; if (GetEntInfo(target)->burnClassStatus.status == STATUS_PARALYSIS) { - flag = HandleDamagingMove(pokemon,target,move,0x80 << 2,param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),param_4) ? TRUE : FALSE; EndBurnClassStatus(pokemon, target); } else { - flag = HandleDamagingMove(pokemon,target,move,0x80 << 1,param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) ? TRUE : FALSE; } return flag; } @@ -1145,7 +1140,7 @@ bool8 HazeMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) bool8 OutrageMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, 0)) @@ -1158,21 +1153,22 @@ bool8 OutrageMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4 bool8 LowKickMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { + s24_8 weight; bool8 flag; EntityInfo *entityInfo = GetEntInfo(target); - flag = HandleDamagingMove(pokemon, target, move, GetWeight(entityInfo->apparentID), param_4) != 0 ? TRUE: FALSE; + weight.raw = GetWeight(entityInfo->apparentID); + flag = HandleDamagingMove(pokemon, target, move, weight, param_4) != 0 ? TRUE: FALSE; return flag; } - bool8 AncientPowerMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag = FALSE; EntityInfo *entityInfo; s32 index1; s32 index2; - if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, gUnknown_80F4DD6)) @@ -1206,7 +1202,7 @@ bool8 AgilityMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4 bool8 RapidSpinMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, 0)) @@ -1236,7 +1232,7 @@ bool8 SkyAttackMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param if(MoveMatchesBideClassStatus(pokemon, move)) { - if (HandleDamagingMove(pokemon, target, move, gUnknown_80F4F4C, param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, gSkyAttackModifier, param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DF4)) CringeStatusTarget(pokemon, target, FALSE); @@ -1256,7 +1252,7 @@ bool8 BasicIceMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_ bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DBC)) { @@ -1272,7 +1268,7 @@ bool8 MeteorMashMoveAction(Entity *pokemon, Entity *target, Move *move, u32 para EntityInfo *entityInfo; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, pokemon, gUnknown_80F4DD0)) { @@ -1301,7 +1297,7 @@ bool8 sub_8058C00(Entity *pokemon, Entity *target, Move *move, u32 param_4) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DF8)) { @@ -1333,7 +1329,7 @@ bool8 sub_8058C98(Entity *pokemon, Entity *target, Move *move, u32 param_4, u32 bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_5) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_5) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DC0)) { @@ -1346,7 +1342,7 @@ bool8 sub_8058C98(Entity *pokemon, Entity *target, Move *move, u32 param_4, u32 bool8 PsychoBoostMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, 0x80 << 1, param_4) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, 0)) @@ -1418,7 +1414,7 @@ bool8 sub_8058E5C(Entity *pokemon, Entity *target, Move *move, s32 param_4) bool8 flag; flag = FALSE; - if ((HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) && (EntityExists(pokemon))) { + if ((HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) && (EntityExists(pokemon))) { iVar2 = GetEntInfo(pokemon)->maxHPStat; if (iVar2 < 0) { iVar2 = iVar2 + 7; @@ -1445,16 +1441,16 @@ bool32 EarthquakeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 par { bool32 flag; EntityInfo *entityInfo; - s32 iVar3; + s32 modifierInt; entityInfo = GetEntInfo(target); - iVar3 = 1; + modifierInt = 1; gDungeon->unk181e8.unk18200 = 0xc; gDungeon->unk181e8.unk18204 = 0; if (entityInfo->bideClassStatus.status == STATUS_DIGGING) { - iVar3 = 2; + modifierInt = 2; } - flag = HandleDamagingMove(pokemon,target,move,iVar3 << 8,param_4); + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),param_4); if (flag != 0) { flag = TRUE; } @@ -1484,7 +1480,7 @@ bool8 LickMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DE4)) { @@ -1517,7 +1513,7 @@ bool8 ThunderboltMoveAction(Entity *pokemon, Entity *target, Move *move, u32 par bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DE8)) { @@ -1562,7 +1558,7 @@ bool8 ExtrasensoryMoveAction(Entity *pokemon, Entity *target, Move *move, u32 pa bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DEA)) { @@ -1587,7 +1583,7 @@ bool8 AbsorbMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) flag = FALSE; hasLiquidOoze = AbilityIsActive(target, ABILITY_LIQUID_OOZE); - iVar3 = HandleDamagingMove(pokemon,target,move,0x100,param_4); + iVar3 = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4); if (iVar3 != 0) { iVar4 = iVar3 / 2; if (iVar4 < 1) { @@ -1685,7 +1681,7 @@ bool8 HeadbuttMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_ bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DF0)) { @@ -1701,7 +1697,7 @@ bool8 DoubleEdgeMoveAction(Entity * pokemon,Entity * target,Move * move,u32 para bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if ((!AbilityIsActive(pokemon, ABILITY_ROCK_HEAD)) && (RollSecondaryEffect(pokemon,0) != 0)) { HP = GetEntInfo(pokemon)->maxHPStat; @@ -1721,7 +1717,7 @@ bool8 DoubleEdgeMoveAction(Entity * pokemon,Entity * target,Move * move,u32 para bool8 SandstormMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { - gDungeon->weather.unkE267[WEATHER_SANDSTORM] = gUnknown_80F4F42; + gDungeon->weather.unkE267[WEATHER_SANDSTORM] = gMoveWeatherDuration; if(sub_807EAA0(1, 0) == 0) { TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FCF78); @@ -1740,7 +1736,7 @@ bool8 SmogMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DC4)) { @@ -1761,7 +1757,7 @@ bool8 SacredFireMoveAction(Entity *pokemon, Entity *target, Move *move, u32 para bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DE0)) { @@ -1792,16 +1788,16 @@ bool8 sub_80595EC(Entity * pokemon,Entity * target,Move * move,u32 param_4) bool8 SolarBeamMoveAction(Entity * pokemon,Entity * target,Move * move,u32 param_4) { u8 weather; // weather and flag are reused in same variable - s32 movePower; + s24_8 modifier; weather = GetApparentWeather(pokemon); if ((weather == WEATHER_SUNNY) || (MoveMatchesBideClassStatus(pokemon,move))) { - movePower = gSolarBeamMovePower; + modifier = gSolarBeamModifier; if (((weather == WEATHER_SANDSTORM) || (weather == WEATHER_RAIN)) || weather == WEATHER_HAIL) { - movePower /= 2; + modifier.raw /= 2; } - weather = HandleDamagingMove(pokemon,target,move,movePower,param_4) != 0 ? TRUE : FALSE; + weather = HandleDamagingMove(pokemon,target,move,modifier,param_4) != 0 ? TRUE : FALSE; sub_8079764(pokemon); } else { @@ -1867,7 +1863,7 @@ bool8 MuddyWaterMoveAction(Entity *pokemon, Entity *target, Move *move, u32 para bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4E00)) { @@ -1885,15 +1881,14 @@ bool8 StockpileMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param bool8 TwisterMoveAction(Entity * pokemon,Entity * target,Move * move,u32 param_4) { - bool8 flag; - s32 iVar2; + s32 modifierInt = 1; + bool8 flag = FALSE; + EntityInfo *entInfo = GetEntInfo(target); - iVar2 = 1; - flag = FALSE; - if ((u8)(GetEntInfo(target)->bideClassStatus.status - 7) <= 1){ - iVar2 = 2; + if (entInfo->bideClassStatus.status == STATUS_FLYING || entInfo->bideClassStatus.status == STATUS_BOUNCING) { + modifierInt = 2; } - if (HandleDamagingMove(pokemon,target,move,iVar2 << 8,param_4) != 0) + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon,target,gUnknown_80F4DEC) != 0) { @@ -1908,7 +1903,7 @@ bool8 TwineedleMoveAction(Entity * pokemon,Entity * target,Move * move,u32 param bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; gUnknown_202F218 = 1; } @@ -2071,7 +2066,7 @@ bool8 ThundershockMoveAction(Entity *pokemon, Entity *target, Move *move, u32 pa bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DE2)) { @@ -2092,7 +2087,7 @@ bool8 ZapCannonMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -2125,7 +2120,7 @@ bool8 PoisonFangMoveAction(Entity *pokemon, Entity *target, Move *move, u32 para bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DCA)) { @@ -2140,7 +2135,7 @@ bool8 PoisonStingMoveAction(Entity *pokemon, Entity *target, Move *move, u32 par bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DBE)) { @@ -2161,7 +2156,7 @@ bool8 JumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,u32 param_ flag = FALSE; if (param_5 == 0) { - flag = HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0 ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0 ? TRUE : FALSE; } if (!flag) { moveType = GetMoveTypeForMonster(pokemon,move); @@ -2211,7 +2206,7 @@ bool8 HiJumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,u32 para flag = FALSE; if (param_5 == 0) { - flag = HandleDamagingMove(pokemon,target,move,0x200,param_4) != 0 ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),param_4) != 0 ? TRUE : FALSE; } if (!flag) { moveType = GetMoveTypeForMonster(pokemon,move); @@ -2234,7 +2229,7 @@ bool8 TriAttackMoveAction(Entity * pokemon, Entity * target, Move *move, u32 par bool8 flag; flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, 0x100, param_4)) + if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4)) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DFC)) @@ -2318,7 +2313,7 @@ bool8 TripleKickMoveAction(Entity * pokemon, Entity * target, Move *move, u32 pa bool8 flag; gUnknown_202F210++; - flag = HandleDamagingMove(pokemon, target, move, gUnknown_202F210 << 8, param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon, target, move, IntToF248_2(gUnknown_202F210), param_4) ? TRUE : FALSE; return flag; } @@ -2341,7 +2336,7 @@ bool8 MudSlapMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4 bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -2371,17 +2366,18 @@ bool8 GrowlMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) bool8 SurfMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; - u32 uVar2; + s32 modifierInt; + s24_8 modifier; flag = FALSE; if (GetEntInfo(target)->bideClassStatus.status == STATUS_DIVING) { - uVar2 = 0x200; + modifierInt = IntToF248_2(2).raw; } - else - { - uVar2 = 0x100; + else { + modifierInt = IntToF248_2(1).raw; } - if(HandleDamagingMove(pokemon,target,move,uVar2,param_4) != 0) + modifier.raw = modifierInt; + if(HandleDamagingMove(pokemon,target,move,modifier,param_4) != 0) flag = TRUE; return flag; } @@ -2411,7 +2407,7 @@ bool8 RolePlayMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_ bool8 SunnyDayMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { - gDungeon->weather.unkE267[WEATHER_SUNNY] = gUnknown_80F4F42; + gDungeon->weather.unkE267[WEATHER_SUNNY] = gMoveWeatherDuration; if (sub_807EAA0(1,0) == 0) { TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCF7C); } @@ -2435,7 +2431,7 @@ bool8 FakeOutMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4 bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DF2)) { @@ -2458,7 +2454,7 @@ bool8 PayDayMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) DungeonPos pos; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (RollSecondaryEffect(pokemon, 0) != 0) { if (!EntityExists(target)) { @@ -2515,7 +2511,7 @@ bool8 sub_805A568(Entity * pokemon, Entity * target, Move *move, u32 param_4) { bool8 flag; - flag = HandleDamagingMove(pokemon, target, move, 0x100, param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) ? TRUE : FALSE; return flag; } @@ -2525,7 +2521,7 @@ bool8 SuperpowerMoveAction(Entity *pokemon, Entity *target, Move *move, u32 para bool32 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,pokemon,0) != 0) { stat = gUnknown_8106A4C; @@ -2542,7 +2538,7 @@ bool8 SteelWingMoveAction(Entity *pokemon, Entity *target, Move *move, u32 stat, bool32 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_5) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_5) != 0) { flag = TRUE; if (sub_805727C(pokemon,pokemon,gUnknown_80F4DD2) != 0) { entityInfo = GetEntInfo(pokemon); @@ -2559,7 +2555,7 @@ bool8 SpitUpMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) stockpileStage = &GetEntInfo(pokemon)->stockpileStage; if (*stockpileStage != 0) { - HandleDamagingMove(pokemon,target,move,*stockpileStage << 8,param_4); + HandleDamagingMove(pokemon,target,move,IntToF248_2(*stockpileStage),param_4); *stockpileStage = 0; } else { @@ -2573,7 +2569,7 @@ bool8 DynamicPunchMoveAction(Entity *pokemon, Entity *target, Move *move, u32 pa bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,0x100,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -2788,7 +2784,7 @@ bool8 SecretPowerMoveAction(Entity * pokemon, Entity * target, Move *move, u32 p bool8 flag; flag = FALSE; - if ( HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4E06) != 0) { switch(gSecretPowerTable[gDungeon->tileset]) { @@ -2831,7 +2827,7 @@ bool8 sub_805AC90(Entity * pokemon, Entity * target, Move *move, u32 param_4) bool8 flag; flag = FALSE; - if ( HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4DFA) != 0) { ConfuseStatusTarget(pokemon, target, FALSE); @@ -2903,7 +2899,7 @@ bool8 BlastBurnMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param bool8 flag; SendThawedMessage(pokemon, target); - flag = HandleDamagingMove(pokemon,target,move,0x80 << 2,param_4) != 0 ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),param_4) != 0 ? TRUE : FALSE; return flag; } @@ -2912,7 +2908,7 @@ bool8 CrushClawMoveAction(Entity * pokemon, Entity * target, Move *move, u32 par bool8 flag; flag = FALSE; - if ( HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4DDA) != 0) { LowerDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, FALSE); @@ -2927,7 +2923,7 @@ bool8 BlazeKickMoveAction(Entity * pokemon, Entity * target, Move *move, u32 par flag = FALSE; SendThawedMessage(pokemon, target); - if ( HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4DFE) != 0) { BurnedStatusTarget(pokemon, target, 0, FALSE); diff --git a/src/move_effects_target.c b/src/move_effects_target.c index 5b4a854f5..3825fb812 100644 --- a/src/move_effects_target.c +++ b/src/move_effects_target.c @@ -58,7 +58,6 @@ extern u8 *gUnknown_80FB414[]; extern u8 *gUnknown_80FB43C[]; extern u8 *gUnknown_80FB41C[]; extern u8 *gUnknown_80FB458[]; -extern s16 gUnknown_80F4F00[]; extern u8 *gUnknown_80FB52C[]; extern u8 *gUnknown_80FCC4C[]; extern u8 *gUnknown_80FB50C[]; @@ -439,7 +438,7 @@ void InfatuateStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessa SetMessageArgument_2(gFormatBuffer_Monsters[0],entityInfo,0); if (entityInfo->cringeClassStatus.status != STATUS_INFATUATED) { entityInfo->cringeClassStatus.status = STATUS_INFATUATED; - entityInfo->cringeClassStatus.turns = CalculateStatusTurns(target,gUnknown_80F4F00,TRUE) + 1; + entityInfo->cringeClassStatus.turns = CalculateStatusTurns(target,gInfatuatedTurnRange,TRUE) + 1; sub_8041EF8(target); TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB50C); } diff --git a/src/status.c b/src/status.c index ab65a2849..955de9766 100644 --- a/src/status.c +++ b/src/status.c @@ -110,7 +110,6 @@ extern u8 *gUnknown_80FBB28[]; extern u8 *gUnknown_80FBBD4[]; extern u8 *gUnknown_80FBBB8[]; extern u8 *gUnknown_80FBB94[]; -extern s16 gUnknown_80F4EF4[]; extern u8 *gUnknown_80FBE84[]; extern u8 *gUnknown_80FBEA0[]; extern u8 *gUnknown_80FBE64[]; @@ -849,22 +848,19 @@ void DestinyBondStatusTarget(Entity * pokemon, Entity * target) EntityInfo *entityInfo; EntityInfo *entityInfo2; s32 index; - u8 *status; - s32 zero; if (((EntityExists(target)) && (GetEntityType(pokemon) == ENTITY_MONSTER)) && (GetEntityType(target) == ENTITY_MONSTER)) { entityInfo = GetEntInfo(pokemon); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0); - status = &entityInfo->leechSeedClassStatus.status; if (entityInfo->leechSeedClassStatus.status != STATUS_DESTINY_BOND) { if (entityInfo->leechSeedClassStatus.status == STATUS_LEECH_SEED) TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FA79C); - zero = 0; - *status = STATUS_DESTINY_BOND; - entityInfo->leechSeedClassStatus.turns = CalculateStatusTurns(target,gUnknown_80F4EF0,TRUE) + 1; - entityInfo->leechSeedClassStatus.damageCountdown = zero; + + entityInfo->leechSeedClassStatus.status = STATUS_DESTINY_BOND; + entityInfo->leechSeedClassStatus.turns = CalculateStatusTurns(target,gDestinyBondTurnRange,TRUE) + 1; + entityInfo->leechSeedClassStatus.damageCountdown = 0; nullsub_74(target); entityInfo->leechSeedClassStatus.unk8 = 0xff; } @@ -1202,7 +1198,7 @@ void EncoreStatusTarget(Entity *pokemon,Entity *target) SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); if (EntityInfo->cringeClassStatus.status != STATUS_ENCORE) { EntityInfo->cringeClassStatus.status = STATUS_ENCORE; - EntityInfo->cringeClassStatus.turns = CalculateStatusTurns(target,gUnknown_80F4EF4,TRUE) + 1; + EntityInfo->cringeClassStatus.turns = CalculateStatusTurns(target,gEncoreTurnRange,TRUE) + 1; nullsub_83(target); TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBB94); }