Fixed replace fainted pokémon twice bug

This commit is contained in:
JappaWakka 2023-02-26 16:05:47 +01:00
parent daef33a886
commit 022597262c
2 changed files with 20 additions and 16 deletions

View File

@ -676,8 +676,8 @@
If BattleScreen.OwnFaint Then If BattleScreen.OwnFaint Then
_mainMenuIndex = 0 _mainMenuIndex = 0
_mainMenuNextIndex = 0 _mainMenuNextIndex = 0
_mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 0, AddressOf MainMenuOpenPokemon))
If BattleScreen.IsRemoteBattle AndAlso Not BattleScreen.IsHost Then If BattleScreen.IsRemoteBattle AndAlso Not BattleScreen.IsHost Then
_mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 0, AddressOf MainMenuOpenPokemon))
BattleScreen.OwnFaint = False BattleScreen.OwnFaint = False
End If End If
ElseIf BattleScreen.OppFaint And BattleScreen.IsRemoteBattle Then ElseIf BattleScreen.OppFaint And BattleScreen.IsRemoteBattle Then
@ -1013,27 +1013,29 @@
Dim Pokemon As Pokemon = Core.Player.Pokemons(PokeIndex) Dim Pokemon As Pokemon = Core.Player.Pokemons(PokeIndex)
If PokeIndex = TempBattleScreen.OwnPokemonIndex Then If PokeIndex = TempBattleScreen.OwnPokemonIndex Then
Screen.TextBox.Show(Pokemon.GetDisplayName() & " is already~in battle!", {}, True, False) If Pokemon.Status <> P3D.Pokemon.StatusProblems.Fainted Then
Screen.TextBox.Show(Pokemon.GetDisplayName() & " is already~in battle!", {}, True, False)
Else
Screen.TextBox.Show(Pokemon.GetDisplayName() & " is fainted!", {}, True, False)
End If
Else Else
If Pokemon.IsEgg() = False Then If Pokemon.IsEgg() = False Then
If Pokemon.Status <> P3D.Pokemon.StatusProblems.Fainted Then If Pokemon.Status <> P3D.Pokemon.StatusProblems.Fainted Then
If BattleCalculation.CanSwitch(TempBattleScreen, True) = False Then If BattleCalculation.CanSwitch(TempBattleScreen, True) = False Then
Screen.TextBox.Show(Localization.GetString("battle_main_cannot_switch", "Cannot switch out."), {}, True, False) Screen.TextBox.Show(Localization.GetString("battle_main_cannot_switch", "Cannot switch out."), {}, True, False)
Else Else
If TempBattleScreen.OwnPokemonIndex <> PokeIndex Then If TempBattleScreen.IsRemoteBattle = True And TempBattleScreen.IsHost = False Then
If TempBattleScreen.IsRemoteBattle = True And TempBattleScreen.IsHost = False Then TempBattleScreen.OppFaint = False
TempBattleScreen.OppFaint = False TempBattleScreen.OwnStatistics.Switches += 1
TempBattleScreen.OwnStatistics.Switches += 1 TempBattleScreen.BattleQuery.Clear()
TempBattleScreen.BattleQuery.Clear() TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle())
TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle()) TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True)) TempBattleScreen.SendClientCommand("SWITCH|" & PokeIndex.ToString())
TempBattleScreen.SendClientCommand("SWITCH|" & PokeIndex.ToString()) Else
Else TempBattleScreen.BattleQuery.Clear()
TempBattleScreen.BattleQuery.Clear() TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle())
TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle()) TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True)) TempBattleScreen.Battle.InitializeRound(TempBattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Switch, .Argument = PokeIndex.ToString()})
TempBattleScreen.Battle.InitializeRound(TempBattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Switch, .Argument = PokeIndex.ToString()})
End If
End If End If
End If End If
Else Else

View File

@ -94,6 +94,7 @@
ClickHandler(Me) ClickHandler(Me)
End If End If
Me.Visible = False Me.Visible = False
Exit For
End If End If
If Controls.Dismiss(True, True, True) = True Then If Controls.Dismiss(True, True, True) = True Then
Me.Index = Me.BackIndex Me.Index = Me.BackIndex
@ -102,6 +103,7 @@
ClickHandler(Me) ClickHandler(Me)
End If End If
Me.Visible = False Me.Visible = False
Exit For
End If End If
Next Next
End If End If