mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-27 15:54:25 +02:00
Permanent item loss caused by attacks fix
If an item is swapped/removed/whatever in a battle If it's a PvP battle or a Trainer battle Every Pokémon that has its item removed gets its original item back If it's a Wild battle If a Pokémon that had its original item removed is holding a different item (because of the attack Trick for example) The Pokémon keeps the new item and the original item is added to the inventory.
This commit is contained in:
parent
9147437d7b
commit
d8f7319bc7
@ -1036,8 +1036,6 @@ nextIndex:
|
|||||||
End If
|
End If
|
||||||
TempPokeFile = ""
|
TempPokeFile = ""
|
||||||
|
|
||||||
OwnPokemon.ResetTemp()
|
|
||||||
|
|
||||||
If IsRemoteBattle = False Then
|
If IsRemoteBattle = False Then
|
||||||
If ConnectScreen.Connected = True Then
|
If ConnectScreen.Connected = True Then
|
||||||
If Battle.Won = False Then
|
If Battle.Won = False Then
|
||||||
@ -1081,6 +1079,11 @@ nextIndex:
|
|||||||
If p.hasLeveledUp = True Then
|
If p.hasLeveledUp = True Then
|
||||||
hasLevelUp = True
|
hasLevelUp = True
|
||||||
End If
|
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()
|
p.ResetTemp()
|
||||||
Next
|
Next
|
||||||
If hasLevelUp = False Then
|
If hasLevelUp = False Then
|
||||||
@ -1118,6 +1121,14 @@ nextIndex:
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
Else
|
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()
|
ResetVars()
|
||||||
Core.SetScreen(New TransitionScreen(Me, New BlackOutScreen(Me), Color.Black, False))
|
Core.SetScreen(New TransitionScreen(Me, New BlackOutScreen(Me), Color.Black, False))
|
||||||
End If
|
End If
|
||||||
|
@ -106,6 +106,11 @@ Namespace BattleSystem.Moves.Psychic
|
|||||||
If CanSwitchItems Then
|
If CanSwitchItems Then
|
||||||
Dim i1 As Item = Nothing
|
Dim i1 As Item = Nothing
|
||||||
Dim i2 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
|
If p.Item IsNot Nothing Then
|
||||||
i1 = p.Item
|
i1 = p.Item
|
||||||
End If
|
End If
|
||||||
|
@ -1014,11 +1014,18 @@ Public Class Pokemon
|
|||||||
|
|
||||||
Me.Ability = Me._originalAbility
|
Me.Ability = Me._originalAbility
|
||||||
|
|
||||||
'If Not Me._originalItem Is Nothing Then
|
If Not Me._originalItem Is Nothing Then
|
||||||
' Me.Item = P3D.Item.GetItemByID(Me._originalItem.ID)
|
If Me.Item IsNot Nothing Then
|
||||||
' Me.Item.AdditionalData = Me._originalItem.AdditionalData
|
Core.Player.Inventory.AddItem(Me._originalItem.ID, 1)
|
||||||
' Me._originalItem = Nothing
|
SoundManager.PlaySound("item_found", True)
|
||||||
'End If
|
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
|
Me.IsTransformed = False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user