Fix Pokémon Learn Move Bugs

This commit is contained in:
JappaWakka 2024-02-14 12:08:59 +01:00
parent ac07ee10ea
commit 0a218527b3
10 changed files with 186 additions and 111 deletions

View File

@ -8302,12 +8302,13 @@
For i = 0 To expPokemon.Count - 1 For i = 0 To expPokemon.Count - 1
Dim PokeIndex As Integer = expPokemon(i) Dim PokeIndex As Integer = expPokemon(i)
Dim AttackLearnList As New List(Of BattleSystem.Attack)
Dim LevelUpAmount As Integer = 0
Dim originalLevel As Integer = Core.Player.Pokemons(PokeIndex).Level
If Core.Player.Pokemons(PokeIndex).Level < CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then If Core.Player.Pokemons(PokeIndex).Level < CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then
Dim EXP As Integer = BattleCalculation.GainExp(Core.Player.Pokemons(PokeIndex), BattleScreen, expPokemon) Dim EXP As Integer = BattleCalculation.GainExp(Core.Player.Pokemons(PokeIndex), BattleScreen, expPokemon)
BattleScreen.BattleQuery.Add(New TextQueryObject(Core.Player.Pokemons(PokeIndex).GetDisplayName() & " gained " & EXP & " experience points.")) BattleScreen.BattleQuery.Add(New TextQueryObject(Core.Player.Pokemons(PokeIndex).GetDisplayName() & " gained " & EXP & " experience points."))
Dim originalLevel As Integer = Core.Player.Pokemons(PokeIndex).Level
Dim moveLevel As Integer = originalLevel Dim moveLevel As Integer = originalLevel
For e = 1 To EXP For e = 1 To EXP
@ -8327,11 +8328,30 @@
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("Battle\exp_max", False)) BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("Battle\exp_max", False))
BattleScreen.BattleQuery.Add(New TextQueryObject(Core.Player.Pokemons(PokeIndex).GetDisplayName() & " reached level " & moveLevel & "!")) BattleScreen.BattleQuery.Add(New TextQueryObject(Core.Player.Pokemons(PokeIndex).GetDisplayName() & " reached level " & moveLevel & "!"))
BattleScreen.BattleQuery.Add(New DisplayLevelUpQueryObject(Core.Player.Pokemons(PokeIndex), oldStats)) BattleScreen.BattleQuery.Add(New DisplayLevelUpQueryObject(Core.Player.Pokemons(PokeIndex), oldStats))
If Core.Player.Pokemons(PokeIndex).AttackLearns.ContainsKey(moveLevel) = True AndAlso Core.Player.Pokemons(PokeIndex).KnowsMove(Core.Player.Pokemons(PokeIndex).AttackLearns(Core.Player.Pokemons(PokeIndex).Level)) = False Then
BattleScreen.BattleQuery.Add(New LearnMovesQueryObject(Core.Player.Pokemons(PokeIndex), Core.Player.Pokemons(PokeIndex).AttackLearns(moveLevel), BattleScreen))
End If
End If End If
Next Next
LevelUpAmount = moveLevel - originalLevel
End If
If LevelUpAmount > 0 Then
For l = 1 To LevelUpAmount
If Core.Player.Pokemons(PokeIndex).AttackLearns.ContainsKey(originalLevel + l) Then
Dim aList As List(Of BattleSystem.Attack) = Core.Player.Pokemons(PokeIndex).AttackLearns(originalLevel + l)
For a = 0 To aList.Count - 1
If AttackLearnList.Contains(aList(a)) = False AndAlso Core.Player.Pokemons(PokeIndex).KnowsMove(aList(a)) = False Then
AttackLearnList.Add(aList(a))
End If
Next
End If
Next
End If
If AttackLearnList.Count > 0 Then
For a = 0 To AttackLearnList.Count - 1
BattleScreen.BattleQuery.Add(New LearnMovesQueryObject(Core.Player.Pokemons(PokeIndex), AttackLearnList(a), BattleScreen))
Next
End If End If
Core.Player.Pokemons(PokeIndex).GainEffort(BattleScreen.OppPokemon) Core.Player.Pokemons(PokeIndex).GainEffort(BattleScreen.OppPokemon)

