From a044774896e46391a8e3afad7efab927749e93b3 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 24 Jan 2023 16:47:54 -0300 Subject: [PATCH] Added Gen9 item data and fixed Punching Glove's effect --- include/constants/items.h | 8 +++- src/battle_util.c | 10 ++--- src/data/graphics/items.h | 15 +++++++ src/data/item_icon_table.h | 5 +++ src/data/items.h | 66 +++++++++++++++++++++++++++++++ src/data/text/item_descriptions.h | 25 ++++++++++++ 6 files changed, 122 insertions(+), 7 deletions(-) diff --git a/include/constants/items.h b/include/constants/items.h index 9f931686e..1cb2803f3 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -928,7 +928,13 @@ #define ITEM_RUBY 756 #define ITEM_SAPPHIRE 757 -#define ITEMS_COUNT 758 +#define ITEM_ABILITY_SHIELD 758 +#define ITEM_CLEAR_AMULET 759 +#define ITEM_PUNCHING_GLOVE 760 +#define ITEM_COVERT_CLOAK 761 +#define ITEM_LOADED_DICE 762 + +#define ITEMS_COUNT 763 #define ITEM_FIELD_ARROW ITEMS_COUNT // A special item id associated with "Cancel"/"Exit" etc. in a list of items or decorations diff --git a/src/battle_util.c b/src/battle_util.c index a4c6dbedc..4ad22a7a6 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8201,7 +8201,7 @@ u32 GetBattlerHoldEffectParam(u8 battlerId) bool32 IsMoveMakingContact(u16 move, u8 battlerAtk) { u16 atkHoldEffect = GetBattlerHoldEffect(battlerAtk, TRUE); - + if (!(gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) { if (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gBattleStruct->swapDamageCategory) @@ -8209,11 +8209,9 @@ bool32 IsMoveMakingContact(u16 move, u8 battlerAtk) else return FALSE; } - else if (GetBattlerAbility(battlerAtk) == ABILITY_LONG_REACH || atkHoldEffect == HOLD_EFFECT_PUNCHING_GLOVE) - { - return FALSE; - } - else if (atkHoldEffect == HOLD_EFFECT_PROTECTIVE_PADS) + else if ((atkHoldEffect == HOLD_EFFECT_PUNCHING_GLOVE && (gBattleMoves[move].flags & FLAG_IRON_FIST_BOOST)) + || atkHoldEffect == HOLD_EFFECT_PROTECTIVE_PADS + || GetBattlerAbility(battlerAtk) == ABILITY_LONG_REACH) { return FALSE; } diff --git a/src/data/graphics/items.h b/src/data/graphics/items.h index a755c7e6f..35ce13db2 100644 --- a/src/data/graphics/items.h +++ b/src/data/graphics/items.h @@ -1930,3 +1930,18 @@ const u32 gItemIcon_Gem[] = INCBIN_U32("graphics/items/icons/gem.4bpp.lz"); const u32 gItemIconPalette_Ruby[] = INCBIN_U32("graphics/items/icon_palettes/ruby.gbapal.lz"); const u32 gItemIconPalette_Sapphire[] = INCBIN_U32("graphics/items/icon_palettes/sapphire.gbapal.lz"); + +//const u32 gItemIcon_AbilityShield[] = INCBIN_U32("graphics/items/icons/ability_shield.4bpp.lz"); +//const u32 gItemIconPalette_AbilityShield[] = INCBIN_U32("graphics/items/icon_palettes/ability_shield.gbapal.lz"); + +//const u32 gItemIcon_ClearAmulet[] = INCBIN_U32("graphics/items/icons/clear_amulet.4bpp.lz"); +//const u32 gItemIconPalette_ClearAmulet[] = INCBIN_U32("graphics/items/icon_palettes/clear_amulet.gbapal.lz"); + +//const u32 gItemIcon_PunchingGlove[] = INCBIN_U32("graphics/items/icons/punching_glove.4bpp.lz"); +//const u32 gItemIconPalette_PunchingGlove[] = INCBIN_U32("graphics/items/icon_palettes/punching_glove.gbapal.lz"); + +//const u32 gItemIcon_CovertCloak[] = INCBIN_U32("graphics/items/icons/covert_cloak.4bpp.lz"); +//const u32 gItemIconPalette_CovertCloak[] = INCBIN_U32("graphics/items/icon_palettes/covert_cloak.gbapal.lz"); + +//const u32 gItemIcon_LoadedDice[] = INCBIN_U32("graphics/items/icons/loaded_dice.4bpp.lz"); +//const u32 gItemIconPalette_LoadedDice[] = INCBIN_U32("graphics/items/icon_palettes/loaded_dice.gbapal.lz"); diff --git a/src/data/item_icon_table.h b/src/data/item_icon_table.h index 0a95b5dbf..0107b71ab 100644 --- a/src/data/item_icon_table.h +++ b/src/data/item_icon_table.h @@ -803,6 +803,11 @@ const u32 *const gItemIconTable[ITEMS_COUNT + 1][2] = [ITEM_TEA] = {gItemIcon_Tea, gItemIconPalette_Tea}, [ITEM_RUBY] = {gItemIcon_Gem, gItemIconPalette_Ruby}, [ITEM_SAPPHIRE] = {gItemIcon_Gem, gItemIconPalette_Sapphire}, + [ITEM_ABILITY_SHIELD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_AbilityShield, gItemIconPalette_AbilityShield}, + [ITEM_CLEAR_AMULET] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_ClearAmulet, gItemIconPalette_ClearAmulet}, + [ITEM_PUNCHING_GLOVE] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_PunchingGlove, gItemIconPalette_PunchingGlove}, + [ITEM_COVERT_CLOAK] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_CovertCloak, gItemIconPalette_CovertCloak}, + [ITEM_LOADED_DICE] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_LoadedDice, gItemIconPalette_LoadedDice}, // Return to field arrow [ITEMS_COUNT] = {gItemIcon_ReturnToFieldArrow, gItemIconPalette_ReturnToFieldArrow}, }; diff --git a/src/data/items.h b/src/data/items.h index 971428099..63446913e 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -9852,4 +9852,70 @@ const struct Item gItems[] = .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, }, + + [ITEM_ABILITY_SHIELD] = + { + .name = _("AbilityShield"), + .itemId = ITEM_ABILITY_SHIELD, + .price = 20000, + .holdEffect = HOLD_EFFECT_ABILITY_SHIELD, + .description = sAbilityShieldDesc, + .pocket = POCKET_ITEMS, + .type = ITEM_USE_BAG_MENU, + .fieldUseFunc = ItemUseOutOfBattle_CannotUse, + .flingPower = 30, + }, + + [ITEM_CLEAR_AMULET] = + { + .name = _("Clear Amulet"), + .itemId = ITEM_CLEAR_AMULET, + .price = 30000, + .holdEffect = HOLD_EFFECT_CLEAR_AMULET, + .description = sClearAmuletDesc, + .pocket = POCKET_ITEMS, + .type = ITEM_USE_BAG_MENU, + .fieldUseFunc = ItemUseOutOfBattle_CannotUse, + .flingPower = 30, + }, + + [ITEM_PUNCHING_GLOVE] = + { + .name = _("PunchingGlove"), + .itemId = ITEM_PUNCHING_GLOVE, + .price = 15000, + .holdEffect = HOLD_EFFECT_PUNCHING_GLOVE, + .description = sPunchingGloveDesc, + .pocket = POCKET_ITEMS, + .type = ITEM_USE_BAG_MENU, + .fieldUseFunc = ItemUseOutOfBattle_CannotUse, + .flingPower = 30, + }, + + [ITEM_COVERT_CLOAK] = + { + .name = _("Covert Cloak"), + .itemId = ITEM_COVERT_CLOAK, + .price = 20000, + .holdEffect = HOLD_EFFECT_COVERT_CLOAK, + .description = sCovertCloakDesc, + .pocket = POCKET_ITEMS, + .type = ITEM_USE_BAG_MENU, + .fieldUseFunc = ItemUseOutOfBattle_CannotUse, + .flingPower = 30, + }, + + [ITEM_LOADED_DICE] = + { + //YellwApricorn + .name = _("Loaded Dice"), + .itemId = ITEM_LOADED_DICE, + .price = 20000, + .holdEffect = HOLD_EFFECT_LOADED_DICE, + .description = sLoadedDiceDesc, + .pocket = POCKET_ITEMS, + .type = ITEM_USE_BAG_MENU, + .fieldUseFunc = ItemUseOutOfBattle_CannotUse, + .flingPower = 30, + }, }; diff --git a/src/data/text/item_descriptions.h b/src/data/text/item_descriptions.h index 08e5fc846..e815d8ae1 100644 --- a/src/data/text/item_descriptions.h +++ b/src/data/text/item_descriptions.h @@ -3792,3 +3792,28 @@ static const u8 sSapphireDesc[] = _( "A brilliant blue gem\n" "that symbolizes\n" "honesty."); + +static const u8 sAbilityShieldDesc[] = _( + "Ability changes are\n" + "prevented for this\n" + "items's holder."); + +static const u8 sClearAmuletDesc[] = _( + "Stat lowering is\n" + "prevented for this\n" + "items's holder."); + +static const u8 sPunchingGloveDesc[] = _( + "Powers up punching\n" + "moves and removes\n" + "their contact."); + +static const u8 sCovertCloakDesc[] = _( + "Protects the holder\n" + "from secondary\n" + "move effects."); + +static const u8 sLoadedDiceDesc[] = _( + "Rolls high numbers.\n" + "Multihit strikes\n" + "hit more times.");