diff --git a/P3D/Battle/BattleSystemV2/Battle.vb b/P3D/Battle/BattleSystemV2/Battle.vb index ca9712e86..903ad5247 100644 --- a/P3D/Battle/BattleSystemV2/Battle.vb +++ b/P3D/Battle/BattleSystemV2/Battle.vb @@ -8332,8 +8332,14 @@ Next For i = 0 To Core.Player.Pokemons.Count - 1 - If expPokemon.Contains(i) = False And Not Core.Player.Pokemons(i).Item Is Nothing AndAlso Core.Player.Pokemons(i).Item.OriginalName.ToLower() = "exp. share" AndAlso Core.Player.Pokemons(i).Status <> Pokemon.StatusProblems.Fainted AndAlso Core.Player.Pokemons(i).IsEgg() = False Then - expPokemon.Add(i) + If Core.Player.Inventory.GetItemAmount(658.ToString) > 0 And Core.Player.EnableExpAll = True Then + If expPokemon.Contains(i) = False AndAlso Core.Player.Pokemons(i).Status <> Pokemon.StatusProblems.Fainted AndAlso Core.Player.Pokemons(i).IsEgg() = False Then + expPokemon.Add(i) + End If + Else + If expPokemon.Contains(i) = False And Not Core.Player.Pokemons(i).Item Is Nothing AndAlso Core.Player.Pokemons(i).Item.OriginalName.ToLower() = "exp. share" AndAlso Core.Player.Pokemons(i).Status <> Pokemon.StatusProblems.Fainted AndAlso Core.Player.Pokemons(i).IsEgg() = False Then + expPokemon.Add(i) + End If End If Next @@ -8347,7 +8353,7 @@ Dim LevelUpAmount As Integer = 0 Dim originalLevel As Integer = Core.Player.Pokemons(PokeIndex).Level If Core.Player.Pokemons(PokeIndex).Level < CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then - Dim EXP As Integer = BattleCalculation.GainExp(Core.Player.Pokemons(PokeIndex), BattleScreen, expPokemon) + Dim EXP As Integer = BattleCalculation.GainExp(Core.Player.Pokemons(PokeIndex), BattleScreen, expPokemon, PokeIndex) BattleScreen.BattleQuery.Add(New TextQueryObject(Core.Player.Pokemons(PokeIndex).GetDisplayName() & " gained " & EXP & " experience points.")) Dim moveLevel As Integer = originalLevel diff --git a/P3D/Battle/BattleSystemV2/BattleCalculation.vb b/P3D/Battle/BattleSystemV2/BattleCalculation.vb index ad14c6faf..82bbbcd79 100644 --- a/P3D/Battle/BattleSystemV2/BattleCalculation.vb +++ b/P3D/Battle/BattleSystemV2/BattleCalculation.vb @@ -991,7 +991,7 @@ Return CalculateEffectiveness(move, BattleScreen, p, op, own) End Function - Public Shared Function GainExp(ByVal p As Pokemon, ByVal BattleScreen As BattleScreen, ByVal PokemonList As List(Of Integer)) As Integer + Public Shared Function GainExp(ByVal p As Pokemon, ByVal BattleScreen As BattleScreen, ByVal PokemonList As List(Of Integer), ByVal PokeIndex As Integer) As Integer Dim op As Pokemon = BattleScreen.OppPokemon Dim a As Double = 1D @@ -1036,25 +1036,33 @@ Dim s As Double = PokemonList.Count Dim expShares As Integer = 0 - For Each po As Pokemon In Core.Player.Pokemons - If Not po.Item Is Nothing Then - If po.Item.OriginalName.ToLower() = "exp. share" Then - expShares += 1 - End If + Dim expAllMultiplier As Single = 1 + If Core.Player.Inventory.GetItemAmount(658.ToString) > 0 And Core.Player.EnableExpAll = True Then + s = 1D + If BattleScreen.ParticipatedPokemon.Contains(PokeIndex) = False Then + expAllMultiplier = 0.5F End If - Next + Else + For Each po As Pokemon In Core.Player.Pokemons + If Not po.Item Is Nothing Then + If po.Item.OriginalName.ToLower() = "exp. share" Then + expShares += 1 + End If + End If + Next - If expShares > 0 Then - If Not p.Item Is Nothing Then - If p.Item.OriginalName.ToLower() = "exp. share" Then - s = 2D - Else - s = (PokemonList.Count * 2D) * expShares + If expShares > 0 Then + If Not p.Item Is Nothing Then + If p.Item.OriginalName.ToLower() = "exp. share" Then + s = 2D + Else + s = (PokemonList.Count * 2D) * expShares + End If End If End If End If - Dim EXP As Integer = CInt((((a * b * L) / (5 * s)) * (((2 * L + 10) ^ 2.5D) / ((L + Lp + 10) ^ 2.5D)) + 1) * t * e * gm * 1) + Dim EXP As Integer = CInt((((a * b * L) / (5 * s)) * (((2 * L + 10) ^ 2.5D) / ((L + Lp + 10) ^ 2.5D)) + 1) * t * e * gm * expAllMultiplier) If EXP < 2 Then EXP = 2 diff --git a/P3D/Content/Localization/Tokens_en.dat b/P3D/Content/Localization/Tokens_en.dat index ffc6f4832..1e9e40be1 100644 --- a/P3D/Content/Localization/Tokens_en.dat +++ b/P3D/Content/Localization/Tokens_en.dat @@ -1681,6 +1681,7 @@ item_name_576,Mega Bracelet item_name_651,Light Stone item_name_652,Dark Stone item_name_653,Black Augurite +item_name_658,Exp. All Technical Machines: item_name_191,TM 01 @@ -2334,6 +2335,8 @@ item_6_only_custom_gamemodes,This item can't be used~on this GameMode. Key Items: item_use_6, stepped~off the Bicycle. item_use_54,Your Coins:~ +item_use_658_disable,The Exp. All was turned off. +item_use_658_enable,The Exp. All was turned on. ------------------- Move Names: move_name_1,Pound diff --git a/P3D/Player/Player.vb b/P3D/Player/Player.vb index 6286a36b6..525a05a13 100644 --- a/P3D/Player/Player.vb +++ b/P3D/Player/Player.vb @@ -443,6 +443,7 @@ Public startThirdPerson As Boolean = False Public startSurfing As Boolean = False Public startRiding As Boolean = False + Public EnableExpAll As Boolean = False Public filePrefix As String = "nilllzz" Public newFilePrefix As String = "" @@ -794,6 +795,10 @@ If Value <> "" Then EarnedAchievements = Value.Split(CChar(",")).ToList() End If + Case "expall" + If Core.Player.Inventory.GetItemAmount(658.ToString) > 0 Then + EnableExpAll = CBool(Value) + End If End Select Else Logger.Log(Logger.LogTypes.Warning, "Player.vb: The line """ & Line & """ is either empty or does not conform the player.dat file rules.") @@ -1262,6 +1267,7 @@ "Surfing|" & Screen.Level.Surfing.ToNumberString() & Environment.NewLine & "BP|" & BP & Environment.NewLine & "Coins|" & Coins & Environment.NewLine & + "ExpAll|" & EnableExpAll & Environment.NewLine & "ShowModels|" & ShowModelsInBattle.ToNumberString() & Environment.NewLine & "GTSStars|" & GTSStars & Environment.NewLine & "SandBoxMode|" & SandBoxMode.ToNumberString() & Environment.NewLine & diff --git a/P3D/Pokemon/Items/KeyItems/ExpAll.vb b/P3D/Pokemon/Items/KeyItems/ExpAll.vb new file mode 100644 index 000000000..ec8d6b16c --- /dev/null +++ b/P3D/Pokemon/Items/KeyItems/ExpAll.vb @@ -0,0 +1,29 @@ +Namespace Items.KeyItems + + + Public Class ExpAll + + Inherits KeyItem + + Public Overrides ReadOnly Property Description As String = "Turning on this special device will allow all the Pokémon on your team to receive Exp. Points from battles." + Public Overrides ReadOnly Property PokeDollarPrice As Integer = 3000 + Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False + Public Overrides ReadOnly Property CanBeUsed As Boolean = True + + Public Sub New() + _textureRectangle = New Rectangle(216, 48, 24, 24) + End Sub + + Public Overrides Sub Use() + Core.Player.EnableExpAll = Not Core.Player.EnableExpAll + If Core.Player.EnableExpAll = False Then + Screen.TextBox.Show(Localization.GetString("item_use_658_disable", "The Exp. All was turned off.")) + Else + Screen.TextBox.Show(Localization.GetString("item_use_658_enable", "The Exp. All was turned on.")) + End If + + End Sub + + End Class + +End Namespace diff --git a/P3D/Pokemon/Items/_itemList.txt b/P3D/Pokemon/Items/_itemList.txt index 1f401b212..2c62e5c61 100644 Binary files a/P3D/Pokemon/Items/_itemList.txt and b/P3D/Pokemon/Items/_itemList.txt differ diff --git a/P3D/Screens/Battle/BattleCatchScreen.vb b/P3D/Screens/Battle/BattleCatchScreen.vb index 4f935773a..37dcab56d 100644 --- a/P3D/Screens/Battle/BattleCatchScreen.vb +++ b/P3D/Screens/Battle/BattleCatchScreen.vb @@ -550,7 +550,7 @@ nextIndex: Dim LevelUpAmount As Integer = 0 Dim originalLevel As Integer = Core.Player.Pokemons(PokeIndex).Level If Core.Player.Pokemons(PokeIndex).Level < CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then - Dim EXP As Integer = BattleSystem.BattleCalculation.GainExp(Core.Player.Pokemons(PokeIndex), Battlescreen, expPokemon) + Dim EXP As Integer = BattleSystem.BattleCalculation.GainExp(Core.Player.Pokemons(PokeIndex), Battlescreen, expPokemon, PokeIndex) Battlescreen.BattleQuery.Add(New BattleSystem.TextQueryObject(Core.Player.Pokemons(PokeIndex).GetDisplayName() & " gained " & EXP & " experience points.")) Dim moveLevel As Integer = originalLevel