Fixes Neutralizing Gas crashes + adds missing interaction, Regenerator small fix (#5694)

This commit is contained in:
PhallenTree 2024-11-21 16:35:05 +00:00 committed by GitHub
parent 2f7116531b
commit 596b8b20f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 103 additions and 5 deletions

View file

@ -2401,7 +2401,6 @@ BattleScript_EffectHealingWish::
storehealingwish BS_ATTACKER storehealingwish BS_ATTACKER
.if B_HEALING_WISH_SWITCH <= GEN_4 .if B_HEALING_WISH_SWITCH <= GEN_4
openpartyscreen BS_ATTACKER, BattleScript_EffectHealingWishEnd openpartyscreen BS_ATTACKER, BattleScript_EffectHealingWishEnd
switchoutabilities BS_ATTACKER
waitstate waitstate
switchhandleorder BS_ATTACKER, 2 switchhandleorder BS_ATTACKER, 2
returnatktoball returnatktoball
@ -5764,7 +5763,6 @@ BattleScript_PrintFullBox::
BattleScript_ActionSwitch:: BattleScript_ActionSwitch::
hpthresholds2 BS_ATTACKER hpthresholds2 BS_ATTACKER
saveattacker
printstring STRINGID_RETURNMON printstring STRINGID_RETURNMON
jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_PursuitSwitchDmgSetMultihit jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_PursuitSwitchDmgSetMultihit
setmultihit 1 setmultihit 1
@ -5782,7 +5780,6 @@ BattleScript_DoSwitchOut::
switchoutabilities BS_ATTACKER switchoutabilities BS_ATTACKER
updatedynamax updatedynamax
waitstate waitstate
restoreattacker
returnatktoball returnatktoball
waitstate waitstate
drawpartystatussummary BS_ATTACKER drawpartystatussummary BS_ATTACKER
@ -9602,7 +9599,9 @@ BattleScript_EjectButtonActivates::
removeitem BS_SCRIPTING removeitem BS_SCRIPTING
makeinvisible BS_SCRIPTING makeinvisible BS_SCRIPTING
openpartyscreen BS_SCRIPTING, BattleScript_EjectButtonEnd openpartyscreen BS_SCRIPTING, BattleScript_EjectButtonEnd
copybyte sSAVED_BATTLER, sBATTLER
switchoutabilities BS_SCRIPTING switchoutabilities BS_SCRIPTING
copybyte sBATTLER, sSAVED_BATTLER
waitstate waitstate
switchhandleorder BS_SCRIPTING 0x2 switchhandleorder BS_SCRIPTING 0x2
returntoball BS_SCRIPTING, FALSE returntoball BS_SCRIPTING, FALSE
@ -9699,6 +9698,7 @@ BattleScript_PastelVeilEnd:
end3 end3
BattleScript_NeutralizingGasExits:: BattleScript_NeutralizingGasExits::
saveattacker
savetarget savetarget
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
printstring STRINGID_NEUTRALIZINGGASOVER printstring STRINGID_NEUTRALIZINGGASOVER
@ -9708,6 +9708,7 @@ BattleScript_NeutralizingGasExitsLoop:
switchinabilities BS_TARGET switchinabilities BS_TARGET
addbyte gBattlerTarget, 1 addbyte gBattlerTarget, 1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_NeutralizingGasExitsLoop jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_NeutralizingGasExitsLoop
restoreattacker
restoretarget restoretarget
return return

View file

@ -3976,6 +3976,15 @@ static void Cmd_tryfaintmon(void)
} }
else else
{ {
if (gBattleMons[battler].ability == ABILITY_NEUTRALIZING_GAS
&& !(gAbsentBattlerFlags & (1u << battler))
&& !IsBattlerAlive(battler))
{
gBattleMons[battler].ability = ABILITY_NONE;
BattleScriptPush(gBattlescriptCurrInstr);
gBattlescriptCurrInstr = BattleScript_NeutralizingGasExits;
return;
}
if (cmd->battler == BS_ATTACKER) if (cmd->battler == BS_ATTACKER)
{ {
destinyBondBattler = gBattlerTarget; destinyBondBattler = gBattlerTarget;
@ -14763,7 +14772,7 @@ static void Cmd_switchoutabilities(void)
MarkBattlerForControllerExec(battler); MarkBattlerForControllerExec(battler);
break; break;
case ABILITY_REGENERATOR: case ABILITY_REGENERATOR:
gBattleMoveDamage = GetNonDynamaxMaxHP(gBattlerAttacker) / 3; gBattleMoveDamage = GetNonDynamaxMaxHP(battler) / 3;
gBattleMoveDamage += gBattleMons[battler].hp; gBattleMoveDamage += gBattleMons[battler].hp;
if (gBattleMoveDamage > gBattleMons[battler].maxHP) if (gBattleMoveDamage > gBattleMons[battler].maxHP)
gBattleMoveDamage = gBattleMons[battler].maxHP; gBattleMoveDamage = gBattleMons[battler].maxHP;

View file

@ -246,7 +246,7 @@ DOUBLE_BATTLE_TEST("Intimidate is not going to trigger if a mon switches out thr
} }
} }
SINGLE_BATTLE_TEST("Intimidate activates when it's no longer effected by Neutralizing Gas") SINGLE_BATTLE_TEST("Intimidate activates when it's no longer effected by Neutralizing Gas - switching out")
{ {
GIVEN { GIVEN {
PLAYER(SPECIES_WEEZING) { Ability(ABILITY_NEUTRALIZING_GAS); } PLAYER(SPECIES_WEEZING) { Ability(ABILITY_NEUTRALIZING_GAS); }
@ -263,3 +263,91 @@ SINGLE_BATTLE_TEST("Intimidate activates when it's no longer effected by Neutral
SEND_IN_MESSAGE("Wobbuffet"); SEND_IN_MESSAGE("Wobbuffet");
} }
} }
SINGLE_BATTLE_TEST("Intimidate activates when it's no longer affected by Neutralizing Gas - switching moves")
{
u32 move;
PARAMETRIZE { move = MOVE_U_TURN; }
PARAMETRIZE { move = MOVE_HEALING_WISH; }
PARAMETRIZE { move = MOVE_BATON_PASS; }
GIVEN {
ASSUME(gMovesInfo[MOVE_U_TURN].effect == EFFECT_HIT_ESCAPE);
ASSUME(gMovesInfo[MOVE_HEALING_WISH].effect == EFFECT_HEALING_WISH);
ASSUME(gMovesInfo[MOVE_BATON_PASS].effect == EFFECT_BATON_PASS);
PLAYER(SPECIES_WEEZING) { Ability(ABILITY_NEUTRALIZING_GAS); }
PLAYER(SPECIES_WOBBUFFET) { HP(1); }
OPPONENT(SPECIES_ARBOK) { Ability(ABILITY_INTIMIDATE); }
} WHEN {
TURN { MOVE(player, move); SEND_OUT(player, 1); }
} SCENE {
ABILITY_POPUP(player, ABILITY_NEUTRALIZING_GAS);
MESSAGE("Neutralizing Gas filled the area!");
ANIMATION(ANIM_TYPE_MOVE, move, player);
MESSAGE("The effects of Neutralizing Gas wore off!");
ABILITY_POPUP(opponent, ABILITY_INTIMIDATE);
SEND_IN_MESSAGE("Wobbuffet");
} THEN {
if (move == MOVE_HEALING_WISH)
EXPECT_EQ(player->hp, player->maxHP);
}
}
SINGLE_BATTLE_TEST("Intimidate activates when it's no longer affected by Neutralizing Gas - opponent caused switches")
{
u32 move, item;
PARAMETRIZE { move = MOVE_TACKLE; item = ITEM_EJECT_BUTTON; }
PARAMETRIZE { move = MOVE_GROWL; item = ITEM_EJECT_PACK; }
PARAMETRIZE { move = MOVE_ROAR; item = ITEM_NONE; }
PARAMETRIZE { move = MOVE_DRAGON_TAIL; item = ITEM_NONE; }
GIVEN {
ASSUME(gItemsInfo[ITEM_EJECT_BUTTON].holdEffect == HOLD_EFFECT_EJECT_BUTTON);
ASSUME(gItemsInfo[ITEM_EJECT_PACK].holdEffect == HOLD_EFFECT_EJECT_PACK);
ASSUME(gMovesInfo[MOVE_GROWL].effect == EFFECT_ATTACK_DOWN);
ASSUME(gMovesInfo[MOVE_ROAR].effect == EFFECT_ROAR);
ASSUME(gMovesInfo[MOVE_DRAGON_TAIL].effect == EFFECT_HIT_SWITCH_TARGET);
PLAYER(SPECIES_WEEZING) { Ability(ABILITY_NEUTRALIZING_GAS); Item(item); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_ARBOK) { Ability(ABILITY_INTIMIDATE); }
} WHEN {
if (item != ITEM_NONE) {
TURN { MOVE(opponent, move); SEND_OUT(player, 1); }
} else {
TURN { MOVE(opponent, move); }
}
} SCENE {
ABILITY_POPUP(player, ABILITY_NEUTRALIZING_GAS);
MESSAGE("Neutralizing Gas filled the area!");
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
if (item != ITEM_NONE)
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
MESSAGE("The effects of Neutralizing Gas wore off!");
ABILITY_POPUP(opponent, ABILITY_INTIMIDATE);
if (item != ITEM_NONE) {
SEND_IN_MESSAGE("Wobbuffet");
} else {
MESSAGE("Wobbuffet was dragged out!");
}
}
}
SINGLE_BATTLE_TEST("Intimidate activates when it's no longer affected by Neutralizing Gas - fainted")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_FELL_STINGER].effect == EFFECT_FELL_STINGER);
PLAYER(SPECIES_WEEZING) { Ability(ABILITY_NEUTRALIZING_GAS); HP(1); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_ARBOK) { Ability(ABILITY_INTIMIDATE); }
} WHEN {
TURN { MOVE(opponent, MOVE_FELL_STINGER); SEND_OUT(player, 1); }
} SCENE {
ABILITY_POPUP(player, ABILITY_NEUTRALIZING_GAS);
MESSAGE("Neutralizing Gas filled the area!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_FELL_STINGER, opponent);
MESSAGE("The effects of Neutralizing Gas wore off!");
ABILITY_POPUP(opponent, ABILITY_INTIMIDATE);
MESSAGE("Weezing fainted!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
SEND_IN_MESSAGE("Wobbuffet");
}
}