mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Document pokemon item effects
This commit is contained in:
parent
f9f5f34b0c
commit
b4e1375bb6
79
include/constants/item_effects.h
Normal file
79
include/constants/item_effects.h
Normal file
@ -0,0 +1,79 @@
|
||||
#ifndef GUARD_CONSTANTS_ITEM_EFFECTS_H
|
||||
#define GUARD_CONSTANTS_ITEM_EFFECTS_H
|
||||
|
||||
// field 0 masks
|
||||
#define ITEM0_X_ATTACK 0x0F
|
||||
#define ITEM0_HIGH_CRIT 0x30 // For Dire Hit, works the same way as move Focus Energy.
|
||||
#define ITEM0_SACRED_ASH 0x40
|
||||
#define ITEM0_INFATUATION 0x80
|
||||
|
||||
// field 1 masks
|
||||
#define ITEM1_X_SPEED 0x0F
|
||||
#define ITEM1_X_DEFEND 0xF0
|
||||
|
||||
// field 2 masks
|
||||
#define ITEM2_X_SPATK 0x0F
|
||||
#define ITEM2_X_ACCURACY 0xF0
|
||||
|
||||
// field 3 masks
|
||||
#define ITEM3_CONFUSION 0x1
|
||||
#define ITEM3_PARALYSIS 0x2
|
||||
#define ITEM3_FREEZE 0x4
|
||||
#define ITEM3_BURN 0x8
|
||||
#define ITEM3_POISON 0x10
|
||||
#define ITEM3_SLEEP 0x20
|
||||
#define ITEM3_LEVEL_UP 0x40
|
||||
#define ITEM3_MIST 0x80 // For Guard Specs, works the same way as move Mist.
|
||||
|
||||
#define ITEM3_STATUS_ALL (ITEM3_CONFUSION | ITEM3_PARALYSIS | ITEM3_FREEZE | ITEM3_BURN | ITEM3_POISON | ITEM3_SLEEP)
|
||||
|
||||
// field 4 masks
|
||||
#define ITEM4_EV_HP 0x1
|
||||
#define ITEM4_EV_ATK 0x2
|
||||
#define ITEM4_HEAL_HP 0x4
|
||||
#define ITEM4_HEAL_PP_ALL 0x8
|
||||
#define ITEM4_HEAL_PP_ONE 0x10
|
||||
#define ITEM4_PP_UP 0x20
|
||||
#define ITEM4_REVIVE 0x40
|
||||
#define ITEM4_EVO_STONE 0x80
|
||||
|
||||
// field 5 masks
|
||||
#define ITEM5_EV_DEF 0x1
|
||||
#define ITEM5_EV_SPEED 0x2
|
||||
#define ITEM5_EV_SPDEF 0x4
|
||||
#define ITEM5_EV_SPATK 0x8
|
||||
#define ITEM5_PP_MAX 0x10
|
||||
#define ITEM5_FRIENDSHIP_LOW 0x20
|
||||
#define ITEM5_FRIENDSHIP_MID 0x40
|
||||
#define ITEM5_FRIENDSHIP_HIGH 0x80
|
||||
|
||||
#define ITEM5_FRIENDSHIP_ALL (ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID | ITEM5_FRIENDSHIP_HIGH)
|
||||
|
||||
// fields 6 and onwards are item-specific arguments
|
||||
|
||||
// Used for GetItemEffectType.
|
||||
#define ITEM_EFFECT_X_ITEM 0
|
||||
#define ITEM_EFFECT_RAISE_LEVEL 1
|
||||
#define ITEM_EFFECT_HEAL_HP 2
|
||||
#define ITEM_EFFECT_CURE_POISON 3
|
||||
#define ITEM_EFFECT_CURE_SLEEP 4
|
||||
#define ITEM_EFFECT_CURE_BURN 5
|
||||
#define ITEM_EFFECT_CURE_FREEZE 6
|
||||
#define ITEM_EFFECT_CURE_PARALYSIS 7
|
||||
#define ITEM_EFFECT_CURE_CONFUSION 8
|
||||
#define ITEM_EFFECT_CURE_INFATUATION 9
|
||||
#define ITEM_EFFECT_SACRED_ASH 10
|
||||
#define ITEM_EFFECT_CURE_ALL_STATUS 11
|
||||
#define ITEM_EFFECT_ATK_EV 12
|
||||
#define ITEM_EFFECT_HP_EV 13
|
||||
#define ITEM_EFFECT_SPATK_EV 14
|
||||
#define ITEM_EFFECT_SPDEF_EV 15
|
||||
#define ITEM_EFFECT_SPEED_EV 16
|
||||
#define ITEM_EFFECT_DEF_EV 17
|
||||
#define ITEM_EFFECT_EVO_STONE 18
|
||||
#define ITEM_EFFECT_PP_UP 19
|
||||
#define ITEM_EFFECT_PP_MAX 20
|
||||
#define ITEM_EFFECT_HEAL_PP 21
|
||||
#define ITEM_EFFECT_NONE 22
|
||||
|
||||
#endif // GUARD_CONSTANTS_ITEM_EFFECTS_H
|
@ -473,6 +473,6 @@
|
||||
#define NUM_HIDDEN_MACHINES 8
|
||||
|
||||
// Check if the item is one that can be used on a Pokemon.
|
||||
#define IS_POKEMON_ITEM(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2)
|
||||
#define ITEM_HAS_EFFECT(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2)
|
||||
|
||||
#endif // GUARD_CONSTANTS_ITEMS_H
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "random.h"
|
||||
#include "util.h"
|
||||
#include "constants/abilities.h"
|
||||
#include "constants/item_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/moves.h"
|
||||
#include "constants/species.h"
|
||||
@ -778,18 +779,17 @@ u8 GetMostSuitableMonToSwitchInto(void)
|
||||
return bestMonId;
|
||||
}
|
||||
|
||||
// TODO: use PokemonItemEffect struct instead of u8 once it's documented.
|
||||
static u8 GetAI_ItemType(u8 itemId, const u8 *itemEffect) // NOTE: should take u16 as item Id argument
|
||||
{
|
||||
if (itemId == ITEM_FULL_RESTORE)
|
||||
return AI_ITEM_FULL_RESTORE;
|
||||
else if (itemEffect[4] & 4)
|
||||
else if (itemEffect[4] & ITEM4_HEAL_HP)
|
||||
return AI_ITEM_HEAL_HP;
|
||||
else if (itemEffect[3] & 0x3F)
|
||||
else if (itemEffect[3] & ITEM3_STATUS_ALL)
|
||||
return AI_ITEM_CURE_CONDITION;
|
||||
else if (itemEffect[0] & 0x3F || itemEffect[1] != 0 || itemEffect[2] != 0)
|
||||
else if (itemEffect[0] & (ITEM0_HIGH_CRIT | ITEM0_X_ATTACK) || itemEffect[1] != 0 || itemEffect[2] != 0)
|
||||
return AI_ITEM_X_STAT;
|
||||
else if (itemEffect[3] & 0x80)
|
||||
else if (itemEffect[3] & ITEM3_MIST)
|
||||
return AI_ITEM_GUARD_SPECS;
|
||||
else
|
||||
return AI_ITEM_NOT_RECOGNIZABLE;
|
||||
@ -832,13 +832,13 @@ static bool8 ShouldUseItem(void)
|
||||
item = gBattleResources->battleHistory->trainerItems[i];
|
||||
if (item == ITEM_NONE)
|
||||
continue;
|
||||
if (gItemEffectTable[item - 13] == NULL)
|
||||
if (gItemEffectTable[item - ITEM_POTION] == NULL)
|
||||
continue;
|
||||
|
||||
if (item == ITEM_ENIGMA_BERRY)
|
||||
itemEffects = gSaveBlock1Ptr->enigmaBerry.itemEffect;
|
||||
else
|
||||
itemEffects = gItemEffectTable[item - 13];
|
||||
itemEffects = gItemEffectTable[item - ITEM_POTION];
|
||||
|
||||
*(gBattleStruct->AI_itemType + gActiveBattler / 2) = GetAI_ItemType(item, itemEffects);
|
||||
|
||||
@ -862,32 +862,32 @@ static bool8 ShouldUseItem(void)
|
||||
break;
|
||||
case AI_ITEM_CURE_CONDITION:
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) = 0;
|
||||
if (itemEffects[3] & 0x20 && gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)
|
||||
if (itemEffects[3] & ITEM3_SLEEP && gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x20;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x10 && (gBattleMons[gActiveBattler].status1 & STATUS1_POISON || gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_POISON))
|
||||
if (itemEffects[3] & ITEM3_POISON && (gBattleMons[gActiveBattler].status1 & STATUS1_POISON || gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_POISON))
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x10;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x8 && gBattleMons[gActiveBattler].status1 & STATUS1_BURN)
|
||||
if (itemEffects[3] & ITEM3_BURN && gBattleMons[gActiveBattler].status1 & STATUS1_BURN)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x8;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x4 && gBattleMons[gActiveBattler].status1 & STATUS1_FREEZE)
|
||||
if (itemEffects[3] & ITEM3_FREEZE && gBattleMons[gActiveBattler].status1 & STATUS1_FREEZE)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x4;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x2 && gBattleMons[gActiveBattler].status1 & STATUS1_PARALYSIS)
|
||||
if (itemEffects[3] & ITEM3_PARALYSIS && gBattleMons[gActiveBattler].status1 & STATUS1_PARALYSIS)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x2;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x1 && gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION)
|
||||
if (itemEffects[3] & ITEM3_CONFUSION && gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1;
|
||||
shouldUse = TRUE;
|
||||
@ -897,17 +897,17 @@ static bool8 ShouldUseItem(void)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) = 0;
|
||||
if (gDisableStructs[gActiveBattler].isFirstTurn == 0)
|
||||
break;
|
||||
if (itemEffects[0] & 0xF)
|
||||
if (itemEffects[0] & ITEM0_X_ATTACK)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1;
|
||||
if (itemEffects[1] & 0xF0)
|
||||
if (itemEffects[1] & ITEM1_X_DEFEND)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x2;
|
||||
if (itemEffects[1] & 0xF)
|
||||
if (itemEffects[1] & ITEM1_X_SPEED)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x4;
|
||||
if (itemEffects[2] & 0xF)
|
||||
if (itemEffects[2] & ITEM2_X_SPATK)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x8;
|
||||
if (itemEffects[2] & 0xF0)
|
||||
if (itemEffects[2] & ITEM2_X_ACCURACY)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x20;
|
||||
if (itemEffects[0] & 0x30)
|
||||
if (itemEffects[0] & ITEM0_HIGH_CRIT)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x80;
|
||||
shouldUse = TRUE;
|
||||
break;
|
||||
|
@ -1,236 +1,476 @@
|
||||
const u8 gItemEffect_Potion[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 20};
|
||||
const u8 gItemEffect_Antidote[] = {0x00, 0x00, 0x00, 0x10, 0x00, 0x00};
|
||||
const u8 gItemEffect_BurnHeal[] = {0x00, 0x00, 0x00, 0x08, 0x00, 0x00};
|
||||
const u8 gItemEffect_IceHeal[] = {0x00, 0x00, 0x00, 0x04, 0x00, 0x00};
|
||||
const u8 gItemEffect_Awakening[] = {0x00, 0x00, 0x00, 0x20, 0x00, 0x00};
|
||||
const u8 gItemEffect_ParalyzeHeal[] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00};
|
||||
const u8 gItemEffect_FullRestore[] = {0x00, 0x00, 0x00, 0x3f, 0x04, 0x00, 0xff};
|
||||
const u8 gItemEffect_MaxPotion[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff};
|
||||
const u8 gItemEffect_HyperPotion[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 200};
|
||||
const u8 gItemEffect_SuperPotion[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 50};
|
||||
const u8 gItemEffect_FullHeal[] = {0x00, 0x00, 0x00, 0x3f, 0x00, 0x00};
|
||||
const u8 gItemEffect_Revive[] = {0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0xfe};
|
||||
const u8 gItemEffect_MaxRevive[] = {0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0xff};
|
||||
const u8 gItemEffect_FreshWater[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 50};
|
||||
const u8 gItemEffect_SodaPop[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 60};
|
||||
const u8 gItemEffect_Lemonade[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 80};
|
||||
const u8 gItemEffect_MoomooMilk[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 100};
|
||||
const u8 gItemEffect_EnergyPowder[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0xe0, 50, 0xfb, 0xfb, 0xf6};
|
||||
const u8 gItemEffect_EnergyRoot[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0xe0, 200, 0xf6, 0xf6, 0xf1};
|
||||
const u8 gItemEffect_HealPowder[] = {0x00, 0x00, 0x00, 0x3f, 0x00, 0xe0, 0xfb, 0xfb, 0xf6};
|
||||
const u8 gItemEffect_RevivalHerb[] = {0x00, 0x00, 0x00, 0x00, 0x44, 0xe0, 0xff, 0xf1, 0xf1, 0xec};
|
||||
const u8 gItemEffect_Ether[] = {0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x0a};
|
||||
const u8 gItemEffect_MaxEther[] = {0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x7f};
|
||||
const u8 gItemEffect_Elixir[] = {0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0a};
|
||||
const u8 gItemEffect_MaxElixir[] = {0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x7f};
|
||||
const u8 gItemEffect_LavaCookie[] = {0x00, 0x00, 0x00, 0x3f, 0x00, 0x00};
|
||||
const u8 gItemEffect_BlueFlute[] = {0x00, 0x00, 0x00, 0x20, 0x00, 0x00};
|
||||
const u8 gItemEffect_YellowFlute[] = {0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
|
||||
const u8 gItemEffect_RedFlute[] = {0x80, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
const u8 gItemEffect_BerryJuice[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 20};
|
||||
const u8 gItemEffect_SacredAsh[] = {0x40, 0x00, 0x00, 0x00, 0x44, 0x00, 0xff};
|
||||
const u8 gItemEffect_HPUp[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0xe0, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_Protein[] = {0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_Iron[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_Carbos[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_Calcium[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_RareCandy[] = {0x00, 0x00, 0x00, 0x40, 0x44, 0xe0, 253, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_PPUp[] = {0x00, 0x00, 0x00, 0x00, 0x20, 0xe0, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_Zinc[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_PPMax[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_GuardSpec[] = {0x00, 0x00, 0x00, 0x80, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_DireHit[] = {0x20, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_XAttack[] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_XDefend[] = {0x00, 0x10, 0x00, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_XSpeed[] = {0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_XAccuracy[] = {0x00, 0x00, 0x10, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_XSpecial[] = {0x00, 0x00, 0x01, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_SunStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_MoonStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_FireStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_ThunderStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_WaterStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_LeafStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_CheriBerry[] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00};
|
||||
const u8 gItemEffect_ChestoBerry[] = {0x00, 0x00, 0x00, 0x20, 0x00, 0x00};
|
||||
const u8 gItemEffect_PechaBerry[] = {0x00, 0x00, 0x00, 0x10, 0x00, 0x00};
|
||||
const u8 gItemEffect_RawstBerry[] = {0x00, 0x00, 0x00, 0x08, 0x00, 0x00};
|
||||
const u8 gItemEffect_AspearBerry[] = {0x00, 0x00, 0x00, 0x04, 0x00, 0x00};
|
||||
const u8 gItemEffect_LeppaBerry[] = {0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x0a};
|
||||
const u8 gItemEffect_OranBerry[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 10};
|
||||
const u8 gItemEffect_PersimBerry[] = {0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
|
||||
const u8 gItemEffect_LumBerry[] = {0x00, 0x00, 0x00, 0x3f, 0x00, 0x00};
|
||||
const u8 gItemEffect_SitrusBerry[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 30};
|
||||
const u8 gItemEffect_PomegBerry[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0xe0, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_KelpsyBerry[] = {0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_QualotBerry[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_HondrewBerry[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_GrepaBerry[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_TamatoBerry[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_Potion[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 20,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Antidote[6] = {
|
||||
[3] = ITEM3_POISON,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_BurnHeal[6] = {
|
||||
[3] = ITEM3_BURN,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_IceHeal[6] = {
|
||||
[3] = ITEM3_FREEZE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Awakening[6] = {
|
||||
[3] = ITEM3_SLEEP,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_ParalyzeHeal[6] = {
|
||||
[3] = ITEM3_PARALYSIS,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_FullRestore[7] = {
|
||||
[3] = ITEM3_STATUS_ALL,
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = -1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MaxPotion[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = -1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_HyperPotion[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 200,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_SuperPotion[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 50,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_FullHeal[6] = {
|
||||
[3] = ITEM3_STATUS_ALL,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Revive[7] = {
|
||||
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
|
||||
[6] = -2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MaxRevive[7] = {
|
||||
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
|
||||
[6] = -1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_FreshWater[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 50,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_SodaPop[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 60,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Lemonade[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 80,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MoomooMilk[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 100,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_EnergyPowder[10] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 50,
|
||||
[7] = -5,
|
||||
[8] = -5,
|
||||
[9] = -10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_EnergyRoot[10] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 200,
|
||||
[7] = -10,
|
||||
[8] = -10,
|
||||
[9] = -15,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_HealPowder[9] = {
|
||||
[3] = ITEM3_STATUS_ALL,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -5,
|
||||
[7] = -5,
|
||||
[8] = -10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_RevivalHerb[10] = {
|
||||
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -1,
|
||||
[7] = -15,
|
||||
[8] = -15,
|
||||
[9] = -20,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Ether[7] = {
|
||||
[4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP_ALL,
|
||||
[6] = 10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MaxEther[7] = {
|
||||
[4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP_ALL,
|
||||
[6] = 0x7F,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Elixir[7] = {
|
||||
[4] = ITEM4_HEAL_PP_ALL,
|
||||
[6] = 10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MaxElixir[7] = {
|
||||
[4] = ITEM4_HEAL_PP_ALL,
|
||||
[6] = 0x7F,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_LavaCookie[6] = {
|
||||
[3] = ITEM3_STATUS_ALL,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_BlueFlute[6] = {
|
||||
[3] = ITEM3_SLEEP,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_YellowFlute[6] = {
|
||||
[3] = ITEM3_CONFUSION,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_RedFlute[6] = {
|
||||
[0] = ITEM0_INFATUATION,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_BerryJuice[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 20,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_SacredAsh[7] = {
|
||||
[0] = ITEM0_SACRED_ASH,
|
||||
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
|
||||
[6] = -1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_HPUp[10] = {
|
||||
[4] = ITEM4_EV_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Protein[10] = {
|
||||
[4] = ITEM4_EV_ATK,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Iron[10] = {
|
||||
[5] = ITEM5_EV_DEF | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Carbos[10] = {
|
||||
[5] = ITEM5_EV_SPEED | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Calcium[10] = {
|
||||
[5] = ITEM5_EV_SPATK | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_RareCandy[10] = {
|
||||
[3] = ITEM3_LEVEL_UP,
|
||||
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 0xFD,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_PPUp[9] = {
|
||||
[4] = ITEM4_PP_UP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 5,
|
||||
[7] = 3,
|
||||
[8] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Zinc[10] = {
|
||||
[5] = ITEM5_EV_SPDEF | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_PPMax[9] = {
|
||||
[5] = ITEM5_PP_MAX | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 5,
|
||||
[7] = 3,
|
||||
[8] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_GuardSpec[8] = {
|
||||
[3] = ITEM3_MIST,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_DireHit[8] = {
|
||||
[0] = 2 << 4,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_XAttack[8] = {
|
||||
[0] = 1,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_XDefend[8] = {
|
||||
[1] = 1 << 4,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_XSpeed[8] = {
|
||||
[1] = 1,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_XAccuracy[8] = {
|
||||
[2] = 1 << 4,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_XSpecial[8] = {
|
||||
[2] = 1,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_SunStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MoonStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_FireStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_ThunderStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_WaterStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_LeafStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_CheriBerry[6] = {
|
||||
[3] = ITEM3_PARALYSIS,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_ChestoBerry[6] = {
|
||||
[3] = ITEM3_SLEEP,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_PechaBerry[6] = {
|
||||
[3] = ITEM3_POISON,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_RawstBerry[6] = {
|
||||
[3] = ITEM3_BURN,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_AspearBerry[6] = {
|
||||
[3] = ITEM3_FREEZE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_LeppaBerry[7] = {
|
||||
[4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP_ALL,
|
||||
[6] = 10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_OranBerry[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_PersimBerry[6] = {
|
||||
[3] = ITEM3_CONFUSION,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_LumBerry[6] = {
|
||||
[3] = ITEM3_STATUS_ALL,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_SitrusBerry[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 30,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_PomegBerry[10] = {
|
||||
[4] = ITEM4_EV_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_KelpsyBerry[10] = {
|
||||
[4] = ITEM4_EV_ATK,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_QualotBerry[10] = {
|
||||
[5] = ITEM5_EV_DEF | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_HondrewBerry[10] = {
|
||||
[5] = ITEM5_EV_SPATK | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_GrepaBerry[10] = {
|
||||
[5] = ITEM5_EV_SPDEF | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_TamatoBerry[10] = {
|
||||
[5] = ITEM5_EV_SPEED | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 *const gItemEffectTable[] =
|
||||
{
|
||||
gItemEffect_Potion,
|
||||
gItemEffect_Antidote,
|
||||
gItemEffect_BurnHeal,
|
||||
gItemEffect_IceHeal,
|
||||
gItemEffect_Awakening,
|
||||
gItemEffect_ParalyzeHeal,
|
||||
gItemEffect_FullRestore,
|
||||
gItemEffect_MaxPotion,
|
||||
gItemEffect_HyperPotion,
|
||||
gItemEffect_SuperPotion,
|
||||
gItemEffect_FullHeal,
|
||||
gItemEffect_Revive,
|
||||
gItemEffect_MaxRevive,
|
||||
gItemEffect_FreshWater,
|
||||
gItemEffect_SodaPop,
|
||||
gItemEffect_Lemonade,
|
||||
gItemEffect_MoomooMilk,
|
||||
gItemEffect_EnergyPowder,
|
||||
gItemEffect_EnergyRoot,
|
||||
gItemEffect_HealPowder,
|
||||
gItemEffect_RevivalHerb,
|
||||
gItemEffect_Ether,
|
||||
gItemEffect_MaxEther,
|
||||
gItemEffect_Elixir,
|
||||
gItemEffect_MaxElixir,
|
||||
gItemEffect_LavaCookie,
|
||||
gItemEffect_BlueFlute,
|
||||
gItemEffect_YellowFlute,
|
||||
gItemEffect_RedFlute,
|
||||
NULL,
|
||||
NULL,
|
||||
gItemEffect_BerryJuice,
|
||||
gItemEffect_SacredAsh,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gItemEffect_HPUp,
|
||||
gItemEffect_Protein,
|
||||
gItemEffect_Iron,
|
||||
gItemEffect_Carbos,
|
||||
gItemEffect_Calcium,
|
||||
gItemEffect_RareCandy,
|
||||
gItemEffect_PPUp,
|
||||
gItemEffect_Zinc,
|
||||
gItemEffect_PPMax,
|
||||
NULL,
|
||||
gItemEffect_GuardSpec,
|
||||
gItemEffect_DireHit,
|
||||
gItemEffect_XAttack,
|
||||
gItemEffect_XDefend,
|
||||
gItemEffect_XSpeed,
|
||||
gItemEffect_XAccuracy,
|
||||
gItemEffect_XSpecial,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gItemEffect_SunStone,
|
||||
gItemEffect_MoonStone,
|
||||
gItemEffect_FireStone,
|
||||
gItemEffect_ThunderStone,
|
||||
gItemEffect_WaterStone,
|
||||
gItemEffect_LeafStone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gItemEffect_CheriBerry,
|
||||
gItemEffect_ChestoBerry,
|
||||
gItemEffect_PechaBerry,
|
||||
gItemEffect_RawstBerry,
|
||||
gItemEffect_AspearBerry,
|
||||
gItemEffect_LeppaBerry,
|
||||
gItemEffect_OranBerry,
|
||||
gItemEffect_PersimBerry,
|
||||
gItemEffect_LumBerry,
|
||||
gItemEffect_SitrusBerry,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gItemEffect_PomegBerry,
|
||||
gItemEffect_KelpsyBerry,
|
||||
gItemEffect_QualotBerry,
|
||||
gItemEffect_HondrewBerry,
|
||||
gItemEffect_GrepaBerry,
|
||||
gItemEffect_TamatoBerry,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
[ITEM_POTION - ITEM_POTION] = gItemEffect_Potion,
|
||||
[ITEM_ANTIDOTE - ITEM_POTION] = gItemEffect_Antidote,
|
||||
[ITEM_BURN_HEAL - ITEM_POTION] = gItemEffect_BurnHeal,
|
||||
[ITEM_ICE_HEAL - ITEM_POTION] = gItemEffect_IceHeal,
|
||||
[ITEM_AWAKENING - ITEM_POTION] = gItemEffect_Awakening,
|
||||
[ITEM_PARALYZE_HEAL - ITEM_POTION] = gItemEffect_ParalyzeHeal,
|
||||
[ITEM_FULL_RESTORE - ITEM_POTION] = gItemEffect_FullRestore,
|
||||
[ITEM_MAX_POTION - ITEM_POTION] = gItemEffect_MaxPotion,
|
||||
[ITEM_HYPER_POTION - ITEM_POTION] = gItemEffect_HyperPotion,
|
||||
[ITEM_SUPER_POTION - ITEM_POTION] = gItemEffect_SuperPotion,
|
||||
[ITEM_FULL_HEAL - ITEM_POTION] = gItemEffect_FullHeal,
|
||||
[ITEM_REVIVE - ITEM_POTION] = gItemEffect_Revive,
|
||||
[ITEM_MAX_REVIVE - ITEM_POTION] = gItemEffect_MaxRevive,
|
||||
[ITEM_FRESH_WATER - ITEM_POTION] = gItemEffect_FreshWater,
|
||||
[ITEM_SODA_POP - ITEM_POTION] = gItemEffect_SodaPop,
|
||||
[ITEM_LEMONADE - ITEM_POTION] = gItemEffect_Lemonade,
|
||||
[ITEM_MOOMOO_MILK - ITEM_POTION] = gItemEffect_MoomooMilk,
|
||||
[ITEM_ENERGY_POWDER - ITEM_POTION] = gItemEffect_EnergyPowder,
|
||||
[ITEM_ENERGY_ROOT - ITEM_POTION] = gItemEffect_EnergyRoot,
|
||||
[ITEM_HEAL_POWDER - ITEM_POTION] = gItemEffect_HealPowder,
|
||||
[ITEM_REVIVAL_HERB - ITEM_POTION] = gItemEffect_RevivalHerb,
|
||||
[ITEM_ETHER - ITEM_POTION] = gItemEffect_Ether,
|
||||
[ITEM_MAX_ETHER - ITEM_POTION] = gItemEffect_MaxEther,
|
||||
[ITEM_ELIXIR - ITEM_POTION] = gItemEffect_Elixir,
|
||||
[ITEM_MAX_ELIXIR - ITEM_POTION] = gItemEffect_MaxElixir,
|
||||
[ITEM_LAVA_COOKIE - ITEM_POTION] = gItemEffect_LavaCookie,
|
||||
[ITEM_BLUE_FLUTE - ITEM_POTION] = gItemEffect_BlueFlute,
|
||||
[ITEM_YELLOW_FLUTE - ITEM_POTION] = gItemEffect_YellowFlute,
|
||||
[ITEM_RED_FLUTE - ITEM_POTION] = gItemEffect_RedFlute,
|
||||
[ITEM_BERRY_JUICE - ITEM_POTION] = gItemEffect_BerryJuice,
|
||||
[ITEM_SACRED_ASH - ITEM_POTION] = gItemEffect_SacredAsh,
|
||||
[ITEM_HP_UP - ITEM_POTION] = gItemEffect_HPUp,
|
||||
[ITEM_PROTEIN - ITEM_POTION] = gItemEffect_Protein,
|
||||
[ITEM_IRON - ITEM_POTION] = gItemEffect_Iron,
|
||||
[ITEM_CARBOS - ITEM_POTION] = gItemEffect_Carbos,
|
||||
[ITEM_CALCIUM - ITEM_POTION] = gItemEffect_Calcium,
|
||||
[ITEM_RARE_CANDY - ITEM_POTION] = gItemEffect_RareCandy,
|
||||
[ITEM_PP_UP - ITEM_POTION] = gItemEffect_PPUp,
|
||||
[ITEM_ZINC - ITEM_POTION] = gItemEffect_Zinc,
|
||||
[ITEM_PP_MAX - ITEM_POTION] = gItemEffect_PPMax,
|
||||
[ITEM_GUARD_SPEC - ITEM_POTION] = gItemEffect_GuardSpec,
|
||||
[ITEM_DIRE_HIT - ITEM_POTION] = gItemEffect_DireHit,
|
||||
[ITEM_X_ATTACK - ITEM_POTION] = gItemEffect_XAttack,
|
||||
[ITEM_X_DEFEND - ITEM_POTION] = gItemEffect_XDefend,
|
||||
[ITEM_X_SPEED - ITEM_POTION] = gItemEffect_XSpeed,
|
||||
[ITEM_X_ACCURACY - ITEM_POTION] = gItemEffect_XAccuracy,
|
||||
[ITEM_X_SPECIAL - ITEM_POTION] = gItemEffect_XSpecial,
|
||||
[ITEM_SUN_STONE - ITEM_POTION] = gItemEffect_SunStone,
|
||||
[ITEM_MOON_STONE - ITEM_POTION] = gItemEffect_MoonStone,
|
||||
[ITEM_FIRE_STONE - ITEM_POTION] = gItemEffect_FireStone,
|
||||
[ITEM_THUNDER_STONE - ITEM_POTION] = gItemEffect_ThunderStone,
|
||||
[ITEM_WATER_STONE - ITEM_POTION] = gItemEffect_WaterStone,
|
||||
[ITEM_LEAF_STONE - ITEM_POTION] = gItemEffect_LeafStone,
|
||||
[ITEM_CHERI_BERRY - ITEM_POTION] = gItemEffect_CheriBerry,
|
||||
[ITEM_CHESTO_BERRY - ITEM_POTION] = gItemEffect_ChestoBerry,
|
||||
[ITEM_PECHA_BERRY - ITEM_POTION] = gItemEffect_PechaBerry,
|
||||
[ITEM_RAWST_BERRY - ITEM_POTION] = gItemEffect_RawstBerry,
|
||||
[ITEM_ASPEAR_BERRY - ITEM_POTION] = gItemEffect_AspearBerry,
|
||||
[ITEM_LEPPA_BERRY - ITEM_POTION] = gItemEffect_LeppaBerry,
|
||||
[ITEM_ORAN_BERRY - ITEM_POTION] = gItemEffect_OranBerry,
|
||||
[ITEM_PERSIM_BERRY - ITEM_POTION] = gItemEffect_PersimBerry,
|
||||
[ITEM_LUM_BERRY - ITEM_POTION] = gItemEffect_LumBerry,
|
||||
[ITEM_SITRUS_BERRY - ITEM_POTION] = gItemEffect_SitrusBerry,
|
||||
[ITEM_POMEG_BERRY - ITEM_POTION] = gItemEffect_PomegBerry,
|
||||
[ITEM_KELPSY_BERRY - ITEM_POTION] = gItemEffect_KelpsyBerry,
|
||||
[ITEM_QUALOT_BERRY - ITEM_POTION] = gItemEffect_QualotBerry,
|
||||
[ITEM_HONDEW_BERRY - ITEM_POTION] = gItemEffect_HondrewBerry,
|
||||
[ITEM_GREPA_BERRY - ITEM_POTION] = gItemEffect_GrepaBerry,
|
||||
[ITEM_TAMATO_BERRY - ITEM_POTION] = gItemEffect_TamatoBerry,
|
||||
[LAST_BERRY_INDEX - ITEM_POTION] = NULL
|
||||
};
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "constants/bg_event_constants.h"
|
||||
#include "constants/event_objects.h"
|
||||
#include "constants/flags.h"
|
||||
#include "constants/item_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/vars.h"
|
||||
@ -389,7 +390,7 @@ bool8 sub_80FD6D4(const struct MapEvents *events, s16 x, s16 y)
|
||||
|
||||
bool8 sub_80FD730(struct MapConnection *connection, int x, int y)
|
||||
{
|
||||
|
||||
|
||||
u16 localX, localY;
|
||||
u32 localOffset;
|
||||
s32 localLength;
|
||||
@ -1026,44 +1027,45 @@ void ItemUseInBattle_Escape(u8 taskId)
|
||||
|
||||
void ItemUseOutOfBattle_EnigmaBerry(u8 taskId)
|
||||
{
|
||||
switch (GetItemEffectType(gSpecialVar_ItemId) - 1)
|
||||
switch (GetItemEffectType(gSpecialVar_ItemId))
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
case ITEM_EFFECT_HEAL_HP:
|
||||
case ITEM_EFFECT_CURE_POISON:
|
||||
case ITEM_EFFECT_CURE_SLEEP:
|
||||
case ITEM_EFFECT_CURE_BURN:
|
||||
case ITEM_EFFECT_CURE_FREEZE:
|
||||
case ITEM_EFFECT_CURE_PARALYSIS:
|
||||
case ITEM_EFFECT_CURE_ALL_STATUS:
|
||||
case ITEM_EFFECT_ATK_EV:
|
||||
case ITEM_EFFECT_HP_EV:
|
||||
case ITEM_EFFECT_SPATK_EV:
|
||||
case ITEM_EFFECT_SPDEF_EV:
|
||||
case ITEM_EFFECT_SPEED_EV:
|
||||
case ITEM_EFFECT_DEF_EV:
|
||||
gTasks[taskId].data[4] = 1;
|
||||
ItemUseOutOfBattle_Medicine(taskId);
|
||||
break;
|
||||
case 9:
|
||||
case ITEM_EFFECT_SACRED_ASH:
|
||||
gTasks[taskId].data[4] = 1;
|
||||
ItemUseOutOfBattle_SacredAsh(taskId);
|
||||
break;
|
||||
case 0:
|
||||
case ITEM_EFFECT_RAISE_LEVEL:
|
||||
gTasks[taskId].data[4] = 1;
|
||||
ItemUseOutOfBattle_RareCandy(taskId);
|
||||
break;
|
||||
case 18:
|
||||
case 19:
|
||||
case ITEM_EFFECT_PP_UP:
|
||||
case ITEM_EFFECT_PP_MAX:
|
||||
gTasks[taskId].data[4] = 1;
|
||||
ItemUseOutOfBattle_PPUp(taskId);
|
||||
break;
|
||||
case 20:
|
||||
case ITEM_EFFECT_HEAL_PP:
|
||||
gTasks[taskId].data[4] = 1;
|
||||
ItemUseOutOfBattle_PPRecovery(taskId);
|
||||
break;
|
||||
default:
|
||||
gTasks[taskId].data[4] = 4;
|
||||
ItemUseOutOfBattle_CannotUse(taskId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1071,25 +1073,26 @@ void ItemUseInBattle_EnigmaBerry(u8 taskId)
|
||||
{
|
||||
switch (GetItemEffectType(gSpecialVar_ItemId))
|
||||
{
|
||||
case 0:
|
||||
case ITEM_EFFECT_X_ITEM:
|
||||
ItemUseInBattle_StatIncrease(taskId);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 11:
|
||||
case ITEM_EFFECT_HEAL_HP:
|
||||
case ITEM_EFFECT_CURE_POISON:
|
||||
case ITEM_EFFECT_CURE_SLEEP:
|
||||
case ITEM_EFFECT_CURE_BURN:
|
||||
case ITEM_EFFECT_CURE_FREEZE:
|
||||
case ITEM_EFFECT_CURE_PARALYSIS:
|
||||
case ITEM_EFFECT_CURE_ALL_STATUS:
|
||||
case ITEM_EFFECT_CURE_CONFUSION:
|
||||
case ITEM_EFFECT_CURE_INFATUATION:
|
||||
ItemUseInBattle_Medicine(taskId);
|
||||
break;
|
||||
case 21:
|
||||
case ITEM_EFFECT_HEAL_PP:
|
||||
ItemUseInBattle_PPRecovery(taskId);
|
||||
break;
|
||||
default:
|
||||
ItemUseOutOfBattle_CannotUse(taskId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
177
src/party_menu.c
177
src/party_menu.c
@ -68,6 +68,7 @@
|
||||
#include "constants/easy_chat.h"
|
||||
#include "constants/field_effects.h"
|
||||
#include "constants/flags.h"
|
||||
#include "constants/item_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/maps.h"
|
||||
#include "constants/moves.h"
|
||||
@ -298,8 +299,8 @@ static u8 sub_81B8984(void);
|
||||
static void sub_81B6280(u8);
|
||||
static void c2_815ABFC(void);
|
||||
static void sub_81B672C(u8);
|
||||
static u16 sub_81B691C(struct Pokemon*, u8);
|
||||
static void option_menu_get_string(u8, u8*);
|
||||
static u16 ItemEffectToMonEv(struct Pokemon*, u8);
|
||||
static void ItemEffectToStatString(u8, u8*);
|
||||
static void sub_81B6BB4(u8);
|
||||
static void ether_effect_related_2(u8);
|
||||
static void ether_effect_related(u8);
|
||||
@ -5230,7 +5231,7 @@ void sub_81B617C(void)
|
||||
doubleBattleStatus = 0;
|
||||
}
|
||||
|
||||
if (GetItemEffectType(gSpecialVar_ItemId) == 10)
|
||||
if (GetItemEffectType(gSpecialVar_ItemId) == ITEM_EFFECT_SACRED_ASH)
|
||||
{
|
||||
gUnknown_0203CEC8.unk9 = 0;
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
@ -5284,7 +5285,7 @@ static bool8 IsHPRecoveryItem(u16 item)
|
||||
else
|
||||
effect = gItemEffectTable[item - ITEM_POTION];
|
||||
|
||||
if ((effect[4] & 4) != 0)
|
||||
if (effect[4] & ITEM4_HEAL_HP)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -5294,59 +5295,59 @@ static void GetMedicineItemEffectMessage(u16 item)
|
||||
{
|
||||
switch (GetItemEffectType(item))
|
||||
{
|
||||
case 3:
|
||||
case ITEM_EFFECT_CURE_POISON:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnCuredOfPoison);
|
||||
break;
|
||||
case 4:
|
||||
case ITEM_EFFECT_CURE_SLEEP:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnWokeUp2);
|
||||
break;
|
||||
case 5:
|
||||
case ITEM_EFFECT_CURE_BURN:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBurnHealed);
|
||||
break;
|
||||
case 6:
|
||||
case ITEM_EFFECT_CURE_FREEZE:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnThawedOut);
|
||||
break;
|
||||
case 7:
|
||||
case ITEM_EFFECT_CURE_PARALYSIS:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnCuredOfParalysis);
|
||||
break;
|
||||
case 8:
|
||||
case ITEM_EFFECT_CURE_CONFUSION:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnSnappedOutOfConfusion);
|
||||
break;
|
||||
case 9:
|
||||
case ITEM_EFFECT_CURE_INFATUATION:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnGotOverInfatuation);
|
||||
break;
|
||||
case 11:
|
||||
case ITEM_EFFECT_CURE_ALL_STATUS:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBecameHealthy);
|
||||
break;
|
||||
case 13:
|
||||
case ITEM_EFFECT_HP_EV:
|
||||
StringCopy(gStringVar2, gText_HP3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 12:
|
||||
case ITEM_EFFECT_ATK_EV:
|
||||
StringCopy(gStringVar2, gText_Attack3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 17:
|
||||
case ITEM_EFFECT_DEF_EV:
|
||||
StringCopy(gStringVar2, gText_Defense3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 16:
|
||||
case ITEM_EFFECT_SPEED_EV:
|
||||
StringCopy(gStringVar2, gText_Speed2);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 14:
|
||||
case ITEM_EFFECT_SPATK_EV:
|
||||
StringCopy(gStringVar2, gText_SpAtk3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 15:
|
||||
case ITEM_EFFECT_SPDEF_EV:
|
||||
StringCopy(gStringVar2, gText_SpDef3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 19:
|
||||
case 20:
|
||||
case ITEM_EFFECT_PP_UP:
|
||||
case ITEM_EFFECT_PP_MAX:
|
||||
StringExpandPlaceholders(gStringVar4, gText_MovesPPIncreased);
|
||||
break;
|
||||
case 21:
|
||||
case ITEM_EFFECT_HEAL_PP:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PPWasRestored);
|
||||
break;
|
||||
default:
|
||||
@ -5357,12 +5358,12 @@ static void GetMedicineItemEffectMessage(u16 item)
|
||||
|
||||
static bool8 UsingHPEVItemOnShedinja(struct Pokemon *mon, u16 item)
|
||||
{
|
||||
if (GetItemEffectType(item) == 13 && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_SHEDINJA)
|
||||
if (GetItemEffectType(item) == ITEM_EFFECT_HP_EV && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_SHEDINJA)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 IsBlueYellowRedFlute(u16 item)
|
||||
static bool8 IsItemFlute(u16 item)
|
||||
{
|
||||
if (item == ITEM_BLUE_FLUTE || item == ITEM_RED_FLUTE || item == ITEM_YELLOW_FLUTE)
|
||||
return TRUE;
|
||||
@ -5409,7 +5410,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task)
|
||||
goto iTriedHonestlyIDid;
|
||||
}
|
||||
gUnknown_0203CEE8 = 1;
|
||||
if (IsBlueYellowRedFlute(item) == FALSE)
|
||||
if (IsItemFlute(item) == FALSE)
|
||||
{
|
||||
PlaySE(SE_KAIFUKU);
|
||||
if (gUnknown_0203CEC8.unkB != 14)
|
||||
@ -5466,10 +5467,10 @@ void sub_81B67C8(u8 taskId, TaskFunc task)
|
||||
u16 item = gSpecialVar_ItemId;
|
||||
u8 effectType = GetItemEffectType(item);
|
||||
u16 friendship = GetMonData(mon, MON_DATA_FRIENDSHIP);
|
||||
u16 relevantEV = sub_81B691C(mon, effectType);
|
||||
u16 relevantEV = ItemEffectToMonEv(mon, effectType);
|
||||
bool8 cannotUseEffect = ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, item, 0);
|
||||
u16 newFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP);
|
||||
u16 newRelevantEV = sub_81B691C(mon, effectType);
|
||||
u16 newRelevantEV = ItemEffectToMonEv(mon, effectType);
|
||||
|
||||
if (cannotUseEffect || (friendship == newFriendship && relevantEV == newRelevantEV))
|
||||
{
|
||||
@ -5485,7 +5486,7 @@ void sub_81B67C8(u8 taskId, TaskFunc task)
|
||||
PlaySE(SE_KAIFUKU);
|
||||
RemoveBagItem(item, 1);
|
||||
GetMonNickname(mon, gStringVar1);
|
||||
option_menu_get_string(effectType, gStringVar2);
|
||||
ItemEffectToStatString(effectType, gStringVar2);
|
||||
if (friendship != newFriendship)
|
||||
{
|
||||
if (relevantEV != newRelevantEV)
|
||||
@ -5503,48 +5504,48 @@ void sub_81B67C8(u8 taskId, TaskFunc task)
|
||||
}
|
||||
}
|
||||
|
||||
static u16 sub_81B691C(struct Pokemon *mon, u8 effectType)
|
||||
static u16 ItemEffectToMonEv(struct Pokemon *mon, u8 effectType)
|
||||
{
|
||||
switch (effectType)
|
||||
{
|
||||
case 13:
|
||||
case ITEM_EFFECT_HP_EV:
|
||||
if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_SHEDINJA)
|
||||
return GetMonData(mon, MON_DATA_HP_EV);
|
||||
break;
|
||||
case 12:
|
||||
case ITEM_EFFECT_ATK_EV:
|
||||
return GetMonData(mon, MON_DATA_ATK_EV);
|
||||
case 17:
|
||||
case ITEM_EFFECT_DEF_EV:
|
||||
return GetMonData(mon, MON_DATA_DEF_EV);
|
||||
case 16:
|
||||
case ITEM_EFFECT_SPEED_EV:
|
||||
return GetMonData(mon, MON_DATA_SPEED_EV);
|
||||
case 14:
|
||||
case ITEM_EFFECT_SPATK_EV:
|
||||
return GetMonData(mon, MON_DATA_SPATK_EV);
|
||||
case 15:
|
||||
case ITEM_EFFECT_SPDEF_EV:
|
||||
return GetMonData(mon, MON_DATA_SPDEF_EV);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void option_menu_get_string(u8 effectType, u8 *dest)
|
||||
static void ItemEffectToStatString(u8 effectType, u8 *dest)
|
||||
{
|
||||
switch (effectType)
|
||||
{
|
||||
case 13:
|
||||
case ITEM_EFFECT_HP_EV:
|
||||
StringCopy(dest, gText_HP3);
|
||||
break;
|
||||
case 12:
|
||||
case ITEM_EFFECT_ATK_EV:
|
||||
StringCopy(dest, gText_Attack3);
|
||||
break;
|
||||
case 17:
|
||||
case ITEM_EFFECT_DEF_EV:
|
||||
StringCopy(dest, gText_Defense3);
|
||||
break;
|
||||
case 16:
|
||||
case ITEM_EFFECT_SPEED_EV:
|
||||
StringCopy(dest, gText_Speed2);
|
||||
break;
|
||||
case 14:
|
||||
case ITEM_EFFECT_SPATK_EV:
|
||||
StringCopy(dest, gText_SpAtk3);
|
||||
break;
|
||||
case 15:
|
||||
case ITEM_EFFECT_SPDEF_EV:
|
||||
StringCopy(dest, gText_SpDef3);
|
||||
break;
|
||||
}
|
||||
@ -5598,7 +5599,7 @@ void dp05_ether(u8 taskId, TaskFunc task)
|
||||
else
|
||||
effect = gItemEffectTable[item - ITEM_POTION];
|
||||
|
||||
if ((effect[4] & 0x10) == 0)
|
||||
if (!(effect[4] & ITEM4_HEAL_PP_ONE))
|
||||
{
|
||||
gUnknown_0203CEC8.unkE = 0;
|
||||
ether_effect_related(taskId);
|
||||
@ -6221,8 +6222,8 @@ u8 GetItemEffectType(u16 item)
|
||||
const u8 *itemEffect;
|
||||
u32 statusCure;
|
||||
|
||||
if (!IS_POKEMON_ITEM(item))
|
||||
return 22;
|
||||
if (!ITEM_HAS_EFFECT(item))
|
||||
return ITEM_EFFECT_NONE;
|
||||
|
||||
// Read the item's effect properties.
|
||||
if (item == ITEM_ENIGMA_BERRY)
|
||||
@ -6230,58 +6231,58 @@ u8 GetItemEffectType(u16 item)
|
||||
else
|
||||
itemEffect = gItemEffectTable[item - ITEM_POTION];
|
||||
|
||||
if ((itemEffect[0] & 0x3F) || itemEffect[1] || itemEffect[2] || (itemEffect[3] & 0x80))
|
||||
return 0;
|
||||
else if (itemEffect[0] & 0x40)
|
||||
return 10;
|
||||
else if (itemEffect[3] & 0x40)
|
||||
return 1;
|
||||
if ((itemEffect[0] & (ITEM0_HIGH_CRIT | ITEM0_X_ATTACK)) || itemEffect[1] || itemEffect[2] || (itemEffect[3] & ITEM3_MIST))
|
||||
return ITEM_EFFECT_X_ITEM;
|
||||
else if (itemEffect[0] & ITEM0_SACRED_ASH)
|
||||
return ITEM_EFFECT_SACRED_ASH;
|
||||
else if (itemEffect[3] & ITEM3_LEVEL_UP)
|
||||
return ITEM_EFFECT_RAISE_LEVEL;
|
||||
|
||||
statusCure = itemEffect[3] & 0x3F;
|
||||
statusCure = itemEffect[3] & ITEM3_STATUS_ALL;
|
||||
if (statusCure || (itemEffect[0] >> 7))
|
||||
{
|
||||
if (statusCure == 0x20)
|
||||
return 4;
|
||||
else if (statusCure == 0x10)
|
||||
return 3;
|
||||
else if (statusCure == 0x8)
|
||||
return 5;
|
||||
else if (statusCure == 0x4)
|
||||
return 6;
|
||||
else if (statusCure == 0x2)
|
||||
return 7;
|
||||
else if (statusCure == 0x1)
|
||||
return 8;
|
||||
if (statusCure == ITEM3_SLEEP)
|
||||
return ITEM_EFFECT_CURE_SLEEP;
|
||||
else if (statusCure == ITEM3_POISON)
|
||||
return ITEM_EFFECT_CURE_POISON;
|
||||
else if (statusCure == ITEM3_BURN)
|
||||
return ITEM_EFFECT_CURE_BURN;
|
||||
else if (statusCure == ITEM3_FREEZE)
|
||||
return ITEM_EFFECT_CURE_FREEZE;
|
||||
else if (statusCure == ITEM3_PARALYSIS)
|
||||
return ITEM_EFFECT_CURE_PARALYSIS;
|
||||
else if (statusCure == ITEM3_CONFUSION)
|
||||
return ITEM_EFFECT_CURE_CONFUSION;
|
||||
else if (itemEffect[0] >> 7 && !statusCure)
|
||||
return 9;
|
||||
return ITEM_EFFECT_CURE_INFATUATION;
|
||||
else
|
||||
return 11;
|
||||
return ITEM_EFFECT_CURE_ALL_STATUS;
|
||||
}
|
||||
|
||||
if (itemEffect[4] & 0x44)
|
||||
return 2;
|
||||
else if (itemEffect[4] & 0x2)
|
||||
return 12;
|
||||
else if (itemEffect[4] & 0x1)
|
||||
return 13;
|
||||
else if (itemEffect[5] & 0x8)
|
||||
return 14;
|
||||
else if (itemEffect[5] & 0x4)
|
||||
return 15;
|
||||
else if (itemEffect[5] & 0x2)
|
||||
return 16;
|
||||
else if (itemEffect[5] & 0x1)
|
||||
return 17;
|
||||
else if (itemEffect[4] & 0x80)
|
||||
return 18;
|
||||
else if (itemEffect[4] & 0x20)
|
||||
return 19;
|
||||
else if (itemEffect[5] & 0x10)
|
||||
return 20;
|
||||
else if (itemEffect[4] & 0x18)
|
||||
return 21;
|
||||
if (itemEffect[4] & (ITEM4_REVIVE | ITEM4_HEAL_HP))
|
||||
return ITEM_EFFECT_HEAL_HP;
|
||||
else if (itemEffect[4] & ITEM4_EV_ATK)
|
||||
return ITEM_EFFECT_ATK_EV;
|
||||
else if (itemEffect[4] & ITEM4_EV_HP)
|
||||
return ITEM_EFFECT_HP_EV;
|
||||
else if (itemEffect[5] & ITEM5_EV_SPATK)
|
||||
return ITEM_EFFECT_SPATK_EV;
|
||||
else if (itemEffect[5] & ITEM5_EV_SPDEF)
|
||||
return ITEM_EFFECT_SPDEF_EV;
|
||||
else if (itemEffect[5] & ITEM5_EV_SPEED)
|
||||
return ITEM_EFFECT_SPEED_EV;
|
||||
else if (itemEffect[5] & ITEM5_EV_DEF)
|
||||
return ITEM_EFFECT_DEF_EV;
|
||||
else if (itemEffect[4] & ITEM4_EVO_STONE)
|
||||
return ITEM_EFFECT_EVO_STONE;
|
||||
else if (itemEffect[4] & ITEM4_PP_UP)
|
||||
return ITEM_EFFECT_PP_UP;
|
||||
else if (itemEffect[5] & ITEM5_PP_MAX)
|
||||
return ITEM_EFFECT_PP_MAX;
|
||||
else if (itemEffect[4] & (ITEM4_HEAL_PP_ALL | ITEM4_HEAL_PP_ONE))
|
||||
return ITEM_EFFECT_HEAL_PP;
|
||||
else
|
||||
return 22;
|
||||
return ITEM_EFFECT_NONE;
|
||||
}
|
||||
|
||||
static void sub_81B7E4C(u8 taskId)
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "constants/battle_frontier.h"
|
||||
#include "constants/battle_move_effects.h"
|
||||
#include "constants/hold_effects.h"
|
||||
#include "constants/item_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/layouts.h"
|
||||
#include "constants/moves.h"
|
||||
@ -4664,9 +4665,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
battlerId = MAX_BATTLERS_COUNT;
|
||||
}
|
||||
|
||||
if (!IS_POKEMON_ITEM(item))
|
||||
if (!ITEM_HAS_EFFECT(item))
|
||||
return TRUE;
|
||||
if (gItemEffectTable[item - 13] == NULL && item != ITEM_ENIGMA_BERRY)
|
||||
if (gItemEffectTable[item - ITEM_POTION] == NULL && item != ITEM_ENIGMA_BERRY)
|
||||
return TRUE;
|
||||
|
||||
if (item == ITEM_ENIGMA_BERRY)
|
||||
@ -4678,82 +4679,82 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
else
|
||||
{
|
||||
itemEffect = gItemEffectTable[item - 13];
|
||||
itemEffect = gItemEffectTable[item - ITEM_POTION];
|
||||
}
|
||||
|
||||
for (cmdIndex = 0; cmdIndex < 6; cmdIndex++)
|
||||
{
|
||||
switch (cmdIndex)
|
||||
{
|
||||
// status healing effects
|
||||
// infatuation heal, x attack, sacred ash and dire hit
|
||||
case 0:
|
||||
if ((itemEffect[cmdIndex] & 0x80)
|
||||
&& gMain.inBattle && battlerId != 4 && (gBattleMons[battlerId].status2 & STATUS2_INFATUATION))
|
||||
if ((itemEffect[cmdIndex] & ITEM0_INFATUATION)
|
||||
&& gMain.inBattle && battlerId != MAX_BATTLERS_COUNT && (gBattleMons[battlerId].status2 & STATUS2_INFATUATION))
|
||||
{
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_INFATUATION;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0x30)
|
||||
if ((itemEffect[cmdIndex] & ITEM0_HIGH_CRIT)
|
||||
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_FOCUS_ENERGY))
|
||||
{
|
||||
gBattleMons[gActiveBattler].status2 |= STATUS2_FOCUS_ENERGY;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
if ((itemEffect[cmdIndex] & ITEM0_X_ATTACK)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[cmdIndex] & 0xF;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[cmdIndex] & ITEM0_X_ATTACK;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ATK] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
// in-battle stat boosting effects?
|
||||
// in-battle stat boosting effects
|
||||
case 1:
|
||||
if ((itemEffect[cmdIndex] & 0xF0)
|
||||
if ((itemEffect[cmdIndex] & ITEM1_X_DEFEND)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[cmdIndex] & 0xF0) >> 4;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[cmdIndex] & ITEM1_X_DEFEND) >> 4;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_DEF] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
if ((itemEffect[cmdIndex] & ITEM1_X_SPEED)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[cmdIndex] & 0xF;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[cmdIndex] & ITEM1_X_SPEED;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPEED] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
// more stat boosting effects?
|
||||
// more stat boosting effects
|
||||
case 2:
|
||||
if ((itemEffect[cmdIndex] & 0xF0)
|
||||
if ((itemEffect[cmdIndex] & ITEM2_X_ACCURACY)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[cmdIndex] & 0xF0) >> 4;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[cmdIndex] & ITEM2_X_ACCURACY) >> 4;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ACC] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
if ((itemEffect[cmdIndex] & ITEM2_X_SPATK)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[cmdIndex] & 0xF;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[cmdIndex] & ITEM2_X_SPATK;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPATK] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ((itemEffect[cmdIndex] & 0x80)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_MIST)
|
||||
&& gSideTimers[GetBattlerSide(gActiveBattler)].mistTimer == 0)
|
||||
{
|
||||
gSideTimers[GetBattlerSide(gActiveBattler)].mistTimer = 5;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0x40) // raise level
|
||||
if ((itemEffect[cmdIndex] & ITEM3_LEVEL_UP)
|
||||
&& GetMonData(mon, MON_DATA_LEVEL, NULL) != MAX_LEVEL)
|
||||
{
|
||||
dataUnsigned = gExperienceTables[gBaseStats[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][GetMonData(mon, MON_DATA_LEVEL, NULL) + 1];
|
||||
@ -4761,23 +4762,23 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
CalculateMonStats(mon);
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0x20)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_SLEEP)
|
||||
&& HealStatusConditions(mon, partyIndex, 7, battlerId) == 0)
|
||||
{
|
||||
if (battlerId != 4)
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0x10) && HealStatusConditions(mon, partyIndex, STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER, battlerId) == 0)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_POISON) && HealStatusConditions(mon, partyIndex, STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER, battlerId) == 0)
|
||||
retVal = FALSE;
|
||||
if ((itemEffect[cmdIndex] & 8) && HealStatusConditions(mon, partyIndex, STATUS1_BURN, battlerId) == 0)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_BURN) && HealStatusConditions(mon, partyIndex, STATUS1_BURN, battlerId) == 0)
|
||||
retVal = FALSE;
|
||||
if ((itemEffect[cmdIndex] & 4) && HealStatusConditions(mon, partyIndex, STATUS1_FREEZE, battlerId) == 0)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_FREEZE) && HealStatusConditions(mon, partyIndex, STATUS1_FREEZE, battlerId) == 0)
|
||||
retVal = FALSE;
|
||||
if ((itemEffect[cmdIndex] & 2) && HealStatusConditions(mon, partyIndex, STATUS1_PARALYSIS, battlerId) == 0)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_PARALYSIS) && HealStatusConditions(mon, partyIndex, STATUS1_PARALYSIS, battlerId) == 0)
|
||||
retVal = FALSE;
|
||||
if ((itemEffect[cmdIndex] & 1) // heal confusion
|
||||
&& gMain.inBattle && battlerId != 4 && (gBattleMons[battlerId].status2 & STATUS2_CONFUSION))
|
||||
if ((itemEffect[cmdIndex] & ITEM3_CONFUSION) // heal confusion
|
||||
&& gMain.inBattle && battlerId != MAX_BATTLERS_COUNT && (gBattleMons[battlerId].status2 & STATUS2_CONFUSION))
|
||||
{
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION;
|
||||
retVal = FALSE;
|
||||
@ -4786,9 +4787,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
// EV, HP, and PP raising effects
|
||||
case 4:
|
||||
r10 = itemEffect[cmdIndex];
|
||||
if (r10 & 0x20)
|
||||
if (r10 & ITEM4_PP_UP)
|
||||
{
|
||||
r10 &= ~0x20;
|
||||
r10 &= ~ITEM4_PP_UP;
|
||||
dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
|
||||
var_38 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
|
||||
if (dataUnsigned <= 2 && var_38 > 4)
|
||||
@ -4811,6 +4812,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
// ev raise
|
||||
evCount = GetMonEVCount(mon);
|
||||
r5 = itemEffect[var_3C];
|
||||
dataSigned = GetMonData(mon, sGetMonDataEVConstants[var_38], NULL);
|
||||
@ -4849,7 +4851,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
retVal = FALSE;
|
||||
break;
|
||||
case 2:
|
||||
// revive?
|
||||
// revive
|
||||
if (r10 & 0x10)
|
||||
{
|
||||
if (GetMonData(mon, MON_DATA_HP, NULL) != 0)
|
||||
@ -4930,6 +4932,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
r10 &= 0xEF;
|
||||
break;
|
||||
case 3:
|
||||
// Heal pp in all moves.
|
||||
if (!(r10 & 2))
|
||||
{
|
||||
for (r5 = 0; (signed)(r5) < (signed)(4); r5++)
|
||||
@ -4949,7 +4952,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
SetMonData(mon, MON_DATA_PP1 + r5, &dataUnsigned);
|
||||
if (gMain.inBattle
|
||||
&& battlerId != 4 && !(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED)
|
||||
&& battlerId != MAX_BATTLERS_COUNT && !(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED)
|
||||
&& !(gDisableStructs[battlerId].mimickedMoves & gBitTable[r5]))
|
||||
gBattleMons[battlerId].pp[r5] = dataUnsigned;
|
||||
retVal = FALSE;
|
||||
@ -4957,6 +4960,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
var_3C++;
|
||||
}
|
||||
// Heal pp in one move.
|
||||
else
|
||||
{
|
||||
u16 moveId;
|
||||
@ -4981,6 +4985,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Evolution stone
|
||||
case 7:
|
||||
{
|
||||
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 2, item);
|
||||
@ -4998,6 +5003,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
r10 >>= 1;
|
||||
}
|
||||
break;
|
||||
// EV and friendship
|
||||
case 5:
|
||||
r10 = itemEffect[cmdIndex];
|
||||
var_38 = 0;
|
||||
@ -5180,7 +5186,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit)
|
||||
|
||||
offset = 6;
|
||||
|
||||
temp = gItemEffectTable[itemId - 13];
|
||||
temp = gItemEffectTable[itemId - ITEM_POTION];
|
||||
|
||||
if (!temp && itemId != ITEM_ENIGMA_BERRY)
|
||||
return 0;
|
||||
@ -5205,8 +5211,8 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit)
|
||||
break;
|
||||
case 4:
|
||||
val = itemEffect[4];
|
||||
if (val & 0x20)
|
||||
val &= 0xDF;
|
||||
if (val & ITEM4_PP_UP)
|
||||
val &= ~(ITEM4_PP_UP);
|
||||
j = 0;
|
||||
while (val)
|
||||
{
|
||||
@ -5304,7 +5310,7 @@ u8 *sub_806CF78(u16 itemId)
|
||||
}
|
||||
else
|
||||
{
|
||||
itemEffect = gItemEffectTable[itemId - 13];
|
||||
itemEffect = gItemEffectTable[itemId - ITEM_POTION];
|
||||
}
|
||||
|
||||
gPotentialItemEffectBattler = gBattlerInMenuId;
|
||||
@ -5327,7 +5333,7 @@ u8 *sub_806CF78(u16 itemId)
|
||||
}
|
||||
}
|
||||
|
||||
if (itemEffect[3] & 0x80)
|
||||
if (itemEffect[3] & ITEM3_MIST)
|
||||
{
|
||||
gBattlerAttacker = gBattlerInMenuId;
|
||||
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnShroudedInMist);
|
||||
|
Loading…
Reference in New Issue
Block a user