diff --git a/2.5DHero/2.5DHero/Pokemon/Monster/EvolutionCondition.vb b/2.5DHero/2.5DHero/Pokemon/Monster/EvolutionCondition.vb
index 067036f23..94f2b48d0 100644
--- a/2.5DHero/2.5DHero/Pokemon/Monster/EvolutionCondition.vb
+++ b/2.5DHero/2.5DHero/Pokemon/Monster/EvolutionCondition.vb
@@ -21,9 +21,9 @@ Public Class EvolutionCondition
Public Structure Condition
Dim ConditionType As ConditionTypes
Dim Argument As String
- Dim Trigger As EvolutionTrigger
End Structure
+ Public Trigger As EvolutionTrigger
Public Evolution As Integer = 0
Public Conditions As New List(Of Condition)
@@ -31,7 +31,7 @@ Public Class EvolutionCondition
Me.Evolution = evolution
End Sub
- Public Sub AddCondition(ByVal type As String, ByVal arg As String, ByVal trigger As String)
+ Public Sub AddCondition(ByVal type As String, ByVal arg As String)
Dim c As New Condition
c.Argument = arg
@@ -67,19 +67,20 @@ Public Class EvolutionCondition
Case "weather"
c.ConditionType = ConditionTypes.Weather
End Select
+ Me.Conditions.Add(c)
+ End Sub
+ Public Sub SetTrigger(ByVal trigger As String)
Select Case trigger.ToLower()
Case "none", ""
- c.Trigger = EvolutionTrigger.None
+ Me.Trigger = EvolutionTrigger.None
Case "level", "levelup"
- c.Trigger = EvolutionTrigger.LevelUp
+ Me.Trigger = EvolutionTrigger.LevelUp
Case "trade", "trading"
- c.Trigger = EvolutionTrigger.Trading
+ Me.Trigger = EvolutionTrigger.Trading
Case "item", "itemuse"
- c.Trigger = EvolutionTrigger.ItemUse
+ Me.Trigger = EvolutionTrigger.ItemUse
End Select
-
- Me.Conditions.Add(c)
End Sub
Public ReadOnly Property Count() As Integer
@@ -102,24 +103,31 @@ Public Class EvolutionCondition
''' The trigger that triggered the evolution.
''' An argument (for example Item ID)
Public Shared Function EvolutionNumber(ByVal p As Pokemon, ByVal trigger As EvolutionTrigger, ByVal arg As String) As Integer
+ Dim e As EvolutionCondition = GetEvolutionCondition(p, trigger, arg)
+ If e Is Nothing Then
+ Return 0
+ Else
+ Return e.Evolution
+ End If
+ End Function
+
+ Public Shared Function GetEvolutionCondition(ByVal p As Pokemon, ByVal trigger As EvolutionTrigger, ByVal arg As String) As EvolutionCondition
If trigger = EvolutionTrigger.LevelUp Or trigger = EvolutionTrigger.Trading Then
If Not p.Item Is Nothing Then
If p.Item.ID = 112 Then
- Return 0
+ Return Nothing
End If
End If
End If
- Dim possibleEvolutions As New List(Of Integer)
+ Dim possibleEvolutions As New List(Of EvolutionCondition)
For Each e As EvolutionCondition In p.EvolutionConditions
Dim canEvolve As Boolean = True
- For Each c As Condition In e.Conditions
- If c.Trigger <> trigger Then
- canEvolve = False
- End If
- Next
+ If trigger <> e.Trigger Then
+ canEvolve = False
+ End If
If canEvolve = True Then
For Each c As Condition In e.Conditions
@@ -156,6 +164,8 @@ Public Class EvolutionCondition
Else
If p.Item.ID <> CInt(c.Argument) Then
canEvolve = False
+ 'ElseIf c.Trigger = EvolutionTrigger.Trading Then
+ 'REMOVE HELD ITEM CHECK
End If
End If
Case ConditionTypes.InParty
@@ -220,15 +230,16 @@ Public Class EvolutionCondition
End If
If canEvolve = True Then
- possibleEvolutions.Add(e.Evolution)
+ possibleEvolutions.Add(e)
End If
Next
+ 'Assuming there is never more than one possible evolution for trading + held item
If possibleEvolutions.Count > 0 Then
Return possibleEvolutions(Core.Random.Next(0, possibleEvolutions.Count))
End If
- Return 0
+ Return Nothing
End Function
End Class
diff --git a/2.5DHero/2.5DHero/Pokemon/Monster/Pokemon.vb b/2.5DHero/2.5DHero/Pokemon/Monster/Pokemon.vb
index 0cd0fef99..2f2897c9e 100644
--- a/2.5DHero/2.5DHero/Pokemon/Monster/Pokemon.vb
+++ b/2.5DHero/2.5DHero/Pokemon/Monster/Pokemon.vb
@@ -1447,15 +1447,17 @@ Public Class Pokemon
Dim EvolutionExists As Boolean = False
Dim e As EvolutionCondition = New EvolutionCondition
+ e.SetTrigger(Trigger)
+ e.SetEvolution(Evolution)
+
For Each oldE As EvolutionCondition In Me.EvolutionConditions
- If Evolution = oldE.Evolution Then
+ If e.Evolution = oldE.Evolution AndAlso e.Trigger = oldE.Trigger Then
e = oldE
EvolutionExists = True
End If
Next
- e.SetEvolution(Evolution)
- e.AddCondition(Type, Argument, Trigger)
+ e.AddCondition(Type, Argument)
If EvolutionExists = False Then
EvolutionConditions.Add(e)
diff --git a/2.5DHero/2.5DHero/Screens/Battle/BattleCatchScreen.vb b/2.5DHero/2.5DHero/Screens/Battle/BattleCatchScreen.vb
index b7e910210..6ee77ad71 100644
--- a/2.5DHero/2.5DHero/Screens/Battle/BattleCatchScreen.vb
+++ b/2.5DHero/2.5DHero/Screens/Battle/BattleCatchScreen.vb
@@ -345,7 +345,7 @@
Case "moon ball"
For Each ev As EvolutionCondition In cp.EvolutionConditions
For Each con As EvolutionCondition.Condition In ev.Conditions
- If con.ConditionType = EvolutionCondition.ConditionTypes.Item And con.Argument = "8" And con.Trigger = EvolutionCondition.EvolutionTrigger.ItemUse Then
+ If con.ConditionType = EvolutionCondition.ConditionTypes.Item And con.Argument = "8" And ev.Trigger = EvolutionCondition.EvolutionTrigger.ItemUse Then
BallRate = 4.0F
Exit For
End If
diff --git a/2.5DHero/2.5DHero/Screens/Pokemon/EvolutionScreen.vb b/2.5DHero/2.5DHero/Screens/Pokemon/EvolutionScreen.vb
index 17faa42f4..200944a4a 100644
--- a/2.5DHero/2.5DHero/Screens/Pokemon/EvolutionScreen.vb
+++ b/2.5DHero/2.5DHero/Screens/Pokemon/EvolutionScreen.vb
@@ -263,6 +263,21 @@
End If
End If
+ If Me.EvolutionTrigger = EvolutionCondition.EvolutionTrigger.Trading Then
+ Dim econ As EvolutionCondition = EvolutionCondition.GetEvolutionCondition(currentPokemon, Me.EvolutionTrigger, Me.EvolutionArg)
+ Dim removeItem As Boolean = False
+ If econ.Trigger = EvolutionCondition.EvolutionTrigger.Trading Then
+ For i = 0 To econ.Conditions.Count - 1
+ If econ.Conditions(i).ConditionType = EvolutionCondition.ConditionTypes.HoldItem Then
+ removeItem = True
+ End If
+ Next
+ End If
+ If removeItem Then
+ evolvedPokemon.Item = Nothing
+ End If
+ End If
+
Core.Player.AddPoints(10, "Evolved Pokémon.")
If ConnectScreen.Connected = True Then