Implement Unburden.
This commit is contained in:
parent
df95c4801a
commit
1146de4561
2 changed files with 51 additions and 1 deletions
|
@ -2678,6 +2678,17 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||||
{
|
{
|
||||||
gLastUsedItem = gBattleStruct->changedItems[gBattlerAttacker] = gBattleMons[gBattlerTarget].item;
|
gLastUsedItem = gBattleStruct->changedItems[gBattlerAttacker] = gBattleMons[gBattlerTarget].item;
|
||||||
gBattleMons[gBattlerTarget].item = 0;
|
gBattleMons[gBattlerTarget].item = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (GetBattlerAbility(gBattlerTarget) == ABILITY_UNBURDEN)
|
||||||
|
{
|
||||||
|
gBattleResources->flags->flags[gBattlerTarget] |= RESOURCE_FLAG_UNBURDEN;
|
||||||
|
RecordAbilityBattle(gBattlerTarget, ABILITY_UNBURDEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetBattlerAbility(gBattlerAttacker) == ABILITY_UNBURDEN && gBattleResources->flags->flags[gBattlerAttacker] & RESOURCE_FLAG_UNBURDEN)
|
||||||
|
gBattleResources->flags->flags[gBattlerAttacker] &= ~(RESOURCE_FLAG_UNBURDEN);
|
||||||
|
|
||||||
gActiveBattler = gBattlerAttacker;
|
gActiveBattler = gBattlerAttacker;
|
||||||
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedItem);
|
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedItem);
|
||||||
|
@ -2795,6 +2806,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||||
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
||||||
gBattleMons[gEffectBattler].item = 0;
|
gBattleMons[gEffectBattler].item = 0;
|
||||||
gWishFutureKnock.knockedOffMons[side] |= gBitTable[gBattlerPartyIndexes[gEffectBattler]];
|
gWishFutureKnock.knockedOffMons[side] |= gBitTable[gBattlerPartyIndexes[gEffectBattler]];
|
||||||
|
if (GetBattlerAbility(gEffectBattler) == ABILITY_UNBURDEN)
|
||||||
|
{
|
||||||
|
gBattleResources->flags->flags[gEffectBattler] |= RESOURCE_FLAG_UNBURDEN;
|
||||||
|
RecordAbilityBattle(gEffectBattler, ABILITY_UNBURDEN);
|
||||||
|
}
|
||||||
|
|
||||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||||
gBattlescriptCurrInstr = BattleScript_KnockedOff;
|
gBattlescriptCurrInstr = BattleScript_KnockedOff;
|
||||||
|
@ -2929,6 +2945,13 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||||
{
|
{
|
||||||
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
||||||
gBattleMons[gEffectBattler].item = 0;
|
gBattleMons[gEffectBattler].item = 0;
|
||||||
|
|
||||||
|
if (GetBattlerAbility(gEffectBattler) == ABILITY_UNBURDEN)
|
||||||
|
{
|
||||||
|
gBattleResources->flags->flags[gEffectBattler] |= RESOURCE_FLAG_UNBURDEN;
|
||||||
|
RecordAbilityBattle(gEffectBattler, ABILITY_UNBURDEN);
|
||||||
|
}
|
||||||
|
|
||||||
gActiveBattler = gEffectBattler;
|
gActiveBattler = gEffectBattler;
|
||||||
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gEffectBattler].item);
|
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gEffectBattler].item);
|
||||||
MarkBattlerForControllerExec(gActiveBattler);
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
|
@ -2942,6 +2965,13 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||||
{
|
{
|
||||||
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
||||||
gBattleMons[gEffectBattler].item = 0;
|
gBattleMons[gEffectBattler].item = 0;
|
||||||
|
|
||||||
|
if (GetBattlerAbility(gEffectBattler) == ABILITY_UNBURDEN)
|
||||||
|
{
|
||||||
|
gBattleResources->flags->flags[gEffectBattler] |= RESOURCE_FLAG_UNBURDEN;
|
||||||
|
RecordAbilityBattle(gEffectBattler, ABILITY_UNBURDEN);
|
||||||
|
}
|
||||||
|
|
||||||
gActiveBattler = gEffectBattler;
|
gActiveBattler = gEffectBattler;
|
||||||
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gEffectBattler].item);
|
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gEffectBattler].item);
|
||||||
MarkBattlerForControllerExec(gActiveBattler);
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
|
@ -6118,6 +6148,12 @@ static void Cmd_removeitem(void)
|
||||||
gBattleStruct->usedHeldItems[gActiveBattler] = gBattleMons[gActiveBattler].item;
|
gBattleStruct->usedHeldItems[gActiveBattler] = gBattleMons[gActiveBattler].item;
|
||||||
|
|
||||||
gBattleMons[gActiveBattler].item = 0;
|
gBattleMons[gActiveBattler].item = 0;
|
||||||
|
|
||||||
|
if (GetBattlerAbility(gActiveBattler) == ABILITY_UNBURDEN)
|
||||||
|
{
|
||||||
|
gBattleResources->flags->flags[gActiveBattler] |= RESOURCE_FLAG_UNBURDEN;
|
||||||
|
RecordAbilityBattle(gActiveBattler, ABILITY_UNBURDEN);
|
||||||
|
}
|
||||||
|
|
||||||
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gActiveBattler].item);
|
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gActiveBattler].item);
|
||||||
MarkBattlerForControllerExec(gActiveBattler);
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
|
@ -10484,9 +10520,22 @@ static void Cmd_tryswapitems(void) // trick
|
||||||
if (oldItemAtk != 0 && *newItemAtk != 0)
|
if (oldItemAtk != 0 && *newItemAtk != 0)
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2; // attacker's item -> <- target's item
|
gBattleCommunication[MULTISTRING_CHOOSER] = 2; // attacker's item -> <- target's item
|
||||||
else if (oldItemAtk == 0 && *newItemAtk != 0)
|
else if (oldItemAtk == 0 && *newItemAtk != 0)
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0; // nothing -> <- target's item
|
{
|
||||||
|
if (GetBattlerAbility(gBattlerAttacker) == ABILITY_UNBURDEN && gBattleResources->flags->flags[gBattlerAttacker] & RESOURCE_FLAG_UNBURDEN)
|
||||||
|
gBattleResources->flags->flags[gBattlerAttacker] &= ~(RESOURCE_FLAG_UNBURDEN);
|
||||||
|
|
||||||
|
gBattleCommunication[MULTISTRING_CHOOSER] = 0; // nothing -> <- target's item
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (GetBattlerAbility(gBattlerAttacker) == ABILITY_UNBURDEN)
|
||||||
|
{
|
||||||
|
gBattleResources->flags->flags[gBattlerAttacker] |= RESOURCE_FLAG_UNBURDEN;
|
||||||
|
RecordAbilityBattle(gBattlerAttacker, ABILITY_UNBURDEN);
|
||||||
|
}
|
||||||
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1; // attacker's item -> <- nothing
|
gBattleCommunication[MULTISTRING_CHOOSER] = 1; // attacker's item -> <- nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5111,6 +5111,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
|
||||||
break;
|
break;
|
||||||
case EFFECT_FLING:
|
case EFFECT_FLING:
|
||||||
// todo
|
// todo
|
||||||
|
// reminder to program Fling + Unburden interaction
|
||||||
break;
|
break;
|
||||||
case EFFECT_ERUPTION:
|
case EFFECT_ERUPTION:
|
||||||
basePower = gBattleMons[battlerAtk].hp * basePower / gBattleMons[battlerAtk].maxHP;
|
basePower = gBattleMons[battlerAtk].hp * basePower / gBattleMons[battlerAtk].maxHP;
|
||||||
|
|
Loading…
Reference in a new issue