Public Class HeadbuttTree Inherits Entity Public Overrides Sub UpdateEntity() If Me.Rotation.Y <> Screen.Camera.Yaw Then Me.Rotation.Y = Screen.Camera.Yaw CreatedWorld = False End If MyBase.UpdateEntity() End Sub Public Overrides Sub ClickFunction() If Screen.Level.Surfing = False Then Dim pName As String = "" For Each p As Pokemon In Core.Player.Pokemons If p.IsEgg() = False Then For Each a As BattleSystem.Attack In p.Attacks If a.Name = "Headbutt" Then pName = p.GetDisplayName() Exit For End If Next If pName <> "" Then Exit For End If End If Next If pName <> "" Or Core.Player.SandBoxMode = True Or GameController.IS_DEBUG_ACTIVE = True Then Dim text As String = Localization.GetString("fieldmove_headbutt_question", "This tree could have~a Pokémon in it.*Do you want to~use Headbutt?") & "%" & Localization.GetString("global_yes", "Yes") & "|" & Localization.GetString("global_no", "No") & "%" Screen.TextBox.Show(text, {Me}) SoundManager.PlaySound("select") End If End If End Sub Public Overrides Sub ResultFunction(Result As Integer) If Result = 0 Then Dim pName As String = "" For Each p As Pokemon In Core.Player.Pokemons For Each a As BattleSystem.Attack In p.Attacks If a.Name = "Headbutt" Then pName = p.GetDisplayName() Exit For End If Next If pName <> "" Then Exit For End If Next Dim spawnedPokemon As Pokemon = Spawner.GetPokemon(Screen.Level.LevelFile, Spawner.EncounterMethods.Headbutt, False) If spawnedPokemon Is Nothing Then Dim s As String = "version=2" & Environment.NewLine & "@text.show(" & pName & " " & Localization.GetString("fieldmove_headbutt_used", "used~Headbutt!") & ")" & Environment.NewLine & "@sound.play(destroy,0)" & Environment.NewLine & "@level.wait(20)" & Environment.NewLine & "@text.show(Nothing happened...)" & Environment.NewLine & ":end" CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2) Else Dim s As String = "version=2" & Environment.NewLine & "@text.show(" & pName & " " & Localization.GetString("fieldmove_headbutt_used", "used~Headbutt!") & ")" & Environment.NewLine & "@sound.play(destroy,0)" & Environment.NewLine & "@level.wait(20)" & Environment.NewLine & "@text.show(A wild Pokémon~appeared!)" & Environment.NewLine & "@battle.wild(" & spawnedPokemon.GetSaveData & ")" & Environment.NewLine & ":end" CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2) End If End If End Sub Public Overrides Sub Render() If Me.Model Is Nothing Then Me.Draw(Me.BaseModel, Textures, False) Else UpdateModel() Draw(Me.BaseModel, Me.Textures, True, Me.Model) End If End Sub End Class