View File

@ -547,10 +547,12 @@ Public Class GameModeItem
Return "" Return ""
End If End If
For Each learnAttack As BattleSystem.Attack In p.AttackLearns.Values For Each aList As List(Of BattleSystem.Attack) In p.AttackLearns.Values
If learnAttack.ID = gmTeachMove.ID Then For Each learnAttack As BattleSystem.Attack In aList
Return "" If learnAttack.ID = gmTeachMove.ID Then
End If Return ""
End If
Next
Next Next
If gmCanTeachAlways = True Then If gmCanTeachAlways = True Then

View File

@ -42,24 +42,28 @@ Namespace Items.Medicine
Dim removedItem As Boolean = False Dim removedItem As Boolean = False
If Pokemon.AttackLearns.ContainsKey(Pokemon.Level) = True Then If Pokemon.AttackLearns.ContainsKey(Pokemon.Level) = True Then
If Pokemon.KnowsMove(Pokemon.AttackLearns(Pokemon.Level)) = False Then Dim aList As List(Of BattleSystem.Attack) = Pokemon.AttackLearns(Pokemon.Level)
If Pokemon.Attacks.Count = 4 Then For a = 0 To aList.Count - 1
s &= "@pokemon.learnattack(" & PokeIndex & "," & Pokemon.AttackLearns(Pokemon.Level).ID & ")" & Environment.NewLine If Pokemon.KnowsMove(aList(a)) = False Then
If Pokemon.Attacks.Count = 4 Then
s &= "@pokemon.learnattack(" & PokeIndex & "," & aList(a).ID & ")" & Environment.NewLine
Dim t As String = Me.RemoveItem() Dim t As String = Me.RemoveItem()
If t <> "" Then If t <> "" Then
s &= "@text.show(" & t & ")" & Environment.NewLine s &= "@text.show(" & t & ")" & Environment.NewLine
End If
removedItem = True
Else
Pokemon.Attacks.Add(aList(a))
s &= "@sound.play(success_small,1)" & Environment.NewLine &
"@text.show(" & Pokemon.GetDisplayName() & " learned~" & aList(a).Name & "!" & Me.RemoveItem() & ")" & Environment.NewLine
removedItem = True
PlayerStatistics.Track("Moves learned", 1)
End If End If
removedItem = True
Else
Pokemon.Attacks.Add(Pokemon.AttackLearns(Pokemon.Level))
s &= "@sound.play(success_small,1)" & Environment.NewLine &
"@text.show(" & Pokemon.GetDisplayName() & " learned~" & Pokemon.AttackLearns(Pokemon.Level).Name & "!" & Me.RemoveItem() & ")" & Environment.NewLine
removedItem = True
PlayerStatistics.Track("Moves learned", 1)
End If End If
End If Next
End If End If
If Pokemon.CanEvolve(EvolutionCondition.EvolutionTrigger.LevelUp, "") = True Then If Pokemon.CanEvolve(EvolutionCondition.EvolutionTrigger.LevelUp, "") = True Then

View File

@ -143,10 +143,12 @@
Return "" Return ""
End If End If
For Each learnAttack As BattleSystem.Attack In p.AttackLearns.Values For Each aList As List(Of BattleSystem.Attack) In p.AttackLearns.Values
If learnAttack.ID = Attack.ID Then For Each learnAttack As BattleSystem.Attack In aList
Return "" If learnAttack.ID = Attack.ID Then
End If Return ""
End If
Next
Next Next
If CanTeachAlways = True Then If CanTeachAlways = True Then

View File

@ -633,7 +633,7 @@ Public Class Pokemon
Private _type1 As Element Private _type1 As Element
Private _type2 As Element Private _type2 As Element
Public StartItems As New Dictionary(Of Item, Integer) Public StartItems As New Dictionary(Of Item, Integer)
Public AttackLearns As New Dictionary(Of Integer, BattleSystem.Attack) Public AttackLearns As New Dictionary(Of Integer, List(Of BattleSystem.Attack))
Public EggMoves As New List(Of Integer) Public EggMoves As New List(Of Integer)
Public TutorAttacks As New List(Of BattleSystem.Attack) Public TutorAttacks As New List(Of BattleSystem.Attack)
Public EvolutionConditions As New List(Of EvolutionCondition) Public EvolutionConditions As New List(Of EvolutionCondition)
@ -1385,6 +1385,7 @@ Public Class Pokemon
''' Loads definition data from the data files and empties the temp textures. ''' Loads definition data from the data files and empties the temp textures.
''' </summary> ''' </summary>
Public Sub ReloadDefinitions() Public Sub ReloadDefinitions()
Me.AttackLearns.Clear()
Me.LoadDefinitions(Me.Number, Me.AdditionalData) Me.LoadDefinitions(Me.Number, Me.AdditionalData)
Me.ClearTextures() Me.ClearTextures()
End Sub End Sub
@ -1562,12 +1563,11 @@ Public Class Pokemon
Dim MoveID As Integer = CInt(Value.GetSplit(1)) Dim MoveID As Integer = CInt(Value.GetSplit(1))
If AttackLearns.ContainsKey(Level) = True Then If AttackLearns.ContainsKey(Level) = True Then
While AttackLearns.ContainsKey(Level) AttackLearns(Level).Add(BattleSystem.Attack.GetAttackByID(MoveID))
Level += 1 Else
End While AttackLearns.Add(Level, New List(Of BattleSystem.Attack))
AttackLearns(Level).Add(BattleSystem.Attack.GetAttackByID(MoveID))
End If End If
Me.AttackLearns.Add(Level, BattleSystem.Attack.GetAttackByID(MoveID))
Case "evolutioncondition" Case "evolutioncondition"
'Evolution,Type,Argument,Trigger 'Evolution,Type,Argument,Trigger
@ -1612,7 +1612,7 @@ Public Class Pokemon
Me.EggPokemon = Me.Number.ToString Me.EggPokemon = Me.Number.ToString
End If End If
Dim pAttacks As New SortedDictionary(Of Integer, BattleSystem.Attack) Dim pAttacks As New SortedDictionary(Of Integer, List(Of BattleSystem.Attack))
For i = 0 To AttackLearns.Count - 1 For i = 0 To AttackLearns.Count - 1
pAttacks.Add(AttackLearns.Keys(i), AttackLearns.Values(i)) pAttacks.Add(AttackLearns.Keys(i), AttackLearns.Values(i))
Next Next
@ -2138,26 +2138,29 @@ Public Class Pokemon
Dim canLearnMoves As New List(Of BattleSystem.Attack) Dim canLearnMoves As New List(Of BattleSystem.Attack)
For i = 0 To Me.AttackLearns.Count - 1 For i = 0 To Me.AttackLearns.Count - 1
If Me.AttackLearns.Keys(i) <= Me.Level Then If Me.AttackLearns.Keys(i) <= Me.Level Then
For Each levelAttack As BattleSystem.Attack In Me.AttackLearns(Me.AttackLearns.Keys(i))
Dim hasMove As Boolean = False
Dim hasMove As Boolean = False For Each m As BattleSystem.Attack In Me.Attacks
For Each m As BattleSystem.Attack In Me.Attacks If m.ID = levelAttack.ID Then
If m.ID = Me.AttackLearns.Values(i).ID Then
hasMove = True
Exit For
End If
Next
If hasMove = False Then
For Each m As BattleSystem.Attack In canLearnMoves
If m.ID = Me.AttackLearns.Values(i).ID Then
hasMove = True hasMove = True
Exit For Exit For
End If End If
Next Next
End If If hasMove = False Then
For Each m As BattleSystem.Attack In canLearnMoves
If m.ID = levelAttack.ID Then
hasMove = True
Exit For
End If
Next
End If
If hasMove = False Then If hasMove = False Then
canLearnMoves.Add(Me.AttackLearns.Values(i)) canLearnMoves.Add(levelAttack)
End If End If
Next
End If End If
Next Next
@ -2452,7 +2455,13 @@ Public Class Pokemon
''' <param name="learnLevel">The level the Pokémon learns the desired move on.</param> ''' <param name="learnLevel">The level the Pokémon learns the desired move on.</param>
Public Sub LearnAttack(ByVal learnLevel As Integer) Public Sub LearnAttack(ByVal learnLevel As Integer)
If AttackLearns.ContainsKey(learnLevel) = True Then If AttackLearns.ContainsKey(learnLevel) = True Then
Dim a As BattleSystem.Attack = AttackLearns(learnLevel) Dim a As BattleSystem.Attack
Dim aList As List(Of BattleSystem.Attack) = AttackLearns(learnLevel)
If aList.Count > 1 Then
a = aList(Random.Next(0, aList.Count - 1))
Else
a = aList(0)
End If
For Each la As BattleSystem.Attack In Attacks For Each la As BattleSystem.Attack In Attacks
If la.ID = a.ID Then If la.ID = a.ID Then

View File

@ -111,14 +111,18 @@
Case 1 Case 1
cParent = parent2 cParent = parent2
End Select End Select
For Each THMMove As BattleSystem.Attack In p.AttackLearns.Values For Each aList As List(Of BattleSystem.Attack) In p.AttackLearns.Values
For Each m1 As BattleSystem.Attack In cParent.Attacks For Each THMMove As BattleSystem.Attack In aList
If m1.ID = THMMove.ID Then For Each m1 As BattleSystem.Attack In cParent.Attacks
Dim newAttack As BattleSystem.Attack = BattleSystem.Attack.GetAttackByID(m1.ID) If m1.ID = THMMove.ID Then
EggMoves.Add(newAttack) Dim newAttack As BattleSystem.Attack = BattleSystem.Attack.GetAttackByID(m1.ID)
End If EggMoves.Add(newAttack)
End If
Next
Next Next
Next Next
End If End If
' Egg Moves: ' Egg Moves:

View File

@ -135,7 +135,7 @@
Dim evolutionStarted As Boolean = False Dim evolutionStarted As Boolean = False
Dim evolved As Boolean = False Dim evolved As Boolean = False
Dim brokeEvolution As Boolean = False Dim brokeEvolution As Boolean = False
Dim learnAttack As Boolean = False Dim AttackLearnList As New List(Of BattleSystem.Attack)
Dim EvolutionArg As String = "" Dim EvolutionArg As String = ""
Dim EvolutionTrigger As EvolutionCondition.EvolutionTrigger Dim EvolutionTrigger As EvolutionCondition.EvolutionTrigger
@ -198,6 +198,7 @@
Sparks.Add(New Spark()) Sparks.Add(New Spark())
Next Next
Else Else
If evolutionReady = False And TextBox.Showing = False Then If evolutionReady = False And TextBox.Showing = False Then
MusicManager.Play("evolution", True) MusicManager.Play("evolution", True)
@ -260,16 +261,19 @@
evolutionReady = True evolutionReady = True
Dim t As String = "Congratulations!*Your " & currentPokemon.GetDisplayName() & "~evolved into " & evolvedPokemon.GetName() & "!" Dim t As String = "Congratulations!*Your " & currentPokemon.GetDisplayName() & "~evolved into " & evolvedPokemon.GetName() & "!"
If evolvedPokemon.AttackLearns.ContainsKey(evolvedPokemon.Level) = True Then If evolvedPokemon.AttackLearns.ContainsKey(evolvedPokemon.Level) = True Then
If evolvedPokemon.KnowsMove(evolvedPokemon.AttackLearns(evolvedPokemon.Level)) = False Then Dim aList As List(Of BattleSystem.Attack) = evolvedPokemon.AttackLearns(evolvedPokemon.Level)
If evolvedPokemon.Attacks.Count = 4 Then For a = 0 To aList.Count - 1
Me.learnAttack = True If evolvedPokemon.KnowsMove(aList(a)) = False Then
Else If evolvedPokemon.Attacks.Count = 4 Then
evolvedPokemon.Attacks.Add(evolvedPokemon.AttackLearns(evolvedPokemon.Level)) Me.AttackLearnList.Add(aList(a))
Else
evolvedPokemon.Attacks.Add(aList(a))
t &= "*" & evolvedPokemon.GetDisplayName() & " learned~" & evolvedPokemon.AttackLearns(evolvedPokemon.Level).Name & "!" t &= "*" & evolvedPokemon.GetDisplayName() & " learned~" & aList(a).Name & "!"
PlayerStatistics.Track("Moves learned", 1) PlayerStatistics.Track("Moves learned", 1)
End If
End If End If
End If Next
End If End If
If Me.EvolutionTrigger = EvolutionCondition.EvolutionTrigger.Trading Then If Me.EvolutionTrigger = EvolutionCondition.EvolutionTrigger.Trading Then
@ -298,9 +302,9 @@
End If End If
Else Else
If TextBox.Showing = False Then If TextBox.Showing = False Then
If learnAttack = True Then If AttackLearnList.Count > 0 Then
learnAttack = False Core.SetScreen(New LearnAttackScreen(Core.CurrentScreen, evolvedPokemon, AttackLearnList))
Core.SetScreen(New LearnAttackScreen(Core.CurrentScreen, evolvedPokemon, evolvedPokemon.AttackLearns(evolvedPokemon.Level))) AttackLearnList.Clear()
Else Else
Endscene() Endscene()
End If End If
@ -346,10 +350,15 @@
Dim HPpercentage As Integer = CInt((currentPokemon.HP / currentPokemon.MaxHP) * 100) Dim HPpercentage As Integer = CInt((currentPokemon.HP / currentPokemon.MaxHP) * 100)
Dim ID As String = currentPokemon.GetEvolutionID(Me.EvolutionTrigger, Me.EvolutionArg) Dim ID As String = currentPokemon.GetEvolutionID(Me.EvolutionTrigger, Me.EvolutionArg)
If ID.Contains(CChar("_")) Then If ID.Contains(CChar("_")) Then
evolvedPokemon = Pokemon.GetPokemonByID(CInt(ID.Split(CChar("_"))(0)), ID.Split(CChar("_"))(1)) evolvedPokemon = Pokemon.GetPokemonByID(CInt(ID.Split(CChar("_"))(0)), ID.Split(CChar("_"))(1), True)
Else Else
evolvedPokemon = Pokemon.GetPokemonByID(CInt(ID)) evolvedPokemon = Pokemon.GetPokemonByID(CInt(ID), "", True)
End If End If
If evolvedPokemon.AdditionalData = "" AndAlso currentPokemon.AdditionalData <> "" Then
evolvedPokemon.AdditionalData = currentPokemon.AdditionalData
End If
evolvedPokemon.Status = currentPokemon.Status evolvedPokemon.Status = currentPokemon.Status
evolvedPokemon.EVHP = currentPokemon.EVHP evolvedPokemon.EVHP = currentPokemon.EVHP

