diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2020-10-06 18:39:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-06 18:39:43 -0400 |
commit | 13f37cf974e8f227db9ee68b2ca7987cf1f509a8 (patch) | |
tree | e059372dd361e44dd854fa256c6b8ff5c31f2ad9 /src | |
parent | ba18f4011abd40e530500867b35716ce3d6dc6aa (diff) | |
parent | 65a4e067378b53225536d060d10fa306b6f045c2 (diff) |
Merge pull request #1223 from GriffinRichards/constants-misc
Add ITEM6_HEAL constants, change move flags to shifts
Diffstat (limited to 'src')
-rw-r--r-- | src/data/pokemon/item_effects.h | 14 | ||||
-rw-r--r-- | src/pokemon.c | 16 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/data/pokemon/item_effects.h b/src/data/pokemon/item_effects.h index 698d97a43..1ed721e44 100644 --- a/src/data/pokemon/item_effects.h +++ b/src/data/pokemon/item_effects.h @@ -26,12 +26,12 @@ const u8 gItemEffect_ParalyzeHeal[6] = { const u8 gItemEffect_FullRestore[7] = { [3] = ITEM3_STATUS_ALL, [4] = ITEM4_HEAL_HP, - [6] = -1, + [6] = ITEM6_HEAL_FULL, }; const u8 gItemEffect_MaxPotion[7] = { [4] = ITEM4_HEAL_HP, - [6] = -1, + [6] = ITEM6_HEAL_FULL, }; const u8 gItemEffect_HyperPotion[7] = { @@ -50,12 +50,12 @@ const u8 gItemEffect_FullHeal[6] = { const u8 gItemEffect_Revive[7] = { [4] = ITEM4_REVIVE | ITEM4_HEAL_HP, - [6] = -2, + [6] = ITEM6_HEAL_HALF, }; const u8 gItemEffect_MaxRevive[7] = { [4] = ITEM4_REVIVE | ITEM4_HEAL_HP, - [6] = -1, + [6] = ITEM6_HEAL_FULL, }; const u8 gItemEffect_FreshWater[7] = { @@ -107,7 +107,7 @@ const u8 gItemEffect_HealPowder[9] = { const u8 gItemEffect_RevivalHerb[10] = { [4] = ITEM4_REVIVE | ITEM4_HEAL_HP, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = -1, + [6] = ITEM6_HEAL_FULL, [7] = -15, [8] = -15, [9] = -20, @@ -157,7 +157,7 @@ const u8 gItemEffect_BerryJuice[7] = { const u8 gItemEffect_SacredAsh[7] = { [0] = ITEM0_SACRED_ASH, [4] = ITEM4_REVIVE | ITEM4_HEAL_HP, - [6] = -1, + [6] = ITEM6_HEAL_FULL, }; const u8 gItemEffect_HPUp[10] = { @@ -206,7 +206,7 @@ const u8 gItemEffect_RareCandy[10] = { [3] = ITEM3_LEVEL_UP, [4] = ITEM4_REVIVE | ITEM4_HEAL_HP, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = 0xFD, + [6] = ITEM6_HEAL_LVL_UP, [7] = 5, [8] = 3, [9] = 2, diff --git a/src/pokemon.c b/src/pokemon.c index 7d384de3d..8767207d7 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2836,9 +2836,9 @@ void CalculateMonStats(struct Pokemon *mon) newMaxHP = (((n + hpEV / 4) * level) / 100) + level + 10; } - gBattleScripting.field_23 = newMaxHP - oldMaxHP; - if (gBattleScripting.field_23 == 0) - gBattleScripting.field_23 = 1; + gBattleScripting.levelUpHP = newMaxHP - oldMaxHP; + if (gBattleScripting.levelUpHP == 0) + gBattleScripting.levelUpHP = 1; SetMonData(mon, MON_DATA_MAX_HP, &newMaxHP); @@ -4912,19 +4912,21 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov break; } } + + // Get amount of HP to restore dataUnsigned = itemEffect[var_3C++]; switch (dataUnsigned) { - case 0xFF: + case ITEM6_HEAL_FULL: dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) - GetMonData(mon, MON_DATA_HP, NULL); break; - case 0xFE: + case ITEM6_HEAL_HALF: dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) / 2; if (dataUnsigned == 0) dataUnsigned = 1; break; - case 0xFD: - dataUnsigned = gBattleScripting.field_23; + case ITEM6_HEAL_LVL_UP: + dataUnsigned = gBattleScripting.levelUpHP; break; } if (GetMonData(mon, MON_DATA_MAX_HP, NULL) != GetMonData(mon, MON_DATA_HP, NULL)) |