Skip to content

Commit

Permalink
Merge pull request #190 from BuffelSaft/balance
Browse files Browse the repository at this point in the history
Improved Power Items
  • Loading branch information
BuffelSaft authored Sep 2, 2021
2 parents 75d752a + f3627e8 commit 7b04ef0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/battle_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ u8 GetTrainerBattleTransition(void)
case TRAINER_GLACIA_2:
case TRAINER_GLACIA_3:
case TRAINER_GLACIA_4:
return B_TRANSITION_SIDNEY;
return B_TRANSITION_GLACIA;
case TRAINER_DRAKE:
case TRAINER_DRAKE_2:
case TRAINER_DRAKE_3:
Expand Down
24 changes: 12 additions & 12 deletions src/data/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -3360,9 +3360,9 @@ const struct Item gItems[] =
{
.name = _("Power Bracer"),
.itemId = ITEM_POWER_BRACER,
.price = 10000,
.price = 2000,
.holdEffect = HOLD_EFFECT_POWER_ITEM,
.holdEffectParam = 8,
.holdEffectParam = 16,
.description = sPowerBracerDesc,
.pocket = POCKET_BATTLE,
.type = ITEM_USE_BAG_MENU,
Expand All @@ -3374,9 +3374,9 @@ const struct Item gItems[] =
{
.name = _("Power Belt"),
.itemId = ITEM_POWER_BELT,
.price = 10000,
.price = 2000,
.holdEffect = HOLD_EFFECT_POWER_ITEM,
.holdEffectParam = 8,
.holdEffectParam = 16,
.description = sPowerBeltDesc,
.pocket = POCKET_BATTLE,
.type = ITEM_USE_BAG_MENU,
Expand All @@ -3388,9 +3388,9 @@ const struct Item gItems[] =
{
.name = _("Power Lens"),
.itemId = ITEM_POWER_LENS,
.price = 10000,
.price = 2000,
.holdEffect = HOLD_EFFECT_POWER_ITEM,
.holdEffectParam = 8,
.holdEffectParam = 16,
.description = sPowerLensDesc,
.pocket = POCKET_BATTLE,
.type = ITEM_USE_BAG_MENU,
Expand All @@ -3402,9 +3402,9 @@ const struct Item gItems[] =
{
.name = _("Power Band"),
.itemId = ITEM_POWER_BAND,
.price = 10000,
.price = 2000,
.holdEffect = HOLD_EFFECT_POWER_ITEM,
.holdEffectParam = 8,
.holdEffectParam = 16,
.description = sPowerBandDesc,
.pocket = POCKET_BATTLE,
.type = ITEM_USE_BAG_MENU,
Expand All @@ -3416,9 +3416,9 @@ const struct Item gItems[] =
{
.name = _("Power Anklet"),
.itemId = ITEM_POWER_ANKLET,
.price = 10000,
.price = 2000,
.holdEffect = HOLD_EFFECT_POWER_ITEM,
.holdEffectParam = 8,
.holdEffectParam = 16,
.description = sPowerAnkletDesc,
.pocket = POCKET_BATTLE,
.type = ITEM_USE_BAG_MENU,
Expand All @@ -3430,9 +3430,9 @@ const struct Item gItems[] =
{
.name = _("Power Weight"),
.itemId = ITEM_POWER_WEIGHT,
.price = 10000,
.price = 2000,
.holdEffect = HOLD_EFFECT_POWER_ITEM,
.holdEffectParam = 8,
.holdEffectParam = 16,
.description = sPowerWeightDesc,
.pocket = POCKET_BATTLE,
.type = ITEM_USE_BAG_MENU,
Expand Down
54 changes: 29 additions & 25 deletions src/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -6801,6 +6801,8 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
powerItemStat = ItemId_GetSecondaryId(heldItem);
}

powerItemBonus = ItemId_GetHoldEffectParam(heldItem);

for (i = 0; i < NUM_STATS; i++)
{
if (totalEVs >= MAX_TOTAL_EVS)
Expand All @@ -6811,35 +6813,37 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
else
multiplier = 1;

if ((holdEffect == HOLD_EFFECT_POWER_ITEM) && (powerItemStat == (STAT_HP + i)))
// Power items prevent EV gain from Pokemon
if (holdEffect == HOLD_EFFECT_POWER_ITEM)
{
powerItemBonus = ItemId_GetHoldEffectParam(heldItem);
if (powerItemStat == (STAT_HP + i))
evIncrease = powerItemBonus * multiplier;
else
evIncrease = 0;
}
else
{
powerItemBonus = 0;
}

switch (i)
{
case STAT_HP:
evIncrease = (gBaseStats[defeatedSpecies].evYield_HP + powerItemBonus) * multiplier;
break;
case STAT_ATK:
evIncrease = (gBaseStats[defeatedSpecies].evYield_Attack + powerItemBonus) * multiplier;
break;
case STAT_DEF:
evIncrease = (gBaseStats[defeatedSpecies].evYield_Defense + powerItemBonus) * multiplier;
break;
case STAT_SPEED:
evIncrease = (gBaseStats[defeatedSpecies].evYield_Speed + powerItemBonus) * multiplier;
break;
case STAT_SPATK:
evIncrease = (gBaseStats[defeatedSpecies].evYield_SpAttack + powerItemBonus) * multiplier;
break;
case STAT_SPDEF:
evIncrease = (gBaseStats[defeatedSpecies].evYield_SpDefense + powerItemBonus) * multiplier;
break;
switch (i)
{
case STAT_HP:
evIncrease = gBaseStats[defeatedSpecies].evYield_HP * multiplier;
break;
case STAT_ATK:
evIncrease = gBaseStats[defeatedSpecies].evYield_Attack * multiplier;
break;
case STAT_DEF:
evIncrease = gBaseStats[defeatedSpecies].evYield_Defense * multiplier;
break;
case STAT_SPEED:
evIncrease = gBaseStats[defeatedSpecies].evYield_Speed * multiplier;
break;
case STAT_SPATK:
evIncrease = gBaseStats[defeatedSpecies].evYield_SpAttack * multiplier;
break;
case STAT_SPDEF:
evIncrease = gBaseStats[defeatedSpecies].evYield_SpDefense * multiplier;
break;
}
}

if (holdEffect == HOLD_EFFECT_MACHO_BRACE)
Expand Down

0 comments on commit 7b04ef0

Please sign in to comment.