Implement Exp. All Key Item

This commit is contained in:
JappaWakka 2024-08-31 16:32:35 +02:00
parent 16a88c1c22
commit 2c9a1ebc61
7 changed files with 70 additions and 18 deletions

View File

@ -8332,9 +8332,15 @@
Next Next
For i = 0 To Core.Player.Pokemons.Count - 1 For i = 0 To Core.Player.Pokemons.Count - 1
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 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) expPokemon.Add(i)
End If End If
End If
Next Next
If expPokemon.Count > 0 Then If expPokemon.Count > 0 Then
@ -8347,7 +8353,7 @@
Dim LevelUpAmount As Integer = 0 Dim LevelUpAmount As Integer = 0
Dim originalLevel As Integer = Core.Player.Pokemons(PokeIndex).Level Dim originalLevel As Integer = Core.Player.Pokemons(PokeIndex).Level
If Core.Player.Pokemons(PokeIndex).Level < CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then 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.")) BattleScreen.BattleQuery.Add(New TextQueryObject(Core.Player.Pokemons(PokeIndex).GetDisplayName() & " gained " & EXP & " experience points."))
Dim moveLevel As Integer = originalLevel Dim moveLevel As Integer = originalLevel

View File

@ -991,7 +991,7 @@
Return CalculateEffectiveness(move, BattleScreen, p, op, own) Return CalculateEffectiveness(move, BattleScreen, p, op, own)
End Function 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 op As Pokemon = BattleScreen.OppPokemon
Dim a As Double = 1D Dim a As Double = 1D
@ -1036,6 +1036,13 @@
Dim s As Double = PokemonList.Count Dim s As Double = PokemonList.Count
Dim expShares As Integer = 0 Dim expShares As Integer = 0
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
Else
For Each po As Pokemon In Core.Player.Pokemons For Each po As Pokemon In Core.Player.Pokemons
If Not po.Item Is Nothing Then If Not po.Item Is Nothing Then
If po.Item.OriginalName.ToLower() = "exp. share" Then If po.Item.OriginalName.ToLower() = "exp. share" Then
@ -1053,8 +1060,9 @@
End If End If
End If 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 If EXP < 2 Then
EXP = 2 EXP = 2

View File

@ -1681,6 +1681,7 @@ item_name_576,Mega Bracelet
item_name_651,Light Stone item_name_651,Light Stone
item_name_652,Dark Stone item_name_652,Dark Stone
item_name_653,Black Augurite item_name_653,Black Augurite
item_name_658,Exp. All
Technical Machines: Technical Machines:
item_name_191,TM 01 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: Key Items:
item_use_6,<player.name> stepped~off the Bicycle. item_use_6,<player.name> stepped~off the Bicycle.
item_use_54,Your Coins:~ 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 Names:
move_name_1,Pound move_name_1,Pound

View File

@ -443,6 +443,7 @@
Public startThirdPerson As Boolean = False Public startThirdPerson As Boolean = False
Public startSurfing As Boolean = False Public startSurfing As Boolean = False
Public startRiding As Boolean = False Public startRiding As Boolean = False
Public EnableExpAll As Boolean = False
Public filePrefix As String = "nilllzz" Public filePrefix As String = "nilllzz"
Public newFilePrefix As String = "" Public newFilePrefix As String = ""
@ -794,6 +795,10 @@
If Value <> "" Then If Value <> "" Then
EarnedAchievements = Value.Split(CChar(",")).ToList() EarnedAchievements = Value.Split(CChar(",")).ToList()
End If End If
Case "expall"
If Core.Player.Inventory.GetItemAmount(658.ToString) > 0 Then
EnableExpAll = CBool(Value)
End If
End Select End Select
Else Else
Logger.Log(Logger.LogTypes.Warning, "Player.vb: The line """ & Line & """ is either empty or does not conform the player.dat file rules.") 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 & "Surfing|" & Screen.Level.Surfing.ToNumberString() & Environment.NewLine &
"BP|" & BP & Environment.NewLine & "BP|" & BP & Environment.NewLine &
"Coins|" & Coins & Environment.NewLine & "Coins|" & Coins & Environment.NewLine &
"ExpAll|" & EnableExpAll & Environment.NewLine &
"ShowModels|" & ShowModelsInBattle.ToNumberString() & Environment.NewLine & "ShowModels|" & ShowModelsInBattle.ToNumberString() & Environment.NewLine &
"GTSStars|" & GTSStars & Environment.NewLine & "GTSStars|" & GTSStars & Environment.NewLine &
"SandBoxMode|" & SandBoxMode.ToNumberString() & Environment.NewLine & "SandBoxMode|" & SandBoxMode.ToNumberString() & Environment.NewLine &

View File

@ -0,0 +1,29 @@
Namespace Items.KeyItems
<Item(658, "Exp. All")>
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

Binary file not shown.

View File

@ -550,7 +550,7 @@ nextIndex:
Dim LevelUpAmount As Integer = 0 Dim LevelUpAmount As Integer = 0
Dim originalLevel As Integer = Core.Player.Pokemons(PokeIndex).Level Dim originalLevel As Integer = Core.Player.Pokemons(PokeIndex).Level
If Core.Player.Pokemons(PokeIndex).Level < CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then 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.")) Battlescreen.BattleQuery.Add(New BattleSystem.TextQueryObject(Core.Player.Pokemons(PokeIndex).GetDisplayName() & " gained " & EXP & " experience points."))
Dim moveLevel As Integer = originalLevel Dim moveLevel As Integer = originalLevel