2016-09-19 04:34:12 +02:00
Namespace Items . Standard
2016-09-07 18:50:38 +02:00
2016-09-19 04:34:12 +02:00
<Item(187, "Ability Capsule")>
2016-09-07 18:50:38 +02:00
Public Class AbilityCapsule
Inherits Item
2016-09-21 00:08:06 +02:00
Public Overrides ReadOnly Property Description As String = " A capsule that allows a Pokémon with two Abilities to switch between these Abilities when it is used. "
2016-09-25 02:16:31 +02:00
Public Overrides ReadOnly Property PokeDollarPrice As Integer = 1000
2016-09-21 00:08:06 +02:00
Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False
2016-09-21 00:04:54 +02:00
2016-09-21 00:08:06 +02:00
Public Sub New ( )
_textureRectangle = New Rectangle ( 0 , 240 , 24 , 24 )
2016-09-07 18:50:38 +02:00
End Sub
Public Overrides Sub Use ( )
2017-08-11 09:01:17 +02:00
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 )
2016-09-07 18:50:38 +02:00
End Sub
Public Overrides Function UseOnPokemon ( ByVal PokeIndex As Integer ) As Boolean
Dim currentAbility As Integer = - 1
Dim p As Pokemon = Core . Player . Pokemons ( PokeIndex )
If p . NewAbilities . Count = 1 Then
Screen . TextBox . Show ( " You cannot use this on~ " & p . GetDisplayName ( ) & " . " )
Return False
End If
For i = 0 To p . NewAbilities . Count - 1
If p . Ability . ID = p . NewAbilities ( i ) . ID Then
currentAbility = i
Exit For
End If
Next
If currentAbility = - 1 Then
Screen . TextBox . Show ( " You cannot use this on~ " & p . GetDisplayName ( ) & " . " )
Return False
Else
Dim oldAbilityName As String = p . Ability . Name
Dim newAbility As Integer = currentAbility
While newAbility = currentAbility
newAbility = Core . Random . Next ( 0 , p . NewAbilities . Count )
End While
p . Ability = Ability . GetAbilityByID ( p . NewAbilities ( newAbility ) . ID )
2018-03-12 07:58:10 +01:00
p . SetOriginalAbility ( )
2016-09-07 18:50:38 +02:00
Screen . TextBox . Show ( p . GetDisplayName ( ) & " forgot how~to use " & oldAbilityName & " .*It learned~ " & p . NewAbilities ( newAbility ) . Name & " instead. " & RemoveItem ( ) )
Return True
End If
End Function
End Class
2016-09-19 04:34:12 +02:00
End Namespace