mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-28 12:44:18 +01:00
Merge pull request #1618 from BuffelSaft/protect-like
Fix protect-like moves
This commit is contained in:
commit
fa081d1fc5
@ -144,6 +144,7 @@ struct ProtectStruct
|
|||||||
u32 usedThroatChopPreventedMove:1;
|
u32 usedThroatChopPreventedMove:1;
|
||||||
u32 micle:1;
|
u32 micle:1;
|
||||||
u32 custap:1; // also quick claw
|
u32 custap:1; // also quick claw
|
||||||
|
u32 touchedProtectLike:1;
|
||||||
u32 physicalDmg;
|
u32 physicalDmg;
|
||||||
u32 specialDmg;
|
u32 specialDmg;
|
||||||
u8 physicalBattlerId;
|
u8 physicalBattlerId;
|
||||||
|
@ -1452,8 +1452,11 @@ static void Cmd_attackcanceler(void)
|
|||||||
}
|
}
|
||||||
else if (IsBattlerProtected(gBattlerTarget, gCurrentMove)
|
else if (IsBattlerProtected(gBattlerTarget, gCurrentMove)
|
||||||
&& (gCurrentMove != MOVE_CURSE || IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GHOST))
|
&& (gCurrentMove != MOVE_CURSE || IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GHOST))
|
||||||
&& ((!IsTwoTurnsMove(gCurrentMove) || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS))))
|
&& ((!IsTwoTurnsMove(gCurrentMove) || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)))
|
||||||
|
&& gBattleMoves[gCurrentMove].effect != EFFECT_SUCKER_PUNCH)
|
||||||
{
|
{
|
||||||
|
if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT)
|
||||||
|
gProtectStructs[gBattlerAttacker].touchedProtectLike = 1;
|
||||||
CancelMultiTurnMoves(gBattlerAttacker);
|
CancelMultiTurnMoves(gBattlerAttacker);
|
||||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||||
gLastLandedMoves[gBattlerTarget] = 0;
|
gLastLandedMoves[gBattlerTarget] = 0;
|
||||||
@ -4786,10 +4789,11 @@ static void Cmd_moveend(void)
|
|||||||
switch (gBattleScripting.moveendState)
|
switch (gBattleScripting.moveendState)
|
||||||
{
|
{
|
||||||
case MOVEEND_PROTECT_LIKE_EFFECT:
|
case MOVEEND_PROTECT_LIKE_EFFECT:
|
||||||
if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT)
|
if (gProtectStructs[gBattlerAttacker].touchedProtectLike)
|
||||||
{
|
{
|
||||||
if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
|
if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
|
||||||
{
|
{
|
||||||
|
gProtectStructs[gBattlerAttacker].touchedProtectLike = 0;
|
||||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8;
|
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8;
|
||||||
if (gBattleMoveDamage == 0)
|
if (gBattleMoveDamage == 0)
|
||||||
gBattleMoveDamage = 1;
|
gBattleMoveDamage = 1;
|
||||||
@ -4800,6 +4804,7 @@ static void Cmd_moveend(void)
|
|||||||
}
|
}
|
||||||
else if (gProtectStructs[gBattlerTarget].kingsShielded)
|
else if (gProtectStructs[gBattlerTarget].kingsShielded)
|
||||||
{
|
{
|
||||||
|
gProtectStructs[gBattlerAttacker].touchedProtectLike = 0;
|
||||||
i = gBattlerAttacker;
|
i = gBattlerAttacker;
|
||||||
gBattlerAttacker = gBattlerTarget;
|
gBattlerAttacker = gBattlerTarget;
|
||||||
gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable
|
gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable
|
||||||
@ -4810,6 +4815,7 @@ static void Cmd_moveend(void)
|
|||||||
}
|
}
|
||||||
else if (gProtectStructs[gBattlerTarget].banefulBunkered)
|
else if (gProtectStructs[gBattlerTarget].banefulBunkered)
|
||||||
{
|
{
|
||||||
|
gProtectStructs[gBattlerAttacker].touchedProtectLike = 0;
|
||||||
gBattleScripting.moveEffect = MOVE_EFFECT_POISON | MOVE_EFFECT_AFFECTS_USER;
|
gBattleScripting.moveEffect = MOVE_EFFECT_POISON | MOVE_EFFECT_AFFECTS_USER;
|
||||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_BANEFUL_BUNKER);
|
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_BANEFUL_BUNKER);
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
|
Loading…
Reference in New Issue
Block a user