mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 20:24:18 +01:00
functional but not perfect implementation
This commit is contained in:
parent
f0d74b60ff
commit
0cb6529ae2
@ -9560,3 +9560,9 @@ BattleScript_MagicianActivates::
|
|||||||
call BattleScript_AbilityPopUp
|
call BattleScript_AbilityPopUp
|
||||||
call BattleScript_ItemSteal
|
call BattleScript_ItemSteal
|
||||||
return
|
return
|
||||||
|
|
||||||
|
BattleScript_SymbiosisActivates::
|
||||||
|
call BattleScript_AbilityPopUp
|
||||||
|
printstring STRINGID_SYMBIOSISITEMPASS
|
||||||
|
waitmessage B_WAIT_TIME_LONG
|
||||||
|
return
|
||||||
|
@ -419,5 +419,6 @@ extern const u8 BattleScript_MagicianActivates[];
|
|||||||
extern const u8 BattleScript_BeakBlastSetUp[];
|
extern const u8 BattleScript_BeakBlastSetUp[];
|
||||||
extern const u8 BattleScript_BeakBlastBurn[];
|
extern const u8 BattleScript_BeakBlastBurn[];
|
||||||
extern const u8 BattleScript_DefDownSpeedUp[];
|
extern const u8 BattleScript_DefDownSpeedUp[];
|
||||||
|
extern const u8 BattleScript_SymbiosisActivates[];
|
||||||
|
|
||||||
#endif // GUARD_BATTLE_SCRIPTS_H
|
#endif // GUARD_BATTLE_SCRIPTS_H
|
||||||
|
@ -601,7 +601,7 @@ static const u8 sText_HarvestBerry[] = _("{B_ATK_NAME_WITH_PREFIX} harvested\nit
|
|||||||
static const u8 sText_LastAbilityRaisedBuff1[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_LAST_ABILITY}\nraised its {B_BUFF1}!");
|
static const u8 sText_LastAbilityRaisedBuff1[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_LAST_ABILITY}\nraised its {B_BUFF1}!");
|
||||||
static const u8 sText_MagicBounceActivates[] = _("The {B_DEF_NAME_WITH_PREFIX} bounced the\n{B_ATK_NAME_WITH_PREFIX} back!");
|
static const u8 sText_MagicBounceActivates[] = _("The {B_DEF_NAME_WITH_PREFIX} bounced the\n{B_ATK_NAME_WITH_PREFIX} back!");
|
||||||
static const u8 sText_ProteanTypeChange[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY} transformed\nit into the {B_BUFF1} type!");
|
static const u8 sText_ProteanTypeChange[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY} transformed\nit into the {B_BUFF1} type!");
|
||||||
static const u8 sText_SymbiosisItemPass[] = _("{B_ATK_NAME_WITH_PREFIX} passed its {B_LAST_ITEM}\nto {B_SCR_ACTIVE_NAME_WITH_PREFIX} through {B_ATK_ABILITY}!");
|
static const u8 sText_SymbiosisItemPass[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} passed its {B_LAST_ITEM}\nto {B_DEF_NAME_WITH_PREFIX} through {B_LAST_ABILITY}!");
|
||||||
static const u8 sText_StealthRockDmg[] = _("Pointed stones dug into\n{B_SCR_ACTIVE_NAME_WITH_PREFIX}!");
|
static const u8 sText_StealthRockDmg[] = _("Pointed stones dug into\n{B_SCR_ACTIVE_NAME_WITH_PREFIX}!");
|
||||||
static const u8 sText_ToxicSpikesAbsorbed[] = _("The poison spikes disappeared\nfrom around the opposing team's feet!");
|
static const u8 sText_ToxicSpikesAbsorbed[] = _("The poison spikes disappeared\nfrom around the opposing team's feet!");
|
||||||
static const u8 sText_ToxicSpikesPoisoned[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} was poisoned!");
|
static const u8 sText_ToxicSpikesPoisoned[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} was poisoned!");
|
||||||
|
@ -7030,6 +7030,53 @@ static bool32 TryCheekPouch(u32 battlerId, u32 itemId)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notes:
|
||||||
|
// Symbiosis applies before a move and after a gem is used in Gen 6.
|
||||||
|
// Symbiosis applies if an ally consumes a berry through Bug Bite / Pluck and doesn't have an item.
|
||||||
|
// Symbiosis does not apply if an ally has an item stolen, knocked off, or destroyed by Incinerate.
|
||||||
|
// Symbiosis does not apply after Eject Button (except in Gen 6, where it is bugged).
|
||||||
|
// Symbiosis does not apply if an ally tricks away their item and does not receive one in return.
|
||||||
|
|
||||||
|
//itemId is used to check Eject Button or Eject Pack
|
||||||
|
static bool32 TrySymbiosis(u32 battler, u32 itemId)
|
||||||
|
{
|
||||||
|
u32 ally = battler ^ BIT_FLANK;
|
||||||
|
|
||||||
|
if (!gBattleStruct->itemStolen[gBattlerPartyIndexes[battler]].stolen
|
||||||
|
&& gBattleStruct->changedItems[battler] == ITEM_NONE
|
||||||
|
&& ItemId_GetHoldEffect(itemId) != HOLD_EFFECT_EJECT_BUTTON
|
||||||
|
&& ItemId_GetHoldEffect(itemId) != HOLD_EFFECT_EJECT_PACK
|
||||||
|
&& 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)
|
||||||
|
{
|
||||||
|
gLastUsedItem = gBattleMons[ally].item;
|
||||||
|
|
||||||
|
gActiveBattler = ally;
|
||||||
|
gBattleMons[ally].item = ITEM_NONE;
|
||||||
|
BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battler].item), &gBattleMons[battler].item);
|
||||||
|
MarkBattlerForControllerExec(ally);
|
||||||
|
|
||||||
|
gActiveBattler = battler;
|
||||||
|
gBattleMons[battler].item = gLastUsedItem;
|
||||||
|
BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battler].item), &gBattleMons[battler].item);
|
||||||
|
MarkBattlerForControllerExec(battler);
|
||||||
|
gBattleResources->flags->flags[battler] &= ~RESOURCE_FLAG_UNBURDEN;
|
||||||
|
|
||||||
|
gLastUsedAbility = gBattleMons[ally].ability;
|
||||||
|
gBattleScripting.battler = gBattlerAbility = ally;
|
||||||
|
gBattlerTarget = battler;
|
||||||
|
BattleScriptPush(gBattlescriptCurrInstr + 2);
|
||||||
|
gBattlescriptCurrInstr = BattleScript_SymbiosisActivates;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void Cmd_removeitem(void)
|
static void Cmd_removeitem(void)
|
||||||
{
|
{
|
||||||
u16 itemId = 0;
|
u16 itemId = 0;
|
||||||
@ -7048,7 +7095,7 @@ static void Cmd_removeitem(void)
|
|||||||
MarkBattlerForControllerExec(gActiveBattler);
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
|
|
||||||
ClearBattlerItemEffectHistory(gActiveBattler);
|
ClearBattlerItemEffectHistory(gActiveBattler);
|
||||||
if (!TryCheekPouch(gActiveBattler, itemId))
|
if (!TryCheekPouch(gActiveBattler, itemId) && !TrySymbiosis(gActiveBattler, itemId))
|
||||||
gBattlescriptCurrInstr += 2;
|
gBattlescriptCurrInstr += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8830,6 +8877,7 @@ static void Cmd_various(void)
|
|||||||
MarkBattlerForControllerExec(gActiveBattler);
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
gBattleResources->flags->flags[gBattlerTarget] &= ~RESOURCE_FLAG_UNBURDEN;
|
gBattleResources->flags->flags[gBattlerTarget] &= ~RESOURCE_FLAG_UNBURDEN;
|
||||||
|
|
||||||
|
if (!TrySymbiosis(gBattlerAttacker, gLastUsedItem))
|
||||||
gBattlescriptCurrInstr += 7;
|
gBattlescriptCurrInstr += 7;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -12623,6 +12671,7 @@ static void Cmd_tryswapitems(void) // trick
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckSetUnburden(gBattlerAttacker);
|
CheckSetUnburden(gBattlerAttacker);
|
||||||
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ITEM_SWAP_GIVEN; // attacker's item -> <- nothing
|
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ITEM_SWAP_GIVEN; // attacker's item -> <- nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user