Merge pull request #64 from JappaWakkaP3D/permanent_item_loss_fix

Permanent item loss caused by attacks fix
This commit is contained in:
JappaWakka 2022-05-13 23:49:52 +02:00 committed by GitHub
commit 8160838230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 7 deletions

View File

@ -1174,8 +1174,6 @@ nextIndex:
End If
TempPokeFile = ""
OwnPokemon.ResetTemp()
If IsRemoteBattle = False Then
If ConnectScreen.Connected = True Then
If Battle.Won = False Then
@ -1219,6 +1217,11 @@ nextIndex:
If p.hasLeveledUp = True Then
hasLevelUp = True
End If
If IsRemoteBattle = True Or IsTrainerBattle = True Then
p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID)
p.Item.AdditionalData = p.OriginalItem.AdditionalData
Screen.TextBox.Show(Core.Player.Name & " received" & p.OriginalItem.Name & "*and gave it back to~" & p.GetDisplayName)
End If
p.ResetTemp()
Next
@ -1261,6 +1264,14 @@ nextIndex:
End If
Next
Else
For Each p As Pokemon In Core.Player.Pokemons
If IsRemoteBattle = True Or IsTrainerBattle = True Then
p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID)
p.Item.AdditionalData = p.OriginalItem.AdditionalData
Screen.TextBox.Show(Core.Player.Name & " received~" & p.OriginalItem.Name & "*and gave it back to~" & p.GetDisplayName)
End If
p.ResetTemp()
Next
ResetVars()
Core.SetScreen(New TransitionScreen(Me, New BlackOutScreen(Me), Color.Black, False))
End If

View File

@ -106,6 +106,11 @@ Namespace BattleSystem.Moves.Psychic
If CanSwitchItems Then
Dim i1 As Item = Nothing
Dim i2 As Item = Nothing
If own = True Then
p.OriginalItem = p.Item
Else
op.OriginalItem = op.Item
End If
If p.Item IsNot Nothing Then
i1 = p.Item
End If

View File

@ -1035,11 +1035,18 @@ Public Class Pokemon
Me.Ability = Me._originalAbility
'If Not Me._originalItem Is Nothing Then
' Me.Item = P3D.Item.GetItemByID(Me._originalItem.ID)
' Me.Item.AdditionalData = Me._originalItem.AdditionalData
' Me._originalItem = Nothing
'End If
If Not Me._originalItem Is Nothing Then
If Me.Item IsNot Nothing Then
Core.Player.Inventory.AddItem(Me._originalItem.ID, 1)
SoundManager.PlaySound("item_found", True)
Screen.TextBox.Show(Core.Player.Name & " found~" & Me._originalItem.Name & "!*" & Core.Player.Inventory.GetMessageReceive(_originalItem, 1))
Else
Me.Item = P3D.Item.GetItemByID(Me._originalItem.ID)
Me.Item.AdditionalData = Me._originalItem.AdditionalData
Screen.TextBox.Show(Core.Player.Name & " found~" & Me._originalItem.Name & "*and gave it back to~" & Me.GetDisplayName)
End If
Me._originalItem = Nothing
End If
Me.IsTransformed = False