Skip to content

Commit

Permalink
Fixes with Pledge combos and absorption abilities (#5364)
Browse files Browse the repository at this point in the history
* Fixes with Pledge combos and absorption moves

* Fixed incorrect merge

* Removed superflous if statement

---------

Co-authored-by: Hedara <[email protected]>
  • Loading branch information
hedara90 and Hedara authored Sep 10, 2024
1 parent 3aa46c3 commit c57d149
Show file tree
Hide file tree
Showing 2 changed files with 217 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -5313,13 +5313,15 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
}
if (caseID == ABILITYEFFECT_WOULD_ABSORB)
{
gBattleStruct->pledgeMove = FALSE;
if (effect && gLastUsedAbility != 0xFFFF)
RecordAbilityBattle(battler, gLastUsedAbility);

return effect;
}
else if (effect == 1) // Drain Hp ability.
{
gBattleStruct->pledgeMove = FALSE;
if (BATTLER_MAX_HP(battler) || (B_HEAL_BLOCKING >= GEN_5 && gStatuses3[battler] & STATUS3_HEAL_BLOCK))
{
if ((gProtectStructs[gBattlerAttacker].notFirstStrike))
Expand All @@ -5342,6 +5344,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
}
else if (effect == 2) // Boost Stat ability;
{
gBattleStruct->pledgeMove = FALSE;
if (!CompareStat(battler, statId, MAX_STAT_STAGE, CMP_LESS_THAN))
{
if ((gProtectStructs[gBattlerAttacker].notFirstStrike))
Expand All @@ -5363,6 +5366,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
}
else if (effect == 3)
{
gBattleStruct->pledgeMove = FALSE;
if (!(gBattleResources->flags->flags[battler] & RESOURCE_FLAG_FLASH_FIRE))
{
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FLASH_FIRE_BOOST;
Expand Down
213 changes: 213 additions & 0 deletions test/battle/move_effect/pledge.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,3 +836,216 @@ DOUBLE_BATTLE_TEST("Pledge move combo doesn't trigger on opponent's Pledge move
HP_BAR(opponentLeft);
}
}

DOUBLE_BATTLE_TEST("Pledge move combo doesn't trigger on opponent's Pledge move - Electrify")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_ELECTRIFY].effect == EFFECT_ELECTRIFY);
PLAYER(SPECIES_MAROWAK) { Ability(ABILITY_LIGHTNING_ROD); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(playerRight, MOVE_ELECTRIFY, target: opponentRight);
MOVE(opponentLeft, MOVE_GRASS_PLEDGE, target: playerLeft);
MOVE(opponentRight, MOVE_FIRE_PLEDGE, target: playerLeft);
MOVE(playerLeft, MOVE_WATER_PLEDGE, target: opponentRight); }
} SCENE {
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, playerLeft);
}
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, playerLeft);
HP_BAR(opponentRight);
}
}

DOUBLE_BATTLE_TEST("Pledge move combo doesn't trigger on opponent's Pledge move - Storm Drain")
{
GIVEN {
PLAYER(SPECIES_GASTRODON) { Ability(ABILITY_STORM_DRAIN); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(opponentLeft, MOVE_FIRE_PLEDGE, target: playerLeft);
MOVE(opponentRight, MOVE_WATER_PLEDGE, target: playerLeft);
MOVE(playerLeft, MOVE_GRASS_PLEDGE, target: opponentRight); }
} SCENE {
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, playerLeft);
}
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, playerLeft);
HP_BAR(opponentRight);
}
}

DOUBLE_BATTLE_TEST("Pledge move combo doesn't trigger on opponent's Pledge move - Sap Sipper")
{
GIVEN {
PLAYER(SPECIES_GOODRA) { Ability(ABILITY_SAP_SIPPER); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(opponentLeft, MOVE_WATER_PLEDGE, target: playerLeft);
MOVE(opponentRight, MOVE_GRASS_PLEDGE, target: playerLeft);
MOVE(playerLeft, MOVE_FIRE_PLEDGE, target: opponentRight); }
} SCENE {
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, playerLeft);
}
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, playerLeft);
HP_BAR(opponentRight);
}
}

