mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-03-08 08:27:52 +01:00
Adds define B_RESTORE_HELD_BATTLE_ITEMS
following Gen9 (#2932)
This commit is contained in:
commit
594bc831d6
@ -517,7 +517,7 @@ struct ZMoveData
|
|||||||
u8 splits[MAX_BATTLERS_COUNT];
|
u8 splits[MAX_BATTLERS_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StolenItem
|
struct LostItem
|
||||||
{
|
{
|
||||||
u16 originalItem:15;
|
u16 originalItem:15;
|
||||||
u16 stolen:1;
|
u16 stolen:1;
|
||||||
@ -640,7 +640,7 @@ struct BattleStruct
|
|||||||
u16 moveEffect2; // For Knock Off
|
u16 moveEffect2; // For Knock Off
|
||||||
u16 changedSpecies[PARTY_SIZE]; // For Zygarde or future forms when multiple mons can change into the same pokemon.
|
u16 changedSpecies[PARTY_SIZE]; // For Zygarde or future forms when multiple mons can change into the same pokemon.
|
||||||
u8 quickClawBattlerId;
|
u8 quickClawBattlerId;
|
||||||
struct StolenItem itemStolen[PARTY_SIZE]; // Player's team that had items stolen (two bytes per party member)
|
struct LostItem itemLost[PARTY_SIZE]; // Player's team that had items consumed or stolen (two bytes per party member)
|
||||||
u8 blunderPolicy:1; // should blunder policy activate
|
u8 blunderPolicy:1; // should blunder policy activate
|
||||||
u8 swapDamageCategory:1; // Photon Geyser, Shell Side Arm, Light That Burns the Sky
|
u8 swapDamageCategory:1; // Photon Geyser, Shell Side Arm, Light That Burns the Sky
|
||||||
u8 forcedSwitch:4; // For each battler
|
u8 forcedSwitch:4; // For each battler
|
||||||
|
@ -197,7 +197,7 @@ bool32 IsPartnerMonFromSameTrainer(u8 battlerId);
|
|||||||
u8 GetSplitBasedOnStats(u8 battlerId);
|
u8 GetSplitBasedOnStats(u8 battlerId);
|
||||||
void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast);
|
void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast);
|
||||||
bool32 TestSheerForceFlag(u8 battler, u16 move);
|
bool32 TestSheerForceFlag(u8 battler, u16 move);
|
||||||
void TryRestoreStolenItems(void);
|
void TryRestoreHeldItems(void);
|
||||||
bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item);
|
bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item);
|
||||||
void TrySaveExchangedItem(u8 battlerId, u16 stolenItem);
|
void TrySaveExchangedItem(u8 battlerId, u16 stolenItem);
|
||||||
bool32 IsPartnerMonFromSameTrainer(u8 battlerId);
|
bool32 IsPartnerMonFromSameTrainer(u8 battlerId);
|
||||||
|
@ -126,6 +126,7 @@
|
|||||||
#define B_X_ITEMS_BUFF GEN_LATEST // In Gen7+, the X Items raise a stat by 2 stages instead of 1.
|
#define B_X_ITEMS_BUFF GEN_LATEST // In Gen7+, the X Items raise a stat by 2 stages instead of 1.
|
||||||
#define B_MENTAL_HERB GEN_LATEST // In Gen5+, the Mental Herb cures Taunt, Encore, Torment, Heal Block, and Disable in addition to Infatuation from before.
|
#define B_MENTAL_HERB GEN_LATEST // In Gen5+, the Mental Herb cures Taunt, Encore, Torment, Heal Block, and Disable in addition to Infatuation from before.
|
||||||
#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items.
|
#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items.
|
||||||
|
#define B_RESTORE_HELD_BATTLE_ITEMS TRUE // In Gen9 all non berry items are restored after battle.
|
||||||
#define B_SOUL_DEW_BOOST GEN_LATEST // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead.
|
#define B_SOUL_DEW_BOOST GEN_LATEST // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead.
|
||||||
#define B_NET_BALL_MODIFIER GEN_LATEST // In Gen7+, Net Ball's catch multiplier is x5 instead of x3.
|
#define B_NET_BALL_MODIFIER GEN_LATEST // In Gen7+, Net Ball's catch multiplier is x5 instead of x3.
|
||||||
#define B_DIVE_BALL_MODIFIER GEN_LATEST // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing.
|
#define B_DIVE_BALL_MODIFIER GEN_LATEST // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing.
|
||||||
|
@ -3190,7 +3190,7 @@ static void BattleStartClearSetData(void)
|
|||||||
{
|
{
|
||||||
gBattleStruct->usedHeldItems[i][B_SIDE_PLAYER] = 0;
|
gBattleStruct->usedHeldItems[i][B_SIDE_PLAYER] = 0;
|
||||||
gBattleStruct->usedHeldItems[i][B_SIDE_OPPONENT] = 0;
|
gBattleStruct->usedHeldItems[i][B_SIDE_OPPONENT] = 0;
|
||||||
gBattleStruct->itemStolen[i].originalItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
|
gBattleStruct->itemLost[i].originalItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
|
||||||
gPartyCriticalHits[i] = 0;
|
gPartyCriticalHits[i] = 0;
|
||||||
gBattleStruct->allowedToChangeFormInWeather[i][B_SIDE_PLAYER] = FALSE;
|
gBattleStruct->allowedToChangeFormInWeather[i][B_SIDE_PLAYER] = FALSE;
|
||||||
gBattleStruct->allowedToChangeFormInWeather[i][B_SIDE_OPPONENT] = FALSE;
|
gBattleStruct->allowedToChangeFormInWeather[i][B_SIDE_OPPONENT] = FALSE;
|
||||||
@ -5388,9 +5388,9 @@ static void HandleEndTurn_FinishBattle(void)
|
|||||||
TestRunner_Battle_AfterLastTurn();
|
TestRunner_Battle_AfterLastTurn();
|
||||||
BeginFastPaletteFade(3);
|
BeginFastPaletteFade(3);
|
||||||
FadeOutMapMusic(5);
|
FadeOutMapMusic(5);
|
||||||
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
|
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE || B_RESTORE_HELD_BATTLE_ITEMS == TRUE
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||||
TryRestoreStolenItems();
|
TryRestoreHeldItems();
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
|
@ -7892,7 +7892,7 @@ static void BestowItem(u32 battlerAtk, u32 battlerDef)
|
|||||||
// Called by Cmd_removeitem. itemId represents the item that was removed, not being given.
|
// Called by Cmd_removeitem. itemId represents the item that was removed, not being given.
|
||||||
static bool32 TrySymbiosis(u32 battler, u32 itemId)
|
static bool32 TrySymbiosis(u32 battler, u32 itemId)
|
||||||
{
|
{
|
||||||
if (!gBattleStruct->itemStolen[gBattlerPartyIndexes[battler]].stolen
|
if (!gBattleStruct->itemLost[gBattlerPartyIndexes[battler]].stolen
|
||||||
&& gBattleStruct->changedItems[battler] == ITEM_NONE
|
&& gBattleStruct->changedItems[battler] == ITEM_NONE
|
||||||
&& GetBattlerHoldEffect(battler, TRUE) != HOLD_EFFECT_EJECT_BUTTON
|
&& GetBattlerHoldEffect(battler, TRUE) != HOLD_EFFECT_EJECT_BUTTON
|
||||||
&& GetBattlerHoldEffect(battler, TRUE) != HOLD_EFFECT_EJECT_PACK
|
&& GetBattlerHoldEffect(battler, TRUE) != HOLD_EFFECT_EJECT_PACK
|
||||||
@ -11264,7 +11264,7 @@ static void Cmd_various(void)
|
|||||||
|
|
||||||
// Open party menu, wait to go to next instruction.
|
// Open party menu, wait to go to next instruction.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CHOOSE_FAINTED_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gBattlerAttacker]);
|
BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CHOOSE_FAINTED_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gBattlerAttacker]);
|
||||||
MarkBattlerForControllerExec(gBattlerAttacker);
|
MarkBattlerForControllerExec(gBattlerAttacker);
|
||||||
}
|
}
|
||||||
@ -16469,7 +16469,7 @@ void BS_ItemRestoreHP(void) {
|
|||||||
}
|
}
|
||||||
if (hp + healAmount > maxHP)
|
if (hp + healAmount > maxHP)
|
||||||
healAmount = maxHP - hp;
|
healAmount = maxHP - hp;
|
||||||
|
|
||||||
// Heal is applied as move damage if battler is active.
|
// Heal is applied as move damage if battler is active.
|
||||||
if (battlerId != MAX_BATTLERS_COUNT && hp != 0)
|
if (battlerId != MAX_BATTLERS_COUNT && hp != 0)
|
||||||
{
|
{
|
||||||
@ -16494,10 +16494,10 @@ void BS_ItemRestoreHP(void) {
|
|||||||
void BS_ItemCureStatus(void) {
|
void BS_ItemCureStatus(void) {
|
||||||
NATIVE_ARGS();
|
NATIVE_ARGS();
|
||||||
struct Pokemon *party = (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
struct Pokemon *party = (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
||||||
|
|
||||||
// Heal Status1 conditions.
|
// Heal Status1 conditions.
|
||||||
HealStatusConditions(&party[gBattleStruct->itemPartyIndex[gBattlerAttacker]], gBattleStruct->itemPartyIndex[gBattlerAttacker], GetItemStatus1Mask(gLastUsedItem), gBattlerAttacker);
|
HealStatusConditions(&party[gBattleStruct->itemPartyIndex[gBattlerAttacker]], gBattleStruct->itemPartyIndex[gBattlerAttacker], GetItemStatus1Mask(gLastUsedItem), gBattlerAttacker);
|
||||||
|
|
||||||
// Heal Status2 conditions if battler is active.
|
// Heal Status2 conditions if battler is active.
|
||||||
if (gBattleStruct->itemPartyIndex[gBattlerAttacker] == gBattlerPartyIndexes[gBattlerAttacker])
|
if (gBattleStruct->itemPartyIndex[gBattlerAttacker] == gBattlerPartyIndexes[gBattlerAttacker])
|
||||||
{
|
{
|
||||||
@ -16506,10 +16506,10 @@ void BS_ItemCureStatus(void) {
|
|||||||
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
|
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
|
||||||
&& gBattleStruct->itemPartyIndex[gBattlerAttacker] == gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerAttacker)])
|
&& gBattleStruct->itemPartyIndex[gBattlerAttacker] == gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerAttacker)])
|
||||||
{
|
{
|
||||||
gBattleMons[gBattlerAttacker].status2 &= ~GetItemStatus2Mask(gLastUsedItem);
|
gBattleMons[gBattlerAttacker].status2 &= ~GetItemStatus2Mask(gLastUsedItem);
|
||||||
gBattlerTarget = BATTLE_PARTNER(gBattlerAttacker);
|
gBattlerTarget = BATTLE_PARTNER(gBattlerAttacker);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetItemStatus1Mask(gLastUsedItem) & STATUS1_SLEEP)
|
if (GetItemStatus1Mask(gLastUsedItem) & STATUS1_SLEEP)
|
||||||
gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE;
|
gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE;
|
||||||
|
|
||||||
|
@ -10536,18 +10536,20 @@ void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TryRestoreStolenItems(void)
|
void TryRestoreHeldItems(void)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
u16 stolenItem = ITEM_NONE;
|
u16 lostItem = ITEM_NONE;
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (gBattleStruct->itemStolen[i].stolen)
|
#if B_RESTORE_HELD_BATTLE_ITEMS == FALSE
|
||||||
|
if (gBattleStruct->itemLost[i].stolen)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
stolenItem = gBattleStruct->itemStolen[i].originalItem;
|
lostItem = gBattleStruct->itemLost[i].originalItem;
|
||||||
if (stolenItem != ITEM_NONE && ItemId_GetPocket(stolenItem) != POCKET_BERRIES)
|
if (lostItem != ITEM_NONE && ItemId_GetPocket(lostItem) != POCKET_BERRIES)
|
||||||
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &stolenItem); // Restore stolen non-berry items
|
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &lostItem); // Restore stolen non-berry items
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10601,8 +10603,8 @@ void TrySaveExchangedItem(u8 battlerId, u16 stolenItem)
|
|||||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
|
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
|
||||||
&& !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
|
&& !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
|
||||||
&& GetBattlerSide(battlerId) == B_SIDE_PLAYER
|
&& GetBattlerSide(battlerId) == B_SIDE_PLAYER
|
||||||
&& stolenItem == gBattleStruct->itemStolen[gBattlerPartyIndexes[battlerId]].originalItem)
|
&& stolenItem == gBattleStruct->itemLost[gBattlerPartyIndexes[battlerId]].originalItem)
|
||||||
gBattleStruct->itemStolen[gBattlerPartyIndexes[battlerId]].stolen = TRUE;
|
gBattleStruct->itemLost[gBattlerPartyIndexes[battlerId]].stolen = TRUE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user