Tweaked preprocessor directives

Changed #ifdef X_ITEMS_REWORK == FALSE to #ifndef ITEM_EXPANSION
Changed #ifdef X_ITEMS_REWORK == TRUE to #ifdef ITEM_EXPANSION
This commit is contained in:
LOuroboros 2021-01-04 03:58:31 -03:00
parent 791d561f14
commit dbc3690282
5 changed files with 10 additions and 11 deletions

View File

@ -123,7 +123,6 @@
// Item settings
#define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn.
#define B_BERRIES_INSTANT GEN_6 // In Gen4+, most berries activate on battle start/switch-in if applicable. In gen3, they only activate either at the move end or turn end.
#define X_ITEMS_REWORK FALSE // This flag changes the way in which X Items' effects are implemented in the code and relies on the item_expansion to work.
#define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1. This flag relies on X_ITEMS_REWORK, and by extension, the item_expansion.
// Flag settings.

View File

@ -2,7 +2,7 @@
#define GUARD_CONSTANTS_ITEM_EFFECTS_H
// field 0 masks
#if X_ITEMS_REWORK == FALSE
#ifndef ITEM_EXPANSION
#define ITEM0_X_ATTACK 0x0F
#endif
#define ITEM0_DIRE_HIT 0x30 // Works the same way as the move Focus Energy.
@ -10,7 +10,7 @@
#define ITEM0_INFATUATION 0x80
// field 1 masks
#if X_ITEMS_REWORK == FALSE
#ifndef ITEM_EXPANSION
#define ITEM1_X_SPEED 0x0F
#define ITEM1_X_DEFEND 0xF0
@ -20,7 +20,7 @@
#endif
// alt field 1 masks
#if X_ITEMS_REWORK == TRUE
#ifdef ITEM_EXPANSION
#define ITEM1_X_ATTACK 0x1
#define ITEM1_X_DEFEND 0x2
#define ITEM1_X_SPEED 0x4

View File

@ -773,7 +773,7 @@ static u8 GetAI_ItemType(u16 itemId, const u8 *itemEffect)
return AI_ITEM_HEAL_HP;
else if (itemEffect[3] & ITEM3_STATUS_ALL)
return AI_ITEM_CURE_CONDITION;
#if X_ITEMS_REWORK == TRUE
#ifdef ITEM_EXPANSION
else if ((itemEffect[0] & ITEM0_DIRE_HIT) || itemEffect[1])
#else
else if (itemEffect[0] & (ITEM0_DIRE_HIT | ITEM0_X_ATTACK) || itemEffect[1] != 0 || itemEffect[2] != 0)
@ -887,7 +887,7 @@ static bool8 ShouldUseItem(void)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) = 0;
if (gDisableStructs[gActiveBattler].isFirstTurn == 0)
break;
#if X_ITEMS_REWORK == FALSE
#ifndef ITEM_EXPANSION
if (itemEffects[0] & ITEM0_X_ATTACK)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1;
if (itemEffects[1] & ITEM1_X_DEFEND)

View File

@ -5186,7 +5186,7 @@ u8 GetItemEffectType(u16 item)
else
itemEffect = gItemEffectTable[item - ITEM_POTION];
#if X_ITEMS_REWORK == FALSE
#ifndef ITEM_EXPANSION
if ((itemEffect[0] & (ITEM0_DIRE_HIT | ITEM0_X_ATTACK)) || itemEffect[1] || itemEffect[2] || (itemEffect[3] & ITEM3_GUARD_SPEC))
#else
if ((itemEffect[0] & ITEM0_DIRE_HIT) || itemEffect[1] || (itemEffect[3] & ITEM3_GUARD_SPEC))

View File

@ -2051,7 +2051,7 @@ static const u8 sGetMonDataEVConstants[] =
// For stat-raising items
static const u8 sStatsToRaise[] =
{
#if X_ITEMS_REWORK == FALSE
#ifndef ITEM_EXPANSION
STAT_ATK, STAT_ATK, STAT_SPEED, STAT_DEF, STAT_SPATK, STAT_ACC
#else
STAT_ATK, STAT_ATK, STAT_DEF, STAT_SPEED, STAT_SPATK, STAT_SPDEF, STAT_ACC
@ -4434,7 +4434,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
gBattleMons[gActiveBattler].status2 |= STATUS2_FOCUS_ENERGY;
retVal = FALSE;
}
#if X_ITEMS_REWORK == FALSE
#ifndef ITEM_EXPANSION
if ((itemEffect[cmdIndex] & ITEM0_X_ATTACK)
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE)
{
@ -4446,7 +4446,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
#endif
break;
// in-battle stat boosting effects
#if X_ITEMS_REWORK == FALSE
#ifndef ITEM_EXPANSION
case 1:
if ((itemEffect[cmdIndex] & ITEM1_X_DEFEND)
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE)
@ -5127,7 +5127,7 @@ u8 *UseStatIncreaseItem(u16 itemId)
gPotentialItemEffectBattler = gBattlerInMenuId;
#if X_ITEMS_REWORK == FALSE
#ifndef ITEM_EXPANSION
for (i = 0; i < 3; i++)
{
if (itemEffect[i] & (ITEM0_X_ATTACK | ITEM1_X_SPEED | ITEM2_X_SPATK))