From a1c3c6f9dae30d4fb6f5c346fe0df30a5ddb6e6c Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sat, 16 Dec 2023 15:59:32 +0100 Subject: [PATCH] =?UTF-8?q?Added=20?= =?UTF-8?q?=20construct?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Returns a string of every move the Pokémon can learn at or below a certain level * Index (int) = Index of a Pokémon in the player's party * MaxLevel (int) [optional] = Every move the Pokémon can learn at or below the level specified by this argument is added to the string. When this argument is left out or set to "-1", it will default to the Pokémon's current level. --- .../V2/ScriptConstructs/DoPokemon.vb | 22 +++++++++++++++++++ P3D/World/ActionScript/V2/ScriptLibrary.vb | 2 ++ 2 files changed, 24 insertions(+) diff --git a/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb b/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb index 401719ec8..32b0b4c8f 100644 --- a/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb +++ b/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb @@ -149,6 +149,28 @@ Dim moveIndex As Integer = int(argument.GetSplit(1)) Return Core.Player.Pokemons(pokeIndex).Attacks(moveIndex).Name + Case "levelattacks" + Dim pokeIndex As Integer = int(argument.GetSplit(0)) + Dim MaxLevel As Integer = Core.Player.Pokemons(pokeIndex).Level + Dim levelMoves As String = "" + If argument.Split(",").Count > 1 Then + If argument.GetSplit(1).ToLower = "-1" Then + MaxLevel = Core.Player.Pokemons(pokeIndex).Level + Else + MaxLevel = CInt(argument.GetSplit(1)) + End If + End If + + For Each level As Integer In Core.Player.Pokemons(pokeIndex).AttackLearns.Keys + If level <= MaxLevel Then + If levelMoves = "" Then + levelMoves = Core.Player.Pokemons(pokeIndex).AttackLearns(level).ID.ToString + Else + levelMoves &= "," & Core.Player.Pokemons(pokeIndex).AttackLearns(level).ID.ToString + End If + End If + Next + Return levelMoves Case "isshiny" Dim index As Integer = int(argument.GetSplit(0)) diff --git a/P3D/World/ActionScript/V2/ScriptLibrary.vb b/P3D/World/ActionScript/V2/ScriptLibrary.vb index 2aab56477..e8cfc4dfa 100644 --- a/P3D/World/ActionScript/V2/ScriptLibrary.vb +++ b/P3D/World/ActionScript/V2/ScriptLibrary.vb @@ -862,6 +862,8 @@ Namespace ScriptVersion2 r(New ScriptCommand("pokemon", "countattacks", "int", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Counts the moves the Pokémon knows.", ",", True)) r(New ScriptCommand("pokemon", "attackname", "str", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int), New ScriptArgument("moveIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns the name of the move of a Pokémon in the player's party.", ",", True)) + r(New ScriptCommand("pokemon", "levelattacks", "str", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int), + New ScriptArgument("maxLevel", ScriptArgument.ArgumentTypes.Int, True, "-1")}.ToList(), "Returns a list of move IDs separated by commas that a Pokémon in the player's party can learn at or below its current level/the level specified by the maxLevel argument.", ",", True)) r(New ScriptCommand("pokemon", "isShiny", "bool", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns if the Pokémon is Shiny.", ",", True)) r(New ScriptCommand("pokemon", "nature", "str", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns the nature of a Pokémon in the player's party.", ",", True)) r(New ScriptCommand("pokemon", "ownpokemon", "bool", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns if a Pokémon in the player's party was caught by the player.", ",", True))