From 022597262cfca232445ecf681f20d6d759a2a84c Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sun, 26 Feb 2023 16:05:47 +0100 Subject: [PATCH] =?UTF-8?q?Fixed=20replace=20fainted=20pok=C3=A9mon=20twic?= =?UTF-8?q?e=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- P3D/Battle/BattleSystemV2/BattleMenu.vb | 34 +++++++++++++------------ P3D/Input/UI/SelectMenu.vb | 2 ++ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/P3D/Battle/BattleSystemV2/BattleMenu.vb b/P3D/Battle/BattleSystemV2/BattleMenu.vb index 0c03ff457..e37923fb5 100644 --- a/P3D/Battle/BattleSystemV2/BattleMenu.vb +++ b/P3D/Battle/BattleSystemV2/BattleMenu.vb @@ -676,8 +676,8 @@ If BattleScreen.OwnFaint Then _mainMenuIndex = 0 _mainMenuNextIndex = 0 - _mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 0, AddressOf MainMenuOpenPokemon)) If BattleScreen.IsRemoteBattle AndAlso Not BattleScreen.IsHost Then + _mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 0, AddressOf MainMenuOpenPokemon)) BattleScreen.OwnFaint = False End If ElseIf BattleScreen.OppFaint And BattleScreen.IsRemoteBattle Then @@ -1013,27 +1013,29 @@ Dim Pokemon As Pokemon = Core.Player.Pokemons(PokeIndex) 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 If Pokemon.IsEgg() = False Then If Pokemon.Status <> P3D.Pokemon.StatusProblems.Fainted Then If BattleCalculation.CanSwitch(TempBattleScreen, True) = False Then Screen.TextBox.Show(Localization.GetString("battle_main_cannot_switch", "Cannot switch out."), {}, True, False) Else - If TempBattleScreen.OwnPokemonIndex <> PokeIndex Then - If TempBattleScreen.IsRemoteBattle = True And TempBattleScreen.IsHost = False Then - TempBattleScreen.OppFaint = False - TempBattleScreen.OwnStatistics.Switches += 1 - TempBattleScreen.BattleQuery.Clear() - TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle()) - TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True)) - TempBattleScreen.SendClientCommand("SWITCH|" & PokeIndex.ToString()) - Else - TempBattleScreen.BattleQuery.Clear() - TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle()) - TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True)) - TempBattleScreen.Battle.InitializeRound(TempBattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Switch, .Argument = PokeIndex.ToString()}) - End If + If TempBattleScreen.IsRemoteBattle = True And TempBattleScreen.IsHost = False Then + TempBattleScreen.OppFaint = False + TempBattleScreen.OwnStatistics.Switches += 1 + TempBattleScreen.BattleQuery.Clear() + TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle()) + TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True)) + TempBattleScreen.SendClientCommand("SWITCH|" & PokeIndex.ToString()) + Else + TempBattleScreen.BattleQuery.Clear() + TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle()) + TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True)) + TempBattleScreen.Battle.InitializeRound(TempBattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Switch, .Argument = PokeIndex.ToString()}) End If End If Else diff --git a/P3D/Input/UI/SelectMenu.vb b/P3D/Input/UI/SelectMenu.vb index eb751cc0b..353bbe741 100644 --- a/P3D/Input/UI/SelectMenu.vb +++ b/P3D/Input/UI/SelectMenu.vb @@ -94,6 +94,7 @@ ClickHandler(Me) End If Me.Visible = False + Exit For End If If Controls.Dismiss(True, True, True) = True Then Me.Index = Me.BackIndex @@ -102,6 +103,7 @@ ClickHandler(Me) End If Me.Visible = False + Exit For End If Next End If