From 86428f8055c2fd6576ba6d0e8c8ac511bbc64cb0 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sun, 21 Apr 2024 09:10:23 +0200 Subject: [PATCH] Add construct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Checks if a specific Pokémon or all Pokémon in the party are fully healed. --- .../V2/ScriptConstructs/DoPokemon.vb | 35 +++++++++++++++++++ P3D/World/ActionScript/V2/ScriptLibrary.vb | 1 + 2 files changed, 36 insertions(+) diff --git a/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb b/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb index 2b4255e1f..e9e115f9a 100644 --- a/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb +++ b/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb @@ -524,6 +524,41 @@ End If Next Return ReturnBoolean(False) + Case "fullyhealed" + Dim IsFullyHealed As Boolean = True + If argument = "" Then + For Each pokemon As Pokemon In Core.Player.Pokemons + If pokemon.Attacks.Count > 0 Then + For d = 0 To pokemon.Attacks.Count - 1 + If pokemon.Attacks(d).CurrentPP < pokemon.Attacks(d).MaxPP Then + IsFullyHealed = False + End If + Next + End If + If pokemon.HP < pokemon.MaxHP Then + IsFullyHealed = False + End If + If pokemon.Status <> Pokemon.StatusProblems.None Then + IsFullyHealed = False + End If + Next + Else + Dim pokemon As Pokemon = Core.Player.Pokemons(CInt(argument)) + If pokemon.Attacks.Count > 0 Then + For d = 0 To pokemon.Attacks.Count - 1 + If pokemon.Attacks(d).CurrentPP < pokemon.Attacks(d).MaxPP Then + IsFullyHealed = False + End If + Next + End If + If pokemon.HP < pokemon.MaxHP Then + IsFullyHealed = False + End If + If pokemon.Status <> Pokemon.StatusProblems.None Then + IsFullyHealed = False + End If + End If + Return ReturnBoolean(IsFullyHealed) End Select Return DEFAULTNULL End Function diff --git a/P3D/World/ActionScript/V2/ScriptLibrary.vb b/P3D/World/ActionScript/V2/ScriptLibrary.vb index d4a7ed9a8..d332c96f2 100644 --- a/P3D/World/ActionScript/V2/ScriptLibrary.vb +++ b/P3D/World/ActionScript/V2/ScriptLibrary.vb @@ -920,6 +920,7 @@ Namespace ScriptVersion2 r(New ScriptCommand("pokemon", "istype", "bool", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int), New ScriptArgument("type", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Checks if a Pokémon in the player's party has a specific type.", ",", True)) r(New ScriptCommand("pokemon", "IsRoaming", "bool", {New ScriptArgument("roamerID", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Checks if the given roaming Pokémon is still active.", ",", True)) + r(New ScriptCommand("pokemon", "FullyHealed", "bool", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Str, True, "")}.ToList(), "Checks if a specific Pokémon or all Pokémon in the party are fully healed.", ",", True)) End Sub