Initial After Fainting Switching implementation
This commit is contained in:
parent
6221cf4806
commit
a328c279b0
|
@ -206,14 +206,12 @@
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Going to menu:
|
'Going to menu:
|
||||||
BattleScreen.BattleQuery.Add(New ToggleMenuQueryObject(False))
|
|
||||||
|
|
||||||
If BattleScreen.IsRemoteBattle AndAlso BattleScreen.IsHost Then
|
If BattleScreen.IsRemoteBattle AndAlso BattleScreen.IsHost Then
|
||||||
BattleScreen.BattleQuery.Add(New TriggerNewRoundPVPQueryObject())
|
BattleScreen.BattleQuery.Add(New TriggerNewRoundPVPQueryObject())
|
||||||
|
|
||||||
BattleScreen.SendHostQuery()
|
BattleScreen.SendHostQuery()
|
||||||
End If
|
End If
|
||||||
|
BattleScreen.BattleQuery.Add(New ToggleMenuQueryObject(False))
|
||||||
For i = 0 To 99
|
For i = 0 To 99
|
||||||
BattleScreen.InsertCasualCameramove()
|
BattleScreen.InsertCasualCameramove()
|
||||||
Next
|
Next
|
||||||
|
@ -4072,10 +4070,20 @@
|
||||||
|
|
||||||
If .OwnPokemon.Status = Pokemon.StatusProblems.Fainted Or .OwnPokemon.HP <= 0 Then
|
If .OwnPokemon.Status = Pokemon.StatusProblems.Fainted Or .OwnPokemon.HP <= 0 Then
|
||||||
.OwnPokemon.Status = Pokemon.StatusProblems.Fainted
|
.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)
|
SwitchOutOwn(BattleScreen, -1, -1)
|
||||||
End If
|
End If
|
||||||
If .OppPokemon.Status = Pokemon.StatusProblems.Fainted Or .OppPokemon.HP <= 0 Then
|
If .OppPokemon.Status = Pokemon.StatusProblems.Fainted Or .OppPokemon.HP <= 0 Then
|
||||||
.OppPokemon.Status = Pokemon.StatusProblems.Fainted
|
.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.IsTrainerBattle = True Then
|
||||||
If BattleScreen.Trainer.HasBattlePokemon() = True Then
|
If BattleScreen.Trainer.HasBattlePokemon() = True Then
|
||||||
BattleScreen.FieldEffects.DefeatedTrainerPokemon = True
|
BattleScreen.FieldEffects.DefeatedTrainerPokemon = True
|
||||||
|
@ -5683,7 +5691,11 @@
|
||||||
BattleScreen.AddToQuery(InsertIndex, New ToggleEntityQueryObject(True, ToggleEntityQueryObject.BattleEntities.OwnPokemon, 2, -1, -1, -1, -1))
|
BattleScreen.AddToQuery(InsertIndex, New ToggleEntityQueryObject(True, ToggleEntityQueryObject.BattleEntities.OwnPokemon, 2, -1, -1, -1, -1))
|
||||||
|
|
||||||
If Core.Player.CountFightablePokemon > 0 Then
|
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)
|
SwitchInOwn(BattleScreen, SwitchInIndex, False, InsertIndex, message)
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
If BattleScreen.IsTrainerBattle = True Then
|
If BattleScreen.IsTrainerBattle = True Then
|
||||||
EndBattle(EndBattleReasons.LooseTrainer, BattleScreen, False)
|
EndBattle(EndBattleReasons.LooseTrainer, BattleScreen, False)
|
||||||
|
@ -6000,7 +6012,11 @@
|
||||||
End If
|
End If
|
||||||
BattleScreen.BattleQuery.Add(New ToggleEntityQueryObject(True, ToggleEntityQueryObject.BattleEntities.OppPokemon, 2, -1, -1, -1, -1))
|
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)
|
SwitchInOpp(BattleScreen, False, index)
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
GainEXP(BattleScreen)
|
GainEXP(BattleScreen)
|
||||||
|
|
||||||
|
@ -6187,6 +6203,8 @@
|
||||||
End Enum
|
End Enum
|
||||||
|
|
||||||
Public Sub EndBattle(ByVal reason As EndBattleReasons, ByVal BattleScreen As BattleScreen, ByVal AddPVP As Boolean)
|
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
|
If AddPVP = True Then
|
||||||
Select Case reason
|
Select Case reason
|
||||||
Case EndBattleReasons.WinTrainer 'Lost
|
Case EndBattleReasons.WinTrainer 'Lost
|
||||||
|
|
|
@ -271,7 +271,7 @@
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub Update(ByVal BattleScreen As BattleScreen)
|
Public Sub Update(ByRef BattleScreen As BattleScreen)
|
||||||
Select Case MenuState
|
Select Case MenuState
|
||||||
Case MenuStates.Main
|
Case MenuStates.Main
|
||||||
UpdateMainMenu(BattleScreen)
|
UpdateMainMenu(BattleScreen)
|
||||||
|
@ -559,11 +559,13 @@
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub UpdateMainMenu(ByVal BattleScreen As BattleScreen)
|
Private Sub UpdateMainMenu(ByRef BattleScreen As BattleScreen)
|
||||||
|
|
||||||
If BattleScreen.ClearMenuTime = True Then
|
If BattleScreen.ClearMenuTime = True Then
|
||||||
_mainMenuItemList.Clear()
|
_mainMenuItemList.Clear()
|
||||||
BattleScreen.ClearMenuTime = False
|
BattleScreen.ClearMenuTime = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If _mainMenuItemList.Count = 0 Then
|
If _mainMenuItemList.Count = 0 Then
|
||||||
CreateMainMenuItems(BattleScreen)
|
CreateMainMenuItems(BattleScreen)
|
||||||
End If
|
End If
|
||||||
|
@ -576,9 +578,8 @@
|
||||||
UpdateMenuOptions(_mainMenuIndex, _mainMenuNextIndex, _mainMenuItemList.Count)
|
UpdateMenuOptions(_mainMenuIndex, _mainMenuNextIndex, _mainMenuItemList.Count)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CreateMainMenuItems(ByVal BattleScreen As BattleScreen)
|
Private Sub CreateMainMenuItems(ByRef BattleScreen As BattleScreen)
|
||||||
_mainMenuItemList.Clear()
|
_mainMenuItemList.Clear()
|
||||||
|
|
||||||
Select Case BattleScreen.BattleMode
|
Select Case BattleScreen.BattleMode
|
||||||
Case BattleSystem.BattleScreen.BattleModes.Safari
|
Case BattleSystem.BattleScreen.BattleModes.Safari
|
||||||
Dim safariBallText As String = "Safari Ball x" & Core.Player.Inventory.GetItemAmount(181).ToString()
|
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))
|
_mainMenuItemList.Add(New MainMenuItem(3, "Run", 3, AddressOf MainMenuRun))
|
||||||
|
|
||||||
Case BattleSystem.BattleScreen.BattleModes.Standard
|
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(0, "Battle", 0, AddressOf MainMenuOpenBattleMenu))
|
||||||
_mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 1, AddressOf MainMenuOpenPokemon))
|
_mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 1, AddressOf MainMenuOpenPokemon))
|
||||||
_mainMenuItemList.Add(New MainMenuItem(2, "Bag", 2, AddressOf MainMenuOpenBag))
|
_mainMenuItemList.Add(New MainMenuItem(2, "Bag", 2, AddressOf MainMenuOpenBag))
|
||||||
|
@ -613,6 +631,7 @@
|
||||||
Else
|
Else
|
||||||
MainMenuAddMegaEvolution(BattleScreen, 3)
|
MainMenuAddMegaEvolution(BattleScreen, 3)
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
Case BattleSystem.BattleScreen.BattleModes.PVP
|
Case BattleSystem.BattleScreen.BattleModes.PVP
|
||||||
_mainMenuItemList.Add(New MainMenuItem(0, "Battle", 0, AddressOf MainMenuOpenBattleMenu))
|
_mainMenuItemList.Add(New MainMenuItem(0, "Battle", 0, AddressOf MainMenuOpenBattleMenu))
|
||||||
|
|
|
@ -5,7 +5,12 @@
|
||||||
|
|
||||||
Inherits Screen
|
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 OwnLeadIndex As Integer = 0
|
||||||
Public Shared OppLeadIndex As Integer = 0
|
Public Shared OppLeadIndex As Integer = 0
|
||||||
|
|
||||||
|
@ -1270,6 +1275,8 @@ nextIndex:
|
||||||
Battle.Won = True
|
Battle.Won = True
|
||||||
EndBattle(False)
|
EndBattle(False)
|
||||||
PVPLobbyScreen.BattleSuccessful = False
|
PVPLobbyScreen.BattleSuccessful = False
|
||||||
|
OwnFaint = False
|
||||||
|
OppFaint = False
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
|
@ -1279,6 +1286,8 @@ nextIndex:
|
||||||
Battle.Won = False
|
Battle.Won = False
|
||||||
EndBattle(False)
|
EndBattle(False)
|
||||||
PVPLobbyScreen.BattleSuccessful = False
|
PVPLobbyScreen.BattleSuccessful = False
|
||||||
|
OwnFaint = False
|
||||||
|
OppFaint = False
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
@ -1369,6 +1378,21 @@ nextIndex:
|
||||||
Dim newQueries As New List(Of String)
|
Dim newQueries As New List(Of String)
|
||||||
Dim tempData As String = ""
|
Dim tempData As String = ""
|
||||||
Dim cData As String = data
|
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
|
While cData.Length > 0
|
||||||
If cData(0).ToString() = "|" AndAlso tempData(tempData.Length - 1).ToString() = "}" Then
|
If cData(0).ToString() = "|" AndAlso tempData(tempData.Length - 1).ToString() = "}" Then
|
||||||
|
@ -1385,10 +1409,7 @@ nextIndex:
|
||||||
tempData = ""
|
tempData = ""
|
||||||
End If
|
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
|
If s.Identification = Identifications.BattleScreen Then
|
||||||
CType(s, BattleScreen).BattleQuery.Clear()
|
CType(s, BattleScreen).BattleQuery.Clear()
|
||||||
|
|
|
@ -603,6 +603,8 @@
|
||||||
MusicManager.PlayMusic("lobby", False)
|
MusicManager.PlayMusic("lobby", False)
|
||||||
Core.Player.Pokemons.Clear()
|
Core.Player.Pokemons.Clear()
|
||||||
Core.Player.Pokemons.AddRange(TempOriginalTeam.ToArray())
|
Core.Player.Pokemons.AddRange(TempOriginalTeam.ToArray())
|
||||||
|
BattleSystem.BattleScreen.OwnFaint = False
|
||||||
|
BattleSystem.BattleScreen.OppFaint = False
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
@ -655,6 +657,8 @@
|
||||||
Else
|
Else
|
||||||
PlayerStatistics.Track("PVP Losses", 1)
|
PlayerStatistics.Track("PVP Losses", 1)
|
||||||
End If
|
End If
|
||||||
|
BattleSystem.BattleScreen.OwnFaint = False
|
||||||
|
BattleSystem.BattleScreen.OppFaint = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub DrawBattleResults()
|
Private Sub DrawBattleResults()
|
||||||
|
|
Loading…
Reference in New Issue