Fix Ion Deluge interaction with VoltAbsorb/LightRod (#3764)
* Fix Ion Deluge interaction with VoltAbsorb/LightRod * Use move target all battlers for ion deluge fix * fix teatime failing --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
parent
59a159c338
commit
1ec0333432
3 changed files with 73 additions and 43 deletions
|
@ -8307,8 +8307,7 @@ static bool32 IsRototillerAffected(u32 battler)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static bool32 IsAbilityRodAffected(void)
|
||||
static bool32 IsElectricAbilityAffected(u32 ability)
|
||||
{
|
||||
u32 moveType;
|
||||
|
||||
|
@ -8319,41 +8318,7 @@ static bool32 IsAbilityRodAffected(void)
|
|||
else
|
||||
moveType = gBattleMoves[gCurrentMove].type;
|
||||
|
||||
if (moveType == TYPE_ELECTRIC && GetBattlerAbility(gBattlerTarget) == ABILITY_LIGHTNING_ROD)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool32 IsAbilityMotorAffected(void)
|
||||
{
|
||||
u32 moveType;
|
||||
|
||||
if (gBattleStruct->dynamicMoveType == 0)
|
||||
moveType = gBattleMoves[gCurrentMove].type;
|
||||
else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_IGNORE_PHYSICALITY))
|
||||
moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK;
|
||||
else
|
||||
moveType = gBattleMoves[gCurrentMove].type;
|
||||
|
||||
if (moveType == TYPE_ELECTRIC && GetBattlerAbility(gBattlerTarget) == ABILITY_MOTOR_DRIVE)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool32 IsAbilityAbsorbAffected(void)
|
||||
{
|
||||
u32 moveType;
|
||||
|
||||
if (gBattleStruct->dynamicMoveType == 0)
|
||||
moveType = gBattleMoves[gCurrentMove].type;
|
||||
else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_IGNORE_PHYSICALITY))
|
||||
moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK;
|
||||
else
|
||||
moveType = gBattleMoves[gCurrentMove].type;
|
||||
|
||||
if (moveType == TYPE_ELECTRIC && GetBattlerAbility(gBattlerTarget) == ABILITY_VOLT_ABSORB)
|
||||
if (moveType == TYPE_ELECTRIC && GetBattlerAbility(gBattlerTarget) == ability)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
@ -16098,7 +16063,7 @@ void BS_JumpIfEmergencyExited(void)
|
|||
void BS_JumpIfRod(void)
|
||||
{
|
||||
NATIVE_ARGS(const u8 *jumpInstr);
|
||||
if (IsAbilityRodAffected())
|
||||
if (IsElectricAbilityAffected(ABILITY_LIGHTNING_ROD))
|
||||
gBattlescriptCurrInstr = cmd->jumpInstr;
|
||||
else
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
|
@ -16107,7 +16072,7 @@ void BS_JumpIfRod(void)
|
|||
void BS_JumpIfAbsorb(void)
|
||||
{
|
||||
NATIVE_ARGS(const u8 *jumpInstr);
|
||||
if (IsAbilityAbsorbAffected())
|
||||
if (IsElectricAbilityAffected(ABILITY_VOLT_ABSORB))
|
||||
gBattlescriptCurrInstr = cmd->jumpInstr;
|
||||
else
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
|
@ -16116,7 +16081,7 @@ void BS_JumpIfAbsorb(void)
|
|||
void BS_JumpIfMotor(void)
|
||||
{
|
||||
NATIVE_ARGS(const u8 *jumpInstr);
|
||||
if (IsAbilityMotorAffected())
|
||||
if (IsElectricAbilityAffected(ABILITY_MOTOR_DRIVE))
|
||||
gBattlescriptCurrInstr = cmd->jumpInstr;
|
||||
else
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
|
|
|
@ -5071,7 +5071,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
switch (gLastUsedAbility)
|
||||
{
|
||||
case ABILITY_VOLT_ABSORB:
|
||||
if (moveType == TYPE_ELECTRIC)
|
||||
if (moveType == TYPE_ELECTRIC && gBattleMoves[move].target != MOVE_TARGET_ALL_BATTLERS)
|
||||
effect = 1;
|
||||
break;
|
||||
case ABILITY_WATER_ABSORB:
|
||||
|
@ -5080,11 +5080,11 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
effect = 1;
|
||||
break;
|
||||
case ABILITY_MOTOR_DRIVE:
|
||||
if (moveType == TYPE_ELECTRIC)
|
||||
if (moveType == TYPE_ELECTRIC && gBattleMoves[move].target != MOVE_TARGET_ALL_BATTLERS)
|
||||
effect = 2, statId = STAT_SPEED;
|
||||
break;
|
||||
case ABILITY_LIGHTNING_ROD:
|
||||
if (moveType == TYPE_ELECTRIC)
|
||||
if (moveType == TYPE_ELECTRIC && gBattleMoves[move].target != MOVE_TARGET_ALL_BATTLERS)
|
||||
effect = 2, statId = STAT_SPATK;
|
||||
break;
|
||||
case ABILITY_STORM_DRAIN:
|
||||
|
|
65
test/battle/move_effect/ion_deluge.c
Normal file
65
test/battle/move_effect/ion_deluge.c
Normal file
|
@ -0,0 +1,65 @@
|
|||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(gBattleMoves[MOVE_ION_DELUGE].effect == EFFECT_ION_DELUGE);
|
||||
}
|
||||
|
||||
// For some reason SINGLE_BATTLE_TEST didn't catch these two issues.
|
||||
WILD_BATTLE_TEST("Ion Deluge works the same way as always when used by a mon with Volt Absorb")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_LANTURN) { Ability(ABILITY_VOLT_ABSORB); HP(1); }
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_ION_DELUGE); }
|
||||
} SCENE {
|
||||
MESSAGE("Wild Lanturn used Ion Deluge!");
|
||||
NONE_OF {
|
||||
ABILITY_POPUP(opponent, ABILITY_VOLT_ABSORB);
|
||||
HP_BAR(opponent);
|
||||
MESSAGE("Wild Lanturn restored HP using its Volt Absorb!");
|
||||
}
|
||||
MESSAGE("A deluge of ions showers the battlefield!");
|
||||
}
|
||||
}
|
||||
|
||||
WILD_BATTLE_TEST("Ion Deluge works the same way as always when used by a mon with Lightning Rod / Motor Drive")
|
||||
{
|
||||
u16 ability;
|
||||
PARAMETRIZE { ability = ABILITY_LIGHTNING_ROD; }
|
||||
PARAMETRIZE { ability = ABILITY_MOTOR_DRIVE; }
|
||||
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_ZEBSTRIKA) { Ability(ability); }
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_ION_DELUGE); }
|
||||
} SCENE {
|
||||
MESSAGE("Wild Zebstrika used Ion Deluge!");
|
||||
NONE_OF {
|
||||
ABILITY_POPUP(opponent, ability);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
||||
MESSAGE("Wild Zebstrika's Sp.Atk rose!");
|
||||
MESSAGE("Wild Zebstrika's Speed rose!");
|
||||
}
|
||||
MESSAGE("A deluge of ions showers the battlefield!");
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Ion Deluge makes Normal type moves Electric type")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(gBattleMoves[MOVE_TACKLE].type == TYPE_NORMAL);
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_GOLBAT);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_ION_DELUGE); MOVE(player, MOVE_TACKLE); }
|
||||
} SCENE {
|
||||
MESSAGE("Foe Golbat used Ion Deluge!");
|
||||
MESSAGE("A deluge of ions showers the battlefield!");
|
||||
MESSAGE("Wobbuffet used Tackle!");
|
||||
MESSAGE("It's super effective!"); // Because Tackle is now electric type.
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue