Make it possible to check if pkmn can learn attack

@pokemon.select has an extra argument. If it is set to an attack ID, it will be visible which Pokémon can learn that move while selecting.

Added @Pokemon.CanLearnAttack(PartyIndex,AttackID)
Returns if the Pokémon can learn the specified move.
This commit is contained in:
JappaWakka 2024-05-14 11:02:47 +02:00
parent 14dd28290c
commit f4354a9922
4 changed files with 64 additions and 4 deletions

View File

@ -71,7 +71,7 @@ Public Class PartyScreen
Dim ChoosePokemon As DoStuff
Public ExitedSub As DoStuff
Public LearnAttack As BattleSystem.Attack
Public LearnAttack As BattleSystem.Attack = Nothing
Public LearnType As Integer = 0
Dim moveLearnArg As Object = Nothing
@ -420,6 +420,31 @@ Public Class PartyScreen
AttackLabel = "Able!"
End If
End If
Case 2 'Learnable Move
If LearnAttack IsNot Nothing Then
Dim canLearnMove As Boolean = False
For i = 0 To p.AttackLearns.Count - 1
Dim aList As List(Of BattleSystem.Attack) = p.AttackLearns.Values(i)
For lA = 0 To aList.Count - 1
If aList(lA).ID = LearnAttack.ID Then
canLearnMove = True
End If
Next
Next
For Each eggMoveID As Integer In p.EggMoves
If eggMoveID = LearnAttack.ID Then
canLearnMove = True
End If
Next
For Each TMMoveID As Integer In p.Machines
If TMMoveID = LearnAttack.ID Then
canLearnMove = True
End If
Next
If canLearnMove = True Then
AttackLabel = "Able!"
End If
End If
End Select
End If
GetFontRenderer().DrawString(FontManager.MainFont, AttackLabel, New Vector2(position.X + 216, position.Y + 28), New Color(255, 255, 255, CInt(255 * _interfaceFade)))

View File

@ -379,6 +379,7 @@
Dim canExit As Boolean = False
Dim canChooseEgg As Boolean = True
Dim canChooseFainted As Boolean = True
Dim canLearnAttack As Integer = -1
If argument <> "" Then
Dim data() As String = argument.Split(CChar(","))
@ -392,9 +393,17 @@
If data.Length > 2 Then
canChooseEgg = CBool(data(2))
End If
If data.Length > 3 Then
canLearnAttack = CInt(data(3))
End If
End If
Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), Nothing, "Choose Pokémon", canExit, canChooseFainted, canChooseEgg) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = canExit}
If canLearnAttack <> -1 Then
selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), Nothing, "Learn " & BattleSystem.Attack.GetAttackByID(canLearnAttack).Name, canExit, canChooseFainted, canChooseEgg) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = canExit}
selScreen.SetupLearnAttack(BattleSystem.Attack.GetAttackByID(canLearnAttack), 2, Nothing)
End If
AddHandler selScreen.SelectedObject, Nothing
Core.SetScreen(selScreen)

View File

@ -173,6 +173,29 @@
End If
Next
Return levelMoves
Case "canlearnattack"
Dim pokeIndex As Integer = int(argument.GetSplit(0))
Dim LearnAttack As BattleSystem.Attack = BattleSystem.Attack.GetAttackByID(int(argument.GetSplit(1)))
Dim canLearnMove As Boolean = False
For i = 0 To Core.Player.Pokemons(pokeIndex).AttackLearns.Count - 1
Dim aList As List(Of BattleSystem.Attack) = Core.Player.Pokemons(pokeIndex).AttackLearns.Values(i)
For lA = 0 To aList.Count - 1
If aList(lA).ID = LearnAttack.ID Then
canLearnMove = True
End If
Next
Next
For Each eggMoveID As Integer In Core.Player.Pokemons(pokeIndex).EggMoves
If eggMoveID = LearnAttack.ID Then
canLearnMove = True
End If
Next
For Each TMMoveID As Integer In Core.Player.Pokemons(pokeIndex).Machines
If TMMoveID = LearnAttack.ID Then
canLearnMove = True
End If
Next
Return ReturnBoolean(canLearnMove)
Case "isshiny"
Dim index As Integer = int(argument.GetSplit(0))

View File

@ -761,9 +761,10 @@ Namespace ScriptVersion2
New ScriptArgument("friendship", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Sets the friendship value for a Pokémon in the player's party."))
r(New ScriptCommand("pokemon", "addfriendship", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Str),
New ScriptArgument("friendship", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Adds to the frienship value of a Pokémon in the player's party."))
r(New ScriptCommand("pokemon", "select", {New ScriptArgument("canExit", ScriptArgument.ArgumentTypes.Bool),
New ScriptArgument("canChooseEgg", ScriptArgument.ArgumentTypes.Bool),
New ScriptArgument("canChooseFainted", ScriptArgument.ArgumentTypes.Bool)}.ToList(), "Opens the Pokémon select screen."))
r(New ScriptCommand("pokemon", "select", {New ScriptArgument("canExit", ScriptArgument.ArgumentTypes.Bool, True, "false"),
New ScriptArgument("canChooseEgg", ScriptArgument.ArgumentTypes.Bool, True, "true"),
New ScriptArgument("canChooseFainted", ScriptArgument.ArgumentTypes.Bool, True, "true"),
New ScriptArgument("canlearnAttack", ScriptArgument.ArgumentTypes.Int, True, "-1")}.ToList(), "Opens the Pokémon select screen. If canLearnAttack is set to an attack ID, it will be visible which Pokémon can learn that move."))
r(New ScriptCommand("pokemon", "selectmove", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int),
New ScriptArgument("canChooseHMMove", ScriptArgument.ArgumentTypes.Bool),
New ScriptArgument("canExit", ScriptArgument.ArgumentTypes.Bool)}.ToList(), "Opens the Move Selection screen."))
@ -874,6 +875,8 @@ Namespace ScriptVersion2
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", "CanLearnAttack", "bool", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int),
New ScriptArgument("attackID", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns if the Pokémon can learn the specified move.", ",", 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))