Skip to content

Commit

Permalink
Ogerpon masks were missing their hold effects (#5391)
Browse files Browse the repository at this point in the history
* Ogerpon masks were missing their hold effects

* fix wrong num

* test

* correct tests and additional fix

* added hold effect to battle debug
  • Loading branch information
AlexOn1ine authored Sep 18, 2024
1 parent 76656e8 commit 71dfd3e
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/constants/hold_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,12 @@
// Gen9 hold effects
#define HOLD_EFFECT_ABILITY_SHIELD 175
#define HOLD_EFFECT_CLEAR_AMULET 176
#define HOLD_EFFECT_MIRROR_HERB 177 // Not implemented.
#define HOLD_EFFECT_MIRROR_HERB 177
#define HOLD_EFFECT_PUNCHING_GLOVE 178
#define HOLD_EFFECT_COVERT_CLOAK 179
#define HOLD_EFFECT_LOADED_DICE 180
#define HOLD_EFFECT_BOOSTER_ENERGY 181 // Not implemented.
#define HOLD_EFFECT_BOOSTER_ENERGY 181
#define HOLD_EFFECT_OGERPON_MASK 182

// Gen2 hold effect
#define HOLD_EFFECT_BERSERK_GENE 184
Expand Down
2 changes: 2 additions & 0 deletions src/battle_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2435,6 +2435,7 @@ static const u8 sText_HoldEffectCovertCloak[] = _("Covert Cloak");
static const u8 sText_HoldEffectLoadedDice[] = _("Loaded Dice");
static const u8 sText_HoldEffectBoosterEnergy[] = _("Booster Energy");
static const u8 sText_HoldEffectBerserkGene[] = _("Berserk Gene");
static const u8 sText_HoldEffectOgerponMask[] = _("Ogerpon Mask");
static const u8 *const sHoldEffectNames[] =
{
[HOLD_EFFECT_NONE] = sText_HoldEffectNone,
Expand Down Expand Up @@ -2585,6 +2586,7 @@ static const u8 *const sHoldEffectNames[] =
[HOLD_EFFECT_LOADED_DICE] = sText_HoldEffectLoadedDice,
[HOLD_EFFECT_BOOSTER_ENERGY] = sText_HoldEffectBoosterEnergy,
[HOLD_EFFECT_BERSERK_GENE] = sText_HoldEffectBerserkGene,
[HOLD_EFFECT_OGERPON_MASK] = sText_HoldEffectOgerponMask,
};
static const u8 *GetHoldEffectName(u16 holdEffect)
{
Expand Down
4 changes: 4 additions & 0 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -9454,6 +9454,10 @@ static inline u32 CalcMoveBasePowerAfterModifiers(u32 move, u32 battlerAtk, u32
if (gMovesInfo[move].punchingMove)
modifier = uq4_12_multiply(modifier, UQ_4_12(1.1));
break;
case HOLD_EFFECT_OGERPON_MASK:
if (GET_BASE_SPECIES_ID(gBattleMons[battlerAtk].species) == SPECIES_OGERPON)
modifier = uq4_12_multiply(modifier, UQ_4_12(1.2));
break;
}

// Terastallization boosts weak, non-priority, non-multi hit moves after modifiers to 60 BP.
Expand Down
6 changes: 6 additions & 0 deletions src/data/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -13659,6 +13659,8 @@ const struct Item gItemsInfo[] =
{
.name = HANDLE_EXPANDED_ITEM_NAME("CornrstneMask", "Cornerstone Mask"),
.price = 0,
.holdEffect = HOLD_EFFECT_OGERPON_MASK,
.holdEffectParam = 20,
.description = COMPOUND_STRING(
"Allows Ogerpon to\n"
"wield the Rock-\n"
Expand All @@ -13674,6 +13676,8 @@ const struct Item gItemsInfo[] =
{
.name = HANDLE_EXPANDED_ITEM_NAME("WellsprngMask", "Wellspring Mask"),
.price = 0,
.holdEffect = HOLD_EFFECT_OGERPON_MASK,
.holdEffectParam = 20,
.description = COMPOUND_STRING(
"Allows Ogerpon to\n"
"wield the Water-\n"
Expand All @@ -13689,6 +13693,8 @@ const struct Item gItemsInfo[] =
{
.name = HANDLE_EXPANDED_ITEM_NAME("HrthflameMask", "Hearthflame Mask"),
.price = 0,
.holdEffect = HOLD_EFFECT_OGERPON_MASK,
.holdEffectParam = 20,
.description = COMPOUND_STRING(
"Allows Ogerpon to\n"
"wield the Fire-\n"
Expand Down
36 changes: 36 additions & 0 deletions test/battle/hold_effect/ogerpon_mask.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "global.h"
#include "test/battle.h"

ASSUMPTIONS
{
ASSUME(gItemsInfo[ITEM_CORNERSTONE_MASK].holdEffect == HOLD_EFFECT_OGERPON_MASK);
ASSUME(gItemsInfo[ITEM_WELLSPRING_MASK].holdEffect == HOLD_EFFECT_OGERPON_MASK);
ASSUME(gItemsInfo[ITEM_HEARTHFLAME_MASK].holdEffect == HOLD_EFFECT_OGERPON_MASK);
ASSUME(gItemsInfo[ITEM_CORNERSTONE_MASK].holdEffectParam == 20);
ASSUME(gItemsInfo[ITEM_WELLSPRING_MASK].holdEffectParam == 20);
ASSUME(gItemsInfo[ITEM_HEARTHFLAME_MASK].holdEffectParam == 20);
}

SINGLE_BATTLE_TEST("Ogerpon Masks increase the base power of moves by 20%", s16 damage)
{
u32 species;
u32 item;
PARAMETRIZE { species = SPECIES_OGERPON_TEAL_MASK; item = ITEM_NONE; }
PARAMETRIZE { species = SPECIES_OGERPON_WELLSPRING_MASK; item = ITEM_CORNERSTONE_MASK; }
PARAMETRIZE { species = SPECIES_OGERPON_HEARTHFLAME_MASK; item = ITEM_WELLSPRING_MASK; }
PARAMETRIZE { species = SPECIES_OGERPON_CORNERSTONE_MASK; item = ITEM_HEARTHFLAME_MASK; }

GIVEN {
ASSUME(gMovesInfo[MOVE_TACKLE].power > 0);
PLAYER(species) { Item(item); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.2), results[1].damage);
EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.2), results[2].damage);
EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.2), results[3].damage);
}
}

0 comments on commit 71dfd3e

Please sign in to comment.