DOUBLE_BATTLE_TEST("Pledge move combo doesn't trigger on opponent's Pledge move - Dry Skin")
{
GIVEN {
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(opponentLeft, MOVE_FIRE_PLEDGE, target: playerLeft);
MOVE(opponentRight, MOVE_WATER_PLEDGE, target: playerLeft);
MOVE(playerLeft, MOVE_GRASS_PLEDGE, target: opponentRight); }
} SCENE {
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, playerLeft);
}
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, playerLeft);
HP_BAR(opponentRight);
}
}

DOUBLE_BATTLE_TEST("Pledge move combo doesn't trigger on opponent's Pledge move - Flash Fire")
{
GIVEN {
PLAYER(SPECIES_HEATRAN) { Ability(ABILITY_FLASH_FIRE); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(opponentLeft, MOVE_GRASS_PLEDGE, target: playerLeft);
MOVE(opponentRight, MOVE_FIRE_PLEDGE, target: playerLeft);
MOVE(playerLeft, MOVE_WATER_PLEDGE, target: opponentRight); }
} SCENE {
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, playerLeft);
}
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, playerLeft);
HP_BAR(opponentRight);
}
}

DOUBLE_BATTLE_TEST("Pledge move combo doesn't trigger on opponent's Pledge move - Motor Drive")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_ELECTRIFY].effect == EFFECT_ELECTRIFY);
PLAYER(SPECIES_ELECTIVIRE) { Ability(ABILITY_MOTOR_DRIVE); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(playerRight, MOVE_ELECTRIFY, target: opponentRight);
MOVE(opponentLeft, MOVE_WATER_PLEDGE, target: playerLeft);
MOVE(opponentRight, MOVE_GRASS_PLEDGE, target: playerLeft);
MOVE(playerLeft, MOVE_FIRE_PLEDGE, target: opponentRight); }
} SCENE {
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, playerLeft);
}
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, playerLeft);
HP_BAR(opponentRight);
}
}

DOUBLE_BATTLE_TEST("Pledge move combo doesn't trigger on opponent's Pledge move - Volt Absorb")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_ELECTRIFY].effect == EFFECT_ELECTRIFY);
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(playerRight, MOVE_ELECTRIFY, target: opponentRight);
MOVE(opponentLeft, MOVE_WATER_PLEDGE, target: playerLeft);
MOVE(opponentRight, MOVE_GRASS_PLEDGE, target: playerLeft);
MOVE(playerLeft, MOVE_GRASS_PLEDGE, target: opponentRight); }
} SCENE {
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, playerLeft);
}
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, playerLeft);
HP_BAR(opponentRight);
}
}

DOUBLE_BATTLE_TEST("Pledge move combo doesn't trigger on opponent's Pledge move - Water Absorb")
{
GIVEN {
PLAYER(SPECIES_VAPOREON) { Ability(ABILITY_WATER_ABSORB); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(opponentLeft, MOVE_FIRE_PLEDGE, target: playerLeft);
MOVE(opponentRight, MOVE_WATER_PLEDGE, target: playerLeft);
MOVE(playerLeft, MOVE_GRASS_PLEDGE, target: opponentRight); }
} SCENE {
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, playerLeft);
}
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, playerLeft);
HP_BAR(opponentRight);
}
}

DOUBLE_BATTLE_TEST("Pledge move combo doesn't trigger on opponent's Pledge move - Well Baked Body")
{
GIVEN {
PLAYER(SPECIES_DACHSBUN) { Ability(ABILITY_WELL_BAKED_BODY); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(opponentLeft, MOVE_GRASS_PLEDGE, target: playerLeft);
MOVE(opponentRight, MOVE_FIRE_PLEDGE, target: playerLeft);
MOVE(playerLeft, MOVE_WATER_PLEDGE, target: opponentRight); }
} SCENE {
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, playerLeft);
}
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, playerLeft);
HP_BAR(opponentRight);
}
}

0 comments on commit c57d149

Please sign in to comment.