2016-09-19 04:34:12 +02:00
Namespace Items . Medicine
2016-09-07 18:50:38 +02:00
2016-09-19 04:34:12 +02:00
<Item(32, "Rare Candy")>
2016-09-07 18:50:38 +02:00
Public Class RareCandy
2017-08-22 08:44:56 +02:00
Inherits MedicineItem
2016-09-07 18:50:38 +02:00
2016-09-20 05:11:31 +02:00
Public Overrides ReadOnly Property Description As String = " A candy that is packed with energy. When consumed, it will instantly raise the level of a single Pokémon by one. "
Public Overrides ReadOnly Property PokeDollarPrice As Integer = 4800
Public Overrides ReadOnly Property BattlePointsPrice As Integer = 48
2021-08-20 13:51:55 +02:00
Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False
2022-05-07 00:45:59 +02:00
Public Overrides ReadOnly Property PluralName As String = " Rare Candies "
2016-09-07 18:50:38 +02:00
2016-09-20 05:11:31 +02:00
Public Sub New ( )
_textureRectangle = New Rectangle ( 192 , 24 , 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 Pokemon As Pokemon = Core . Player . Pokemons ( PokeIndex )
If Pokemon . Level < CInt ( GameModeManager . GetGameRuleValue ( " MaxLevel " , " 100 " ) ) And Pokemon . IsEgg ( ) = False Then
Dim beforeHP As Integer = Pokemon . MaxHP
Pokemon . LevelUp ( False )
Pokemon . Experience = Pokemon . NeedExperience ( Pokemon . Level )
2018-02-21 16:34:06 +01:00
If Pokemon . Status = P3D . Pokemon . StatusProblems . Fainted Then
Pokemon . Status = P3D . Pokemon . StatusProblems . None
2016-09-07 18:50:38 +02:00
Pokemon . HP = ( Pokemon . MaxHP - beforeHP ) . Clamp ( 1 , 999 )
End If
Dim s As String =
2018-01-07 18:01:32 +01:00
" version=2 " & Environment . NewLine &
2019-01-24 07:52:47 +01:00
" @sound.play(success_small,1) " & Environment . NewLine &
2018-01-07 18:01:32 +01:00
" @text.show( " & Pokemon . GetDisplayName ( ) & " reached~level " & Pokemon . Level & " !) " & Environment . NewLine
2016-09-07 18:50:38 +02:00
Dim removedItem As Boolean = False
If Pokemon . AttackLearns . ContainsKey ( Pokemon . Level ) = True Then
If Pokemon . KnowsMove ( Pokemon . AttackLearns ( Pokemon . Level ) ) = False Then
If Pokemon . Attacks . Count = 4 Then
2018-01-07 18:01:32 +01:00
s &= " @pokemon.learnattack( " & PokeIndex & " , " & Pokemon . AttackLearns ( Pokemon . Level ) . ID & " ) " & Environment . NewLine
2016-09-07 18:50:38 +02:00
Dim t As String = Me . RemoveItem ( )
If t <> " " Then
2018-01-07 18:01:32 +01:00
s &= " @text.show( " & t & " ) " & Environment . NewLine
2016-09-07 18:50:38 +02:00
End If
removedItem = True
Else
Pokemon . Attacks . Add ( Pokemon . AttackLearns ( Pokemon . Level ) )
2019-01-24 07:52:47 +01:00
s &= " @sound.play(success_small,1) " & Environment . NewLine &
2023-01-30 19:22:24 +01:00
" @text.show( " & Pokemon . GetDisplayName ( ) & " learned~ " & Pokemon . AttackLearns ( Pokemon . Level ) . Name & " ! " & Me . RemoveItem ( ) & " ) " & Environment . NewLine
2016-09-07 18:50:38 +02:00
removedItem = True
PlayerStatistics . Track ( " Moves learned " , 1 )
End If
End If
End If
If Pokemon . CanEvolve ( EvolutionCondition . EvolutionTrigger . LevelUp , " " ) = True Then
2018-01-07 18:01:32 +01:00
s &= " @pokemon.evolve( " & PokeIndex & " ) " & Environment . NewLine
2016-09-07 18:50:38 +02:00
End If
If removedItem = False Then
Dim t As String = Me . RemoveItem ( )
If t <> " " Then
2023-02-23 21:17:51 +01:00
s &= " @text.show( " & t . Remove ( 0 , 1 ) & " ) " & Environment . NewLine
2016-09-07 18:50:38 +02:00
End If
End If
s &= " :end "
Dim sc As Screen = Core . CurrentScreen
While sc . Identification <> Screen . Identifications . OverworldScreen
sc = sc . PreScreen
End While
Core . SetScreen ( sc )
CType ( sc , OverworldScreen ) . ActionScript . StartScript ( s , 2 , False )
PlayerStatistics . Track ( " [17]Medicine Items used " , 1 )
Return True
Else
Return False
End If
End Function
End Class
2016-09-19 04:34:12 +02:00
End Namespace