2016-09-07 18:50:38 +02:00
|
|
|
|
Public Class ChooseAttackScreen
|
|
|
|
|
|
|
|
|
|
Inherits Screen
|
|
|
|
|
|
|
|
|
|
Dim Pokemon As Pokemon
|
|
|
|
|
Dim mainTexture As Texture2D
|
|
|
|
|
|
|
|
|
|
Dim index As Integer = 0
|
|
|
|
|
|
|
|
|
|
Dim AttackIndex As Integer = 0
|
|
|
|
|
Dim AttackPos As Single = 320.0F
|
|
|
|
|
|
|
|
|
|
Dim canChooseHMMove As Boolean = True
|
|
|
|
|
Dim canExit As Boolean = True
|
|
|
|
|
|
|
|
|
|
Public Shared Selected As Integer = -1
|
|
|
|
|
Public Shared Exited As Boolean = False
|
|
|
|
|
Public Shared Chosen As Boolean = False
|
|
|
|
|
|
|
|
|
|
Public Delegate Sub ChoseAttack(ByVal Pokemon As Pokemon, ByVal AttackIndex As Integer)
|
|
|
|
|
|
|
|
|
|
Dim DoSub As ChoseAttack
|
|
|
|
|
|
|
|
|
|
Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As Pokemon, ByVal canChooseHmMove As Boolean, ByVal canExit As Boolean, ByVal DoSub As ChoseAttack)
|
|
|
|
|
Me.Identification = Identifications.ChooseAttackScreen
|
|
|
|
|
|
|
|
|
|
Me.MouseVisible = False
|
|
|
|
|
Me.CanBePaused = True
|
|
|
|
|
Me.CanMuteMusic = True
|
|
|
|
|
Me.CanChat = True
|
|
|
|
|
Me.CanTakeScreenshot = True
|
|
|
|
|
Me.CanDrawDebug = True
|
|
|
|
|
|
|
|
|
|
Me.PreScreen = currentScreen
|
|
|
|
|
Me.Pokemon = Pokemon
|
|
|
|
|
|
|
|
|
|
mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
|
|
|
|
|
|
|
|
|
|
Me.canChooseHMMove = canChooseHmMove
|
|
|
|
|
Me.canExit = canExit
|
|
|
|
|
|
|
|
|
|
Me.DoSub = DoSub
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Public Overrides Sub Update()
|
|
|
|
|
If TextBox.Showing = False Then
|
|
|
|
|
If Controls.Up(True, True, True, True) = True Then
|
|
|
|
|
Me.AttackIndex -= 1
|
|
|
|
|
End If
|
|
|
|
|
If Controls.Down(True, True, True, True) = True Then
|
|
|
|
|
Me.AttackIndex += 1
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Me.AttackIndex = CInt(MathHelper.Clamp(Me.AttackIndex, 0, Pokemon.Attacks.Count - 1))
|
|
|
|
|
|
|
|
|
|
If Controls.Accept() = 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
|
|
|
|
ClickYes()
|
|
|
|
|
End If
|
|
|
|
|
If Controls.Dismiss() = True Then
|
|
|
|
|
If canExit = 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
|
|
|
|
ClickNo()
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Public Overrides Sub Draw()
|
|
|
|
|
Me.PreScreen.Draw()
|
|
|
|
|
Canvas.DrawRectangle(Core.windowSize, New Color(0, 0, 0, 150))
|
|
|
|
|
Dim CanvasTexture As Texture2D = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), "")
|
|
|
|
|
|
|
|
|
|
Dim p As Vector2 = New Vector2(40, 50)
|
|
|
|
|
|
|
|
|
|
If Pokemon.Attacks.Count > 0 Then
|
|
|
|
|
Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(p.X + 432 - 352 + AttackPos), CInt(p.Y + 18), 288, 384))
|
|
|
|
|
|
|
|
|
|
Dim A As BattleSystem.Attack = Pokemon.Attacks(AttackIndex)
|
|
|
|
|
|
|
|
|
|
With Core.SpriteBatch
|
|
|
|
|
Dim fullText As String = A.Description
|
|
|
|
|
Dim t As String = ""
|
|
|
|
|
Dim i As Integer = 0
|
|
|
|
|
Dim n As String = ""
|
|
|
|
|
For i = 0 To fullText.Length - 1
|
|
|
|
|
Dim c As Char = CChar(fullText(i).ToString().Replace("’", "'"))
|
|
|
|
|
|
|
|
|
|
If c = CChar(" ") Then
|
|
|
|
|
If FontManager.MiniFont.MeasureString(n & c).X > 170 Then
|
2018-01-07 18:01:32 +01:00
|
|
|
|
t &= Environment.NewLine
|
2016-09-07 18:50:38 +02:00
|
|
|
|
n = ""
|
|
|
|
|
Else
|
|
|
|
|
t &= " "
|
|
|
|
|
n &= " "
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
t &= c
|
|
|
|
|
n &= c
|
|
|
|
|
End If
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
Dim power As String = A.Power.ToString()
|
|
|
|
|
If power = "0" Then
|
|
|
|
|
power = "-"
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim acc As String = A.Accuracy.ToString()
|
|
|
|
|
If acc = "0" Then
|
|
|
|
|
acc = "-"
|
|
|
|
|
End If
|
|
|
|
|
|
2018-01-07 18:01:32 +01:00
|
|
|
|
.DrawString(FontManager.MiniFont, "Power: " & power & Environment.NewLine & "Accuracy: " & acc & Environment.NewLine & Environment.NewLine & t, New Vector2(CInt(p.X + 432 - 300 + AttackPos), p.Y + 38), Color.Black)
|
2016-09-07 18:50:38 +02:00
|
|
|
|
.Draw(A.GetDamageCategoryImage(), New Rectangle(CInt(p.X + 432 - 150 + AttackPos), CInt(p.Y + 42), 56, 28), Color.White)
|
|
|
|
|
End With
|
|
|
|
|
|
|
|
|
|
Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(p.X + 80), CInt(p.Y + 18), 320, 384))
|
|
|
|
|
Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(p.X + 80), CInt(p.Y + 48 + 384), 320, 96))
|
|
|
|
|
|
|
|
|
|
For i = 0 To Me.Pokemon.Attacks.Count - 1
|
|
|
|
|
DrawAttack(i, Me.Pokemon.Attacks(i))
|
|
|
|
|
Next
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub DrawAttack(ByVal i As Integer, ByVal A As BattleSystem.Attack)
|
|
|
|
|
Dim p As New Vector2(140, 80 + i * (64 + 32))
|
|
|
|
|
|
|
|
|
|
If i = 4 Then
|
|
|
|
|
p.Y += 32
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim CanvasTexture As Texture2D = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), "")
|
|
|
|
|
If Me.AttackIndex = i Then
|
|
|
|
|
CanvasTexture = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(48, 0, 48, 48), "")
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Canvas.DrawImageBorder(CanvasTexture, 2, New Rectangle(CInt(p.X) + 12, CInt(p.Y), 256, 64))
|
|
|
|
|
|
|
|
|
|
With Core.SpriteBatch
|
|
|
|
|
.DrawString(FontManager.MiniFont, A.Name, New Vector2(CInt(p.X) + 30, CInt(p.Y + 26)), Color.Black)
|
|
|
|
|
|
|
|
|
|
Dim c As Color = Color.Black
|
|
|
|
|
Dim per As Integer = CInt((A.CurrentPP / A.MaxPP) * 100)
|
|
|
|
|
|
|
|
|
|
If per <= 33 And per > 10 Then
|
|
|
|
|
c = Color.Orange
|
|
|
|
|
ElseIf per <= 10 Then
|
|
|
|
|
c = Color.IndianRed
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
.DrawString(FontManager.MiniFont, "PP " & A.CurrentPP & " / " & A.MaxPP, New Vector2(CInt(p.X) + 160, CInt(p.Y + 58)), c)
|
|
|
|
|
|
|
|
|
|
.Draw(TextureManager.GetTexture("GUI\Menus\Types", A.Type.GetElementImage(), ""), New Rectangle(CInt(p.X) + 30, CInt(p.Y + 54), 48, 16), Color.White)
|
|
|
|
|
End With
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub ClickYes()
|
|
|
|
|
Dim valid As Boolean = True
|
|
|
|
|
If canChooseHMMove = False Then
|
|
|
|
|
Dim A As BattleSystem.Attack = Pokemon.Attacks(AttackIndex)
|
|
|
|
|
If A.IsHMMove = True Then
|
|
|
|
|
valid = False
|
|
|
|
|
TextBox.Show("Cannot choose HM move.", {}, False, False)
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
If valid = True Then
|
|
|
|
|
Selected = AttackIndex
|
|
|
|
|
Core.SetScreen(Me.PreScreen)
|
|
|
|
|
Exited = True
|
|
|
|
|
Chosen = True
|
|
|
|
|
If Not DoSub Is Nothing Then
|
|
|
|
|
DoSub(Pokemon, AttackIndex)
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub ClickNo()
|
|
|
|
|
Selected = -1
|
|
|
|
|
Core.SetScreen(Me.PreScreen)
|
|
|
|
|
Exited = True
|
|
|
|
|
Chosen = False
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
End Class
|