P3D-Legacy/P3D/Pokemon/Items/Medicine/Elixir.vb

50 lines
1.9 KiB
VB.net

Namespace Items.Medicine
<Item(65, "Elixir")>
Public Class Elixir
Inherits MedicineItem
Public Overrides ReadOnly Property PokeDollarPrice As Integer = 3000
Public Overrides ReadOnly Property Description As String = "This medicine can restore 10 PP to each of the moves that have been learned by a Pokémon."
Public Sub New()
_textureRectangle = New Rectangle(408, 48, 24, 24)
End Sub
Public Overrides Sub Use()
Dim selScreen = New PartyScreen(Core.CurrentScreen, Me, AddressOf Me.UseOnPokemon, "Use " & Me.Name, True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf UseItemhandler
Core.SetScreen(selScreen)
End Sub
Public Overrides Function UseOnPokemon(ByVal PokeIndex As Integer) As Boolean
Dim missingPP As Boolean = False
Dim Pokemon As Pokemon = Core.Player.Pokemons(PokeIndex)
For Each Attack As BattleSystem.Attack In Pokemon.Attacks
If Attack.CurrentPP < Attack.MaxPP Then
missingPP = True
End If
Attack.CurrentPP = CInt(MathHelper.Clamp(Attack.CurrentPP + 10, 0, Attack.MaxPP))
Next
If missingPP = True Then
Dim t As String = "Restored PP of~" & Pokemon.GetDisplayName() & "'s attacks."
t &= RemoveItem()
PlayerStatistics.Track("[17]Medicine Items used", 1)
SoundManager.PlaySound("Use_Item", False)
Screen.TextBox.Show(t, {}, True, True)
Return True
Else
Screen.TextBox.Show("The Pokémon's PP are~full already.", {}, True, True)
Return False
End If
End Function
End Class
End Namespace