Fix Damp loop

This commit is contained in:
DizzyEggg 2020-04-11 12:02:51 +02:00
parent 1435cd4692
commit 6daab7a5c9
2 changed files with 21 additions and 25 deletions

View File

@ -2169,6 +2169,7 @@ BattleScript_ExplosionLoop:
moveendto MOVEEND_NEXT_TARGET
jumpifnexttargetvalid BattleScript_ExplosionLoop
tryfaintmon BS_ATTACKER, FALSE, NULL
moveendcase MOVEEND_CLEAR_BITS
end
BattleScript_ExplosionMissed:
effectivenesssound
@ -6457,7 +6458,9 @@ BattleScript_DampStopsExplosion::
call BattleScript_AbilityPopUp
printstring STRINGID_PKMNPREVENTSUSAGE
pause 0x40
goto BattleScript_MoveEnd
moveendto MOVEEND_NEXT_TARGET
moveendcase MOVEEND_CLEAR_BITS
end
BattleScript_MoveHPDrain_PPLoss::
ppreduce

View File

@ -7850,33 +7850,26 @@ static void Cmd_faintifabilitynotdamp(void)
if (gBattleControllerExecFlags)
return;
for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++)
{
if (gBattleMons[gBattlerTarget].ability == ABILITY_DAMP)
break;
}
if (gBattlerTarget == gBattlersCount)
{
gActiveBattler = gBattlerAttacker;
gBattleMoveDamage = gBattleMons[gActiveBattler].hp;
BtlController_EmitHealthBarUpdate(0, INSTANT_HP_BAR_DROP);
MarkBattlerForControllerExec(gActiveBattler);
gBattlescriptCurrInstr++;
for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++)
{
if (gBattlerTarget == gBattlerAttacker)
continue;
if (!(gAbsentBattlerFlags & gBitTable[gBattlerTarget]))
break;
}
}
else
if ((gBattlerTarget = IsAbilityOnField(ABILITY_DAMP)))
{
gLastUsedAbility = ABILITY_DAMP;
RecordAbilityBattle(gBattlerTarget, gBattleMons[gBattlerTarget].ability);
RecordAbilityBattle(--gBattlerTarget, ABILITY_DAMP);
gBattlescriptCurrInstr = BattleScript_DampStopsExplosion;
return;
}
gActiveBattler = gBattlerAttacker;
gBattleMoveDamage = gBattleMons[gActiveBattler].hp;
BtlController_EmitHealthBarUpdate(0, INSTANT_HP_BAR_DROP);
MarkBattlerForControllerExec(gActiveBattler);
gBattlescriptCurrInstr++;
for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++)
{
if (gBattlerTarget == gBattlerAttacker)
continue;
if (IsBattlerAlive(gBattlerTarget))
break;
}
}