View File

@ -3,7 +3,7 @@
Inherits Screen Inherits Screen
Dim Pokemon As Pokemon Dim Pokemon As Pokemon
Dim newAttack As BattleSystem.Attack Dim newAttacks As List(Of BattleSystem.Attack)
Dim mainTexture As Texture2D Dim mainTexture As Texture2D
Dim chosen As Boolean = False Dim chosen As Boolean = False
@ -17,16 +17,22 @@
Dim currentCharIndex As Integer = 0 Dim currentCharIndex As Integer = 0
Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As Pokemon, ByVal newAttacks As List(Of BattleSystem.Attack))
Me.New(currentScreen, Pokemon, newAttacks, "-1")
End Sub
Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As Pokemon, ByVal newAttack As BattleSystem.Attack) Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As Pokemon, ByVal newAttack As BattleSystem.Attack)
Me.New(currentScreen, Pokemon, newAttack, "-1") Me.New(currentScreen, Pokemon, New List(Of BattleSystem.Attack) From {newAttack}, "-1")
End Sub End Sub
Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As Pokemon, ByVal newAttack As BattleSystem.Attack, ByVal MachineItemID As String) Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As Pokemon, ByVal newAttack As BattleSystem.Attack, ByVal MachineItemID As String)
Me.New(currentScreen, Pokemon, New List(Of BattleSystem.Attack) From {newAttack}, MachineItemID)
End Sub
Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As Pokemon, ByVal newAttacks As List(Of BattleSystem.Attack), ByVal MachineItemID As String)
Me.Identification = Identifications.LearnAttackScreen Me.Identification = Identifications.LearnAttackScreen
Me.PreScreen = currentScreen Me.PreScreen = currentScreen
Me.Pokemon = Pokemon Me.Pokemon = Pokemon
Me.newAttack = newAttack Me.newAttacks = newAttacks
Me.MachineItemID = MachineItemID Me.MachineItemID = MachineItemID
mainTexture = TextureManager.GetTexture("GUI\Menus\Menu") mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
@ -118,7 +124,7 @@
Dim A As BattleSystem.Attack Dim A As BattleSystem.Attack
If AttackIndex = 4 Then If AttackIndex = 4 Then
A = newAttack A = newAttacks(0)
Else Else
A = Pokemon.Attacks(AttackIndex) A = Pokemon.Attacks(AttackIndex)
End If End If
@ -146,7 +152,7 @@
For i = 0 To Me.Pokemon.Attacks.Count - 1 For i = 0 To Me.Pokemon.Attacks.Count - 1
DrawAttack(i, Me.Pokemon.Attacks(i)) DrawAttack(i, Me.Pokemon.Attacks(i))
Next Next
DrawAttack(4, newAttack) DrawAttack(4, newAttacks(0))
End If End If
If chosen = True Then If chosen = True Then
@ -156,9 +162,9 @@
Dim drawText As String = "" Dim drawText As String = ""
If AttackIndex = 4 Then If AttackIndex = 4 Then
drawText = "Give up on learning """ & newAttack.Name & """?" drawText = "Give up on learning """ & newAttacks(0).Name & """?"
Else Else
drawText = "Forget """ & Pokemon.Attacks(AttackIndex).Name & """ to learn """ & newAttack.Name & """?" drawText = "Forget """ & Pokemon.Attacks(AttackIndex).Name & """ to learn """ & newAttacks(0).Name & """?"
If canForget = False Then If canForget = False Then
drawText = "Cannot forget the move " & Pokemon.Attacks(AttackIndex).Name & " because" & Environment.NewLine & "it's a Hidden Machine move." drawText = "Cannot forget the move " & Pokemon.Attacks(AttackIndex).Name & " because" & Environment.NewLine & "it's a Hidden Machine move."
End If End If
@ -208,15 +214,15 @@
End If End If
If currentCharIndex > (Pokemon.GetDisplayName() & " ").Length + 1 Then If currentCharIndex > (Pokemon.GetDisplayName() & " ").Length + 1 Then
If currentCharIndex < GetText().Length Then If currentCharIndex < GetText().Length Then
Core.SpriteBatch.DrawString(FontManager.MainFont, ("wants to learn """ & newAttack.Name & """. But " & Pokemon.GetDisplayName() & " can only learn 4 attacks." & Environment.NewLine & "Do you want " & Pokemon.GetDisplayName() & " to forget an attack to learn """ & newAttack.Name & """?").Remove(currentCharIndex - (Pokemon.GetDisplayName() & " ").Length), New Vector2(FontManager.MainFont.MeasureString(Pokemon.GetDisplayName()).X + 152, 20), Color.White) Core.SpriteBatch.DrawString(FontManager.MainFont, ("wants to learn """ & newAttacks(0).Name & """. But " & Pokemon.GetDisplayName() & " can only learn 4 attacks." & Environment.NewLine & "Do you want " & Pokemon.GetDisplayName() & " to forget an attack to learn """ & newAttacks(0).Name & """?").Remove(currentCharIndex - (Pokemon.GetDisplayName() & " ").Length), New Vector2(FontManager.MainFont.MeasureString(Pokemon.GetDisplayName()).X + 152, 20), Color.White)
Else Else
Core.SpriteBatch.DrawString(FontManager.MainFont, "wants to learn """ & newAttack.Name & """. But " & Pokemon.GetDisplayName() & " can only learn 4 attacks." & Environment.NewLine & "Do you want " & Pokemon.GetDisplayName() & " to forget an attack to learn """ & newAttack.Name & """?", New Vector2(FontManager.MainFont.MeasureString(Pokemon.GetDisplayName()).X + 152, 20), Color.White) Core.SpriteBatch.DrawString(FontManager.MainFont, "wants to learn """ & newAttacks(0).Name & """. But " & Pokemon.GetDisplayName() & " can only learn 4 attacks." & Environment.NewLine & "Do you want " & Pokemon.GetDisplayName() & " to forget an attack to learn """ & newAttacks(0).Name & """?", New Vector2(FontManager.MainFont.MeasureString(Pokemon.GetDisplayName()).X + 152, 20), Color.White)
End If End If
End If End If
End Sub End Sub
Private Function GetText() As String Private Function GetText() As String
Return Pokemon.GetDisplayName() & " wants to learn """ & newAttack.Name & """. But " & Pokemon.GetDisplayName() & " can only learn 4 attacks." & Environment.NewLine & "Do you want " & Pokemon.GetDisplayName() & " to forget an attack to learn """ & newAttack.Name & """?" Return Pokemon.GetDisplayName() & " wants to learn """ & newAttacks(0).Name & """. But " & Pokemon.GetDisplayName() & " can only learn 4 attacks." & Environment.NewLine & "Do you want " & Pokemon.GetDisplayName() & " to forget an attack to learn """ & newAttacks(0).Name & """?"
End Function End Function
Private Sub DrawAttack(ByVal i As Integer, ByVal A As BattleSystem.Attack) Private Sub DrawAttack(ByVal i As Integer, ByVal A As BattleSystem.Attack)
@ -253,13 +259,13 @@
Private Sub ClickYes() Private Sub ClickYes()
If canForget = True Then If canForget = True Then
Dim Text As String = Pokemon.GetDisplayName() & " didn't~learn " & newAttack.Name & "!" Dim Text As String = Pokemon.GetDisplayName() & " didn't~learn " & newAttacks(0).Name & "!"
If AttackIndex <> 4 Then If AttackIndex <> 4 Then
TeachMovesScreen.LearnedMove = True TeachMovesScreen.LearnedMove = True
Text = "1... 2... 3... and...*Ta-da!*" & Pokemon.GetDisplayName() & " forgot~" & Pokemon.Attacks(AttackIndex).Name & " and..." Text = "1... 2... 3... and...*Ta-da!*" & Pokemon.GetDisplayName() & " forgot~" & Pokemon.Attacks(AttackIndex).Name & " and..."
Pokemon.Attacks.RemoveAt(AttackIndex) Pokemon.Attacks.RemoveAt(AttackIndex)
Pokemon.Attacks.Insert(AttackIndex, newAttack) Pokemon.Attacks.Insert(AttackIndex, newAttacks(0))
If Me.MachineItemID <> "-1" Then If Me.MachineItemID <> "-1" Then
PlayerStatistics.Track("TMs/HMs used", 1) PlayerStatistics.Track("TMs/HMs used", 1)
@ -285,7 +291,12 @@
TextBox.Show(Text, {}, False, False) TextBox.Show(Text, {}, False, False)
Core.GameInstance.IsMouseVisible = False Core.GameInstance.IsMouseVisible = False
Core.SetScreen(Me.PreScreen) If Me.newAttacks.Count > 1 Then
Me.newAttacks.RemoveAt(0)
Core.SetScreen(New LearnAttackScreen(Me.PreScreen, Me.Pokemon, Me.newAttacks))
Else
Core.SetScreen(Me.PreScreen)
End If
End If End If
End Sub End Sub
@ -295,7 +306,7 @@
End Sub End Sub
Private Sub FollowUpText() Private Sub FollowUpText()
TextBox.Show("... " & Pokemon.GetDisplayName() & " learned~" & newAttack.Name & "!") TextBox.Show("... " & Pokemon.GetDisplayName() & " learned~" & newAttacks(0).Name & "!")
SoundManager.PlaySound("success_small", True) SoundManager.PlaySound("success_small", True)
End Sub End Sub

View File

@ -17,28 +17,31 @@
Me.Identification = Identifications.TeachMovesScreen Me.Identification = Identifications.TeachMovesScreen
For i = 0 To Pokemon.AttackLearns.Count - 1 For i = 0 To Pokemon.AttackLearns.Count - 1
Dim tutorMove As BattleSystem.Attack = Pokemon.AttackLearns.Values(i) Dim aList As List(Of BattleSystem.Attack) = Pokemon.AttackLearns.Values(i)
Dim learnLevel As Integer = Pokemon.AttackLearns.Keys(i) For a = 0 To aList.Count - 1
Dim tutorMove As BattleSystem.Attack = aList(a)
Dim learnLevel As Integer = Pokemon.AttackLearns.Keys(i)
If learnLevel <= Pokemon.Level Then If learnLevel <= Pokemon.Level Then
Dim canLearnMove As Boolean = True Dim canLearnMove As Boolean = True
For Each learnedAttack As BattleSystem.Attack In Pokemon.Attacks For Each learnedAttack As BattleSystem.Attack In Pokemon.Attacks
If learnedAttack.ID = tutorMove.ID Then If learnedAttack.ID = tutorMove.ID Then
canLearnMove = False canLearnMove = False
End If
Next
For Each move As BattleSystem.Attack In MovesList
If move.ID = tutorMove.ID Then
canLearnMove = False
End If
Next
If canLearnMove = True Then
MovesList.Add(tutorMove)
End If End If
Next
For Each move As BattleSystem.Attack In MovesList
If move.ID = tutorMove.ID Then
canLearnMove = False
End If
Next
If canLearnMove = True Then
MovesList.Add(tutorMove)
End If End If
End If Next
Next Next
Me.MouseVisible = False Me.MouseVisible = False
@ -64,10 +67,14 @@
End If End If
Next Next
For i = 0 To Pokemon.AttackLearns.Count - 1 For i = 0 To Pokemon.AttackLearns.Count - 1
Dim learnAttack As BattleSystem.Attack = Pokemon.AttackLearns.Values(i) Dim aList As List(Of BattleSystem.Attack) = Pokemon.AttackLearns.Values(i)
If learnAttack.ID = a.ID Then For lA = 0 To aList.Count - 1
canLearnMove = True Dim learnAttack As BattleSystem.Attack = aList(lA)
End If If learnAttack.ID = a.ID Then
canLearnMove = True
End If
Next
Next Next
For Each eggMoveID As Integer In Pokemon.EggMoves For Each eggMoveID As Integer In Pokemon.EggMoves
If eggMoveID = a.ID Then If eggMoveID = a.ID Then

View File

@ -742,11 +742,18 @@
End If End If
p.Level += amount p.Level += amount
For i = 0 To amount - 1 If amount > 0 Then
If p.AttackLearns.ContainsKey(originalLevel + i) = True AndAlso p.KnowsMove(p.AttackLearns(originalLevel + i)) = False Then For i = 1 To amount
AttackLearnList.Add(p.AttackLearns(originalLevel + i)) If p.AttackLearns.ContainsKey(originalLevel + i) = True Then
End If Dim aList As List(Of BattleSystem.Attack) = p.AttackLearns(originalLevel + i)
Next For a = 0 To aList.Count - 1
If AttackLearnList.Contains(aList(a)) = False AndAlso p.KnowsMove(aList(a)) = False Then
AttackLearnList.Add(aList(a))
End If
Next
End If
Next
End If
Dim s As String = "version=2" & Environment.NewLine Dim s As String = "version=2" & Environment.NewLine
If amount > 0 Then If amount > 0 Then