Skip to content

Commit

Permalink
Merge pull request #6785 from LandSandBoat/core/items
Browse files Browse the repository at this point in the history
[core] Use enum instead of defines for Item IDs
  • Loading branch information
claywar authored Jan 22, 2025
2 parents 2c9e50e + b8a73b3 commit 57adb6f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 51 deletions.
54 changes: 28 additions & 26 deletions src/map/items.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
#ifndef _ITEMS_H
#define _ITEMS_H

// Add items as needed, with 14K items in the database this
// file would be huge if we put all of them in here.
// Only add items as utilized in core. There is no need to maintain a complete list
// here.

// Ninja tools
#define ITEM_UCHITAKE (1161)
#define ITEM_TSURARA (1164)
#define ITEM_KAWAHORI_OGI (1167)
#define ITEM_MAKIBISHI (1170)
#define ITEM_HIRAISHIN (1173)
#define ITEM_MIZU_DEPPO (1176)
#define ITEM_RYUNO (2644)
#define ITEM_MOKUJIN (2970)
#define ITEM_SANJAKU_TENUGUI (2553)
#define ITEM_KABENRO (2642)
#define ITEM_SHINOBI_TABI (1194)
#define ITEM_SHIHEI (1179)
#define ITEM_SOSHI (2555)
#define ITEM_KODOKU (1191)
#define ITEM_KAGINAWA (1185)
#define ITEM_JUSATSU (1182)
#define ITEM_SAIRUI_RAN (1188)
#define ITEM_JINKO (2643)
#define ITEM_INOSHISHINOFUDA (2971)
#define ITEM_SHIKANOFUDA (2972)
#define ITEM_CHONOFUDA (2973)
#define ITEM_RANKA (8803)
#define ITEM_FURUSUMI (8804)
enum ITEMID : uint16
{
UCHITAKE = 1161,
TSURARA = 1164,
KAWAHORI_OGI = 1167,
MAKIBISHI = 1170,
HIRAISHIN = 1173,
MIZU_DEPPO = 1176,
RYUNO = 2644,
MOKUJIN = 2970,
SANJAKU_TENUGUI = 2553,
KABENRO = 2642,
SHINOBI_TABI = 1194,
SHIHEI = 1179,
SOSHI = 2555,
KODOKU = 1191,
KAGINAWA = 1185,
JUSATSU = 1182,
SAIRUI_RAN = 1188,
JINKO = 2643,
INOSHISHINOFUDA = 2971,
SHIKANOFUDA = 2972,
CHONOFUDA = 2973,
RANKA = 8803,
FURUSUMI = 8804,
};

#endif
50 changes: 25 additions & 25 deletions src/map/utils/battleutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4138,34 +4138,34 @@ namespace battleutils
{
switch (toolID)
{
case ITEM_UCHITAKE:
case ITEM_TSURARA:
case ITEM_KAWAHORI_OGI:
case ITEM_MAKIBISHI:
case ITEM_HIRAISHIN:
case ITEM_MIZU_DEPPO:
toolID = ITEM_INOSHISHINOFUDA;
case ITEMID::UCHITAKE:
case ITEMID::TSURARA:
case ITEMID::KAWAHORI_OGI:
case ITEMID::MAKIBISHI:
case ITEMID::HIRAISHIN:
case ITEMID::MIZU_DEPPO:
toolID = ITEMID::INOSHISHINOFUDA;
break;

case ITEM_RYUNO:
case ITEM_MOKUJIN:
case ITEM_SANJAKU_TENUGUI:
case ITEM_KABENRO:
case ITEM_SHINOBI_TABI:
case ITEM_SHIHEI:
case ITEM_RANKA:
case ITEM_FURUSUMI:
case ITEMID::RYUNO:
case ITEMID::MOKUJIN:
case ITEMID::SANJAKU_TENUGUI:
case ITEMID::KABENRO:
case ITEMID::SHINOBI_TABI:
case ITEMID::SHIHEI:
case ITEMID::RANKA:
case ITEMID::FURUSUMI:

toolID = ITEM_SHIKANOFUDA;
toolID = ITEMID::SHIKANOFUDA;
break;

case ITEM_SOSHI:
case ITEM_KODOKU:
case ITEM_KAGINAWA:
case ITEM_JUSATSU:
case ITEM_SAIRUI_RAN:
case ITEM_JINKO:
toolID = ITEM_CHONOFUDA;
case ITEMID::SOSHI:
case ITEMID::KODOKU:
case ITEMID::KAGINAWA:
case ITEMID::JUSATSU:
case ITEMID::SAIRUI_RAN:
case ITEMID::JINKO:
toolID = ITEMID::CHONOFUDA;
break;

default:
Expand All @@ -4187,8 +4187,8 @@ namespace battleutils
// Check For Futae Effect
bool hasFutae = PChar->StatusEffectContainer->HasStatusEffect(EFFECT_FUTAE);
// Futae only applies to Elemental Wheel Tools
bool useFutae = (toolID == ITEM_UCHITAKE || toolID == ITEM_TSURARA || toolID == ITEM_KAWAHORI_OGI || toolID == ITEM_MAKIBISHI ||
toolID == ITEM_HIRAISHIN || toolID == ITEM_MIZU_DEPPO);
bool useFutae = (toolID == ITEMID::UCHITAKE || toolID == ITEMID::TSURARA || toolID == ITEMID::KAWAHORI_OGI || toolID == ITEMID::MAKIBISHI ||
toolID == ITEMID::HIRAISHIN || toolID == ITEMID::MIZU_DEPPO);

// If you have Futae active, Ninja Tool Expertise does not apply.
if (ConsumeTool && hasFutae && useFutae)
Expand Down

0 comments on commit 57adb6f

Please sign in to comment.