mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
fixed gems and damage-reducing berries
This commit is contained in:
parent
2ffff788b4
commit
9d222d3ab4
@ -182,6 +182,7 @@
|
||||
#define B_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously.
|
||||
#define B_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned.
|
||||
#define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities.
|
||||
#define B_SYMBIOSIS_GEMS GEN_7 // In Gen 6, Symbiosis passes an item before the gem-boosted attack hits and the item effect applies. In Gen 7+, items are passed after a gem-boosted attack.
|
||||
|
||||
// Item settings
|
||||
#define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.
|
||||
|
@ -311,8 +311,9 @@
|
||||
#define MOVEEND_PICKPOCKET 27
|
||||
#define MOVEEND_DANCER 28
|
||||
#define MOVEEND_EMERGENCY_EXIT 29
|
||||
#define MOVEEND_CLEAR_BITS 30
|
||||
#define MOVEEND_COUNT 31
|
||||
#define MOVEEND_SYMBIOSIS 30
|
||||
#define MOVEEND_CLEAR_BITS 31
|
||||
#define MOVEEND_COUNT 32
|
||||
|
||||
// switch cases
|
||||
#define B_SWITCH_NORMAL 0
|
||||
|
@ -306,6 +306,7 @@ static void PutMonIconOnLvlUpBanner(void);
|
||||
static void DrawLevelUpBannerText(void);
|
||||
static void SpriteCB_MonIconOnLvlUpBanner(struct Sprite* sprite);
|
||||
static bool32 CriticalCapture(u32 odds);
|
||||
static void BestowItem(u32 battlerAtk, u32 battlerDef);
|
||||
|
||||
static void Cmd_attackcanceler(void);
|
||||
static void Cmd_accuracycheck(void);
|
||||
@ -4967,6 +4968,15 @@ static bool32 TryKnockOffBattleScript(u32 battlerDef)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define SYMBIOSIS_CHECK(battler, ally) \
|
||||
GetBattlerAbility(ally) == ABILITY_SYMBIOSIS \
|
||||
&& gBattleMons[battler].item == ITEM_NONE \
|
||||
&& gBattleMons[ally].item != ITEM_NONE \
|
||||
&& CanBattlerGetOrLoseItem(battler, gBattleMons[ally].item) \
|
||||
&& CanBattlerGetOrLoseItem(ally, gBattleMons[ally].item) \
|
||||
&& gBattleMons[battler].hp != 0 \
|
||||
&& gBattleMons[ally].hp != 0
|
||||
|
||||
static void Cmd_moveend(void)
|
||||
{
|
||||
s32 i;
|
||||
@ -5592,6 +5602,23 @@ static void Cmd_moveend(void)
|
||||
}
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
case MOVEEND_SYMBIOSIS:
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (((B_SYMBIOSIS_GEMS >= GEN_7 && gSpecialStatuses[i].gemBoost) || gSpecialStatuses[i].berryReduced)
|
||||
&& SYMBIOSIS_CHECK(i, i ^ BIT_FLANK))
|
||||
{
|
||||
BestowItem(i ^ BIT_FLANK, i);
|
||||
gLastUsedAbility = gBattleMons[i ^ BIT_FLANK].ability;
|
||||
gBattleScripting.battler = gBattlerAbility = i ^ BIT_FLANK;
|
||||
gBattlerAttacker = i;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_SymbiosisActivates;
|
||||
effect = TRUE;
|
||||
}
|
||||
}
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
case MOVEEND_CLEAR_BITS: // Clear/Set bits for things like using a move for all targets and all hits.
|
||||
if (gSpecialStatuses[gBattlerAttacker].instructedChosenTarget)
|
||||
*(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].instructedChosenTarget & 0x3;
|
||||
@ -7030,15 +7057,6 @@ static bool32 TryCheekPouch(u32 battlerId, u32 itemId)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define SYMBIOSIS_CHECK(battler, ally) \
|
||||
GetBattlerAbility(ally) == ABILITY_SYMBIOSIS \
|
||||
&& gBattleMons[battler].item == ITEM_NONE \
|
||||
&& gBattleMons[ally].item != ITEM_NONE \
|
||||
&& CanBattlerGetOrLoseItem(battler, gBattleMons[ally].item) \
|
||||
&& CanBattlerGetOrLoseItem(ally, gBattleMons[ally].item) \
|
||||
&& gBattleMons[battler].hp != 0 \
|
||||
&& gBattleMons[ally].hp != 0
|
||||
|
||||
// Used by Bestow and Symbiosis to take an item from one battler and give to another.
|
||||
static void BestowItem(u32 battlerAtk, u32 battlerDef)
|
||||
{
|
||||
@ -7066,7 +7084,11 @@ static bool32 TrySymbiosis(u32 battler, u32 itemId)
|
||||
&& gBattleStruct->changedItems[battler] == ITEM_NONE
|
||||
&& ItemId_GetHoldEffect(itemId) != HOLD_EFFECT_EJECT_BUTTON
|
||||
&& ItemId_GetHoldEffect(itemId) != HOLD_EFFECT_EJECT_PACK
|
||||
&& gCurrentMove != MOVE_FLING
|
||||
&& gBattleStruct->debugHoldEffects[battler] != HOLD_EFFECT_EJECT_BUTTON
|
||||
&& gBattleStruct->debugHoldEffects[battler] != HOLD_EFFECT_EJECT_BUTTON
|
||||
&& !(B_SYMBIOSIS_GEMS >= GEN_7 && gSpecialStatuses[battler].gemBoost)
|
||||
&& gCurrentMove != MOVE_FLING //Fling and damage-reducing berries are handled separately.
|
||||
&& !gSpecialStatuses[battler].berryReduced
|
||||
&& SYMBIOSIS_CHECK(battler, ally))
|
||||
{
|
||||
BestowItem(ally, battler);
|
||||
|
Loading…
Reference in New Issue
Block a user