mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-28 04:34:28 +01:00
Add held effect debug override
This commit is contained in:
parent
93e86e6a76
commit
31222ef64b
@ -514,6 +514,7 @@ struct BattleStruct
|
||||
u8 ateBerry[2]; // array id determined by side, each party pokemon as bit
|
||||
u8 stolenStats[NUM_BATTLE_STATS]; // hp byte is used for which stats to raise, other inform about by how many stages
|
||||
u8 lastMoveFailed; // as bits for each battler, for the sake of Stomping Tantrum
|
||||
u8 debugHoldEffects[MAX_BATTLERS_COUNT]; // These override actual items' hold effects.
|
||||
};
|
||||
|
||||
#define GET_MOVE_TYPE(move, typeArg) \
|
||||
|
@ -113,6 +113,7 @@ enum
|
||||
VAR_IN_LOVE,
|
||||
VAR_U16_4_ENTRIES,
|
||||
VAL_S8,
|
||||
VAL_ITEM,
|
||||
};
|
||||
|
||||
enum
|
||||
@ -210,6 +211,7 @@ static const u8 sText_HpAware[] = _("HP aware");
|
||||
static const u8 sText_Unknown[] = _("Unknown");
|
||||
static const u8 sText_InLove[] = _("In Love");
|
||||
static const u8 sText_AIMovePts[] = _("AI Move Pts");
|
||||
static const u8 sText_EffectOverride[] = _("Effect Override");
|
||||
|
||||
static const u8 sText_EmptyString[] = _("");
|
||||
|
||||
@ -856,7 +858,7 @@ static void CreateSecondaryListMenu(struct BattleDebugMenu *data)
|
||||
{
|
||||
case LIST_ITEM_ABILITY:
|
||||
case LIST_ITEM_HELD_ITEM:
|
||||
itemsCount = 1;
|
||||
itemsCount = 2;
|
||||
break;
|
||||
case LIST_ITEM_TYPES:
|
||||
itemsCount = 3;
|
||||
@ -990,6 +992,11 @@ static void PrintSecondaryEntries(struct BattleDebugMenu *data)
|
||||
PadString(ItemId_GetName(gBattleMons[data->battlerId].item), text);
|
||||
printer.currentY = printer.y = sSecondaryListTemplate.upText_Y;
|
||||
AddTextPrinter(&printer, 0, NULL);
|
||||
|
||||
PadString(sText_EffectOverride, text);
|
||||
printer.fontId = 0;
|
||||
printer.currentY = printer.y = sSecondaryListTemplate.upText_Y + yMultiplier;
|
||||
AddTextPrinter(&printer, 0, NULL);
|
||||
break;
|
||||
case LIST_ITEM_TYPES:
|
||||
for (i = 0; i < 3; i++)
|
||||
@ -1122,6 +1129,12 @@ static void UpdateBattlerValue(struct BattleDebugMenu *data)
|
||||
gBattleMons[data->battlerId].status2 &= ~(STATUS2_INFATUATION);
|
||||
}
|
||||
break;
|
||||
case VAL_ITEM:
|
||||
if (data->currentSecondaryListItemId == 0)
|
||||
*(u16*)(data->modifyArrows.modifiedValPtr) = data->modifyArrows.currValue;
|
||||
else if (data->currentSecondaryListItemId == 1)
|
||||
gBattleStruct->debugHoldEffects[data->battlerId] = data->modifyArrows.currValue;
|
||||
break;
|
||||
}
|
||||
data->battlerWasChanged[data->battlerId] = TRUE;
|
||||
}
|
||||
@ -1338,8 +1351,11 @@ static void SetUpModifyArrows(struct BattleDebugMenu *data)
|
||||
data->modifyArrows.maxValue = ITEMS_COUNT - 1;
|
||||
data->modifyArrows.maxDigits = 3;
|
||||
data->modifyArrows.modifiedValPtr = &gBattleMons[data->battlerId].item;
|
||||
data->modifyArrows.typeOfVal = VAL_U16;
|
||||
data->modifyArrows.currValue = gBattleMons[data->battlerId].item;
|
||||
data->modifyArrows.typeOfVal = VAL_ITEM;
|
||||
if (data->currentSecondaryListItemId == 0)
|
||||
data->modifyArrows.currValue = gBattleMons[data->battlerId].item;
|
||||
else
|
||||
data->modifyArrows.currValue = gBattleStruct->debugHoldEffects[data->battlerId];
|
||||
break;
|
||||
case LIST_ITEM_TYPES:
|
||||
data->modifyArrows.minValue = 0;
|
||||
|
@ -4566,7 +4566,9 @@ u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating)
|
||||
|
||||
gPotentialItemEffectBattler = battlerId;
|
||||
|
||||
if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY)
|
||||
if (USE_BATTLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId] != 0)
|
||||
return gBattleStruct->debugHoldEffects[battlerId];
|
||||
else if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY)
|
||||
return gEnigmaBerries[battlerId].holdEffect;
|
||||
else
|
||||
return ItemId_GetHoldEffect(gBattleMons[battlerId].item);
|
||||
|
Loading…
Reference in New Issue
Block a user