mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Fixes Toxic Debris + CanTargetFaintAi index issue (#3306)
* Fixes Toxic Debris + CanTargetFaintAi index issue * swap macro
This commit is contained in:
parent
13dedfb511
commit
ca9e784102
@ -7333,6 +7333,9 @@ BattleScript_ToxicDebrisActivates::
|
|||||||
printstring STRINGID_POISONSPIKESSCATTERED
|
printstring STRINGID_POISONSPIKESSCATTERED
|
||||||
waitmessage B_WAIT_TIME_LONG
|
waitmessage B_WAIT_TIME_LONG
|
||||||
BattleScript_ToxicDebrisRet:
|
BattleScript_ToxicDebrisRet:
|
||||||
|
copybyte sBATTLER, gBattlerTarget
|
||||||
|
copybyte gBattlerTarget, gBattlerAttacker
|
||||||
|
copybyte gBattlerAttacker, sBATTLER
|
||||||
return
|
return
|
||||||
|
|
||||||
BattleScript_EarthEaterActivates::
|
BattleScript_EarthEaterActivates::
|
||||||
|
@ -1154,7 +1154,7 @@ bool32 CanTargetFaintAi(u8 battlerDef, u8 battlerAtk)
|
|||||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||||
{
|
{
|
||||||
if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && !(unusable & gBitTable[i])
|
if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && !(unusable & gBitTable[i])
|
||||||
&& AI_DATA->simulatedDmg[battlerDef][battlerAtk][moves[i]] >= gBattleMons[battlerAtk].hp)
|
&& AI_DATA->simulatedDmg[battlerDef][battlerAtk][i] >= gBattleMons[battlerAtk].hp)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -5710,10 +5710,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& IS_MOVE_PHYSICAL(gCurrentMove)
|
&& IS_MOVE_PHYSICAL(gCurrentMove)
|
||||||
&& TARGET_TURN_DAMAGED
|
&& TARGET_TURN_DAMAGED
|
||||||
&& !(gSideStatuses[GetBattlerSide(gBattlerAttacker)] & SIDE_STATUS_TOXIC_SPIKES)
|
&& (gSideTimers[gBattlerAttacker].toxicSpikesAmount != 2)
|
||||||
&& IsBattlerAlive(gBattlerTarget))
|
&& IsBattlerAlive(gBattlerTarget))
|
||||||
{
|
{
|
||||||
gBattlerTarget = gBattlerAttacker;
|
SWAP(gBattlerAttacker, gBattlerTarget, i);
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
gBattlescriptCurrInstr = BattleScript_ToxicDebrisActivates;
|
gBattlescriptCurrInstr = BattleScript_ToxicDebrisActivates;
|
||||||
effect++;
|
effect++;
|
||||||
|
96
test/battle/ability/toxic_debris.c
Normal file
96
test/battle/ability/toxic_debris.c
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "test/battle.h"
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Toxic Debris sets Toxic Spikes on the opposing side if hit by a physical attack")
|
||||||
|
{
|
||||||
|
u32 move;
|
||||||
|
|
||||||
|
PARAMETRIZE { move = MOVE_TACKLE;}
|
||||||
|
PARAMETRIZE { move = MOVE_SWIFT;}
|
||||||
|
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_TOXIC_DEBRIS); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(opponent, move); }
|
||||||
|
} SCENE {
|
||||||
|
if (move == MOVE_TACKLE) {
|
||||||
|
ABILITY_POPUP(player, ABILITY_TOXIC_DEBRIS);
|
||||||
|
MESSAGE("Poison Spikes were scattered all around the opposing team's feet!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
NOT ABILITY_POPUP(player, ABILITY_TOXIC_DEBRIS);
|
||||||
|
NOT MESSAGE("Poison Spikes were scattered all around the opposing team's feet!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Toxic Debris does not activate if two layers of Toxic Spikes are already up")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_TOXIC_DEBRIS); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(opponent, MOVE_TACKLE); }
|
||||||
|
TURN { MOVE(opponent, MOVE_TACKLE); }
|
||||||
|
TURN { MOVE(opponent, MOVE_TACKLE); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
|
||||||
|
ABILITY_POPUP(player, ABILITY_TOXIC_DEBRIS);
|
||||||
|
MESSAGE("Poison Spikes were scattered all around the opposing team's feet!");
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
|
||||||
|
ABILITY_POPUP(player, ABILITY_TOXIC_DEBRIS);
|
||||||
|
MESSAGE("Poison Spikes were scattered all around the opposing team's feet!");
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
|
||||||
|
NOT ABILITY_POPUP(player, ABILITY_TOXIC_DEBRIS);
|
||||||
|
NOT MESSAGE("Poison Spikes were scattered all around the opposing team's feet!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("If a Substitute is hit, Toxic Debris does not set Toxic Spikes")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_TOXIC_DEBRIS); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_SUBSTITUTE); }
|
||||||
|
TURN { MOVE(opponent, MOVE_TACKLE); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_SUBSTITUTE, player);
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
|
||||||
|
NOT ABILITY_POPUP(player, ABILITY_TOXIC_DEBRIS);
|
||||||
|
NOT MESSAGE("Poison Spikes were scattered all around the opposing team's feet!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Each hit of a Multi Hit move activates Toxic Debris")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_TOXIC_DEBRIS); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(opponent, MOVE_FURY_SWIPES); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_FURY_SWIPES, opponent);
|
||||||
|
ABILITY_POPUP(player, ABILITY_TOXIC_DEBRIS);
|
||||||
|
MESSAGE("Poison Spikes were scattered all around the opposing team's feet!");
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_FURY_SWIPES, opponent);
|
||||||
|
ABILITY_POPUP(player, ABILITY_TOXIC_DEBRIS);
|
||||||
|
MESSAGE("Poison Spikes were scattered all around the opposing team's feet!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Air Balloon is popped after Toxic Debris activates")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_TOXIC_DEBRIS); Item(ITEM_AIR_BALLOON); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(opponent, MOVE_TACKLE); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
|
||||||
|
ABILITY_POPUP(player, ABILITY_TOXIC_DEBRIS);
|
||||||
|
MESSAGE("Poison Spikes were scattered all around the opposing team's feet!");
|
||||||
|
MESSAGE("Wobbuffet's Air Balloon popped!");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user