Fixed crash in RegisterBattleScreen (BattleSpot). Added @Pokemon.setallEVs and .setallIVs script commands.

This commit is contained in:
CaptainSegis 2017-08-30 20:01:15 -05:00
parent 32a92eb7e3
commit e3c9a78aea
4 changed files with 31 additions and 6 deletions

View File

@ -491,7 +491,7 @@
Dim data() As String = Key.Split(CChar("|"))
Me.GameJoltID = data(1)
Me.BattleStrength = CInt(data(2))
Me.BattleStrength = Clamp(CInt(data(2)), 0, 100)
End Sub
Public Sub SetDifferenceValue(ByVal ownBattleStrength As Integer)
@ -657,16 +657,17 @@
Public Shared Function GetBattleStrength(ByVal team As List(Of Pokemon)) As Integer
Dim pCount As Integer = team.Count
'(BaseStats + EVs * (780 / 186) + IVs * (780 / 186)) / (3 * 780) * 100 = x
'(BaseStats + EVs * (780 / 510) + IVs * (780 / 186)) / (3 * 780) * 100 = x
Dim x As Integer = 0
Dim c As Double = 0
For Each p As Pokemon In team
c = 0
c += p.BaseHP + p.BaseAttack + p.BaseDefense + p.BaseSpAttack + p.BaseSpDefense + p.BaseSpeed
c += (p.IVHP + p.IVAttack + p.IVDefense + p.IVSpAttack + p.IVSpDefense + p.IVSpeed) * (780 / 186)
c += (p.EVHP + p.EVAttack + p.EVDefense + p.EVSpAttack + p.EVSpDefense + p.EVSpeed) * (780 / 186)
c += Clamp((p.IVHP + p.IVAttack + p.IVDefense + p.IVSpAttack + p.IVSpDefense + p.IVSpeed), 0, 186) * (780 / 186)
c += Clamp((p.EVHP + p.EVAttack + p.EVDefense + p.EVSpAttack + p.EVSpDefense + p.EVSpeed), 0, 510) * (780 / 510)
c = c / (3 * 780) * 100
c = Clamp(c, 0, 100)
x += CInt(c)
Next

View File

@ -1936,7 +1936,7 @@ Public Class PokemonForms
Case "primal"
Return New Size(36, 32)
Case Else
Return New Size(35, 32)
Return New Size(32, 32)
End Select
End Function
Public Overrides Function GetDataFileAddition(ByVal AdditionalData As String) As String

View File

@ -6,7 +6,7 @@
Shared _valid As Boolean = False
Const RUNVALIDATION As Boolean = False
Const EXPECTEDSIZE As Integer = 42420205
Const EXPECTEDSIZE As Integer = 42421461
Const METAHASH As String = "MEEzNjIzMUE5RkEwNEFCQjgwQUQwODQ1NDVDRjVCNzQ="
Public Shared ReadOnly Property IsValid(ByVal ForceResult As Boolean) As Boolean

View File

@ -415,6 +415,18 @@
End Select
End With
End If
Case "setallevs"
Dim Index As Integer = int(argument.GetSplit(0, ","))
If Core.Player.Pokemons.Count - 1 >= Index Then
With Core.Player.Pokemons(Index)
.EVHP = Clamp(int(argument.GetSplit(1, ",")), 0, 252)
.EVAttack = Clamp(int(argument.GetSplit(2, ",")), 0, 252)
.EVDefense = Clamp(int(argument.GetSplit(3, ",")), 0, 252)
.EVSpAttack = Clamp(int(argument.GetSplit(4, ",")), 0, 252)
.EVSpDefense = Clamp(int(argument.GetSplit(5, ",")), 0, 252)
.EVSpeed = Clamp(int(argument.GetSplit(6, ",")), 0, 252)
End With
End If
Case "setiv"
Dim Index As Integer = int(argument.GetSplit(0, ","))
Dim dv As String = argument.GetSplit(1, ",")
@ -438,6 +450,18 @@
End Select
End With
End If
Case "setallivs"
Dim Index As Integer = int(argument.GetSplit(0, ","))
If Core.Player.Pokemons.Count - 1 >= Index Then
With Core.Player.Pokemons(Index)
.IVHP = Clamp(int(argument.GetSplit(1, ",")), 0, 31)
.IVAttack = Clamp(int(argument.GetSplit(2, ",")), 0, 31)
.IVDefense = Clamp(int(argument.GetSplit(3, ",")), 0, 31)
.IVSpAttack = Clamp(int(argument.GetSplit(4, ",")), 0, 31)
.IVSpDefense = Clamp(int(argument.GetSplit(5, ",")), 0, 31)
.IVSpeed = Clamp(int(argument.GetSplit(6, ",")), 0, 31)
End With
End If
Case "registerhalloffame"
Dim count As Integer = -1
Dim NewHallOfFameData As String = ""