Merge branch 'master' of https://github.com/pret/pokeemerald into sync-item-expansion

This commit is contained in:
ExpoSeed 2020-10-11 00:07:10 -05:00
commit 8b83d88e75
7 changed files with 45 additions and 38 deletions

View File

@ -178,7 +178,7 @@ mostlyclean: tidy
rm -f $(SAMPLE_SUBDIR)/*.bin rm -f $(SAMPLE_SUBDIR)/*.bin
rm -f $(CRY_SUBDIR)/*.bin rm -f $(CRY_SUBDIR)/*.bin
rm -f $(MID_SUBDIR)/*.s rm -f $(MID_SUBDIR)/*.s
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} + find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc
rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc
find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} + find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} +

View File

@ -493,7 +493,7 @@ struct BattleScripting
u8 field_20; u8 field_20;
u8 reshowMainState; u8 reshowMainState;
u8 reshowHelperState; u8 reshowHelperState;
u8 field_23; u8 levelUpHP;
u8 windowsType; // 0 - normal, 1 - battle arena u8 windowsType; // 0 - normal, 1 - battle arena
u8 multiplayerId; u8 multiplayerId;
u8 specialTrainerBattleType; u8 specialTrainerBattleType;

View File

@ -53,6 +53,11 @@
#define ITEM10_IS_VITAMIN 0x1 #define ITEM10_IS_VITAMIN 0x1
// Special HP recovery amounts for ITEM4_HEAL_HP
#define ITEM6_HEAL_FULL ((u8) -1)
#define ITEM6_HEAL_HALF ((u8) -2)
#define ITEM6_HEAL_LVL_UP ((u8) -3)
// Used for GetItemEffectType. // Used for GetItemEffectType.
#define ITEM_EFFECT_X_ITEM 0 #define ITEM_EFFECT_X_ITEM 0
#define ITEM_EFFECT_RAISE_LEVEL 1 #define ITEM_EFFECT_RAISE_LEVEL 1

View File

@ -241,12 +241,12 @@
#define UNOWN_FORM_COUNT 28 #define UNOWN_FORM_COUNT 28
// Battle move flags // Battle move flags
#define FLAG_MAKES_CONTACT 0x1 #define FLAG_MAKES_CONTACT (1 << 0)
#define FLAG_PROTECT_AFFECTED 0x2 #define FLAG_PROTECT_AFFECTED (1 << 1)
#define FLAG_MAGICCOAT_AFFECTED 0x4 #define FLAG_MAGICCOAT_AFFECTED (1 << 2)
#define FLAG_SNATCH_AFFECTED 0x8 #define FLAG_SNATCH_AFFECTED (1 << 3)
#define FLAG_MIRROR_MOVE_AFFECTED 0x10 #define FLAG_MIRROR_MOVE_AFFECTED (1 << 4)
#define FLAG_KINGSROCK_AFFECTED 0x20 #define FLAG_KINGSROCK_AFFECTED (1 << 5)
// Growth rates // Growth rates
#define GROWTH_MEDIUM_FAST 0 #define GROWTH_MEDIUM_FAST 0
@ -270,22 +270,22 @@
#define F_SUMMARY_SCREEN_FLIP_SPRITE 0x80 #define F_SUMMARY_SCREEN_FLIP_SPRITE 0x80
// Evolution type flags // Evolution types
#define EVO_FRIENDSHIP 0x0001 // Pokémon levels up with friendship ≥ 220 #define EVO_FRIENDSHIP 1 // Pokémon levels up with friendship ≥ 220
#define EVO_FRIENDSHIP_DAY 0x0002 // Pokémon levels up during the day with friendship ≥ 220 #define EVO_FRIENDSHIP_DAY 2 // Pokémon levels up during the day with friendship ≥ 220
#define EVO_FRIENDSHIP_NIGHT 0x0003 // Pokémon levels up at night with friendship ≥ 220 #define EVO_FRIENDSHIP_NIGHT 3 // Pokémon levels up at night with friendship ≥ 220
#define EVO_LEVEL 0x0004 // Pokémon reaches the specified level #define EVO_LEVEL 4 // Pokémon reaches the specified level
#define EVO_TRADE 0x0005 // Pokémon is traded #define EVO_TRADE 5 // Pokémon is traded
#define EVO_TRADE_ITEM 0x0006 // Pokémon is traded while it's holding the specified item #define EVO_TRADE_ITEM 6 // Pokémon is traded while it's holding the specified item
#define EVO_ITEM 0x0007 // specified item is used on Pokémon #define EVO_ITEM 7 // specified item is used on Pokémon
#define EVO_LEVEL_ATK_GT_DEF 0x0008 // Pokémon reaches the specified level with attack > defense #define EVO_LEVEL_ATK_GT_DEF 8 // Pokémon reaches the specified level with attack > defense
#define EVO_LEVEL_ATK_EQ_DEF 0x0009 // Pokémon reaches the specified level with attack = defense #define EVO_LEVEL_ATK_EQ_DEF 9 // Pokémon reaches the specified level with attack = defense
#define EVO_LEVEL_ATK_LT_DEF 0x000a // Pokémon reaches the specified level with attack < defense #define EVO_LEVEL_ATK_LT_DEF 10 // Pokémon reaches the specified level with attack < defense
#define EVO_LEVEL_SILCOON 0x000b // Pokémon reaches the specified level with a Silcoon personality value #define EVO_LEVEL_SILCOON 11 // Pokémon reaches the specified level with a Silcoon personality value
#define EVO_LEVEL_CASCOON 0x000c // Pokémon reaches the specified level with a Cascoon personality value #define EVO_LEVEL_CASCOON 12 // Pokémon reaches the specified level with a Cascoon personality value
#define EVO_LEVEL_NINJASK 0x000d // Pokémon reaches the specified level (special value for Ninjask) #define EVO_LEVEL_NINJASK 13 // Pokémon reaches the specified level (special value for Ninjask)
#define EVO_LEVEL_SHEDINJA 0x000e // Pokémon reaches the specified level (special value for Shedinja) #define EVO_LEVEL_SHEDINJA 14 // Pokémon reaches the specified level (special value for Shedinja)
#define EVO_BEAUTY 0x000f // Pokémon levels up with beauty ≥ specified value #define EVO_BEAUTY 15 // Pokémon levels up with beauty ≥ specified value
#define EVOS_PER_MON 5 #define EVOS_PER_MON 5

View File

@ -26,12 +26,12 @@ const u8 gItemEffect_ParalyzeHeal[6] = {
const u8 gItemEffect_FullRestore[7] = { const u8 gItemEffect_FullRestore[7] = {
[3] = ITEM3_STATUS_ALL, [3] = ITEM3_STATUS_ALL,
[4] = ITEM4_HEAL_HP, [4] = ITEM4_HEAL_HP,
[6] = -1, [6] = ITEM6_HEAL_FULL,
}; };
const u8 gItemEffect_MaxPotion[7] = { const u8 gItemEffect_MaxPotion[7] = {
[4] = ITEM4_HEAL_HP, [4] = ITEM4_HEAL_HP,
[6] = -1, [6] = ITEM6_HEAL_FULL,
}; };
const u8 gItemEffect_HyperPotion[7] = { const u8 gItemEffect_HyperPotion[7] = {
@ -50,12 +50,12 @@ const u8 gItemEffect_FullHeal[6] = {
const u8 gItemEffect_Revive[7] = { const u8 gItemEffect_Revive[7] = {
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP, [4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
[6] = -2, [6] = ITEM6_HEAL_HALF,
}; };
const u8 gItemEffect_MaxRevive[7] = { const u8 gItemEffect_MaxRevive[7] = {
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP, [4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
[6] = -1, [6] = ITEM6_HEAL_FULL,
}; };
const u8 gItemEffect_FreshWater[7] = { const u8 gItemEffect_FreshWater[7] = {
@ -107,7 +107,7 @@ const u8 gItemEffect_HealPowder[9] = {
const u8 gItemEffect_RevivalHerb[10] = { const u8 gItemEffect_RevivalHerb[10] = {
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP, [4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
[5] = ITEM5_FRIENDSHIP_ALL, [5] = ITEM5_FRIENDSHIP_ALL,
[6] = -1, [6] = ITEM6_HEAL_FULL,
[7] = -15, [7] = -15,
[8] = -15, [8] = -15,
[9] = -20, [9] = -20,
@ -170,7 +170,7 @@ const u8 gItemEffect_OldGateau[6] = {
const u8 gItemEffect_SacredAsh[7] = { const u8 gItemEffect_SacredAsh[7] = {
[0] = ITEM0_SACRED_ASH, [0] = ITEM0_SACRED_ASH,
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP, [4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
[6] = -1, [6] = ITEM6_HEAL_FULL,
}; };
const u8 gItemEffect_HPUp[11] = { const u8 gItemEffect_HPUp[11] = {
@ -289,7 +289,7 @@ const u8 gItemEffect_RareCandy[10] = {
[3] = ITEM3_LEVEL_UP, [3] = ITEM3_LEVEL_UP,
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP, [4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
[5] = ITEM5_FRIENDSHIP_ALL, [5] = ITEM5_FRIENDSHIP_ALL,
[6] = 0xFD, [6] = ITEM6_HEAL_LVL_UP,
[7] = 5, [7] = 5,
[8] = 3, [8] = 3,
[9] = 2, [9] = 2,

View File

@ -2847,9 +2847,9 @@ void CalculateMonStats(struct Pokemon *mon)
newMaxHP = (((n + hpEV / 4) * level) / 100) + level + 10; newMaxHP = (((n + hpEV / 4) * level) / 100) + level + 10;
} }
gBattleScripting.field_23 = newMaxHP - oldMaxHP; gBattleScripting.levelUpHP = newMaxHP - oldMaxHP;
if (gBattleScripting.field_23 == 0) if (gBattleScripting.levelUpHP == 0)
gBattleScripting.field_23 = 1; gBattleScripting.levelUpHP = 1;
SetMonData(mon, MON_DATA_MAX_HP, &newMaxHP); SetMonData(mon, MON_DATA_MAX_HP, &newMaxHP);
@ -4929,19 +4929,21 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
break; break;
} }
} }
// Get amount of HP to restore
dataUnsigned = itemEffect[var_3C++]; dataUnsigned = itemEffect[var_3C++];
switch (dataUnsigned) switch (dataUnsigned)
{ {
case 0xFF: case ITEM6_HEAL_FULL:
dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) - GetMonData(mon, MON_DATA_HP, NULL); dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) - GetMonData(mon, MON_DATA_HP, NULL);
break; break;
case 0xFE: case ITEM6_HEAL_HALF:
dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) / 2; dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) / 2;
if (dataUnsigned == 0) if (dataUnsigned == 0)
dataUnsigned = 1; dataUnsigned = 1;
break; break;
case 0xFD: case ITEM6_HEAL_LVL_UP:
dataUnsigned = gBattleScripting.field_23; dataUnsigned = gBattleScripting.levelUpHP;
break; break;
} }
if (GetMonData(mon, MON_DATA_MAX_HP, NULL) != GetMonData(mon, MON_DATA_HP, NULL)) if (GetMonData(mon, MON_DATA_MAX_HP, NULL) != GetMonData(mon, MON_DATA_HP, NULL))