mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-02-03 18:00:01 +01:00
proper mirror armor sticky web targeting
This commit is contained in:
parent
7e6e23005b
commit
48c29a9cd8
@ -1839,8 +1839,8 @@
|
||||
various BS_ATTACKER, VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER
|
||||
.endm
|
||||
|
||||
.macro getrandommirrorarmortarget
|
||||
various BS_TARGET, VARIOUS_GET_RANDOM_MIRROR_ARMOR_TARGET
|
||||
.macro setattackertostickywebuser
|
||||
various BS_TARGET, VARIOUS_SET_ATTACKER_STICKY_WEB_USER
|
||||
.endm
|
||||
|
||||
.macro getrototillertargets ptr:req
|
||||
|
@ -2910,10 +2910,11 @@ BattleScript_MirrorArmorReflectWontFall:
|
||||
copybyte gBattlerTarget, gBattlerAttacker @ STRINGID_STATSWONTDECREASE uses target
|
||||
goto BattleScript_MirrorArmorReflectPrintString
|
||||
|
||||
@ gBattlerTarget is battler with Mirror Armor
|
||||
BattleScript_MirrorArmorReflectStickyWeb:
|
||||
call BattleScript_AbilityPopUp
|
||||
getrandommirrorarmortarget
|
||||
jumpifbyteequal gBattlerTarget, gBattlerAttacker, BattleScript_AbilityNoSpecificStatLossPrint
|
||||
setattackertostickywebuser
|
||||
jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_StickyWebOnSwitchInEnd @ Sticky web user not on field -> no stat loss
|
||||
goto BattleScript_MirrorArmorReflectStatLoss
|
||||
|
||||
BattleScript_StatDown::
|
||||
|
@ -612,6 +612,7 @@ struct BattleStruct
|
||||
struct StolenItem itemStolen[PARTY_SIZE]; // Player's team that had items stolen (two bytes per party member)
|
||||
u8 blunderPolicy:1; // should blunder policy activate
|
||||
u8 ballSpriteIds[2]; // item gfx, window gfx
|
||||
u8 stickyWebUser;
|
||||
};
|
||||
|
||||
#define GET_MOVE_TYPE(move, typeArg) \
|
||||
|
@ -197,7 +197,7 @@
|
||||
#define VARIOUS_UPDATE_ABILITY_POPUP 124
|
||||
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 125
|
||||
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 126
|
||||
#define VARIOUS_GET_RANDOM_MIRROR_ARMOR_TARGET 127
|
||||
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 127
|
||||
|
||||
// Cmd_manipulatedamage
|
||||
#define DMG_CHANGE_SIGN 0
|
||||
|
@ -2933,6 +2933,8 @@ static void BattleStartClearSetData(void)
|
||||
|
||||
gBattleStruct->mega.triggerSpriteId = 0xFF;
|
||||
|
||||
gBattleStruct->stickyWebUser = 0xFF;
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
gBattleStruct->usedHeldItems[i][0] = 0;
|
||||
@ -3030,6 +3032,9 @@ void SwitchInClearSetData(void)
|
||||
gBattleStruct->lastTakenMoveFrom[gActiveBattler][3] = 0;
|
||||
gBattleStruct->lastMoveFailed &= ~(gBitTable[gActiveBattler]);
|
||||
gBattleStruct->palaceFlags &= ~(gBitTable[gActiveBattler]);
|
||||
|
||||
if (gActiveBattler == gBattleStruct->stickyWebUser)
|
||||
gBattleStruct->stickyWebUser = 0xFF; // Switched into sticky web user slot so reset it
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
@ -3127,6 +3132,9 @@ void FaintClearSetData(void)
|
||||
gBattleStruct->lastTakenMoveFrom[gActiveBattler][3] = 0;
|
||||
|
||||
gBattleStruct->palaceFlags &= ~(gBitTable[gActiveBattler]);
|
||||
|
||||
if (gActiveBattler == gBattleStruct->stickyWebUser)
|
||||
gBattleStruct->stickyWebUser = 0xFF; // User of sticky web fainted, so reset the stored battler ID
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
|
@ -9015,24 +9015,13 @@ static void Cmd_various(void)
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
return;
|
||||
case VARIOUS_GET_RANDOM_MIRROR_ARMOR_TARGET:
|
||||
i = BATTLE_OPPOSITE(gActiveBattler);
|
||||
gBattlerAttacker = gBattlerTarget;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
{
|
||||
if (IsBattlerAlive(i)
|
||||
&& !(gBattleMons[i].status2 & STATUS2_SUBSTITUTE))
|
||||
gBattlerAttacker = i;
|
||||
else if (IsBattlerAlive(BATTLE_PARTNER(i))
|
||||
&& !(gBattleMons[BATTLE_PARTNER(i)].status2 & STATUS2_SUBSTITUTE))
|
||||
gBattlerAttacker = BATTLE_PARTNER(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsBattlerAlive(i) && !(gBattleMons[i].status2 & STATUS2_SUBSTITUTE))
|
||||
gBattlerAttacker = i;
|
||||
}
|
||||
case VARIOUS_SET_ATTACKER_STICKY_WEB_USER:
|
||||
// For Mirror Armor: "If the Pokémon with this Ability is affected by Sticky Web, the effect is reflected back to the Pokémon which set it up.
|
||||
// If Pokémon which set up Sticky Web is not on the field, no Pokémon have their Speed lowered."
|
||||
gBattlerAttacker = gBattlerTarget; // Initialize 'fail' condition
|
||||
SET_STATCHANGER(STAT_SPEED, 1, TRUE);
|
||||
if (gBattleStruct->stickyWebUser != 0xFF)
|
||||
gBattlerAttacker = gBattleStruct->stickyWebUser;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -11590,6 +11579,7 @@ static void Cmd_setstickyweb(void)
|
||||
{
|
||||
gSideStatuses[targetSide] |= SIDE_STATUS_STICKY_WEB;
|
||||
gSideTimers[targetSide].stickyWebAmount = 1;
|
||||
gBattleStruct->stickyWebUser = gBattlerAttacker; // For Mirror Armor
|
||||
gBattlescriptCurrInstr += 5;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user