mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 04:04:17 +01:00
Merge pull request #2680 from DizzyEggg/mirror_armor
Fix Mirror Armor against Clear Body
This commit is contained in:
commit
6b0b427d93
@ -3592,7 +3592,7 @@ BattleScript_MirrorArmorReflect::
|
|||||||
call BattleScript_AbilityPopUp
|
call BattleScript_AbilityPopUp
|
||||||
jumpifsubstituteblocks BattleScript_AbilityNoSpecificStatLoss
|
jumpifsubstituteblocks BattleScript_AbilityNoSpecificStatLoss
|
||||||
BattleScript_MirrorArmorReflectStatLoss:
|
BattleScript_MirrorArmorReflectStatLoss:
|
||||||
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_NOT_PROTECT_AFFECTED | STAT_CHANGE_ALLOW_PTR, BattleScript_MirrorArmorReflectEnd
|
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_MIRROR_ARMOR | STAT_CHANGE_NOT_PROTECT_AFFECTED | STAT_CHANGE_ALLOW_PTR, BattleScript_MirrorArmorReflectEnd
|
||||||
jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_MirrorArmorReflectAnim
|
jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_MirrorArmorReflectAnim
|
||||||
goto BattleScript_MirrorArmorReflectWontFall
|
goto BattleScript_MirrorArmorReflectWontFall
|
||||||
BattleScript_MirrorArmorReflectAnim:
|
BattleScript_MirrorArmorReflectAnim:
|
||||||
|
@ -273,6 +273,7 @@
|
|||||||
|
|
||||||
// Cmd_statbuffchange
|
// Cmd_statbuffchange
|
||||||
#define STAT_CHANGE_ALLOW_PTR (1 << 0) // If set, allow use of jumpptr. Set in every use of statbuffchange
|
#define STAT_CHANGE_ALLOW_PTR (1 << 0) // If set, allow use of jumpptr. Set in every use of statbuffchange
|
||||||
|
#define STAT_CHANGE_MIRROR_ARMOR (1 << 1) // Stat change redirection caused by Mirror Armor ability.
|
||||||
#define STAT_CHANGE_NOT_PROTECT_AFFECTED (1 << 5)
|
#define STAT_CHANGE_NOT_PROTECT_AFFECTED (1 << 5)
|
||||||
#define STAT_CHANGE_UPDATE_MOVE_EFFECT (1 << 6)
|
#define STAT_CHANGE_UPDATE_MOVE_EFFECT (1 << 6)
|
||||||
|
|
||||||
|
@ -10890,8 +10890,9 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
|
|||||||
bool32 certain = FALSE;
|
bool32 certain = FALSE;
|
||||||
bool32 notProtectAffected = FALSE;
|
bool32 notProtectAffected = FALSE;
|
||||||
u32 index;
|
u32 index;
|
||||||
bool32 affectsUser = (flags & MOVE_EFFECT_AFFECTS_USER);
|
|
||||||
u16 activeBattlerAbility;
|
u16 activeBattlerAbility;
|
||||||
|
bool32 affectsUser = (flags & MOVE_EFFECT_AFFECTS_USER);
|
||||||
|
bool32 mirrorArmored = (flags & STAT_CHANGE_MIRROR_ARMOR);
|
||||||
|
|
||||||
if (affectsUser)
|
if (affectsUser)
|
||||||
gActiveBattler = gBattlerAttacker;
|
gActiveBattler = gBattlerAttacker;
|
||||||
@ -10902,10 +10903,10 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
|
|||||||
|
|
||||||
gSpecialStatuses[gActiveBattler].changedStatsBattlerId = gBattlerAttacker;
|
gSpecialStatuses[gActiveBattler].changedStatsBattlerId = gBattlerAttacker;
|
||||||
|
|
||||||
flags &= ~MOVE_EFFECT_AFFECTS_USER;
|
flags &= ~(MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_MIRROR_ARMOR);
|
||||||
|
|
||||||
if (flags & MOVE_EFFECT_CERTAIN)
|
if (flags & MOVE_EFFECT_CERTAIN)
|
||||||
certain++;
|
certain = TRUE;
|
||||||
flags &= ~MOVE_EFFECT_CERTAIN;
|
flags &= ~MOVE_EFFECT_CERTAIN;
|
||||||
|
|
||||||
if (flags & STAT_CHANGE_NOT_PROTECT_AFFECTED)
|
if (flags & STAT_CHANGE_NOT_PROTECT_AFFECTED)
|
||||||
@ -10961,7 +10962,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
|
|||||||
|| activeBattlerAbility == ABILITY_CLEAR_BODY
|
|| activeBattlerAbility == ABILITY_CLEAR_BODY
|
||||||
|| activeBattlerAbility == ABILITY_FULL_METAL_BODY
|
|| activeBattlerAbility == ABILITY_FULL_METAL_BODY
|
||||||
|| activeBattlerAbility == ABILITY_WHITE_SMOKE)
|
|| activeBattlerAbility == ABILITY_WHITE_SMOKE)
|
||||||
&& !affectsUser && !certain && gCurrentMove != MOVE_CURSE)
|
&& (!affectsUser || mirrorArmored) && !certain && gCurrentMove != MOVE_CURSE)
|
||||||
{
|
{
|
||||||
if (GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_CLEAR_AMULET)
|
if (GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_CLEAR_AMULET)
|
||||||
{
|
{
|
||||||
@ -11023,7 +11024,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
|
|||||||
}
|
}
|
||||||
return STAT_CHANGE_DIDNT_WORK;
|
return STAT_CHANGE_DIDNT_WORK;
|
||||||
}
|
}
|
||||||
else if (activeBattlerAbility == ABILITY_MIRROR_ARMOR && !affectsUser && gBattlerAttacker != gBattlerTarget && gActiveBattler == gBattlerTarget)
|
else if (activeBattlerAbility == ABILITY_MIRROR_ARMOR && !affectsUser && !mirrorArmored && gBattlerAttacker != gBattlerTarget && gActiveBattler == gBattlerTarget)
|
||||||
{
|
{
|
||||||
if (flags == STAT_CHANGE_ALLOW_PTR)
|
if (flags == STAT_CHANGE_ALLOW_PTR)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user