From c6ccc29c936111e6d51d0481468ff45edb838ef7 Mon Sep 17 00:00:00 2001 From: hedara90 <90hedara@gmail.com> Date: Sun, 27 Oct 2024 15:24:40 +0100 Subject: [PATCH 1/3] Fixed 64px uncompressed followers (#5601) Co-authored-by: Hedara --- .../object_event_pic_tables_followers.h | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/data/object_events/object_event_pic_tables_followers.h b/src/data/object_events/object_event_pic_tables_followers.h index 6ad602a629..a456c17e01 100644 --- a/src/data/object_events/object_event_pic_tables_followers.h +++ b/src/data/object_events/object_event_pic_tables_followers.h @@ -702,7 +702,7 @@ static const struct SpriteFrameImage sPicTable_Onix[] = { }; #if P_GEN_2_CROSS_EVOS static const struct SpriteFrameImage sPicTable_Steelix[] = { - overworld_ascending_frames(gObjectEventPic_Steelix, 4, 4), + overworld_ascending_frames(gObjectEventPic_Steelix, 8, 8), }; #if P_MEGA_EVOLUTIONS /*static const struct SpriteFrameImage sPicTable_SteelixMega[] = { @@ -761,7 +761,7 @@ static const struct SpriteFrameImage sPicTable_Exeggutor[] = { }; #if P_ALOLAN_FORMS static const struct SpriteFrameImage sPicTable_ExeggutorAlolan[] = { - overworld_ascending_frames(gObjectEventPic_ExeggutorAlolan, 4, 4), + overworld_ascending_frames(gObjectEventPic_ExeggutorAlolan, 8, 8), }; #endif //P_ALOLAN_FORMS #endif //P_FAMILY_EXEGGCUTE @@ -1833,13 +1833,13 @@ static const struct SpriteFrameImage sPicTable_Tyranitar[] = { #if P_FAMILY_LUGIA static const struct SpriteFrameImage sPicTable_Lugia[] = { - overworld_ascending_frames(gObjectEventPic_Lugia, 4, 4), + overworld_ascending_frames(gObjectEventPic_Lugia, 8, 8), }; #endif //P_FAMILY_LUGIA #if P_FAMILY_HO_OH static const struct SpriteFrameImage sPicTable_HoOh[] = { - overworld_ascending_frames(gObjectEventPic_HoOh, 4, 4), + overworld_ascending_frames(gObjectEventPic_HoOh, 8, 8), }; #endif //P_FAMILY_HO_OH @@ -2233,7 +2233,7 @@ static const struct SpriteFrameImage sPicTable_Wailmer[] = { overworld_ascending_frames(gObjectEventPic_Wailmer, 4, 4), }; static const struct SpriteFrameImage sPicTable_Wailord[] = { - overworld_ascending_frames(gObjectEventPic_Wailord, 4, 4), + overworld_ascending_frames(gObjectEventPic_Wailord, 8, 8), }; #endif //P_FAMILY_WAILMER @@ -2594,7 +2594,7 @@ static const struct SpriteFrameImage sPicTable_Latios[] = { #if P_FAMILY_KYOGRE static const struct SpriteFrameImage sPicTable_Kyogre[] = { - overworld_ascending_frames(gObjectEventPic_Kyogre, 4, 4), + overworld_ascending_frames(gObjectEventPic_Kyogre, 8, 8), }; #if P_PRIMAL_REVERSIONS /*static const struct SpriteFrameImage sPicTable_KyogrePrimal[] = { @@ -2605,7 +2605,7 @@ static const struct SpriteFrameImage sPicTable_Kyogre[] = { #if P_FAMILY_GROUDON static const struct SpriteFrameImage sPicTable_Groudon[] = { - overworld_ascending_frames(gObjectEventPic_Groudon, 4, 4), + overworld_ascending_frames(gObjectEventPic_Groudon, 8, 8), }; #if P_PRIMAL_REVERSIONS /*static const struct SpriteFrameImage sPicTable_GroudonPrimal[] = { @@ -2616,7 +2616,7 @@ static const struct SpriteFrameImage sPicTable_Groudon[] = { #if P_FAMILY_RAYQUAZA static const struct SpriteFrameImage sPicTable_Rayquaza[] = { - overworld_ascending_frames(gObjectEventPic_Rayquaza, 4, 4), + overworld_ascending_frames(gObjectEventPic_Rayquaza, 8, 8), }; #if P_MEGA_EVOLUTIONS /*static const struct SpriteFrameImage sPicTable_RayquazaMega[] = { @@ -3016,19 +3016,19 @@ static const struct SpriteFrameImage sPicTable_Azelf[] = { #if P_FAMILY_DIALGA static const struct SpriteFrameImage sPicTable_Dialga[] = { - overworld_ascending_frames(gObjectEventPic_Dialga, 4, 4), + overworld_ascending_frames(gObjectEventPic_Dialga, 8, 8), }; static const struct SpriteFrameImage sPicTable_DialgaOrigin[] = { - overworld_ascending_frames(gObjectEventPic_DialgaOrigin, 4, 4), + overworld_ascending_frames(gObjectEventPic_DialgaOrigin, 8, 8), }; #endif //P_FAMILY_DIALGA #if P_FAMILY_PALKIA static const struct SpriteFrameImage sPicTable_Palkia[] = { - overworld_ascending_frames(gObjectEventPic_Palkia, 4, 4), + overworld_ascending_frames(gObjectEventPic_Palkia, 8, 8), }; static const struct SpriteFrameImage sPicTable_PalkiaOrigin[] = { - overworld_ascending_frames(gObjectEventPic_PalkiaOrigin, 4, 4), + overworld_ascending_frames(gObjectEventPic_PalkiaOrigin, 8, 8), }; #endif //P_FAMILY_PALKIA @@ -3040,16 +3040,16 @@ static const struct SpriteFrameImage sPicTable_Heatran[] = { #if P_FAMILY_REGIGIGAS static const struct SpriteFrameImage sPicTable_Regigigas[] = { - overworld_ascending_frames(gObjectEventPic_Regigigas, 4, 4), + overworld_ascending_frames(gObjectEventPic_Regigigas, 8, 8), }; #endif //P_FAMILY_REGIGIGAS #if P_FAMILY_GIRATINA static const struct SpriteFrameImage sPicTable_GiratinaAltered[] = { - overworld_ascending_frames(gObjectEventPic_GiratinaAltered, 4, 4), + overworld_ascending_frames(gObjectEventPic_GiratinaAltered, 8, 8), }; static const struct SpriteFrameImage sPicTable_GiratinaOrigin[] = { - overworld_ascending_frames(gObjectEventPic_GiratinaOrigin, 4, 4), + overworld_ascending_frames(gObjectEventPic_GiratinaOrigin, 8, 8), }; #endif //P_FAMILY_GIRATINA @@ -3086,58 +3086,58 @@ static const struct SpriteFrameImage sPicTable_ShayminSky[] = { #if P_FAMILY_ARCEUS static const struct SpriteFrameImage sPicTable_ArceusNormal[] = { - overworld_ascending_frames(gObjectEventPic_ArceusNormal, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusNormal, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusFighting[] = { - overworld_ascending_frames(gObjectEventPic_ArceusFighting, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusFighting, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusFlying[] = { - overworld_ascending_frames(gObjectEventPic_ArceusFlying, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusFlying, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusPoison[] = { - overworld_ascending_frames(gObjectEventPic_ArceusPoison, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusPoison, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusGround[] = { - overworld_ascending_frames(gObjectEventPic_ArceusGround, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusGround, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusRock[] = { - overworld_ascending_frames(gObjectEventPic_ArceusRock, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusRock, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusBug[] = { - overworld_ascending_frames(gObjectEventPic_ArceusBug, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusBug, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusGhost[] = { - overworld_ascending_frames(gObjectEventPic_ArceusGhost, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusGhost, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusSteel[] = { - overworld_ascending_frames(gObjectEventPic_ArceusSteel, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusSteel, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusFire[] = { - overworld_ascending_frames(gObjectEventPic_ArceusFire, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusFire, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusWater[] = { - overworld_ascending_frames(gObjectEventPic_ArceusWater, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusWater, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusGrass[] = { - overworld_ascending_frames(gObjectEventPic_ArceusGrass, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusGrass, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusElectric[] = { - overworld_ascending_frames(gObjectEventPic_ArceusElectric, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusElectric, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusPsychic[] = { - overworld_ascending_frames(gObjectEventPic_ArceusPsychic, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusPsychic, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusIce[] = { - overworld_ascending_frames(gObjectEventPic_ArceusIce, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusIce, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusDragon[] = { - overworld_ascending_frames(gObjectEventPic_ArceusDragon, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusDragon, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusDark[] = { - overworld_ascending_frames(gObjectEventPic_ArceusDark, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusDark, 8, 8), }; static const struct SpriteFrameImage sPicTable_ArceusFairy[] = { - overworld_ascending_frames(gObjectEventPic_ArceusFairy, 4, 4), + overworld_ascending_frames(gObjectEventPic_ArceusFairy, 8, 8), }; #endif //P_FAMILY_ARCEUS @@ -3915,7 +3915,7 @@ static const struct SpriteFrameImage sPicTable_TornadusIncarnate[] = { overworld_ascending_frames(gObjectEventPic_TornadusIncarnate, 4, 4), }; static const struct SpriteFrameImage sPicTable_TornadusTherian[] = { - overworld_ascending_frames(gObjectEventPic_TornadusTherian, 4, 4), + overworld_ascending_frames(gObjectEventPic_TornadusTherian, 8, 8), }; #endif //P_FAMILY_TORNADUS @@ -3925,19 +3925,19 @@ static const struct SpriteFrameImage sPicTable_ThundurusIncarnate[] = { overworld_ascending_frames(gObjectEventPic_ThundurusIncarnate, 4, 4), }; static const struct SpriteFrameImage sPicTable_ThundurusTherian[] = { - overworld_ascending_frames(gObjectEventPic_ThundurusTherian, 4, 4), + overworld_ascending_frames(gObjectEventPic_ThundurusTherian, 8, 8), }; #endif //P_FAMILY_THUNDURUS #if P_FAMILY_RESHIRAM static const struct SpriteFrameImage sPicTable_Reshiram[] = { - overworld_ascending_frames(gObjectEventPic_Reshiram, 4, 4), + overworld_ascending_frames(gObjectEventPic_Reshiram, 8, 8), }; #endif //P_FAMILY_RESHIRAM #if P_FAMILY_ZEKROM static const struct SpriteFrameImage sPicTable_Zekrom[] = { - overworld_ascending_frames(gObjectEventPic_Zekrom, 4, 4), + overworld_ascending_frames(gObjectEventPic_Zekrom, 8, 8), }; #endif //P_FAMILY_ZEKROM @@ -3953,16 +3953,16 @@ static const struct SpriteFrameImage sPicTable_LandorusTherian[] = { #if P_FAMILY_ENAMORUS static const struct SpriteFrameImage sPicTable_EnamorusIncarnate[] = { - overworld_ascending_frames(gObjectEventPic_EnamorusIncarnate, 4, 4), + overworld_ascending_frames(gObjectEventPic_EnamorusIncarnate, 8, 8), }; static const struct SpriteFrameImage sPicTable_EnamorusTherian[] = { - overworld_ascending_frames(gObjectEventPic_EnamorusTherian, 4, 4), + overworld_ascending_frames(gObjectEventPic_EnamorusTherian, 8, 8), }; #endif //P_FAMILY_ENAMORUS #if P_FAMILY_KYUREM static const struct SpriteFrameImage sPicTable_Kyurem[] = { - overworld_ascending_frames(gObjectEventPic_Kyurem, 4, 4), + overworld_ascending_frames(gObjectEventPic_Kyurem, 8, 8), }; #if P_FUSION_FORMS static const struct SpriteFrameImage sPicTable_KyuremWhite[] = { @@ -4466,23 +4466,23 @@ static const struct SpriteFrameImage sPicTable_Noivern[] = { #if P_FAMILY_XERNEAS static const struct SpriteFrameImage sPicTable_XerneasNeutral[] = { - overworld_ascending_frames(gObjectEventPic_XerneasNeutral, 4, 4), + overworld_ascending_frames(gObjectEventPic_XerneasNeutral, 8, 8), }; static const struct SpriteFrameImage sPicTable_XerneasActive[] = { - overworld_ascending_frames(gObjectEventPic_XerneasActive, 4, 4), + overworld_ascending_frames(gObjectEventPic_XerneasActive, 8, 8), }; #endif //P_FAMILY_XERNEAS #if P_FAMILY_YVELTAL static const struct SpriteFrameImage sPicTable_Yveltal[] = { - overworld_ascending_frames(gObjectEventPic_Yveltal, 4, 4), + overworld_ascending_frames(gObjectEventPic_Yveltal, 8, 8), }; #endif //P_FAMILY_YVELTAL #if P_FAMILY_ZYGARDE static const struct SpriteFrameImage sPicTable_Zygarde50[] = { - overworld_ascending_frames(gObjectEventPic_Zygarde50, 4, 4), + overworld_ascending_frames(gObjectEventPic_Zygarde50, 8, 8), }; static const struct SpriteFrameImage sPicTable_Zygarde10[] = { overworld_ascending_frames(gObjectEventPic_Zygarde10, 4, 4), @@ -4509,7 +4509,7 @@ static const struct SpriteFrameImage sPicTable_HoopaConfined[] = { overworld_ascending_frames(gObjectEventPic_HoopaConfined, 4, 4), }; static const struct SpriteFrameImage sPicTable_HoopaUnbound[] = { - overworld_ascending_frames(gObjectEventPic_HoopaUnbound, 4, 4), + overworld_ascending_frames(gObjectEventPic_HoopaUnbound, 8, 8), }; #endif //P_FAMILY_HOOPA From 13d3245204dd99e9a96a796129c7715f0a675e11 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 27 Oct 2024 15:04:33 -0300 Subject: [PATCH 2/3] Added compressed OW mon VRAM notice in config file (#5599) --- include/config/overworld.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/config/overworld.h b/include/config/overworld.h index c792c76678..f88118007a 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -39,6 +39,7 @@ #define OW_LARGE_OW_SUPPORT TRUE // If true, adds a small amount of overhead to OW code so that large (48x48, 64x64) OWs will display correctly under bridges, etc. #define OW_PKMN_OBJECTS_SHARE_PALETTES FALSE // [WIP!! NOT ALL PALETTES HAVE BEEN ADJUSTED FOR THIS!!] If TRUE, follower palettes are taken from battle sprites. #define OW_GFX_COMPRESS TRUE // Adds support for compressed OW graphics, (Also compresses pokemon follower graphics). + // IMPORTANT: Gfx are loaded into VRAM to avoid continous decompression. If you require more VRAM or want to use a lot of overworld Pokémon at once, you should disable this config. // Compressed gfx are incompatible with non-power-of-two sprite sizes: // (You should not use 48x48 sprites/tables for compressed gfx) // 16x32, 32x32, 64x64 etc are fine From e9ab070e7d5bf43b06b631cecdd9b84c14d36019 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sun, 27 Oct 2024 22:47:02 +0100 Subject: [PATCH 3/3] Fix damage calc modifiers (#5604) Co-authored-by: Eduardo Quezada --- src/battle_util.c | 102 ++++++++++++++++--------------- test/battle/ability/transistor.c | 42 ++++++++++--- 2 files changed, 88 insertions(+), 56 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 5284909ddd..4a16b235c6 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -9255,53 +9255,6 @@ static inline u32 CalcMoveBasePowerAfterModifiers(u32 move, u32 battlerAtk, u32 if (moveType == TYPE_STEEL) modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); break; - case ABILITY_TRANSISTOR: - if (moveType == TYPE_ELECTRIC) - { - if (B_TRANSISTOR_BOOST >= GEN_9) - modifier = uq4_12_multiply(modifier, UQ_4_12(5325 / 4096)); - else - modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); - } - break; - case ABILITY_DRAGONS_MAW: - if (moveType == TYPE_DRAGON) - modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); - break; - case ABILITY_GORILLA_TACTICS: - if (IS_MOVE_PHYSICAL(move)) - modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); - break; - case ABILITY_ROCKY_PAYLOAD: - if (moveType == TYPE_ROCK) - modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); - break; - case ABILITY_PROTOSYNTHESIS: - { - u8 atkHighestStat = GetHighestStatId(battlerAtk); - if (((weather & B_WEATHER_SUN && WEATHER_HAS_EFFECT) || gBattleStruct->boosterEnergyActivates & (1u << battlerAtk)) - && ((IS_MOVE_PHYSICAL(move) && atkHighestStat == STAT_ATK) || (IS_MOVE_SPECIAL(move) && atkHighestStat == STAT_SPATK)) - && !(gBattleMons[battlerAtk].status2 & STATUS2_TRANSFORMED)) - modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); - } - break; - case ABILITY_QUARK_DRIVE: - { - u8 atkHighestStat = GetHighestStatId(battlerAtk); - if ((gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN || gBattleStruct->boosterEnergyActivates & (1u << battlerAtk)) - && ((IS_MOVE_PHYSICAL(move) && atkHighestStat == STAT_ATK) || (IS_MOVE_SPECIAL(move) && atkHighestStat == STAT_SPATK)) - && !(gBattleMons[battlerAtk].status2 & STATUS2_TRANSFORMED)) - modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); - } - break; - case ABILITY_ORICHALCUM_PULSE: - if (weather & B_WEATHER_SUN && WEATHER_HAS_EFFECT && IS_MOVE_PHYSICAL(move)) - modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); - break; - case ABILITY_HADRON_ENGINE: - if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && IS_MOVE_SPECIAL(move)) - modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); - break; case ABILITY_SHARPNESS: if (gMovesInfo[move].slicingMove) modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); @@ -9468,7 +9421,7 @@ static inline u32 CalcMoveBasePowerAfterModifiers(u32 move, u32 battlerAtk, u32 return uq4_12_multiply_by_int_half_down(modifier, basePower); } -static inline u32 CalcAttackStat(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, bool32 isCrit, bool32 updateFlags, u32 atkAbility, u32 defAbility, u32 holdEffectAtk) +static inline u32 CalcAttackStat(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, bool32 isCrit, bool32 updateFlags, u32 atkAbility, u32 defAbility, u32 holdEffectAtk, u32 weather) { u8 atkStage; u32 atkStat; @@ -9608,6 +9561,57 @@ static inline u32 CalcAttackStat(u32 move, u32 battlerAtk, u32 battlerDef, u32 m if (gBattleMons[battlerAtk].status1 & STATUS1_ANY && IS_MOVE_PHYSICAL(move)) modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; + case ABILITY_TRANSISTOR: + if (moveType == TYPE_ELECTRIC) + { + if (B_TRANSISTOR_BOOST >= GEN_9) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); + else + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); + } + break; + case ABILITY_DRAGONS_MAW: + if (moveType == TYPE_DRAGON) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); + break; + case ABILITY_GORILLA_TACTICS: + if (IS_MOVE_PHYSICAL(move)) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); + break; + case ABILITY_ROCKY_PAYLOAD: + if (moveType == TYPE_ROCK) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); + break; + case ABILITY_PROTOSYNTHESIS: + if (!(gBattleMons[battlerAtk].status2 & STATUS2_TRANSFORMED)) + { + u32 atkHighestStat = GetHighestStatId(battlerAtk); + if (((weather & B_WEATHER_SUN) && WEATHER_HAS_EFFECT) || gBattleStruct->boosterEnergyActivates & (1u << battlerAtk)) + { + if ((IS_MOVE_PHYSICAL(move) && atkHighestStat == STAT_ATK) || (IS_MOVE_SPECIAL(move) && atkHighestStat == STAT_SPATK)) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); + } + } + break; + case ABILITY_QUARK_DRIVE: + if (!(gBattleMons[battlerAtk].status2 & STATUS2_TRANSFORMED)) + { + u32 atkHighestStat = GetHighestStatId(battlerAtk); + if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN || gBattleStruct->boosterEnergyActivates & (1u << battlerAtk)) + { + if ((IS_MOVE_PHYSICAL(move) && atkHighestStat == STAT_ATK) || (IS_MOVE_SPECIAL(move) && atkHighestStat == STAT_SPATK)) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); + } + } + break; + case ABILITY_ORICHALCUM_PULSE: + if ((weather & B_WEATHER_SUN) && WEATHER_HAS_EFFECT && IS_MOVE_PHYSICAL(move)) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.33)); + break; + case ABILITY_HADRON_ENGINE: + if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && IS_MOVE_SPECIAL(move)) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.33)); + break; } // target's abilities @@ -10157,7 +10161,7 @@ static inline s32 DoMoveDamageCalcVars(u32 move, u32 battlerAtk, u32 battlerDef, else gBattleMovePower = CalcMoveBasePowerAfterModifiers(move, battlerAtk, battlerDef, moveType, updateFlags, abilityAtk, abilityDef, holdEffectAtk, weather); - userFinalAttack = CalcAttackStat(move, battlerAtk, battlerDef, moveType, isCrit, updateFlags, abilityAtk, abilityDef, holdEffectAtk); + userFinalAttack = CalcAttackStat(move, battlerAtk, battlerDef, moveType, isCrit, updateFlags, abilityAtk, abilityDef, holdEffectAtk, weather); targetFinalDefense = CalcDefenseStat(move, battlerAtk, battlerDef, moveType, isCrit, updateFlags, abilityAtk, abilityDef, holdEffectDef, weather); dmg = CalculateBaseDamage(gBattleMovePower, userFinalAttack, gBattleMons[battlerAtk].level, targetFinalDefense); diff --git a/test/battle/ability/transistor.c b/test/battle/ability/transistor.c index 4588badcc9..f02743ab8c 100644 --- a/test/battle/ability/transistor.c +++ b/test/battle/ability/transistor.c @@ -1,6 +1,9 @@ #include "global.h" #include "test/battle.h" +#include "global.h" +#include "test/battle.h" + SINGLE_BATTLE_TEST("Transistor increases Electric-type move damage", s16 damage) { u32 move; @@ -27,12 +30,37 @@ SINGLE_BATTLE_TEST("Transistor increases Electric-type move damage", s16 damage) HP_BAR(opponent, captureDamage: &results[i].damage); } FINALLY { EXPECT_EQ(results[0].damage, results[1].damage); // Tackle should be unaffected - #if B_TRANSISTOR_BOOST >= GEN_9 - EXPECT_MUL_EQ(results[2].damage, Q_4_12(5325 / 4096), results[3].damage); // Wild Charge should be affected - EXPECT_MUL_EQ(results[4].damage, Q_4_12(5325 / 4096), results[5].damage); // Thunder Shock should be affected - #else - EXPECT_MUL_EQ(results[2].damage, Q_4_12(1.5), results[3].damage); // Wild Charge should be affected - EXPECT_MUL_EQ(results[4].damage, Q_4_12(1.5), results[5].damage); // Thunder Shock should be affected - #endif + if (B_TRANSISTOR_BOOST >= GEN_9) + { + EXPECT_MUL_EQ(results[2].damage, Q_4_12(1.3), results[3].damage); // Wild Charge should be affected + EXPECT_MUL_EQ(results[4].damage, Q_4_12(1.3), results[5].damage); // Thunder Shock should be affected + } + else + { + EXPECT_MUL_EQ(results[2].damage, Q_4_12(1.5), results[3].damage); // Wild Charge should be affected + EXPECT_MUL_EQ(results[4].damage, Q_4_12(1.5), results[5].damage); // Thunder Shock should be affected + } + } +} + +SINGLE_BATTLE_TEST("Transistor boosts Electric type moves by 1.5 in Gen8 and 1.3 in Gen9+", s16 damage) +{ + u16 ability; + PARAMETRIZE { ability = ABILITY_NEUTRALIZING_GAS; } + PARAMETRIZE { ability = ABILITY_LEVITATE; } + + GIVEN { + ASSUME(gMovesInfo[MOVE_THUNDER_SHOCK].type == TYPE_ELECTRIC); + PLAYER(SPECIES_REGIELEKI) { Ability(ABILITY_TRANSISTOR); } + OPPONENT(SPECIES_KOFFING) { Ability(ability); } + } WHEN { + TURN { MOVE(player, MOVE_THUNDER_SHOCK); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + if (B_TRANSISTOR_BOOST >= GEN_9) + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.3), results[1].damage); + else + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); } }