P3D-Legacy/P3D/Battle/BattleSystemV2/BattleMenu.vb

1132 lines
58 KiB
VB.net
Raw Normal View History

2016-09-07 18:50:38 +02:00
Namespace BattleSystem
Public Class BattleMenu
Enum MenuStates
Main
Moves
End Enum
Public CanInteract As Boolean = True
2016-09-07 18:50:38 +02:00
Public MenuState As MenuStates = MenuStates.Main
Public Visible As Boolean = False
Public Sub New()
Me.Reset()
Dim blockinteractscreen() As Screen.Identifications = {Screen.Identifications.PartyScreen, Screen.Identifications.SummaryScreen, Screen.Identifications.PauseScreen, Screen.Identifications.ChatScreen}
If blockinteractscreen.Contains(Core.CurrentScreen.Identification) = True Then
CanInteract = False
Else
CanInteract = True
End If
2016-09-07 18:50:38 +02:00
End Sub
Public Sub Reset()
_moveMenuAlpha = 255
_moveMenuChoseMove = False
MenuState = MenuStates.Main
End Sub
Private Sub DrawWeather(ByVal BattleScreen As BattleScreen)
Dim y As Integer = -1
Dim x As Integer = 0
Dim t As String = ""
Select Case BattleScreen.FieldEffects.Weather
Case BattleWeather.WeatherTypes.Sunny
y = 0
t = "Sunny"
Case BattleWeather.WeatherTypes.Rain
y = 34
t = "Rain"
Case BattleWeather.WeatherTypes.Sandstorm
y = 68
t = "Sandstorm"
Case BattleWeather.WeatherTypes.Hailstorm
y = 102
t = "Hailstorm"
Case BattleWeather.WeatherTypes.Foggy
x = 88
y = 0
t = "Foggy"
Case BattleWeather.WeatherTypes.Snow
x = 88
y = 34
t = "Snow"
End Select
If y > -1 Then
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\WeatherIcons"), New Rectangle(22, Core.windowSize.Height - 90, 176, 68), New Rectangle(x, y, 88, 34), Color.White)
2023-01-15 19:26:05 +01:00
Core.SpriteBatch.DrawString(FontManager.MainFont, t, New Vector2(110 - FontManager.MainFont.MeasureString(t).X / 2, Core.windowSize.Height - 44), Color.Black)
End If
End Sub
Private Sub DrawTerrain(ByVal BattleScreen As BattleScreen)
Dim y As Integer = -1
Dim x As Integer = 0
Dim t As String = ""
With BattleScreen.FieldEffects
If .ElectricTerrain > 0 Then
x = 352
y = 0
t = "Electric Terrain"
End If
If .GrassyTerrain > 0 Then
x = 352
y = 34
t = "Grassy Terrain"
End If
If .MistyTerrain > 0 Then
x = 352
y = 68
t = "Misty Terrain"
End If
If .PsychicTerrain > 0 Then
x = 352
y = 102
t = "Psychic Terrain"
End If
End With
If y > -1 Then
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\WeatherIcons"), New Rectangle(222, Core.windowSize.Height - 90, 176, 68), New Rectangle(x, y, 88, 34), Color.White)
2023-01-15 19:26:05 +01:00
Core.SpriteBatch.DrawString(FontManager.MainFont, t, New Vector2(310 - FontManager.MainFont.MeasureString(t).X / 2, Core.windowSize.Height - 44), Color.Black)
2016-09-07 18:50:38 +02:00
End If
End Sub
Private Sub DrawPokemonStats(ByVal pos As Vector2, ByVal p As Pokemon, ByVal BattleScreen As BattleScreen, ByVal largeStatsDisplay As Boolean, ByVal DrawCaught As Boolean)
Dim shinyHue As Color = Color.White
If p.IsShiny = True Then
shinyHue = Color.Gold
End If
If _moveMenuChoseMove = True Then
shinyHue.A = CByte(_moveMenuAlpha.Clamp(0, 255))
End If
'Draw large stats:
If largeStatsDisplay = True Then
'Background
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X) + 14, CInt(pos.Y) + 14, 182, 42), New Rectangle(0, 0, 91, 21), shinyHue)
'Name:
Dim nameInformation As String = p.GetDisplayName() & " Lv. " & p.Level.ToString()
2023-01-15 19:26:05 +01:00
Core.SpriteBatch.DrawString(FontManager.MainFont, nameInformation, New Vector2(pos.X + 2, pos.Y + 2), New Color(0, 0, 0, _moveMenuAlpha))
Core.SpriteBatch.DrawString(FontManager.MainFont, nameInformation, New Vector2(pos.X, pos.Y), shinyHue)
2016-09-07 18:50:38 +02:00
'Gender:
If p.Gender = Pokemon.Genders.Male Then
2023-01-15 19:26:05 +01:00
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X + 6 + FontManager.MainFont.MeasureString(nameInformation).X), CInt(pos.Y), 12, 20), New Rectangle(0, 104, 6, 10), New Color(255, 255, 255, _moveMenuAlpha))
2016-09-07 18:50:38 +02:00
ElseIf p.Gender = Pokemon.Genders.Female Then
2023-01-15 19:26:05 +01:00
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X + 6 + FontManager.MainFont.MeasureString(nameInformation).X), CInt(pos.Y), 12, 20), New Rectangle(6, 104, 6, 10), New Color(255, 255, 255, _moveMenuAlpha))
2016-09-07 18:50:38 +02:00
End If
'HP indicator:
2023-01-15 19:26:05 +01:00
Core.SpriteBatch.DrawString(FontManager.MainFont, p.HP & "/" & p.MaxHP, New Vector2(pos.X + 102, pos.Y + 37 + 3), New Color(0, 0, 0, _moveMenuAlpha))
Core.SpriteBatch.DrawString(FontManager.MainFont, p.HP & "/" & p.MaxHP, New Vector2(pos.X + 100, pos.Y + 35 + 3), shinyHue)
2016-09-07 18:50:38 +02:00
'EXP Bar:
If BattleScreen.CanReceiveEXP = True Then
Dim NextLvExp As Integer = p.NeedExperience(p.Level + 1) - p.NeedExperience(p.Level)
Dim currentExp As Integer = p.Experience - p.NeedExperience(p.Level)
If p.Level = 1 Then
NextLvExp = p.NeedExperience(p.Level + 1)
currentExp = p.Experience
End If
Dim NeedExp As Integer = NextLvExp - currentExp
If p.Level = CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then
NextLvExp = 0
Else
Dim barPercentage As Integer = CInt((currentExp / NextLvExp) * 100)
If barPercentage > 0 Then
Dim EXPlength As Integer = CInt(Math.Ceiling(144 / 100 * barPercentage))
If currentExp = 0 Then
EXPlength = 0
Else
If EXPlength <= 0 Then
EXPlength = 1
End If
End If
If EXPlength = 144 Then
EXPlength = 143
End If
Dim t = TextureManager.GetTexture("GUI\Battle\Interface")
For dX As Integer = 0 To EXPlength Step 4
Core.SpriteBatch.Draw(t, New Rectangle(CInt(pos.X) + 50 + dX, CInt(pos.Y) + 54, 4, 6), New Rectangle(0, 43, 2, 3), New Color(255, 255, 255, _moveMenuAlpha))
Next
End If
End If
End If
Else 'Smaller stats display
'Background
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X) + 14, CInt(pos.Y) + 14, 182, 32), New Rectangle(0, 21, 91, 16), shinyHue)
'Name:
Dim nameInformation As String = p.GetDisplayName() & " Lv. " & p.Level.ToString()
2023-01-15 19:26:05 +01:00
Core.SpriteBatch.DrawString(FontManager.MainFont, nameInformation, New Vector2(pos.X + 2, pos.Y + 2), New Color(0, 0, 0, _moveMenuAlpha))
Core.SpriteBatch.DrawString(FontManager.MainFont, nameInformation, New Vector2(pos.X, pos.Y), shinyHue)
2016-09-07 18:50:38 +02:00
'Gender:
If p.Gender = Pokemon.Genders.Male Then
2023-01-15 19:26:05 +01:00
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X + 6 + FontManager.MainFont.MeasureString(nameInformation).X), CInt(pos.Y), 12, 20), New Rectangle(0, 104, 6, 10), New Color(255, 255, 255, _moveMenuAlpha))
2016-09-07 18:50:38 +02:00
ElseIf p.Gender = Pokemon.Genders.Female Then
2023-01-15 19:26:05 +01:00
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X + 6 + FontManager.MainFont.MeasureString(nameInformation).X), CInt(pos.Y), 12, 20), New Rectangle(6, 104, 6, 10), New Color(255, 255, 255, _moveMenuAlpha))
2016-09-07 18:50:38 +02:00
End If
End If
Dim HPpercentage As Single = (100.0F / p.MaxHP) * p.HP
Dim HPlength As Integer = CInt(Math.Ceiling(140 / 100 * HPpercentage.Clamp(1, 999)))
If p.HP = 0 Then
HPlength = 0
Else
If HPlength <= 0 Then
HPlength = 1
End If
End If
If p.HP = p.MaxHP Then
HPlength = 140
Else
If HPlength = 140 Then
HPlength = 139
End If
End If
Dim cX As Integer = 0
If HPpercentage <= 75.0F And HPpercentage > 25.0F Then
2016-09-07 18:50:38 +02:00
cX = 2
ElseIf HPpercentage <= 25.0F Then
2016-09-07 18:50:38 +02:00
cX = 4
End If
If HPlength > 0 Then
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X) + 54, CInt(pos.Y) + 26, 2, 12), New Rectangle(cX, 37, 1, 6), New Color(255, 255, 255, _moveMenuAlpha))
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X) + 2 + 54, CInt(pos.Y) + 26, HPlength - 4, 12), New Rectangle(cX + 1, 37, 1, 6), New Color(255, 255, 255, _moveMenuAlpha))
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X) + HPlength - 2 + 54, CInt(pos.Y) + 26, 2, 12), New Rectangle(cX, 37, 1, 6), New Color(255, 255, 255, _moveMenuAlpha))
End If
Dim caughtX As Integer = 0
Dim StatusTexture As Texture2D = BattleStats.GetStatImage(p.Status)
If Not StatusTexture Is Nothing Then
2018-10-22 05:20:08 +02:00
Core.SpriteBatch.Draw(StatusTexture, New Rectangle(CInt(pos.X) + 12, CInt(pos.Y) + 26, 38, 12), New Color(255, 255, 255, _moveMenuAlpha))
2016-09-07 18:50:38 +02:00
caughtX = -16
End If
If DrawCaught = True Then
2023-07-21 16:30:12 +02:00
Dim dexID As String = PokemonForms.GetPokemonDataFileName(p.Number, p.AdditionalData, True)
2023-07-12 20:09:06 +02:00
If Pokedex.GetEntryType(Core.Player.PokedexData, dexID) > 1 Then
2016-09-07 18:50:38 +02:00
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X) + caughtX, CInt(pos.Y) + 22, 20, 20), New Rectangle(0, 46, 10, 10), New Color(255, 255, 255, _moveMenuAlpha))
End If
End If
End Sub
Private Sub DrawPokeBalls(ByVal pos As Vector2, ByVal BattleScreen As BattleScreen, ByVal PokemonList As List(Of Pokemon), ByVal Mirrored As Boolean)
If Mirrored = True Then
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X), CInt(pos.Y), 160, 14), New Rectangle(128, 7, 80, 7), New Color(255, 255, 255, _moveMenuAlpha))
Else
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X), CInt(pos.Y), 160, 14), New Rectangle(128, 0, 80, 7), New Color(255, 255, 255, _moveMenuAlpha))
End If
Dim mouseHovers As Boolean = False
Dim startX As Integer = 12
If Mirrored = True Then
startX = 76
End If
For i = 0 To 5
Dim texturePos As Integer = 0
If PokemonList.Count - 1 >= i Then
Dim p As Pokemon = PokemonList(i)
If p.Status = Pokemon.StatusProblems.Fainted Then
texturePos = 10
ElseIf p.Status = Pokemon.StatusProblems.None Then
texturePos = 0
Else
texturePos = 30
End If
If MouseHandler.IsInRectangle(New Rectangle(CInt(pos.X) + startX + 12 * i, CInt(pos.Y) + 1, 10, 10)) = True And Mirrored = False And _moveMenuChoseMove = False Then
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X) + startX + 12 * i - 27, CInt(pos.Y) - 86, 64, 84), New Rectangle(128, 16, 32, 42), New Color(255, 255, 255, _mainMenuTeamPreviewAlpha))
Core.SpriteBatch.Draw(PokemonList(i).GetMenuTexture(True), New Rectangle(CInt(pos.X) + startX + 12 * i - 27, CInt(pos.Y) - 86, 64, 64), New Color(255, 255, 255, _mainMenuTeamPreviewAlpha))
If _mainMenuTeamPreviewAlpha < 255 Then
_mainMenuTeamPreviewAlpha += 25
If _mainMenuTeamPreviewAlpha > 255 Then
_mainMenuTeamPreviewAlpha = 255
End If
End If
_mainMenuTeamPreviewLastIndex = i
mouseHovers = True
End If
Else
texturePos = 20
End If
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X) + startX + 12 * i, CInt(pos.Y) + 1, 10, 10), New Rectangle(texturePos, 46, 10, 10), New Color(255, 255, 255, _moveMenuAlpha))
Next
If mouseHovers = False And Mirrored = False Then
If _mainMenuTeamPreviewAlpha > 0 Then
_mainMenuTeamPreviewAlpha -= 25
If _mainMenuTeamPreviewAlpha < 0 Then
_mainMenuTeamPreviewAlpha = 0
End If
If _mainMenuTeamPreviewLastIndex > -1 Then
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Battle\Interface"), New Rectangle(CInt(pos.X) + startX + 12 * _mainMenuTeamPreviewLastIndex - 27, CInt(pos.Y) - 86, 64, 84), New Rectangle(128, 16, 32, 42), New Color(255, 255, 255, _mainMenuTeamPreviewAlpha))
Core.SpriteBatch.Draw(PokemonList(_mainMenuTeamPreviewLastIndex).GetMenuTexture(True), New Rectangle(CInt(pos.X) + startX + 12 * _mainMenuTeamPreviewLastIndex - 27, CInt(pos.Y) - 86, 64, 64), New Color(255, 255, 255, _mainMenuTeamPreviewAlpha))
End If
End If
End If
End Sub
Public Sub Draw(ByVal BattleScreen As BattleScreen)
If BattleScreen.IsCurrentScreen() = True Then
DrawPokemonStats(New Vector2(50, 50), BattleScreen.OppPokemon, BattleScreen, False, Not BattleScreen.IsTrainerBattle)
If BattleScreen.BattleMode <> BattleScreen.BattleModes.Safari Then
DrawPokemonStats(New Vector2(Core.windowSize.Width - 280, Core.windowSize.Height - 100), BattleScreen.OwnPokemon, BattleScreen, True, False)
End If
DrawPokeBalls(New Vector2(Core.windowSize.Width - 292, Core.windowSize.Height - 112), BattleScreen, Core.Player.Pokemons, False)
If BattleScreen.IsTrainerBattle = True Then
DrawPokeBalls(New Vector2(38, 38), BattleScreen, BattleScreen.Trainer.Pokemons, True)
End If
Select Case MenuState
Case MenuStates.Main
DrawMainMenu(BattleScreen)
Case MenuStates.Moves
DrawMoveMenu(BattleScreen)
End Select
DrawWeather(BattleScreen)
DrawTerrain(BattleScreen)
2016-09-07 18:50:38 +02:00
End If
End Sub
Public Sub Update(ByRef BattleScreen As BattleScreen)
If CanInteract = True Then
Select Case MenuState
Case MenuStates.Main
UpdateMainMenu(BattleScreen)
Case MenuStates.Moves
UpdateMoveMenu(BattleScreen)
End Select
End If
2016-09-07 18:50:38 +02:00
End Sub
Private _allItemsExtended As Integer = 0
Private _selectedItemExtended As Integer = 0
Private _nextMenuState As MenuStates = MenuStates.Main
Private _retractMenu As Boolean = False
Private _isRetracting As Boolean = False
Private _isExtracting As Boolean = True
Private _moveMenuIndex As Integer = 0
Private _moveMenuNextIndex As Integer = 0
Private _moveMenuItemList As New List(Of MoveMenuItem)
Private _moveMenuCreatedID As String = ""
Private _moveMenuAlpha As Integer = 255
Private _moveMenuChoseMove As Boolean = False
Private _mainMenuIndex As Integer = 0
Private _mainMenuNextIndex As Integer = 0
Private _mainMenuItemList As New List(Of MainMenuItem)
2016-09-07 18:50:38 +02:00
Private _mainMenuTeamPreviewAlpha As Integer = 0
Private _mainMenuTeamPreviewLastIndex As Integer = -1
Public Delegate Sub D_MainMenuClick(ByVal BattleScreen As BattleScreen)
Public Delegate Sub D_MoveMenuClick(ByVal BattleScreen As BattleScreen)
Class MainMenuItem
Private IconSelected As Texture2D
Private IconUnselected As Texture2D
Private IconFading As Integer
Public Text As String
Public Index As Integer
Private Texture As Texture2D
Private ClickAction As D_MainMenuClick
Public Sub New(ByVal IconIndex As Integer, ByVal Text As String, ByVal Index As Integer, ByVal ClickAction As D_MainMenuClick)
2016-10-07 07:20:32 +02:00
If IconIndex > 4 Then
Me.IconUnselected = TextureManager.GetTexture("GUI\Battle\Interface", New Rectangle(160 + (IconIndex - 5) * 24, 56, 24, 24), "")
Me.IconSelected = TextureManager.GetTexture("GUI\Battle\Interface", New Rectangle(160 + (IconIndex - 5) * 24, 80, 24, 24), "")
Else
Me.IconUnselected = TextureManager.GetTexture("GUI\Battle\Interface", New Rectangle(IconIndex * 24, 56, 24, 24), "")
Me.IconSelected = TextureManager.GetTexture("GUI\Battle\Interface", New Rectangle(IconIndex * 24, 80, 24, 24), "")
End If
2016-09-07 18:50:38 +02:00
Me.IconFading = 0
Me.Text = Text
Me.Index = Index
Me.Texture = TextureManager.GetTexture("GUI\Menus\General")
Me.ClickAction = ClickAction
End Sub
Public Sub Draw(ByVal AllExtended As Integer, ByVal SelExtended As Integer, ByVal isSelected As Boolean)
Dim extraExtended As Integer = 0
If isSelected = True Then
Canvas.DrawGradient(New Rectangle(Core.ScreenSize.Width - 255, 100 + Index * 96, 255, 112), New Color(42, 167, 198, 0), New Color(42, 167, 198, (SelExtended + AllExtended)), True, -1)
extraExtended = SelExtended
End If
Core.SpriteBatch.Draw(Me.Texture, New Rectangle(Core.ScreenSize.Width - (AllExtended + extraExtended), 116 + Index * 96, 80, 80), New Rectangle(16, 16, 16, 16), Color.White)
Core.SpriteBatch.Draw(Me.Texture, New Rectangle(Core.ScreenSize.Width - (AllExtended + extraExtended) + 80, 116 + Index * 96, AllExtended + extraExtended - 80, 80), New Rectangle(32, 16, 16, 16), Color.White)
Core.SpriteBatch.Draw(Me.IconUnselected, New Rectangle(Core.ScreenSize.Width - (AllExtended + extraExtended) + 28, 132 + Index * 96, 48, 48), Color.White)
If isSelected = True Then
Core.SpriteBatch.Draw(Me.IconSelected, New Rectangle(Core.ScreenSize.Width - (AllExtended + extraExtended) + 28, 132 + Index * 96, 48, 48), New Color(255, 255, 255, (SelExtended + AllExtended)))
Core.SpriteBatch.DrawString(FontManager.MainFont, Me.Text, New Vector2(CInt(Core.ScreenSize.Width - (AllExtended + extraExtended) + 86), CInt(144 + Index * 96)), New Color(0, 0, 0, (SelExtended + AllExtended)))
2016-09-07 18:50:38 +02:00
Else
If IconFading > 0 Then
Core.SpriteBatch.Draw(Me.IconSelected, New Rectangle(Core.ScreenSize.Width - (AllExtended) + 28, 132 + Index * 96, 48, 48), New Color(255, 255, 255, IconFading))
End If
End If
End Sub
Public Sub Update(ByVal BattleScreen As BattleScreen, ByVal AllExtended As Integer, ByVal isSelected As Boolean)
Me.Activate(BattleScreen, AllExtended, isSelected)
If isSelected = False Then
If MouseHandler.IsInRectangle(New Rectangle(Core.ScreenSize.Width - (AllExtended) + 28, 132 + Index * 96, 48, 48)) = True Then
If IconFading < 255 Then
IconFading += 15
If IconFading > 255 Then
IconFading = 255
End If
End If
Else
If IconFading > 0 Then
IconFading -= 15
If IconFading < 0 Then
IconFading = 0
End If
End If
End If
Else
IconFading = 255
End If
End Sub
Public Sub Activate(ByVal BattleScreen As BattleScreen, ByVal AllExtended As Integer, ByVal isSelected As Boolean)
If BattleScreen.BattleMenu._isExtracting = False And BattleScreen.BattleMenu._isRetracting = False Then
If Controls.Accept(False, True, True) = True And isSelected = True Then
Fix audio engine & contentpacks (#35) * Replaced existing Gen 2 SFX with better sounding ones (no ugly reverb) Replaced MediaPlayer with NAudio(and NAudio.Vorbis) for playing music in order to fix random stopping issues. The game now directly loads .ogg files instead of the .wma/.xnb combination from before. ContentPacks are now able to replace Music and SFX again (I haven't added a menu yet for choosing ContentPacks). To make older GameModes work with current versions, you can add the GameMode property EnterType and set it to "1", this will make the game use the older 2D NewGameScreen. * Delete GameController.vb * Add gamecontroller.vb back * Fix sfx missing * Battleintro doodle now doesn't loop anymore (for no trainer) Changed the shutter sound (aka Large Door sound) to something more large door-y Made the enter sound slightly louder The enter sound now plays when going through any warp to or from an indoor map (including falling through holes) The flying sound effect is played earlier in the animation after selecting a location Changed played sound effect when using the Escape Rope to "teleport" instead of "destroy" The bump noise now also plays when bumping into something in first person Fixed small gap between the end of the intro song and the start of the main song Replaced some songs with better songs * Fixed some more intro issues * Forgot to change a thing * Fixed an error where the main music would play, ignoring the muted musicmanager. * fix indenting in musicmanager * The music player will now only start playback on a new song if the music player is not muted, fixed the end time calculation of the intro of a song after muting, Music can't be unmuted now as long as a sound effect plays that stops the music. * Fixed league restplace position, fixed sound effects sharing the volume slider of the music, sound effects are now also muted when pressing M, changed music on/off popup to audio on/off, removed bump delay in first person, added more control on whether played songs should be looping or not. * Fixed some more scripts that turn on thirdperson mode but don't check if it was on before or set it back to what it was before afterwards, also fixed a small error in creditsscreen.vb. * Fixed indenting error in musicmanager.vb, fixed an error of mine where the loopsong parameter would be seen as the playintro parameter. * Added more music commands, added quite some menu select noises, will add more later * More select sound effects! * Fix music not resuming after soundeffect * Trainer using item now plays the single_heal soundeffect * Pokémon cries now sound louder * Possibly fixing crash when playing Pokémon cry at volume higher than 0.71 * Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720. * Sound effects now sound louder * Revert "Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720." This reverts commit 8c9296ed1a82144d17f303a52c3f2e9e65a5bfea. * Fixed the cause of why the title screen music plays even when the game is muted * Tabs to spaces * Revert Co-authored-by: darkfire006 <blazer257@live.com> Co-authored-by: JappaWakkaP3D <66885565+JappaWakkaP3D@users.noreply.github.com> Co-authored-by: JappaWakkaP3D <jasper.speelman@outlook.com> Co-authored-by: Vitaly Mikhailov <personal@aragas.org>
2020-07-09 19:59:42 +02:00
SoundManager.PlaySound("select")
2016-09-07 18:50:38 +02:00
Me.ClickAction(BattleScreen)
End If
If Controls.Accept(True, False, False) = True Then
If MouseHandler.IsInRectangle(New Rectangle(Core.ScreenSize.Width - 255, 116 + Index * 96, 255, 80)) = True Then
If isSelected = True Then
Fix audio engine & contentpacks (#35) * Replaced existing Gen 2 SFX with better sounding ones (no ugly reverb) Replaced MediaPlayer with NAudio(and NAudio.Vorbis) for playing music in order to fix random stopping issues. The game now directly loads .ogg files instead of the .wma/.xnb combination from before. ContentPacks are now able to replace Music and SFX again (I haven't added a menu yet for choosing ContentPacks). To make older GameModes work with current versions, you can add the GameMode property EnterType and set it to "1", this will make the game use the older 2D NewGameScreen. * Delete GameController.vb * Add gamecontroller.vb back * Fix sfx missing * Battleintro doodle now doesn't loop anymore (for no trainer) Changed the shutter sound (aka Large Door sound) to something more large door-y Made the enter sound slightly louder The enter sound now plays when going through any warp to or from an indoor map (including falling through holes) The flying sound effect is played earlier in the animation after selecting a location Changed played sound effect when using the Escape Rope to "teleport" instead of "destroy" The bump noise now also plays when bumping into something in first person Fixed small gap between the end of the intro song and the start of the main song Replaced some songs with better songs * Fixed some more intro issues * Forgot to change a thing * Fixed an error where the main music would play, ignoring the muted musicmanager. * fix indenting in musicmanager * The music player will now only start playback on a new song if the music player is not muted, fixed the end time calculation of the intro of a song after muting, Music can't be unmuted now as long as a sound effect plays that stops the music. * Fixed league restplace position, fixed sound effects sharing the volume slider of the music, sound effects are now also muted when pressing M, changed music on/off popup to audio on/off, removed bump delay in first person, added more control on whether played songs should be looping or not. * Fixed some more scripts that turn on thirdperson mode but don't check if it was on before or set it back to what it was before afterwards, also fixed a small error in creditsscreen.vb. * Fixed indenting error in musicmanager.vb, fixed an error of mine where the loopsong parameter would be seen as the playintro parameter. * Added more music commands, added quite some menu select noises, will add more later * More select sound effects! * Fix music not resuming after soundeffect * Trainer using item now plays the single_heal soundeffect * Pokémon cries now sound louder * Possibly fixing crash when playing Pokémon cry at volume higher than 0.71 * Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720. * Sound effects now sound louder * Revert "Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720." This reverts commit 8c9296ed1a82144d17f303a52c3f2e9e65a5bfea. * Fixed the cause of why the title screen music plays even when the game is muted * Tabs to spaces * Revert Co-authored-by: darkfire006 <blazer257@live.com> Co-authored-by: JappaWakkaP3D <66885565+JappaWakkaP3D@users.noreply.github.com> Co-authored-by: JappaWakkaP3D <jasper.speelman@outlook.com> Co-authored-by: Vitaly Mikhailov <personal@aragas.org>
2020-07-09 19:59:42 +02:00
SoundManager.PlaySound("select")
2016-09-07 18:50:38 +02:00
Me.ClickAction(BattleScreen)
Else
BattleScreen.BattleMenu._mainMenuNextIndex = Me.Index
BattleScreen.BattleMenu._isRetracting = True
End If
End If
End If
End If
End Sub
End Class
Class MoveMenuItem
Private Move As Attack
Public Index As Integer = 0
Private Texture As Texture2D
Private ClickAction As D_MoveMenuClick
Public Sub New(ByVal Index As Integer, ByVal Move As Attack, ByVal ClickAction As D_MoveMenuClick)
Me.Index = Index
Me.Move = Move
Me.ClickAction = ClickAction
Me.Texture = TextureManager.GetTexture("GUI\Menus\General")
End Sub
Public Sub Draw(ByVal AllExtended As Integer, ByVal SelExtended As Integer, ByVal isSelected As Boolean, ByVal BattleScreen As BattleScreen)
Dim deductAlpha As Integer = 255 - BattleScreen.BattleMenu._moveMenuAlpha
Dim extraExtended As Integer = 0
If isSelected = True Then
Canvas.DrawGradient(New Rectangle(Core.ScreenSize.Width - 255, 100 + Index * 96, 255, 112), New Color(42, 167, 198, 0), New Color(42, 167, 198, (SelExtended + AllExtended) - deductAlpha), True, -1)
extraExtended = SelExtended
End If
Core.SpriteBatch.Draw(Me.Texture, New Rectangle(Core.ScreenSize.Width - (AllExtended + extraExtended), 116 + Index * 96, 80, 80), New Rectangle(16, 16, 16, 16), New Color(255, 255, 255, 255 - deductAlpha))
Core.SpriteBatch.Draw(Me.Texture, New Rectangle(Core.ScreenSize.Width - (AllExtended + extraExtended) + 80, 116 + Index * 96, AllExtended + extraExtended - 80, 80), New Rectangle(32, 16, 16, 16), New Color(255, 255, 255, 255 - deductAlpha))
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\Types", Me.Move.Type.GetElementImage(), ""), New Rectangle(Core.ScreenSize.Width - (AllExtended + extraExtended) + 28, 132 + Index * 96, 48, 16), New Color(255, 255, 255, 255 - deductAlpha))
If isSelected = True Then
If Move.Disabled > 0 Then
Core.SpriteBatch.DrawString(FontManager.MainFont, "Disabled!", New Vector2(CInt(Core.ScreenSize.Width - (AllExtended + extraExtended) + 28), CInt(152 + Index * 96)), Color.Black)
Else
Dim ppColor As Color = GetPPColor()
ppColor.A = CByte((extraExtended + AllExtended - deductAlpha).Clamp(0, 255))
2016-09-07 18:50:38 +02:00
Core.SpriteBatch.DrawString(FontManager.MainFont, Me.Move.CurrentPP & "/" & Me.Move.MaxPP, New Vector2(CInt(Core.ScreenSize.Width - (AllExtended + extraExtended) + 28), CInt(152 + Index * 96)), ppColor)
End If
Core.SpriteBatch.DrawString(FontManager.MainFont, Me.Move.Name, New Vector2(CInt(Core.ScreenSize.Width - (AllExtended + extraExtended) + 86), CInt(132 + Index * 96)), New Color(0, 0, 0, (SelExtended + AllExtended) - deductAlpha))
2016-09-07 18:50:38 +02:00
Else
Core.SpriteBatch.DrawString(FontManager.MainFont, Me.Move.Name, New Vector2(Core.ScreenSize.Width - (AllExtended + extraExtended) + 28, 152 + Index * 96), New Color(0, 0, 0, 255 - (extraExtended + AllExtended) - deductAlpha))
2016-09-07 18:50:38 +02:00
End If
End Sub
Private Function GetPPColor() As Color
Dim c As Color = Color.Black
Dim per As Integer = CInt((Me.Move.CurrentPP / Me.Move.MaxPP) * 100)
If per <= 50 And per > 25 Then
c = Color.Orange
ElseIf per <= 25 Then
c = Color.IndianRed
End If
Return c
End Function
Public Sub Update(ByVal BattleScreen As BattleScreen, ByVal AllExtended As Integer, ByVal isSelected As Boolean)
Me.Activate(BattleScreen, AllExtended, isSelected)
End Sub
Public Sub Activate(ByVal BattleScreen As BattleScreen, ByVal AllExtended As Integer, ByVal isSelected As Boolean)
If BattleScreen.BattleMenu._isExtracting = False And BattleScreen.BattleMenu._isRetracting = False Then
If Me.Move.CurrentPP > 0 Or isSelected = False Then
2016-09-07 18:50:38 +02:00
If Controls.Accept(False, True, True) = True And isSelected = True Then
Fix audio engine & contentpacks (#35) * Replaced existing Gen 2 SFX with better sounding ones (no ugly reverb) Replaced MediaPlayer with NAudio(and NAudio.Vorbis) for playing music in order to fix random stopping issues. The game now directly loads .ogg files instead of the .wma/.xnb combination from before. ContentPacks are now able to replace Music and SFX again (I haven't added a menu yet for choosing ContentPacks). To make older GameModes work with current versions, you can add the GameMode property EnterType and set it to "1", this will make the game use the older 2D NewGameScreen. * Delete GameController.vb * Add gamecontroller.vb back * Fix sfx missing * Battleintro doodle now doesn't loop anymore (for no trainer) Changed the shutter sound (aka Large Door sound) to something more large door-y Made the enter sound slightly louder The enter sound now plays when going through any warp to or from an indoor map (including falling through holes) The flying sound effect is played earlier in the animation after selecting a location Changed played sound effect when using the Escape Rope to "teleport" instead of "destroy" The bump noise now also plays when bumping into something in first person Fixed small gap between the end of the intro song and the start of the main song Replaced some songs with better songs * Fixed some more intro issues * Forgot to change a thing * Fixed an error where the main music would play, ignoring the muted musicmanager. * fix indenting in musicmanager * The music player will now only start playback on a new song if the music player is not muted, fixed the end time calculation of the intro of a song after muting, Music can't be unmuted now as long as a sound effect plays that stops the music. * Fixed league restplace position, fixed sound effects sharing the volume slider of the music, sound effects are now also muted when pressing M, changed music on/off popup to audio on/off, removed bump delay in first person, added more control on whether played songs should be looping or not. * Fixed some more scripts that turn on thirdperson mode but don't check if it was on before or set it back to what it was before afterwards, also fixed a small error in creditsscreen.vb. * Fixed indenting error in musicmanager.vb, fixed an error of mine where the loopsong parameter would be seen as the playintro parameter. * Added more music commands, added quite some menu select noises, will add more later * More select sound effects! * Fix music not resuming after soundeffect * Trainer using item now plays the single_heal soundeffect * Pokémon cries now sound louder * Possibly fixing crash when playing Pokémon cry at volume higher than 0.71 * Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720. * Sound effects now sound louder * Revert "Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720." This reverts commit 8c9296ed1a82144d17f303a52c3f2e9e65a5bfea. * Fixed the cause of why the title screen music plays even when the game is muted * Tabs to spaces * Revert Co-authored-by: darkfire006 <blazer257@live.com> Co-authored-by: JappaWakkaP3D <66885565+JappaWakkaP3D@users.noreply.github.com> Co-authored-by: JappaWakkaP3D <jasper.speelman@outlook.com> Co-authored-by: Vitaly Mikhailov <personal@aragas.org>
2020-07-09 19:59:42 +02:00
SoundManager.PlaySound("select")
If Me.Move.Disabled = 0 Then
Me.ClickAction(BattleScreen)
End If
2016-09-07 18:50:38 +02:00
End If
If Controls.Accept(True, False, False) = True Then
If MouseHandler.IsInRectangle(New Rectangle(Core.ScreenSize.Width - 255, 116 + Index * 96, 255, 80)) = True Then
If isSelected = True Then
Fix audio engine & contentpacks (#35) * Replaced existing Gen 2 SFX with better sounding ones (no ugly reverb) Replaced MediaPlayer with NAudio(and NAudio.Vorbis) for playing music in order to fix random stopping issues. The game now directly loads .ogg files instead of the .wma/.xnb combination from before. ContentPacks are now able to replace Music and SFX again (I haven't added a menu yet for choosing ContentPacks). To make older GameModes work with current versions, you can add the GameMode property EnterType and set it to "1", this will make the game use the older 2D NewGameScreen. * Delete GameController.vb * Add gamecontroller.vb back * Fix sfx missing * Battleintro doodle now doesn't loop anymore (for no trainer) Changed the shutter sound (aka Large Door sound) to something more large door-y Made the enter sound slightly louder The enter sound now plays when going through any warp to or from an indoor map (including falling through holes) The flying sound effect is played earlier in the animation after selecting a location Changed played sound effect when using the Escape Rope to "teleport" instead of "destroy" The bump noise now also plays when bumping into something in first person Fixed small gap between the end of the intro song and the start of the main song Replaced some songs with better songs * Fixed some more intro issues * Forgot to change a thing * Fixed an error where the main music would play, ignoring the muted musicmanager. * fix indenting in musicmanager * The music player will now only start playback on a new song if the music player is not muted, fixed the end time calculation of the intro of a song after muting, Music can't be unmuted now as long as a sound effect plays that stops the music. * Fixed league restplace position, fixed sound effects sharing the volume slider of the music, sound effects are now also muted when pressing M, changed music on/off popup to audio on/off, removed bump delay in first person, added more control on whether played songs should be looping or not. * Fixed some more scripts that turn on thirdperson mode but don't check if it was on before or set it back to what it was before afterwards, also fixed a small error in creditsscreen.vb. * Fixed indenting error in musicmanager.vb, fixed an error of mine where the loopsong parameter would be seen as the playintro parameter. * Added more music commands, added quite some menu select noises, will add more later * More select sound effects! * Fix music not resuming after soundeffect * Trainer using item now plays the single_heal soundeffect * Pokémon cries now sound louder * Possibly fixing crash when playing Pokémon cry at volume higher than 0.71 * Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720. * Sound effects now sound louder * Revert "Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720." This reverts commit 8c9296ed1a82144d17f303a52c3f2e9e65a5bfea. * Fixed the cause of why the title screen music plays even when the game is muted * Tabs to spaces * Revert Co-authored-by: darkfire006 <blazer257@live.com> Co-authored-by: JappaWakkaP3D <66885565+JappaWakkaP3D@users.noreply.github.com> Co-authored-by: JappaWakkaP3D <jasper.speelman@outlook.com> Co-authored-by: Vitaly Mikhailov <personal@aragas.org>
2020-07-09 19:59:42 +02:00
SoundManager.PlaySound("select")
If Me.Move.Disabled = 0 Then
Me.ClickAction(BattleScreen)
End If
2016-09-07 18:50:38 +02:00
Else
BattleScreen.BattleMenu._moveMenuNextIndex = Me.Index
BattleScreen.BattleMenu._isRetracting = True
End If
End If
End If
2016-09-07 18:50:38 +02:00
End If
End If
End Sub
End Class
Private Sub UpdateMenuOptions(ByRef MenuIndex As Integer, ByRef NextMenuIndex As Integer, ByVal ItemListCount As Integer)
Dim l_canSelect As Boolean = True
If _retractMenu = False Then
If _isRetracting = True Then
If _selectedItemExtended > 0 Then
_selectedItemExtended -= 40
If _selectedItemExtended <= 0 Then
_selectedItemExtended = 0
_isRetracting = False
MenuIndex = NextMenuIndex
_isExtracting = True
End If
End If
l_canSelect = False
ElseIf _isExtracting = True Then
2018-12-22 02:26:51 +01:00
If _selectedItemExtended < 200 Then
2016-09-07 18:50:38 +02:00
_selectedItemExtended += 40
2018-12-22 02:26:51 +01:00
If _selectedItemExtended >= 200 Then
_selectedItemExtended = 200
2016-09-07 18:50:38 +02:00
_isExtracting = False
End If
End If
l_canSelect = False
End If
End If
If _retractMenu = True Then
If _allItemsExtended > 0 Then
_allItemsExtended -= 5
_selectedItemExtended -= 40
If _allItemsExtended <= 0 Then
_allItemsExtended = 0
_selectedItemExtended = 0
_retractMenu = False
MenuState = _nextMenuState
_isExtracting = True
End If
End If
l_canSelect = False
ElseIf _allItemsExtended < 80 Then
_allItemsExtended += 5
l_canSelect = False
End If
If l_canSelect = True Then
If Controls.Down(True) = True Then
NextMenuIndex = MenuIndex + 1
If NextMenuIndex = ItemListCount Then
NextMenuIndex = 0
End If
_isRetracting = True
End If
If Controls.Up(True) = True Then
NextMenuIndex = MenuIndex - 1
If NextMenuIndex = -1 Then
NextMenuIndex = ItemListCount - 1
End If
_isRetracting = True
End If
End If
End Sub
#Region "MainMenu"
Private Sub DrawMainMenu(ByVal BattleScreen As BattleScreen)
For Each m As MainMenuItem In _mainMenuItemList
m.Draw(_allItemsExtended, _selectedItemExtended, (m.Index = _mainMenuIndex))
Next
End Sub
Private Sub UpdateMainMenu(ByRef BattleScreen As BattleScreen)
If BattleScreen.ClearMainMenuTime = True Then
_mainMenuItemList.Clear()
BattleScreen.ClearMainMenuTime = False
End If
2016-09-07 18:50:38 +02:00
If _mainMenuItemList.Count = 0 Then
CreateMainMenuItems(BattleScreen)
End If
Battle fixes and improvements * Fixed camera angle not changing to the Pokémon when status effects are doing something * Fixed softlock when opponent trainer switches Pokémon * (Hopefully) fixed initial positioning errors with spawned BattleAnimation entities related to BattleFlip functionality * Removed the now unneccessary BattleFlip checks in the move animation of Growl * Improved Ember move animation (fireball speed & flame delay) * Improved Poison Sting move animation by making the stinger smaller, increasing the speed of the stinger and making it use a flipped version of the texture when the opponent uses the move * Improved Poisoned status effect animation by making it 1 bubble for regular poison and 3 bubbles for toxic * Repositioned the flame of the Burned status effect animation * Trainers now display a message when sending out their Pokémon (I removed that before) * Fixed Party Screen not appearing immediately after the player's Pokémon fainted and also made the player unable to exit the Party Screen when that happens. * Fixed the incorrectly scaled font sizes and text alignment in the selection menu that appears when selecting a Pokémon in the Party screen * Replaced minifont in the Pokémon level up stats box with InGameFont and fixed the offsets * Fixed the error I made in the ceiling map code of Violet City's gym * Removed the file MoveAnimationQueryObject.vb because AnimationQueryObject.vb also includes Move Animations * Fixed the textbox in battles where an empty rectangle would appear before the animation finished. * When a trainer spots the player and an exclamation mark bubble pops up above their head, a sound is played (Emote_Exclamation) * In trainer battles, the player's Pokémon now also plays their cry.
2022-01-16 17:22:36 +01:00
If BattleScreen.OwnFaint = True Then
If BattleScreen.BattleQuery(0).QueryType <> QueryObject.QueryTypes.ScreenFade Then
TempBattleScreen = BattleScreen
Player.Temp.PokemonScreenIndex = BattleScreen.OwnPokemonIndex
Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf ShowPokemonMenu, "Choose Pokémon", False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = False}
Battle fixes and improvements * Fixed camera angle not changing to the Pokémon when status effects are doing something * Fixed softlock when opponent trainer switches Pokémon * (Hopefully) fixed initial positioning errors with spawned BattleAnimation entities related to BattleFlip functionality * Removed the now unneccessary BattleFlip checks in the move animation of Growl * Improved Ember move animation (fireball speed & flame delay) * Improved Poison Sting move animation by making the stinger smaller, increasing the speed of the stinger and making it use a flipped version of the texture when the opponent uses the move * Improved Poisoned status effect animation by making it 1 bubble for regular poison and 3 bubbles for toxic * Repositioned the flame of the Burned status effect animation * Trainers now display a message when sending out their Pokémon (I removed that before) * Fixed Party Screen not appearing immediately after the player's Pokémon fainted and also made the player unable to exit the Party Screen when that happens. * Fixed the incorrectly scaled font sizes and text alignment in the selection menu that appears when selecting a Pokémon in the Party screen * Replaced minifont in the Pokémon level up stats box with InGameFont and fixed the offsets * Fixed the error I made in the ceiling map code of Violet City's gym * Removed the file MoveAnimationQueryObject.vb because AnimationQueryObject.vb also includes Move Animations * Fixed the textbox in battles where an empty rectangle would appear before the animation finished. * When a trainer spots the player and an exclamation mark bubble pops up above their head, a sound is played (Emote_Exclamation) * In trainer battles, the player's Pokémon now also plays their cry.
2022-01-16 17:22:36 +01:00
AddHandler selScreen.SelectedObject, AddressOf ShowPokemonMenuHandler
Core.SetScreen(selScreen)
End If
End If
2016-09-07 18:50:38 +02:00
If _retractMenu = False Then
For Each m As MainMenuItem In _mainMenuItemList
m.Update(BattleScreen, _allItemsExtended, (m.Index = _mainMenuIndex))
Next
End If
UpdateMenuOptions(_mainMenuIndex, _mainMenuNextIndex, _mainMenuItemList.Count)
End Sub
Private Sub CreateMainMenuItems(ByRef BattleScreen As BattleScreen)
2016-09-07 18:50:38 +02:00
_mainMenuItemList.Clear()
Select Case BattleScreen.BattleMode
Case BattleSystem.BattleScreen.BattleModes.Safari
Dim safariBallText As String = "Safari Ball x" & Core.Player.Inventory.GetItemAmount(181.ToString).ToString()
If Core.Player.Inventory.GetItemAmount(181.ToString) = 0 Then
2016-09-07 18:50:38 +02:00
safariBallText = "No Safari Balls."
End If
_mainMenuItemList.Add(New MainMenuItem(4, safariBallText, 0, AddressOf MainMenuUseSafariBall))
_mainMenuItemList.Add(New MainMenuItem(0, "Throw Mud", 1, AddressOf MainMenuThrowMud))
_mainMenuItemList.Add(New MainMenuItem(0, "Throw Bait", 2, AddressOf MainMenuThrowBait))
_mainMenuItemList.Add(New MainMenuItem(3, "Run", 3, AddressOf MainMenuRun))
Case BattleSystem.BattleScreen.BattleModes.BugContest
_mainMenuItemList.Add(New MainMenuItem(0, "Battle", 0, AddressOf MainMenuOpenBattleMenu))
Dim sportBallText As String = "Sport Ball x" & Core.Player.Inventory.GetItemAmount(177.ToString).ToString()
If Core.Player.Inventory.GetItemAmount(177.ToString) = 0 Then
2016-09-07 18:50:38 +02:00
sportBallText = "No Sport Balls."
End If
_mainMenuItemList.Add(New MainMenuItem(4, sportBallText, 1, AddressOf MainMenuUseSportBall))
_mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 2, AddressOf MainMenuOpenPokemon))
_mainMenuItemList.Add(New MainMenuItem(3, "Run", 3, AddressOf MainMenuRun))
Case BattleSystem.BattleScreen.BattleModes.Standard
If BattleScreen.OwnFaint Then
_mainMenuIndex = 0
_mainMenuNextIndex = 0
2016-10-26 01:04:49 +02:00
If BattleScreen.IsRemoteBattle AndAlso Not BattleScreen.IsHost Then
_mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 0, AddressOf MainMenuOpenPokemon))
2016-10-26 01:04:49 +02:00
BattleScreen.OwnFaint = False
End If
ElseIf BattleScreen.OppFaint And BattleScreen.IsRemoteBattle Then
If BattleScreen.IsHost Then
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
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
2016-09-07 18:50:38 +02:00
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))
If BattleScreen.IsTrainerBattle = False Then
_mainMenuItemList.Add(New MainMenuItem(3, "Run", 3, AddressOf MainMenuRun))
MainMenuAddMegaEvolution(BattleScreen, 4)
Else
MainMenuAddMegaEvolution(BattleScreen, 3)
End If
2016-09-07 18:50:38 +02:00
End If
Case BattleSystem.BattleScreen.BattleModes.PVP
_mainMenuItemList.Add(New MainMenuItem(0, "Battle", 0, AddressOf MainMenuOpenBattleMenu))
_mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 1, AddressOf MainMenuOpenPokemon))
_mainMenuItemList.Add(New MainMenuItem(3, "Surrender", 2, AddressOf MainMenuOpenBag))
End Select
End Sub
Private Sub MainMenuAddMegaEvolution(ByVal BattleScreen As BattleScreen, ByVal Index As Integer)
'Checks if the player has the Mega Bracelet.
If Not (Core.Player.Inventory.GetItemAmount(576.ToString) > 0) Then
Exit Sub
End If
If _mainMenuIndex >= 3 Then
_mainMenuIndex = 0
End If
2018-03-26 04:05:39 +02:00
If BattleScreen.FieldEffects.OwnMegaEvolved Then
Exit Sub
End If
'For i = 0 To Core.Player.Pokemons.Count - 1
' Dim _str As String = Core.Player.Pokemons(i).AdditionalData
' Select Case _str
' Case "mega", "mega_x", "mega_y"
' Exit Sub
' Case Else
' 'do nothing
' End Select
'Next
2016-09-29 19:56:36 +02:00
Dim PokeIndex As Integer = BattleScreen.OwnPokemonIndex
2016-09-07 18:50:38 +02:00
If BattleScreen.FieldEffects.OwnMegaEvolved = False Then
If Core.Player.Pokemons(PokeIndex).Item IsNot Nothing Then
If Core.Player.Pokemons(PokeIndex).Item.IsGameModeItem = True Then
If Core.Player.Pokemons(PokeIndex).Item.gmIsMegaStone = True Then
If Core.Player.Pokemons(PokeIndex).Number = CType(Core.Player.Pokemons(PokeIndex).Item, GameModeItem).gmMegaPokemonNumber Then
_mainMenuItemList.Add(New MainMenuItem(5, "Mega Evolve!", Index, AddressOf MainMenuMegaEvolve))
End If
End If
Else
If Core.Player.Pokemons(PokeIndex).Item.IsMegaStone = True Then
Dim megaStone = CType(Core.Player.Pokemons(PokeIndex).Item, Items.MegaStone)
If megaStone.MegaPokemonNumber = Core.Player.Pokemons(PokeIndex).Number Then
_mainMenuItemList.Add(New MainMenuItem(5, "Mega Evolve!", Index, AddressOf MainMenuMegaEvolve))
End If
2016-09-07 18:50:38 +02:00
End If
End If
End If
End If
End Sub
#End Region
#Region "MainMenuActions"
Private Sub MainMenuOpenBattleMenu(ByVal BattleScreen As BattleScreen)
_retractMenu = True
_nextMenuState = MenuStates.Moves
BattleScreen.BattleQuery.Clear()
Dim q As New CameraQueryObject(New Vector3(11, 0.5F, 14.0F), New Vector3(11, 0.5F, 14.0F), Screen.Camera.Speed, Screen.Camera.Speed, -(CSng(MathHelper.PiOver4) + 0.3F), -(CSng(MathHelper.PiOver4) + 0.3F), -0.3F, -0.3F, 0.04F, 0.04F)
BattleScreen.BattleQuery.AddRange({q})
End Sub
Private Sub MainMenuOpenPokemon(ByVal BattleScreen As BattleScreen)
TempBattleScreen = BattleScreen
Player.Temp.PokemonScreenIndex = BattleScreen.OwnPokemonIndex
Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf ShowPokemonMenu, "Choose Pokémon", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ShowPokemonMenuHandler
Core.SetScreen(selScreen)
2016-09-07 18:50:38 +02:00
End Sub
Private Sub MainMenuOpenBag(ByVal BattleScreen As BattleScreen)
If BattleScreen.CanUseItems = True Then
TempBattleScreen = BattleScreen
Dim selScreen As New NewInventoryScreen(Core.CurrentScreen)
selScreen.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection
selScreen.CanExit = True
AddHandler selScreen.SelectedObject, AddressOf SelectedItemHandler
Core.SetScreen(selScreen)
2016-09-07 18:50:38 +02:00
End If
End Sub
Private Sub MainMenuRun(ByVal BattleScreen As BattleScreen)
If BattleCalculation.CanRun(True, BattleScreen) = True And BattleScreen.CanRun = True Then
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
BattleScreen.BattleQuery.Add(BattleScreen.FocusOwnPlayer())
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("Battle\running", False))
BattleScreen.BattleQuery.Add(New TextQueryObject("Got away safely!"))
BattleScreen.BattleQuery.Add(New EndBattleQueryObject(False))
Battle.Won = True
Battle.Fled = True
2016-09-07 18:50:38 +02:00
Else
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Add(BattleScreen.FocusBattle())
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
BattleScreen.Battle.InitializeRound(BattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Text, .Argument = "Failed to run away."})
End If
End Sub
Private Sub MainMenuUseSafariBall(ByVal BattleScreen As BattleScreen)
If Core.Player.Inventory.GetItemAmount(181.ToString) > 0 Then
Core.Player.Inventory.RemoveItem(181.ToString, 1)
2016-09-07 18:50:38 +02:00
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Add(BattleScreen.FocusBattle())
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
Core.SetScreen(New BattleCatchScreen(BattleScreen, Item.GetItemByID(181.ToString)))
2016-09-07 18:50:38 +02:00
Dim safariBallText As String = "Safari Ball x" & Core.Player.Inventory.GetItemAmount(181.ToString).ToString()
If Core.Player.Inventory.GetItemAmount(181.ToString) = 0 Then
2016-09-07 18:50:38 +02:00
safariBallText = "No Safari Balls."
End If
_mainMenuItemList(0).Text = safariBallText
End If
End Sub
Private Sub MainMenuUseSportBall(ByVal BattleScreen As BattleScreen)
If Core.Player.Inventory.GetItemAmount(177.ToString) > 0 Then
Core.Player.Inventory.RemoveItem(177.ToString, 1)
2016-09-07 18:50:38 +02:00
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Add(BattleScreen.FocusBattle())
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
Core.SetScreen(New BattleCatchScreen(BattleScreen, Item.GetItemByID(177.ToString)))
2016-09-07 18:50:38 +02:00
Dim sportBallText As String = "Sport Ball x" & Core.Player.Inventory.GetItemAmount(177.ToString).ToString()
If Core.Player.Inventory.GetItemAmount(177.ToString) = 0 Then
2016-09-07 18:50:38 +02:00
sportBallText = "No Sport Balls."
End If
_mainMenuItemList(0).Text = sportBallText
End If
End Sub
Private Sub MainMenuThrowMud(ByVal BattleScreen As BattleScreen)
If BattleScreen.PokemonSafariStatus > 0 Then
BattleScreen.PokemonSafariStatus = 0
End If
BattleScreen.PokemonSafariStatus -= Core.Random.Next(2, 5)
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Add(BattleScreen.FocusBattle())
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
BattleScreen.Battle.InitializeRound(BattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Text, .Argument = "Threw Mud at " & BattleScreen.OppPokemon.GetDisplayName() & "!"})
End Sub
Private Sub MainMenuThrowBait(ByVal BattleScreen As BattleScreen)
If BattleScreen.PokemonSafariStatus < 0 Then
BattleScreen.PokemonSafariStatus = 0
End If
BattleScreen.PokemonSafariStatus += Core.Random.Next(2, 5)
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Add(BattleScreen.FocusBattle())
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
BattleScreen.Battle.InitializeRound(BattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Text, .Argument = "Threw a Bait at " & BattleScreen.OppPokemon.GetDisplayName() & "!"})
End Sub
2016-09-29 19:56:36 +02:00
Private Sub MainMenuMegaEvolve(ByVal BattleScreen As BattleScreen)
2016-10-07 07:20:32 +02:00
_retractMenu = True
_nextMenuState = MenuStates.Moves
BattleScreen.BattleQuery.Clear()
Dim q As New CameraQueryObject(New Vector3(11, 0.5F, 14.0F), New Vector3(11, 0.5F, 14.0F), Screen.Camera.Speed, Screen.Camera.Speed, -(CSng(MathHelper.PiOver4) + 0.3F), -(CSng(MathHelper.PiOver4) + 0.3F), -0.3F, -0.3F, 0.04F, 0.04F)
BattleScreen.BattleQuery.AddRange({q})
2016-09-29 19:56:36 +02:00
BattleScreen.IsMegaEvolvingOwn = True
For i = 0 To Core.Player.Pokemons.Count - 1
Dim _additionalData As String = Core.Player.Pokemons(i).AdditionalData
Select Case _additionalData
Case "mega", "mega_x", "mega_y"
BattleScreen.IsMegaEvolvingOwn = False
Case Else
'do nothing
End Select
2016-09-29 19:56:36 +02:00
Next
End Sub
2016-09-07 18:50:38 +02:00
#End Region
#Region "MoveMenu"
Private Sub DrawMoveMenu(ByVal BattleScreen As BattleScreen)
For Each m As MoveMenuItem In _moveMenuItemList
m.Draw(_allItemsExtended, _selectedItemExtended, (m.Index = _moveMenuIndex), BattleScreen)
Next
End Sub
Private Sub UpdateMoveMenu(ByVal BattleScreen As BattleScreen)
If BattleScreen.ClearMoveMenuTime = True Then
_moveMenuItemList.Clear()
BattleScreen.ClearMoveMenuTime = False
End If
2016-09-07 18:50:38 +02:00
If _moveMenuChoseMove = True Then
_moveMenuAlpha -= 15
If _moveMenuAlpha <= 0 Then
_moveMenuAlpha = 0
MoveMenuStartRound(BattleScreen)
Visible = False
End If
Else
UseStruggle(BattleScreen)
2016-10-26 23:59:42 +02:00
If _moveMenuItemList.Count = 0 Or _moveMenuCreatedID <> BattleScreen.OwnPokemon.IndividualValue Or BattleScreen.IsChoiced Then
2016-09-07 18:50:38 +02:00
If _moveMenuCreatedID <> BattleScreen.OwnPokemon.IndividualValue Then
_moveMenuIndex = 0
End If
CreateMoveMenuItems(BattleScreen)
_moveMenuCreatedID = BattleScreen.OwnPokemon.IndividualValue
End If
If _retractMenu = False Then
For Each m As MoveMenuItem In _moveMenuItemList
m.Update(BattleScreen, _allItemsExtended, (m.Index = _moveMenuIndex))
Next
End If
UpdateMenuOptions(_moveMenuIndex, _moveMenuNextIndex, _moveMenuItemList.Count)
If Controls.Dismiss(True, True, True) = True And _retractMenu = False And _isExtracting = False And _isRetracting = False Then
Fix audio engine & contentpacks (#35) * Replaced existing Gen 2 SFX with better sounding ones (no ugly reverb) Replaced MediaPlayer with NAudio(and NAudio.Vorbis) for playing music in order to fix random stopping issues. The game now directly loads .ogg files instead of the .wma/.xnb combination from before. ContentPacks are now able to replace Music and SFX again (I haven't added a menu yet for choosing ContentPacks). To make older GameModes work with current versions, you can add the GameMode property EnterType and set it to "1", this will make the game use the older 2D NewGameScreen. * Delete GameController.vb * Add gamecontroller.vb back * Fix sfx missing * Battleintro doodle now doesn't loop anymore (for no trainer) Changed the shutter sound (aka Large Door sound) to something more large door-y Made the enter sound slightly louder The enter sound now plays when going through any warp to or from an indoor map (including falling through holes) The flying sound effect is played earlier in the animation after selecting a location Changed played sound effect when using the Escape Rope to "teleport" instead of "destroy" The bump noise now also plays when bumping into something in first person Fixed small gap between the end of the intro song and the start of the main song Replaced some songs with better songs * Fixed some more intro issues * Forgot to change a thing * Fixed an error where the main music would play, ignoring the muted musicmanager. * fix indenting in musicmanager * The music player will now only start playback on a new song if the music player is not muted, fixed the end time calculation of the intro of a song after muting, Music can't be unmuted now as long as a sound effect plays that stops the music. * Fixed league restplace position, fixed sound effects sharing the volume slider of the music, sound effects are now also muted when pressing M, changed music on/off popup to audio on/off, removed bump delay in first person, added more control on whether played songs should be looping or not. * Fixed some more scripts that turn on thirdperson mode but don't check if it was on before or set it back to what it was before afterwards, also fixed a small error in creditsscreen.vb. * Fixed indenting error in musicmanager.vb, fixed an error of mine where the loopsong parameter would be seen as the playintro parameter. * Added more music commands, added quite some menu select noises, will add more later * More select sound effects! * Fix music not resuming after soundeffect * Trainer using item now plays the single_heal soundeffect * Pokémon cries now sound louder * Possibly fixing crash when playing Pokémon cry at volume higher than 0.71 * Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720. * Sound effects now sound louder * Revert "Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720." This reverts commit 8c9296ed1a82144d17f303a52c3f2e9e65a5bfea. * Fixed the cause of why the title screen music plays even when the game is muted * Tabs to spaces * Revert Co-authored-by: darkfire006 <blazer257@live.com> Co-authored-by: JappaWakkaP3D <66885565+JappaWakkaP3D@users.noreply.github.com> Co-authored-by: JappaWakkaP3D <jasper.speelman@outlook.com> Co-authored-by: Vitaly Mikhailov <personal@aragas.org>
2020-07-09 19:59:42 +02:00
SoundManager.PlaySound("select")
2016-09-07 18:50:38 +02:00
_retractMenu = True
_nextMenuState = MenuStates.Main
BattleScreen.BattleQuery.Clear()
For i = 0 To 99
BattleScreen.InsertCasualCameramove()
Next
Dim fQ As CameraQueryObject = CType(BattleScreen.BattleQuery(0), CameraQueryObject)
Dim q As New CameraQueryObject(fQ.StartPosition, Screen.Camera.Position, 0.06F, 0.06F, fQ.StartYaw, Screen.Camera.Yaw, fQ.TargetPitch, Screen.Camera.Pitch, 0.06F, 0.06F)
BattleScreen.BattleQuery.Insert(0, q)
2016-10-07 07:20:32 +02:00
BattleScreen.IsMegaEvolvingOwn = False
2016-09-07 18:50:38 +02:00
End If
If BattleScreen.BattleQuery.Count = 0 Then
For i = 0 To 50
Dim q As New CameraQueryObject(New Vector3(11.5, 0.5F, 13.0F), Screen.Camera.Position, 0.001F, Screen.Camera.Yaw, Screen.Camera.Pitch)
Dim q1 As New CameraQueryObject(New Vector3(11, 0.5F, 14.0F), New Vector3(11.5, 0.5F, 13.0F), 0.001F, Screen.Camera.Yaw, Screen.Camera.Pitch)
BattleScreen.BattleQuery.AddRange({q, q1})
Next
End If
End If
End Sub
Private Sub CreateMoveMenuItems(ByVal BattleScreen As BattleScreen)
_moveMenuItemList.Clear()
For i = 0 To BattleScreen.OwnPokemon.Attacks.Count - 1
_moveMenuItemList.Add(New MoveMenuItem(i, BattleScreen.OwnPokemon.Attacks(i), AddressOf MoveMenuChooseMove))
Next
End Sub
Private Sub MoveMenuChooseMove(ByVal BattleScreen As BattleScreen)
_moveMenuChoseMove = True
_moveMenuAlpha = 255
End Sub
Private Sub MoveMenuStartRound(ByVal BattleScreen As BattleScreen)
If BattleScreen.IsRemoteBattle = True And BattleScreen.IsHost = False Then
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Add(BattleScreen.FocusBattle())
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
If BattleScreen.IsMegaEvolvingOwn Then
BattleScreen.SendClientCommand("MEGA|" & BattleScreen.OwnPokemon.Attacks(_moveMenuIndex).ID.ToString())
2016-10-25 03:17:57 +02:00
BattleScreen.IsMegaEvolvingOwn = False
2018-03-26 04:05:39 +02:00
BattleScreen.FieldEffects.OwnMegaEvolved = True
Else
BattleScreen.SendClientCommand("MOVE|" & BattleScreen.OwnPokemon.Attacks(_moveMenuIndex).ID.ToString())
End If
2016-09-07 18:50:38 +02:00
Else
2018-03-26 04:05:39 +02:00
If BattleScreen.IsMegaEvolvingOwn Then
BattleScreen.FieldEffects.OwnMegaEvolved = True
End If
2016-09-07 18:50:38 +02:00
BattleScreen.OwnStatistics.Moves += 1
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Add(BattleScreen.FocusBattle())
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
BattleScreen.Battle.InitializeRound(BattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Move, .Argument = BattleScreen.OwnPokemon.Attacks(_moveMenuIndex)})
End If
_moveMenuChoseMove = False
_moveMenuAlpha = 255
_moveMenuItemList.Clear()
End Sub
Private Sub UseStruggle(ByVal BattleScreen As BattleScreen)
If BattleScreen.OwnPokemon.CountPP() <= 0 Then 'Use Struggle
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Add(BattleScreen.FocusBattle())
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
BattleScreen.Battle.InitializeRound(BattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Move, .Argument = Attack.GetAttackByID(165)})
End If
End Sub
#End Region
#Region "SwitchPokemon"
Shared TempBattleScreen As BattleScreen
Private Shared Sub ShowPokemonMenuHandler(ByVal params As Object())
ShowPokemonMenu(CInt(params(0)))
End Sub
2016-09-07 18:50:38 +02:00
Private Shared Sub ShowPokemonMenu(ByVal PokeIndex As Integer)
SwitchPokemonTo(PokeIndex)
2016-09-07 18:50:38 +02:00
End Sub
Private Shared Sub SwitchPokemonTo(ByVal PokeIndex As Integer)
Dim Pokemon As Pokemon = Core.Player.Pokemons(PokeIndex)
If PokeIndex = TempBattleScreen.OwnPokemonIndex Then
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
2016-09-07 18:50:38 +02:00
Else
If Pokemon.IsEgg() = False Then
If Pokemon.Status <> P3D.Pokemon.StatusProblems.Fainted Then
2016-09-07 18:50:38 +02:00
If BattleCalculation.CanSwitch(TempBattleScreen, True) = False Then
Screen.TextBox.Show(Localization.GetString("battle_main_cannot_switch", "Cannot switch out."), {}, True, False)
2016-09-07 18:50:38 +02:00
Else
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()})
2016-09-07 18:50:38 +02:00
End If
End If
Else
Screen.TextBox.Show(Pokemon.GetDisplayName() & " is fainted!", {}, True, False)
End If
Else
Screen.TextBox.Show("Cannot switch in~the egg!", {}, True, False)
End If
End If
End Sub
#End Region
#Region "UseItem"
Private Shared Sub SelectedItemHandler(ByVal params As Object())
SelectedItem(CStr(params(0)))
End Sub
Private Shared Sub SelectedItem(ByVal itemID As String)
Dim Item As Item = Item.GetItemByID(itemID.ToString)
2016-09-07 18:50:38 +02:00
If Item.CanBeUsedInBattle = True Then
If Item.IsBall = True Then
Core.Player.Inventory.RemoveItem(itemID.ToString, 1)
2016-09-07 18:50:38 +02:00
If TempBattleScreen.IsTrainerBattle = False Then
If BattleScreen.CanCatch = True Or CBool(GameModeManager.GetGameRuleValue("OnlyCaptureFirst", "0")) = True And Core.Player.PokeFiles.Contains(BattleScreen.TempPokeFile) = True Then
TempBattleScreen.BattleQuery.Clear()
TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle())
TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
Core.SetScreen(New BattleCatchScreen(TempBattleScreen, Item.GetItemByID(itemID.ToString)))
2016-09-07 18:50:38 +02:00
PlayerStatistics.Track("[4]Poké Balls used", 1)
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.Text, .Argument = "The wild Pokémon blocked the Pokéball!"})
End If
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.Text, .Argument = "Hey! Don't be a thief!"})
End If
Else
TempItemID = itemID
If Item.BattleSelectPokemon = True Then
'Core.SetScreen(New PartyScreen(Core.CurrentScreen, Item, AddressOf UseItem, "Use " & Item.Name, True))
Dim selScreen = New PartyScreen(Core.CurrentScreen, Item, AddressOf Item.UseOnPokemon, "Use " & Item.Name, True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf UseItemHandler
Core.SetScreen(selScreen)
2016-09-07 18:50:38 +02:00
Else
UseItem(0)
End If
End If
End If
End Sub
Shared TempItemID As String = "-1"
2016-09-07 18:50:38 +02:00
Private Shared Sub UseItemHandler(ByVal params As Object())
UseItem(CInt(params(0)))
End Sub
2016-09-07 18:50:38 +02:00
Private Shared Sub UseItem(ByVal PokeIndex As Integer)
Dim Pokemon As Pokemon = Core.Player.Pokemons(PokeIndex)
2023-06-14 19:10:27 +02:00
Dim Item As Item = Item.GetItemByID(TempItemID)
2016-09-07 18:50:38 +02:00
If Item.UseOnPokemon(PokeIndex) = True Then
TempBattleScreen.BattleQuery.Clear()
2016-09-07 18:50:38 +02:00
TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle())
TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
TempBattleScreen.Battle.InitializeRound(TempBattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Item, .Argument = TempItemID.ToString()})
End If
End Sub
#End Region
End Class
End Namespace