Fix item swap bug

This commit is contained in:
JappaWakka 2023-02-02 10:32:26 +01:00
parent 74d5981c22
commit 4d1899037b
2 changed files with 19 additions and 5 deletions

View File

@ -123,6 +123,18 @@ Namespace BattleSystem.Moves.Psychic
End If
p.Item = i2
op.Item = i1
If p.Item IsNot Nothing AndAlso p.OriginalItem IsNot Nothing Then
If p.Item.ID = p.OriginalItem.ID AndAlso p.Item.AdditionalData = p.OriginalItem.AdditionalData Then
p.OriginalItem = Nothing
End If
End If
If op.Item IsNot Nothing AndAlso op.OriginalItem IsNot Nothing Then
If op.Item.ID = op.OriginalItem.ID AndAlso op.Item.AdditionalData = op.OriginalItem.AdditionalData Then
p.OriginalItem = Nothing
End If
End If
BattleScreen.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & " switched items with " & op.GetDisplayName() & "."))
Else
BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!"))

View File

@ -998,13 +998,17 @@ Public Class Pokemon
_originalNumber = -1
End If
If Not _originalItem Is Nothing Then
Me._originalItem = Nothing
End If
If Not _originalType1 Is Nothing Then
Me.Type1 = _originalType1
Me.Type1.Type = _originalType1.Type
_originalType1 = Nothing
End If
If Not _originalType2 Is Nothing Then
Me.Type2 = _originalType2
Me.Type2.Type = _originalType2.Type
_originalType2 = Nothing
End If
@ -1162,9 +1166,7 @@ Public Class Pokemon
Return Me._originalItem
End Get
Set(value As Item)
If Me._originalItem Is Nothing Then
Me._originalItem = value
End If
End Set
End Property