diff --git a/P3D/Battle/BattleSystemV2/BattleScreen.vb b/P3D/Battle/BattleSystemV2/BattleScreen.vb index 1d478904c..7db135415 100644 --- a/P3D/Battle/BattleSystemV2/BattleScreen.vb +++ b/P3D/Battle/BattleSystemV2/BattleScreen.vb @@ -1338,6 +1338,7 @@ nextIndex: End If Dim hasLevelUp As Boolean = False + Dim ItemReturnScript As String = "@Text.Show(" For Each p As Pokemon In Core.Player.Pokemons If p.hasLeveledUp = True Then hasLevelUp = True @@ -1351,7 +1352,10 @@ nextIndex: End If p.Item.AdditionalData = p.OriginalItem.AdditionalData - Screen.TextBox.Show(Core.Player.Name & " received~" & p.OriginalItem.Name & "and gave it back to~" & p.GetDisplayName & "!") + If ItemReturnScript <> "" Then + ItemReturnScript &= "*" + End If + ItemReturnScript &= Core.Player.Name & " received~" & p.OriginalItem.Name & "*and gave it back to~" & p.GetDisplayName & "!" p.OriginalItem = Nothing End If Else @@ -1364,7 +1368,12 @@ nextIndex: End If p.Item.AdditionalData = p.OriginalItem.AdditionalData - Screen.TextBox.Show(Core.Player.Name & " found~" & p.OriginalItem.Name & "*and gave it back to~" & p.GetDisplayName & "!") + + If ItemReturnScript <> "" Then + ItemReturnScript &= "*" + End If + + ItemReturnScript &= Core.Player.Name & " found~" & p.OriginalItem.Name & "*and gave it back to~" & p.GetDisplayName & "!" p.OriginalItem = Nothing Else If p.OriginalItem.IsGameModeItem = True Then @@ -1372,15 +1381,27 @@ nextIndex: Else Core.Player.Inventory.AddItem(p.OriginalItem.ID.ToString, 1) End If + If ItemReturnScript <> "" Then + ItemReturnScript &= ")" & Environment.NewLine + End If + ItemReturnScript &= "@Sound.Play(item_found)" & Environment.NewLine & "@Text.Show(" & Core.Player.Name & " found~" & p.OriginalItem.Name & "!*" & Core.Player.Inventory.GetMessageReceive(p.OriginalItem, 1) - SoundManager.PlaySound("item_found", True) - Screen.TextBox.Show(Core.Player.Name & " found~" & p.OriginalItem.Name & "!*" & Core.Player.Inventory.GetMessageReceive(p.OriginalItem, 1)) p.OriginalItem = Nothing + End If End If - End If End If p.ResetTemp() Next + If ItemReturnScript <> "" Then + ItemReturnScript &= ")" + End If + + Dim s As String = + "version=2" & Environment.NewLine & + ItemReturnScript & Environment.NewLine & + ":end" + + CType(SavedOverworld.OverworldScreen, OverworldScreen).ActionScript.StartScript(s, 2, False) If hasLevelUp = False Then Core.SetScreen(New TransitionScreen(Me, SavedOverworld.OverworldScreen, New Color(255, 255, 255), False, AddressOf ChangeSavedScreen)) @@ -1421,38 +1442,67 @@ nextIndex: FieldEffects.OppRageFistPower = 0 Else + Dim ItemReturnScript As String = "@Text.Show(" For Each p As Pokemon In Core.Player.Pokemons If IsRemoteBattle = True Then If p.OriginalItem IsNot Nothing Then If p.OriginalItem.IsGameModeItem = True Then - p.Item = P3D.Item.GetItemByID(p.OriginalItem.gmID.ToString) + p.Item = P3D.Item.GetItemByID(p.OriginalItem.gmID) Else p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID.ToString) End If + p.Item.AdditionalData = p.OriginalItem.AdditionalData - Screen.TextBox.Show(Core.Player.Name & " received~" & p.OriginalItem.Name & "and gave it back to~" & p.GetDisplayName & "!") + If ItemReturnScript <> "" Then + ItemReturnScript &= "*" + End If + ItemReturnScript &= Core.Player.Name & " received~" & p.OriginalItem.Name & "*and gave it back to~" & p.GetDisplayName & "!" + p.OriginalItem = Nothing End If Else If Not p.OriginalItem Is Nothing Then - If p.Item IsNot Nothing Then + If p.Item Is Nothing Then + If p.OriginalItem.IsGameModeItem = True Then + p.Item = P3D.Item.GetItemByID(p.OriginalItem.gmID.ToString) + Else + p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID.ToString) + End If + + p.Item.AdditionalData = p.OriginalItem.AdditionalData + + If ItemReturnScript <> "" Then + ItemReturnScript &= "*" + End If + + ItemReturnScript &= Core.Player.Name & " found~" & p.OriginalItem.Name & "*and gave it back to~" & p.GetDisplayName & "!" + p.OriginalItem = Nothing + Else If p.OriginalItem.IsGameModeItem = True Then Core.Player.Inventory.AddItem(p.OriginalItem.gmID, 1) Else Core.Player.Inventory.AddItem(p.OriginalItem.ID.ToString, 1) End If - SoundManager.PlaySound("item_found", True) - Screen.TextBox.Show(Core.Player.Name & " found~" & p.OriginalItem.Name & "!*" & Core.Player.Inventory.GetMessageReceive(p.OriginalItem, 1)) - p.OriginalItem = Nothing - Else - p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID.ToString) - p.Item.AdditionalData = p.OriginalItem.AdditionalData - Screen.TextBox.Show(Core.Player.Name & " found~" & p.OriginalItem.Name & "*and gave it back to~" & p.GetDisplayName & "!") + If ItemReturnScript <> "" Then + ItemReturnScript &= ")" & Environment.NewLine + End If + ItemReturnScript &= "@Sound.Play(item_found)" & Environment.NewLine & "@Text.Show(" & Core.Player.Name & " found~" & p.OriginalItem.Name & "!*" & Core.Player.Inventory.GetMessageReceive(p.OriginalItem, 1) + p.OriginalItem = Nothing End If End If End If p.ResetTemp() Next + If ItemReturnScript <> "" Then + ItemReturnScript &= ")" + End If + + Dim s As String = + "version=2" & Environment.NewLine & + ItemReturnScript & Environment.NewLine & + ":end" + + CType(SavedOverworld.OverworldScreen, OverworldScreen).ActionScript.StartScript(s, 2, False) FieldEffects.OwnRageFistPower = 0 FieldEffects.OppRageFistPower = 0 diff --git a/P3D/Pokemon/Monster/Pokemon.vb b/P3D/Pokemon/Monster/Pokemon.vb index 1d7d0d3b0..1c84203b1 100644 --- a/P3D/Pokemon/Monster/Pokemon.vb +++ b/P3D/Pokemon/Monster/Pokemon.vb @@ -1074,10 +1074,6 @@ Public Class Pokemon _originalNumber = -1 End If - If Not _originalItem Is Nothing Then - Me._originalItem = Nothing - End If - If OriginalType1 IsNot Nothing Then Me.Type1.Type = OriginalType1.Type OriginalType1 = Nothing diff --git a/P3D/Screens/Battle/BattleCatchScreen.vb b/P3D/Screens/Battle/BattleCatchScreen.vb index 0c49b9606..761ad1e78 100644 --- a/P3D/Screens/Battle/BattleCatchScreen.vb +++ b/P3D/Screens/Battle/BattleCatchScreen.vb @@ -297,6 +297,9 @@ nextIndex: End Sub Private Sub CatchPokemon() + If Not p.OriginalItem Is Nothing Then + p.OriginalItem = Nothing + End If p.ResetTemp() Dim s As String = "Gotcha!~" & p.GetName() & " was caught!"