Added lead pick for PvP matches

This commit is contained in:
CaptainSegis 2016-10-21 02:15:35 -05:00
parent 2490622091
commit 38c381f692
6 changed files with 160 additions and 16 deletions

View File

@ -1575,6 +1575,7 @@
<Compile Include="Screens\BattleIntroScreen.vb" /> <Compile Include="Screens\BattleIntroScreen.vb" />
<Compile Include="Screens\Battle\BattleCatchScreen.vb" /> <Compile Include="Screens\Battle\BattleCatchScreen.vb" />
<Compile Include="Screens\Battle\BattleGrowStatsScreen.vb" /> <Compile Include="Screens\Battle\BattleGrowStatsScreen.vb" />
<Compile Include="Screens\Battle\LeadPokemonInfoScreen.vb" />
<Compile Include="Screens\Battle\BattlePokemonInfoScreen.vb" /> <Compile Include="Screens\Battle\BattlePokemonInfoScreen.vb" />
<Compile Include="Screens\Battle\BlackOutScreen.vb" /> <Compile Include="Screens\Battle\BlackOutScreen.vb" />
<Compile Include="Screens\Credits\CreditsCamera.vb" /> <Compile Include="Screens\Credits\CreditsCamera.vb" />

View File

@ -2,8 +2,13 @@
Public Class BattleScreen Public Class BattleScreen
Inherits Screen Inherits Screen
Public Shared OwnLeadIndex As Integer = 0
Public Shared OppLeadIndex As Integer = 0
#Region "BattleValues" #Region "BattleValues"
Public ClearMenuTime As Boolean = False Public ClearMenuTime As Boolean = False
@ -337,6 +342,12 @@
End If End If
Next Next
Me.OwnPokemon = Core.Player.Pokemons(meIndex) Me.OwnPokemon = Core.Player.Pokemons(meIndex)
If IsPVPBattle Then
OwnPokemon = Core.Player.Pokemons(OwnLeadIndex)
OwnPokemonIndex = OwnLeadIndex
OppPokemon = Trainer.Pokemons(OppLeadIndex)
OppPokemonIndex = OppLeadIndex
End If
Me.IsTrainerBattle = True Me.IsTrainerBattle = True
Me.ParticipatedPokemon.Add(meIndex) Me.ParticipatedPokemon.Add(meIndex)
@ -421,8 +432,8 @@
Me.BattleQuery.AddRange({cq, q, q1, q2, q22, q3, q31, q4}) Me.BattleQuery.AddRange({cq, q, q1, q2, q22, q3, q31, q4})
Battle.SwitchInOwn(Me, meIndex, True, -1) Battle.SwitchInOwn(Me, meIndex, True, OwnPokemonIndex)
Battle.SwitchInOpp(Me, True, 0) Battle.SwitchInOpp(Me, True, OppPokemonIndex)
Me.BattleQuery.AddRange({cq1, q5, cq2}) Me.BattleQuery.AddRange({cq1, q5, cq2})
@ -1070,6 +1081,8 @@ nextIndex:
ResetVars() ResetVars()
Core.SetScreen(New TransitionScreen(Me, New BlackOutScreen(Me), Color.Black, False)) Core.SetScreen(New TransitionScreen(Me, New BlackOutScreen(Me), Color.Black, False))
End If End If
OwnLeadIndex = 0
OppLeadIndex = 0
End Sub End Sub
Public Sub ChangeSavedScreen() Public Sub ChangeSavedScreen()

View File

