Attacks fail if PP is 0 before subtraction

This commit is contained in:
JappaWakka 2025-04-06 10:42:13 +02:00
parent 38c0d9368f
commit 57e7eb2935

View File

@ -35,14 +35,20 @@
If BattleScreen.FieldEffects.OwnUsedRandomMove = True Then If BattleScreen.FieldEffects.OwnUsedRandomMove = True Then
For Each a As Attack In Pokemon.Attacks For Each a As Attack In Pokemon.Attacks
If a.Name.ToLower = "metronome" OrElse a.IsGameModeMove AndAlso a.gmUseRandomMove = True Then If a.Name.ToLower = "metronome" OrElse a.IsGameModeMove AndAlso a.gmUseRandomMove = True Then
If a.CurrentPP > 0 Then
a.CurrentPP -= 1 a.CurrentPP -= 1
Exit For
End If
End If End If
Next Next
End If End If
If BattleScreen.FieldEffects.OwnUsedMirrorMove = True Then If BattleScreen.FieldEffects.OwnUsedMirrorMove = True Then
For Each a As Attack In Pokemon.Attacks For Each a As Attack In Pokemon.Attacks
If a.Name.ToLower = "mirror move" Then If a.Name.ToLower = "mirror move" Then
If a.CurrentPP > 0 Then
a.CurrentPP -= 1 a.CurrentPP -= 1
Exit For
End If
End If End If
Next Next
End If End If
@ -53,14 +59,20 @@
If BattleScreen.FieldEffects.OppUsedRandomMove = True Then If BattleScreen.FieldEffects.OppUsedRandomMove = True Then
For Each a As Attack In Pokemon.Attacks For Each a As Attack In Pokemon.Attacks
If a.Name.ToLower = "metronome" OrElse a.IsGameModeMove AndAlso a.gmUseRandomMove = True Then If a.Name.ToLower = "metronome" OrElse a.IsGameModeMove AndAlso a.gmUseRandomMove = True Then
If a.CurrentPP > 0 Then
a.CurrentPP -= 1 a.CurrentPP -= 1
Exit For
End If
End If End If
Next Next
End If End If
If BattleScreen.FieldEffects.OppUsedMirrorMove = True Then If BattleScreen.FieldEffects.OppUsedMirrorMove = True Then
For Each a As Attack In Pokemon.Attacks For Each a As Attack In Pokemon.Attacks
If a.Name.ToLower = "mirror move" Then If a.Name.ToLower = "mirror move" Then
If a.CurrentPP > 0 Then
a.CurrentPP -= 1 a.CurrentPP -= 1
Exit For
End If
End If End If
Next Next
End If End If
@ -1807,10 +1819,16 @@
BattleScreen.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & " used " & moveUsed.Name & "!")) BattleScreen.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & " used " & moveUsed.Name & "!"))
If moveUsed.DeductPP(own, BattleScreen) = True Then If moveUsed.DeductPP(own, BattleScreen) = True Then
If moveUsed.CurrentPP > 0 Then
moveUsed.CurrentPP -= 1 moveUsed.CurrentPP -= 1
If op.Ability.Name.ToLower() = "pressure" And moveUsed.CurrentPP > 0 Then If op.Ability.Name.ToLower() = "pressure" And moveUsed.CurrentPP > 0 Then
moveUsed.CurrentPP -= 1 moveUsed.CurrentPP -= 1
End If End If
Else
BattleScreen.BattleQuery.Add(New TextQueryObject("But it failed..."))
moveUsed.MoveMisses(own, BattleScreen)
Exit Sub
End If
End If End If
'If there's no opponent (opponent is fainted), skip to end of turn: 'If there's no opponent (opponent is fainted), skip to end of turn: