2016-09-07 18:50:38 +02:00
Public Class DiveTile
Inherits Entity
Dim diveUp As Integer = 0
Public Overrides Sub Initialize ( )
MyBase . Initialize ( )
Me . diveUp = Me . ActionValue
Me . NeedsUpdate = True
End Sub
Public Overrides Sub Update ( )
If Screen . Level . Surfing = True Then
If CInt ( Me . Position . X ) = CInt ( Screen . Camera . Position . X ) And CInt ( Me . Position . Y ) = CInt ( Screen . Camera . Position . Y ) And CInt ( Me . Position . Z ) = CInt ( Screen . Camera . Position . Z ) Then
If Controls . Accept ( True , True , True ) = True Then
2016-11-11 09:32:29 +01:00
If Core . CurrentScreen . Identification = Screen . Identifications . OverworldScreen Then
If CType ( Core . CurrentScreen , OverworldScreen ) . ActionScript . IsReady Then
Me . StartDive ( )
End If
End If
2016-09-07 18:50:38 +02:00
End If
End If
End If
End Sub
Private Sub StartDive ( )
If diveUp = 0 Then
'Down
2023-07-30 18:16:27 +02:00
Dim t As String = Localization . GetString ( " fieldmove_dive_down_1 " , " The water seems to be~really deep at this point. " )
2016-09-07 18:50:38 +02:00
Dim d As String = GetDivePokemon ( )
If d <> " " And Badge . CanUseHMMove ( Badge . HMMoves . Dive ) = True Or Core . Player . SandBoxMode = True Or GameController . IS_DEBUG_ACTIVE = True Then
2023-07-30 18:16:27 +02:00
t &= Localization . GetString ( " fieldmove_dive_down_2 " , " *Do you want to~use Dive? " ) & " % " & Localization . GetString ( " global_yes " , " Yes " ) & " | " & Localization . GetString ( " global_no " , " No " ) & " % "
2016-09-07 18:50:38 +02:00
End If
Screen . TextBox . Show ( t , { Me } )
SoundManager . PlaySound ( " select " )
2016-10-08 10:37:13 +02:00
ElseIf diveUp = 1 Then
2016-09-07 18:50:38 +02:00
'Up
2023-07-30 18:16:27 +02:00
Dim t As String = Localization . GetString ( " fieldmove_dive_up_type1 " , " Light shines down from~the surface.*Do you want to~use Dive? " ) & " % " & Localization . GetString ( " global_yes " , " Yes " ) & " | " & Localization . GetString ( " global_no " , " No " ) & " % "
2016-09-07 18:50:38 +02:00
2016-10-08 10:37:13 +02:00
Screen . TextBox . Show ( t , { Me } )
SoundManager . PlaySound ( " select " )
ElseIf diveUp = 2 Then
'Up
2023-07-30 18:16:27 +02:00
Dim t As String = Localization . GetString ( " fieldmove_dive_up_type2 " , " The boat's shadow is cast~upon the ocean floor.*Do you want to~use Dive? " ) & " % " & Localization . GetString ( " global_yes " , " Yes " ) & " | " & Localization . GetString ( " global_no " , " No " ) & " % "
2016-10-08 10:37:13 +02:00
2016-09-07 18:50:38 +02:00
Screen . TextBox . Show ( t , { Me } )
SoundManager . PlaySound ( " select " )
End If
End Sub
Public Overrides Sub ResultFunction ( ByVal result As Integer )
If result = 0 Then
If diveUp = 0 Then
'Down
2018-01-07 18:01:32 +01:00
Dim s As String = " version=2 " & Environment . NewLine &
2023-07-30 18:16:27 +02:00
" @text.show( " & GetDivePokemon ( ) & " " & Localization . GetString ( " fieldmove_dive_used " , " used~Dive! " ) & " ) " & Environment . NewLine &
2018-01-07 18:01:32 +01:00
" @screen.fadeout " & Environment . NewLine &
" @player.warp( " & Me . AdditionalValue & " ) " & Environment . NewLine &
" @level.update " & Environment . NewLine &
" @player.setmovement(0,-0.5,0) " & Environment . NewLine &
" @screen.fadein " & Environment . NewLine &
" @player.move(8) " & Environment . NewLine &
" @player.resetmovement " & Environment . NewLine &
2016-09-07 18:50:38 +02:00
" :end "
CType ( Core . CurrentScreen , OverworldScreen ) . ActionScript . StartScript ( s , 2 )
2016-10-08 10:37:13 +02:00
ElseIf diveUp = 1 Then
2016-09-07 18:50:38 +02:00
'Up
2018-01-07 18:01:32 +01:00
Dim s As String = " version=2 " & Environment . NewLine &
2023-07-30 18:16:27 +02:00
" @text.show( " & GetDivePokemon ( ) & " " & Localization . GetString ( " fieldmove_dive_used " , " used~Dive! " ) & " ) " & Environment . NewLine &
2018-01-07 18:01:32 +01:00
" @player.setmovement(0,0.5,0) " & Environment . NewLine &
" @player.move(8) " & Environment . NewLine &
" @player.resetmovement " & Environment . NewLine &
" @screen.fadeout " & Environment . NewLine &
" @player.warp( " & Me . AdditionalValue & " ) " & Environment . NewLine &
" @level.update " & Environment . NewLine &
" @screen.fadein " & Environment . NewLine &
2016-09-07 18:50:38 +02:00
" :end "
2016-10-08 10:37:13 +02:00
CType ( Core . CurrentScreen , OverworldScreen ) . ActionScript . StartScript ( s , 2 )
ElseIf diveUp = 2 Then
'Up
2018-01-07 18:01:32 +01:00
Dim s As String = " version=2 " & Environment . NewLine &
2023-07-30 18:16:27 +02:00
" @text.show( " & GetDivePokemon ( ) & " " & Localization . GetString ( " fieldmove_dive_used " , " used~Dive! " ) & " ) " & Environment . NewLine &
2018-01-07 18:01:32 +01:00
" @player.setmovement(0,0.5,0) " & Environment . NewLine &
" @player.move(6) " & Environment . NewLine &
" @player.resetmovement " & Environment . NewLine &
" @screen.fadeout " & Environment . NewLine &
" @player.warp( " & Me . AdditionalValue & " ) " & Environment . NewLine &
" @level.update " & Environment . NewLine &
" @screen.fadein " & Environment . NewLine &
2016-10-08 10:37:13 +02:00
" :end "
2016-09-07 18:50:38 +02:00
CType ( Core . CurrentScreen , OverworldScreen ) . ActionScript . StartScript ( s , 2 )
End If
End If
End Sub
Private Function GetDivePokemon ( ) As String
For Each p As Pokemon In Core . Player . Pokemons
For Each a As BattleSystem . Attack In p . Attacks
If a . Name . ToLower ( ) = " dive " Then
Return p . GetDisplayName ( )
End If
Next
Next
Return " "
End Function
Public Overrides Sub Render ( )
2022-07-13 00:12:16 +02:00
If Me . Model Is Nothing Then
Me . Draw ( Me . BaseModel , Textures , False )
Else
2022-07-16 14:48:29 +02:00
UpdateModel ( )
2022-07-13 00:12:16 +02:00
Draw ( Me . BaseModel , Me . Textures , True , Me . Model )
End If
2016-09-07 18:50:38 +02:00
End Sub
End Class