@ -286,12 +286,18 @@
Private Sub StartBattle() Private Sub StartBattle()
If Not Me.OwnTeam Is Nothing And Not OppTeam Is Nothing Then If Not Me.OwnTeam Is Nothing And Not OppTeam Is Nothing Then
Core.ServersManager.ServerConnection.SendPackage(New Servers.Package(Servers.Package.PackageTypes.BattleStart, Core.ServersManager.ID, Servers.Package.ProtocolTypes.TCP, PartnerNetworkID.ToString())) Core.SetScreen(New ChoosePokemonScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf LeadPickedStart, "Choose your lead.", True, True, False, _pokemonList:=OwnTeam))
If ReceivedBattleOffer = True Then End If
InitializeBattle() End Sub
Else
SentBattleOffer = True Private Sub LeadPickedStart(ByVal index As Integer)
End If BattleSystem.BattleScreen.OwnLeadIndex = index
Core.ServersManager.ServerConnection.SendPackage(New Servers.Package(Servers.Package.PackageTypes.BattleOffer,
Core.ServersManager.ID, Servers.Package.ProtocolTypes.TCP, {PartnerNetworkID.ToString(), CStr(index)}.ToList()))
If ReceivedBattleOffer = True Then
InitializeBattle()
Else
SentBattleOffer = True
End If End If
End Sub End Sub
@ -490,7 +496,8 @@
End If End If
End Sub End Sub
Public Shared Sub ReceiveBattleStart() Public Shared Sub ReceiveBattleStart(ByVal index As Integer)
BattleSystem.BattleScreen.OppLeadIndex = index
If IsLobbyScreen() = True Then If IsLobbyScreen() = True Then
If SentBattleOffer = True Then If SentBattleOffer = True Then
StartBattleRemote = True StartBattleRemote = True

View File

@ -203,7 +203,15 @@
End Sub End Sub
Private Shared Sub HandleBattleOffer(ByVal p As Package) Private Shared Sub HandleBattleOffer(ByVal p As Package)
PVPLobbyScreen.ReceiveOppTeam(p.DataItems(0)) 'Remove the whole "if" when server API is updated.
If p.DataItems(0).Length = 1 Then
PVPLobbyScreen.ReceiveBattleStart(CInt(p.DataItems(0)))
Else
PVPLobbyScreen.ReceiveOppTeam(p.DataItems(0))
End If
'PVPLobbyScreen.ReceiveOppTeam(p.DataItems(0))
End Sub End Sub
Private Shared Sub HandleBattleQuit(ByVal p As Package) Private Shared Sub HandleBattleQuit(ByVal p As Package)
@ -229,7 +237,7 @@
End Sub End Sub
Private Shared Sub HandleBattleStart(ByVal p As Package) Private Shared Sub HandleBattleStart(ByVal p As Package)
PVPLobbyScreen.ReceiveBattleStart() PVPLobbyScreen.ReceiveBattleStart(CInt(p.DataItems(0)))
End Sub End Sub
Private Shared Sub HandleBattleHostData(ByVal p As Package) Private Shared Sub HandleBattleHostData(ByVal p As Package)

View File

@ -0,0 +1,108 @@
Public Class LeadPokemonInfoScreen
Inherits Screen
Dim Pokemon As Pokemon
Dim index As Integer = 0
Dim mainTexture As Texture2D
Public Delegate Sub DoStuff(ByVal PokeIndex As Integer)
Dim ChoosePokemon As DoStuff
Dim pokeIndex As Integer = 0
Dim PokeSize As Integer = 128
Dim ItemSize As Integer = 0
Public Sub New(ByVal currentScreen As Screen, ByVal PokeIndex As Integer, ByVal ChoosePokemon As DoStuff)
Me.PreScreen = currentScreen
Me.Identification = Identifications.BattlePokemonScreen
Me.ChoosePokemon = ChoosePokemon
Me.pokeIndex = PokeIndex
Me.Pokemon = Core.Player.Pokemons(PokeIndex)
Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
Logger.Debug(currentScreen.Identification.ToString())
End Sub
Public Overrides Sub Update()
If Controls.Up(True, True, True, True) = True Then
Me.index -= 1
End If
If Controls.Down(True, True, True, True) = True Then
Me.index += 1
End If
If Me.index < 0 Then
Me.index = 2
ElseIf Me.index > 2 Then
Me.index = 0
End If
If PokeSize < 128 Then
PokeSize += 10
End If
If ItemSize > 0 Then
ItemSize -= 10
End If
If Controls.Dismiss(True, True) = True Then
Core.SetScreen(Me.PreScreen)
End If
If Controls.Accept(True, True) = True Then
Select Case index
Case 0
Core.SetScreen(Me.PreScreen)
Me.ChoosePokemon(Me.pokeIndex)
Case 1
Core.SetScreen(New PokemonStatusScreen(Me, Me.pokeIndex, {}, Core.Player.Pokemons(Me.pokeIndex), True))
Case 2
Core.SetScreen(Me.PreScreen)
End Select
End If
End Sub
Public Overrides Sub Draw()
PreScreen.Draw()
Canvas.DrawRectangle(New Rectangle(0, 0, Core.ScreenSize.Width, Core.ScreenSize.Height), New Color(0, 0, 0, 150))
DrawPreview()
DrawMenuPokemon()
End Sub
Private Sub DrawPreview() 'Draws the preview of the pokemon and it's holding item.
Dim T As Texture2D = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), "")
Canvas.DrawImageBorder(T, 2, New Rectangle(CInt(Core.windowSize.Width / 2) - 70, 48, 96, 96))
Core.SpriteBatch.Draw(Pokemon.GetTexture(True), New Rectangle(CInt(Core.windowSize.Width / 2) - 70, 32, PokeSize, PokeSize), Color.White)
If Not Pokemon.Item Is Nothing Then
Core.SpriteBatch.Draw(Pokemon.Item.Texture, New Rectangle(CInt(Core.windowSize.Width / 2) - 70, 64, ItemSize, ItemSize), Color.White)
End If
End Sub
Private Sub DrawMenuPokemon()
Dim T As Texture2D
For i = 0 To 2
Dim Text As String = "Pick"
Select Case i
Case 1
Text = "Summary"
Case 2
Text = "Back"
End Select
If i = index Then
T = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), "")
Else
T = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), "")
End If
Canvas.DrawImageBorder(T, 2, New Rectangle(CInt(Core.windowSize.Width / 2) - 180, 180 + 128 * i, 320, 64))
Core.SpriteBatch.DrawString(FontManager.InGameFont, Text, New Vector2(CInt(Core.windowSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(Text).X / 2) - 7, 215 + 128 * i), Color.Black)
Next
End Sub
End Class

