Minor clean up for Lightning Rod / Storm Drain (#7778)
This commit is contained in:
parent
1ca5b23f19
commit
a00b16fd90
@ -183,13 +183,13 @@ struct SpecialStatus
|
||||
s32 specialDmg;
|
||||
u8 changedStatsBattlerId; // Battler that was responsible for the latest stat change. Can be self.
|
||||
u8 statLowered:1;
|
||||
u8 lightningRodRedirected:1;
|
||||
u8 abilityRedirected:1;
|
||||
u8 restoredBattlerSprite: 1;
|
||||
u8 faintedHasReplacement:1;
|
||||
u8 preventLifeOrbDamage:1; // So that Life Orb doesn't activate various effects.
|
||||
u8 afterYou:1;
|
||||
u8 enduredDamage:1;
|
||||
u8 stormDrainRedirected:1;
|
||||
u8 dancerUsedMove:1;
|
||||
// End of byte
|
||||
u8 switchInAbilityDone:1;
|
||||
u8 switchInItemDone:1;
|
||||
@ -208,9 +208,8 @@ struct SpecialStatus
|
||||
u8 teraShellAbilityDone:1;
|
||||
u8 criticalHit:1;
|
||||
// End of byte
|
||||
u8 dancerUsedMove:1;
|
||||
u8 dancerOriginalTarget:3;
|
||||
u8 unused:4;
|
||||
u8 unused:5;
|
||||
// End of byte
|
||||
};
|
||||
|
||||
|
||||
@ -1249,19 +1249,10 @@ static void Cmd_attackcanceler(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (gSpecialStatuses[gBattlerTarget].lightningRodRedirected)
|
||||
if (gSpecialStatuses[gBattlerTarget].abilityRedirected)
|
||||
{
|
||||
gSpecialStatuses[gBattlerTarget].lightningRodRedirected = FALSE;
|
||||
gLastUsedAbility = ABILITY_LIGHTNING_ROD;
|
||||
gSpecialStatuses[gBattlerTarget].abilityRedirected = FALSE;
|
||||
BattleScriptCall(BattleScript_TookAttack);
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
}
|
||||
else if (gSpecialStatuses[gBattlerTarget].stormDrainRedirected)
|
||||
{
|
||||
gSpecialStatuses[gBattlerTarget].stormDrainRedirected = FALSE;
|
||||
gLastUsedAbility = ABILITY_STORM_DRAIN;
|
||||
BattleScriptCall(BattleScript_TookAttack);
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
}
|
||||
else if (IsBattlerProtected(gBattlerAttacker, gBattlerTarget, gCurrentMove)
|
||||
&& (ctx.moveEffect != EFFECT_CURSE || IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GHOST))
|
||||
|
||||
@ -367,17 +367,13 @@ bool32 HandleMoveTargetRedirection(void)
|
||||
redirectorOrderNum = GetBattlerTurnOrderNum(battler);
|
||||
}
|
||||
}
|
||||
if (redirectorOrderNum != MAX_BATTLERS_COUNT)
|
||||
if (redirectorOrderNum != MAX_BATTLERS_COUNT && gCurrentMove != MOVE_TEATIME)
|
||||
{
|
||||
u16 battlerAbility;
|
||||
battler = gBattlerByTurnOrder[redirectorOrderNum];
|
||||
battlerAbility = GetBattlerAbility(battler);
|
||||
|
||||
RecordAbilityBattle(battler, gBattleMons[battler].ability);
|
||||
if (battlerAbility == ABILITY_LIGHTNING_ROD && gCurrentMove != MOVE_TEATIME)
|
||||
gSpecialStatuses[battler].lightningRodRedirected = TRUE;
|
||||
else if (battlerAbility == ABILITY_STORM_DRAIN)
|
||||
gSpecialStatuses[battler].stormDrainRedirected = TRUE;
|
||||
RecordAbilityBattle(battler, battlerAbility);
|
||||
gSpecialStatuses[battler].abilityRedirected = TRUE;
|
||||
gBattlerTarget = battler;
|
||||
return TRUE;
|
||||
}
|
||||
@ -7677,7 +7673,7 @@ u32 GetBattleMoveTarget(u16 move, u8 setTarget)
|
||||
{
|
||||
targetBattler = battlerAbilityOnField - 1;
|
||||
RecordAbilityBattle(targetBattler, gBattleMons[targetBattler].ability);
|
||||
gSpecialStatuses[targetBattler].lightningRodRedirected = TRUE;
|
||||
gSpecialStatuses[targetBattler].abilityRedirected = TRUE;
|
||||
}
|
||||
}
|
||||
else if (moveType == TYPE_WATER && GetBattlerAbility(targetBattler) != ABILITY_STORM_DRAIN)
|
||||
@ -7691,7 +7687,7 @@ u32 GetBattleMoveTarget(u16 move, u8 setTarget)
|
||||
{
|
||||
targetBattler = battlerAbilityOnField - 1;
|
||||
RecordAbilityBattle(targetBattler, gBattleMons[targetBattler].ability);
|
||||
gSpecialStatuses[targetBattler].lightningRodRedirected = TRUE;
|
||||
gSpecialStatuses[targetBattler].abilityRedirected = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +28,8 @@ SINGLE_BATTLE_TEST("Lightning Rod absorbs Electric-type moves and increases the
|
||||
HP_BAR(opponent);
|
||||
}
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
|
||||
} THEN {
|
||||
EXPECT_EQ(gBattleHistory->abilities[1], ABILITY_LIGHTNING_ROD); // Check if the correct ability has been recorded
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user