Initial After Fainting Switching implementation
This commit is contained in:
parent
6221cf4806
commit
a328c279b0
|
@ -206,14 +206,12 @@
|
|||
End If
|
||||
|
||||
'Going to menu:
|
||||
BattleScreen.BattleQuery.Add(New ToggleMenuQueryObject(False))
|
||||
|
||||
If BattleScreen.IsRemoteBattle AndAlso BattleScreen.IsHost Then
|
||||
BattleScreen.BattleQuery.Add(New TriggerNewRoundPVPQueryObject())
|
||||
|
||||
BattleScreen.SendHostQuery()
|
||||
End If
|
||||
|
||||
BattleScreen.BattleQuery.Add(New ToggleMenuQueryObject(False))
|
||||
For i = 0 To 99
|
||||
BattleScreen.InsertCasualCameramove()
|
||||
Next
|
||||
|
@ -4072,10 +4070,20 @@
|
|||
|
||||
If .OwnPokemon.Status = Pokemon.StatusProblems.Fainted Or .OwnPokemon.HP <= 0 Then
|
||||
.OwnPokemon.Status = Pokemon.StatusProblems.Fainted
|
||||
BattleScreen.OwnFaint = True
|
||||
If BattleScreen.IsRemoteBattle AndAlso BattleScreen.IsHost Then
|
||||
Core.ServersManager.ServerConnection.SendPackage(New Servers.Package(Servers.Package.PackageTypes.BattleHostData,
|
||||
Core.ServersManager.ID, Servers.Package.ProtocolTypes.TCP, {BattleScreen.PartnerNetworkID.ToString(), "-HostFainted-"}.ToList()))
|
||||
End If
|
||||
SwitchOutOwn(BattleScreen, -1, -1)
|
||||
End If
|
||||
If .OppPokemon.Status = Pokemon.StatusProblems.Fainted Or .OppPokemon.HP <= 0 Then
|
||||
.OppPokemon.Status = Pokemon.StatusProblems.Fainted
|
||||
BattleScreen.OppFaint = True
|
||||
If BattleScreen.IsRemoteBattle AndAlso BattleScreen.IsHost Then
|
||||
Core.ServersManager.ServerConnection.SendPackage(New Servers.Package(Servers.Package.PackageTypes.BattleHostData,
|
||||
Core.ServersManager.ID, Servers.Package.ProtocolTypes.TCP, {BattleScreen.PartnerNetworkID.ToString(), "-ClientFainted-"}.ToList()))
|
||||
End If
|
||||
If BattleScreen.IsTrainerBattle = True Then
|
||||
If BattleScreen.Trainer.HasBattlePokemon() = True Then
|
||||
BattleScreen.FieldEffects.DefeatedTrainerPokemon = True
|
||||
|
@ -5683,7 +5691,11 @@
|
|||
BattleScreen.AddToQuery(InsertIndex, New ToggleEntityQueryObject(True, ToggleEntityQueryObject.BattleEntities.OwnPokemon, 2, -1, -1, -1, -1))
|
||||
|
||||
If Core.Player.CountFightablePokemon > 0 Then
|
||||
If BattleScreen.OwnFaint Then
|
||||
'Next pokemon sent by the player is decided via menu.
|
||||
Else
|
||||
SwitchInOwn(BattleScreen, SwitchInIndex, False, InsertIndex, message)
|
||||
End If
|
||||
Else
|
||||
If BattleScreen.IsTrainerBattle = True Then
|
||||
EndBattle(EndBattleReasons.LooseTrainer, BattleScreen, False)
|
||||
|
@ -6000,7 +6012,11 @@
|
|||
End If
|
||||
BattleScreen.BattleQuery.Add(New ToggleEntityQueryObject(True, ToggleEntityQueryObject.BattleEntities.OppPokemon, 2, -1, -1, -1, -1))
|
||||
|
||||
If BattleScreen.IsRemoteBattle And BattleScreen.OppFaint Then
|
||||
'Next pokemon is selected by the opponent.
|
||||
Else
|
||||
SwitchInOpp(BattleScreen, False, index)
|
||||
End If
|
||||
Else
|
||||
GainEXP(BattleScreen)
|
||||
|
||||
|
@ -6187,6 +6203,8 @@
|
|||
End Enum
|
||||
|
||||
Public Sub EndBattle(ByVal reason As EndBattleReasons, ByVal BattleScreen As BattleScreen, ByVal AddPVP As Boolean)
|
||||
BattleSystem.BattleScreen.OwnFaint = False
|
||||
BattleSystem.BattleScreen.OppFaint = False
|
||||
If AddPVP = True Then
|
||||
Select Case reason
|
||||
Case EndBattleReasons.WinTrainer 'Lost
|
||||
|
|
|
@ -271,7 +271,7 @@
|
|||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub Update(ByVal BattleScreen As BattleScreen)
|
||||
Public Sub Update(ByRef BattleScreen As BattleScreen)
|
||||
Select Case MenuState
|
||||
Case MenuStates.Main
|
||||
UpdateMainMenu(BattleScreen)
|
||||
|
@ -559,11 +559,13 @@
|
|||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateMainMenu(ByVal BattleScreen As BattleScreen)
|
||||
Private Sub UpdateMainMenu(ByRef BattleScreen As BattleScreen)
|
||||
|
||||
If BattleScreen.ClearMenuTime = True Then
|
||||
_mainMenuItemList.Clear()
|
||||
BattleScreen.ClearMenuTime = False
|
||||
End If
|
||||
|
||||
If _mainMenuItemList.Count = 0 Then
|
||||
CreateMainMenuItems(BattleScreen)
|
||||
End If
|
||||
|
@ -576,9 +578,8 @@
|
|||
UpdateMenuOptions(_mainMenuIndex, _mainMenuNextIndex, _mainMenuItemList.Count)
|
||||
End Sub
|
||||
|
||||
Private Sub CreateMainMenuItems(ByVal BattleScreen As BattleScreen)
|
||||
Private Sub CreateMainMenuItems(ByRef BattleScreen As BattleScreen)
|
||||
_mainMenuItemList.Clear()
|
||||
|
||||
Select Case BattleScreen.BattleMode
|
||||
Case BattleSystem.BattleScreen.BattleModes.Safari
|
||||
Dim safariBallText As String = "Safari Ball x" & Core.Player.Inventory.GetItemAmount(181).ToString()
|
||||
|
@ -603,6 +604,23 @@
|
|||
_mainMenuItemList.Add(New MainMenuItem(3, "Run", 3, AddressOf MainMenuRun))
|
||||
|
||||
Case BattleSystem.BattleScreen.BattleModes.Standard
|
||||
If BattleScreen.OwnFaint Then
|
||||
_mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 0, AddressOf MainMenuOpenPokemon))
|
||||
BattleScreen.OwnFaint = False
|
||||
ElseIf BattleScreen.OppFaint And BattleScreen.IsRemoteBattle Then
|
||||
If BattleScreen.IsHost Then
|
||||
BattleScreen.BattleQuery.Clear()
|
||||
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
|
||||
BattleScreen.OppFaint = False
|
||||
BattleScreen.Battle.InitializeRound(BattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Text, .Argument = "The client sends the next pokemon!"})
|
||||
Else
|
||||
BattleScreen.OwnStatistics.Switches += 1
|
||||
BattleScreen.BattleQuery.Clear()
|
||||
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
|
||||
BattleScreen.SendClientCommand("TEXT|" & "The host sends the next pokemon!")
|
||||
End If
|
||||
BattleScreen.OppFaint = False
|
||||
Else
|
||||
_mainMenuItemList.Add(New MainMenuItem(0, "Battle", 0, AddressOf MainMenuOpenBattleMenu))
|
||||
_mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 1, AddressOf MainMenuOpenPokemon))
|
||||
_mainMenuItemList.Add(New MainMenuItem(2, "Bag", 2, AddressOf MainMenuOpenBag))
|
||||
|
@ -613,6 +631,7 @@
|
|||
Else
|
||||
MainMenuAddMegaEvolution(BattleScreen, 3)
|
||||
End If
|
||||
End If
|
||||
|
||||
Case BattleSystem.BattleScreen.BattleModes.PVP
|
||||
_mainMenuItemList.Add(New MainMenuItem(0, "Battle", 0, AddressOf MainMenuOpenBattleMenu))
|
||||
|
|
|
@ -5,7 +5,12 @@
|
|||
|
||||
Inherits Screen
|
||||
|
||||
'Used for after fainting switching
|
||||
Public Shared OwnFaint As Boolean = False
|
||||
Public Shared OppFaint As Boolean = False
|
||||
|
||||
|
||||
'Used for lead picking in PvP Battles
|
||||
Public Shared OwnLeadIndex As Integer = 0
|
||||
Public Shared OppLeadIndex As Integer = 0
|
||||
|
||||
|
@ -1270,6 +1275,8 @@ nextIndex:
|
|||
Battle.Won = True
|
||||
EndBattle(False)
|
||||
PVPLobbyScreen.BattleSuccessful = False
|
||||
OwnFaint = False
|
||||
OppFaint = False
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
|
@ -1279,6 +1286,8 @@ nextIndex:
|
|||
Battle.Won = False
|
||||
EndBattle(False)
|
||||
PVPLobbyScreen.BattleSuccessful = False
|
||||
OwnFaint = False
|
||||
OppFaint = False
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
@ -1369,6 +1378,21 @@ nextIndex:
|
|||
Dim newQueries As New List(Of String)
|
||||
Dim tempData As String = ""
|
||||
Dim cData As String = data
|
||||
Dim s As Screen = Core.CurrentScreen
|
||||
While Not s.PreScreen Is Nothing And s.Identification <> Identifications.BattleScreen
|
||||
s = s.PreScreen
|
||||
End While
|
||||
If s.Identification = Identifications.BattleScreen Then
|
||||
If data = "-HostFainted-" Then
|
||||
OppFaint = True
|
||||
Exit Sub
|
||||
End If
|
||||
If data = "-ClientFainted-" Then
|
||||
OwnFaint = True
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
While cData.Length > 0
|
||||
If cData(0).ToString() = "|" AndAlso tempData(tempData.Length - 1).ToString() = "}" Then
|
||||
|
@ -1385,10 +1409,7 @@ nextIndex:
|
|||
tempData = ""
|
||||
End If
|
||||
|
||||
Dim s As Screen = Core.CurrentScreen
|
||||
While Not s.PreScreen Is Nothing And s.Identification <> Identifications.BattleScreen
|
||||
s = s.PreScreen
|
||||
End While
|
||||
|
||||
|
||||
If s.Identification = Identifications.BattleScreen Then
|
||||
CType(s, BattleScreen).BattleQuery.Clear()
|
||||
|
|
|
@ -603,6 +603,8 @@
|
|||
MusicManager.PlayMusic("lobby", False)
|
||||
Core.Player.Pokemons.Clear()
|
||||
Core.Player.Pokemons.AddRange(TempOriginalTeam.ToArray())
|
||||
BattleSystem.BattleScreen.OwnFaint = False
|
||||
BattleSystem.BattleScreen.OppFaint = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
@ -655,6 +657,8 @@
|
|||
Else
|
||||
PlayerStatistics.Track("PVP Losses", 1)
|
||||
End If
|
||||
BattleSystem.BattleScreen.OwnFaint = False
|
||||
BattleSystem.BattleScreen.OppFaint = False
|
||||
End Sub
|
||||
|
||||
Private Sub DrawBattleResults()
|
||||
|
|
Loading…
Reference in New Issue