View File

@ -3,6 +3,7 @@
Inherits Screen Inherits Screen
Private PokemonList As New List(Of Pokemon) Private PokemonList As New List(Of Pokemon)
Private AltPokemonList As New List(Of Pokemon)
Public Shared Selected As Integer = -1 Public Shared Selected As Integer = -1
Public Shared Exited As Boolean = False Public Shared Exited As Boolean = False
@ -29,7 +30,7 @@
Public LearnAttack As BattleSystem.Attack Public LearnAttack As BattleSystem.Attack
Public LearnType As Integer = 0 Public LearnType As Integer = 0
Public Sub New(ByVal currentScreen As Screen, ByVal Item As Item, ByVal ChoosePokemon As DoStuff, ByVal Title As String, ByVal canExit As Boolean, ByVal canChooseFainted As Boolean, ByVal canChooseEgg As Boolean) Public Sub New(ByVal currentScreen As Screen, ByVal Item As Item, ByVal ChoosePokemon As DoStuff, ByVal Title As String, ByVal canExit As Boolean, ByVal canChooseFainted As Boolean, ByVal canChooseEgg As Boolean, Optional ByVal _pokemonList As List(Of Pokemon) = Nothing)
Me.PreScreen = currentScreen Me.PreScreen = currentScreen
Me.Identification = Identifications.ChoosePokemonScreen Me.Identification = Identifications.ChoosePokemonScreen
@ -50,6 +51,7 @@
Me.index = Player.Temp.PokemonScreenIndex Me.index = Player.Temp.PokemonScreenIndex
Me.ChoosePokemon = ChoosePokemon Me.ChoosePokemon = ChoosePokemon
Me.AltPokemonList = _pokemonList
GetPokemonList() GetPokemonList()
End Sub End Sub
@ -63,10 +65,15 @@
End Sub End Sub
Private Sub GetPokemonList() Private Sub GetPokemonList()
Me.PokemonList.Clear() If AltPokemonList IsNot Nothing Then
For Each p As Pokemon In Core.Player.Pokemons For Each p As Pokemon In AltPokemonList
Me.PokemonList.Add(Pokemon.GetPokemonByData(p.GetSaveData())) Me.PokemonList.Add(Pokemon.GetPokemonByData(p.GetSaveData()))
Next Next
Else
For Each p As Pokemon In Core.Player.Pokemons
Me.PokemonList.Add(Pokemon.GetPokemonByData(p.GetSaveData()))
Next
End If
End Sub End Sub
Public Overrides Sub Update() Public Overrides Sub Update()