diff --git a/P3D/P3D.vbproj b/P3D/P3D.vbproj index 9c92adc9b..468ebf3b2 100644 --- a/P3D/P3D.vbproj +++ b/P3D/P3D.vbproj @@ -28766,6 +28766,7 @@ + @@ -28920,6 +28921,7 @@ + PreserveNewest diff --git a/P3D/Player/Player.vb b/P3D/Player/Player.vb index 81ff480a8..6020ad642 100644 --- a/P3D/Player/Player.vb +++ b/P3D/Player/Player.vb @@ -543,6 +543,7 @@ End If GameModeManager.SetGameModePointer(GameMode) + BattleSystem.GameModeElementLoader.Load() BattleSystem.GameModeAttackLoader.Load() GameModeItemLoader.Load() diff --git a/P3D/Pokemon/Attacks/GameModeAttackLoader.vb b/P3D/Pokemon/Attacks/GameModeAttackLoader.vb index 8f24e8889..34920e5c1 100644 --- a/P3D/Pokemon/Attacks/GameModeAttackLoader.vb +++ b/P3D/Pokemon/Attacks/GameModeAttackLoader.vb @@ -84,7 +84,11 @@ Case "accuracy", "acc" move.Accuracy = CInt(value) Case "type" - move.Type = New Element(value) + If StringHelper.IsNumeric(value) = False Then + move.Type = GameModeElementLoader.GetElementByName(value) + Else + move.Type = GameModeElementLoader.GetElementByID(CInt(value)) + End If Case "category" Select Case value.ToLower() Case "physical" diff --git a/P3D/Pokemon/Attacks/Normal/NaturalGift.vb b/P3D/Pokemon/Attacks/Normal/NaturalGift.vb index 043eb6d2a..12ab2f825 100644 --- a/P3D/Pokemon/Attacks/Normal/NaturalGift.vb +++ b/P3D/Pokemon/Attacks/Normal/NaturalGift.vb @@ -90,7 +90,7 @@ Namespace BattleSystem.Moves.Normal If Not p.Item Is Nothing Then If p.Item.isBerry = True Then - Return New Element(CType(p.Item, Items.Berry).Type) + Return BattleSystem.GameModeElementLoader.GetElementByID(CType(p.Item, Items.Berry).Type) End If End If diff --git a/P3D/Pokemon/Items/Berry.vb b/P3D/Pokemon/Items/Berry.vb index 86d8d118a..8a64dfcd3 100644 --- a/P3D/Pokemon/Items/Berry.vb +++ b/P3D/Pokemon/Items/Berry.vb @@ -31,7 +31,7 @@ Public SummerGrow As Integer = 2 Public FallGrow As Integer = 1 - Public Type As Element.Types + Public Type As Integer Public Power As Integer = 80 Public JuiceColor As String = "red" diff --git a/P3D/Pokemon/Items/GameModeItem.vb b/P3D/Pokemon/Items/GameModeItem.vb index e6f7fd31d..225eeb7c5 100644 --- a/P3D/Pokemon/Items/GameModeItem.vb +++ b/P3D/Pokemon/Items/GameModeItem.vb @@ -197,45 +197,49 @@ Public Class GameModeItem Public Sub SetTeachMoveTextureRectangle() Dim r As New Rectangle(144, 168, 24, 24) + If gmTeachMove.Type.IsGameModeElement = False Then - Select Case gmTeachMove.Type.Type - Case Element.Types.Blank, Element.Types.Normal - r = New Rectangle(144, 168, 24, 24) - Case Element.Types.Bug - r = New Rectangle(24, 192, 24, 24) - Case Element.Types.Dark - r = New Rectangle(384, 168, 24, 24) - Case Element.Types.Dragon - r = New Rectangle(408, 168, 24, 24) - Case Element.Types.Electric - r = New Rectangle(288, 168, 24, 24) - Case Element.Types.Fairy - r = New Rectangle(72, 264, 24, 24) - Case Element.Types.Fighting - r = New Rectangle(168, 168, 24, 24) - Case Element.Types.Fire - r = New Rectangle(360, 168, 24, 24) - Case Element.Types.Flying - r = New Rectangle(0, 192, 24, 24) - Case Element.Types.Ghost - r = New Rectangle(480, 168, 24, 24) - Case Element.Types.Grass - r = New Rectangle(336, 168, 24, 24) - Case Element.Types.Ground - r = New Rectangle(456, 168, 24, 24) - Case Element.Types.Ice - r = New Rectangle(312, 168, 24, 24) - Case Element.Types.Poison - r = New Rectangle(264, 168, 24, 24) - Case Element.Types.Psychic - r = New Rectangle(216, 168, 24, 24) - Case Element.Types.Rock - r = New Rectangle(240, 168, 24, 24) - Case Element.Types.Steel - r = New Rectangle(432, 168, 24, 24) - Case Element.Types.Water - r = New Rectangle(192, 168, 24, 24) - End Select + Select Case gmTeachMove.Type.Type + Case Element.Types.Blank, Element.Types.Normal + r = New Rectangle(144, 168, 24, 24) + Case Element.Types.Bug + r = New Rectangle(24, 192, 24, 24) + Case Element.Types.Dark + r = New Rectangle(384, 168, 24, 24) + Case Element.Types.Dragon + r = New Rectangle(408, 168, 24, 24) + Case Element.Types.Electric + r = New Rectangle(288, 168, 24, 24) + Case Element.Types.Fairy + r = New Rectangle(72, 264, 24, 24) + Case Element.Types.Fighting + r = New Rectangle(168, 168, 24, 24) + Case Element.Types.Fire + r = New Rectangle(360, 168, 24, 24) + Case Element.Types.Flying + r = New Rectangle(0, 192, 24, 24) + Case Element.Types.Ghost + r = New Rectangle(480, 168, 24, 24) + Case Element.Types.Grass + r = New Rectangle(336, 168, 24, 24) + Case Element.Types.Ground + r = New Rectangle(456, 168, 24, 24) + Case Element.Types.Ice + r = New Rectangle(312, 168, 24, 24) + Case Element.Types.Poison + r = New Rectangle(264, 168, 24, 24) + Case Element.Types.Psychic + r = New Rectangle(216, 168, 24, 24) + Case Element.Types.Rock + r = New Rectangle(240, 168, 24, 24) + Case Element.Types.Steel + r = New Rectangle(432, 168, 24, 24) + Case Element.Types.Water + r = New Rectangle(192, 168, 24, 24) + End Select + Else + r = gmTeachMove.Type.gmMachineTextureRectangle + End If gmTextureRectangle = r End Sub diff --git a/P3D/Pokemon/Items/GameModeItemLoader.vb b/P3D/Pokemon/Items/GameModeItemLoader.vb index 80acd138f..d86a402ba 100644 --- a/P3D/Pokemon/Items/GameModeItemLoader.vb +++ b/P3D/Pokemon/Items/GameModeItemLoader.vb @@ -200,7 +200,12 @@ Public Class GameModeItemLoader ElseIf item.gmName.StartsWith("HM") Then item.gmSortValue = -100000 + CInt(item.gmName.Remove(0, 2)) End If - item.gmTextureSource = "Items\ItemSheet" + If item.gmTeachMove.Type.IsGameModeElement = False Then + item.gmTextureSource = "Items\ItemSheet" + Else + item.gmTextureSource = item.gmTeachMove.Type.gmMachineTextureSource + End If + item.SetTeachMoveTextureRectangle() End If diff --git a/P3D/Pokemon/Monster/Element.vb b/P3D/Pokemon/Monster/Element.vb index 265fb1c46..a3320042a 100644 --- a/P3D/Pokemon/Monster/Element.vb +++ b/P3D/Pokemon/Monster/Element.vb @@ -3,6 +3,8 @@ ''' Public Class Element + Public IsGameModeElement As Boolean = False + ''' ''' The Type an Element can be. ''' @@ -30,18 +32,41 @@ Public Class Element End Enum Private _type As Types = Types.Blank + 'GameMode Element Properties + Private gmType As Integer = 0 + Public gmName As String = "Normal" + Public gmOriginalName As String = "Normal" + Public gmTypeRectangle As Rectangle = New Rectangle(0, 0, 48, 16) + Public gmMachineTextureSource As String = "Items\ItemSheet" + Public gmMachineTextureRectangle As Rectangle = New Rectangle(144, 168, 24, 24) + Public gmEffectivenessAttack As New Dictionary(Of Integer, Single) + Public gmEffectivenessDefense As New Dictionary(Of Integer, Single) ''' ''' The Type of this Element. ''' - Public Property Type As Types + Public Property Type As Integer Get - Return Me._type + If Me.IsGameModeElement = True Then + Return Me.gmType + Else + Return Me._type + End If End Get - Set(value As Types) - Me._type = value + Set(value As Integer) + If Me.IsGameModeElement = True Then + Me.gmType = value + Else + Me._type = CType(value, Types) + End If End Set End Property + ''' + ''' Creates a new instance of the Element class for GameMode Elements. + ''' + ''' + Public Sub New() + End Sub ''' ''' Creates a new instance of the Element class. @@ -162,711 +187,723 @@ Public Class Element Return 1 End If - If d._type = Types.Blank Or a._type = Types.Blank Then + If d.Type = Types.Blank Or a.Type = Types.Blank Then Return 1 End If - Select Case a._type - Case Types.Normal - Select Case d._type + If a.IsGameModeElement = False Then + If d.IsGameModeElement = False Then + Select Case a.Type Case Types.Normal - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 1 + Case Types.Poison + Return 1 + Case Types.Ground + Return 1 + Case Types.Rock + Return 0.5F + Case Types.Bug + Return 1 + Case Types.Ghost + Return 0 + Case Types.Steel + Return 0.5F + Case Types.Fire + Return 1 + Case Types.Water + Return 1 + Case Types.Grass + Return 1 + Case Types.Electric + Return 1 + Case Types.Psychic + Return 1 + Case Types.Ice + Return 1 + Case Types.Dragon + Return 1 + Case Types.Dark + Return 1 + Case Else + Return 1 + End Select Case Types.Fighting - Return 1 + Select Case d.Type + Case Types.Normal + Return 2 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 0.5F + Case Types.Poison + Return 0.5F + Case Types.Ground + Return 1 + Case Types.Rock + Return 2 + Case Types.Bug + Return 0.5F + Case Types.Ghost + Return 0 + Case Types.Steel + Return 2 + Case Types.Fire + Return 1 + Case Types.Water + Return 1 + Case Types.Grass + Return 1 + Case Types.Electric + Return 1 + Case Types.Psychic + Return 0.5F + Case Types.Ice + Return 2 + Case Types.Dragon + Return 1 + Case Types.Dark + Return 2 + Case Types.Fairy + Return 0.5F + Case Else + Return 1 + End Select Case Types.Flying - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 2 + Case Types.Flying + Return 1 + Case Types.Poison + Return 1 + Case Types.Ground + Return 1 + Case Types.Rock + Return 0.5F + Case Types.Bug + Return 2 + Case Types.Ghost + Return 1 + Case Types.Steel + Return 0.5F + Case Types.Fire + Return 1 + Case Types.Water + Return 1 + Case Types.Grass + Return 2 + Case Types.Electric + Return 0.5F + Case Types.Psychic + Return 1 + Case Types.Ice + Return 1 + Case Types.Dragon + Return 1 + Case Types.Dark + Return 1 + Case Else + Return 1 + End Select Case Types.Poison - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 1 + Case Types.Poison + Return 0.5F + Case Types.Ground + Return 0.5F + Case Types.Rock + Return 0.5F + Case Types.Bug + Return 1 + Case Types.Ghost + Return 0.5F + Case Types.Steel + Return 0 + Case Types.Fire + Return 1 + Case Types.Water + Return 1 + Case Types.Grass + Return 2 + Case Types.Electric + Return 1 + Case Types.Psychic + Return 1 + Case Types.Ice + Return 1 + Case Types.Dragon + Return 1 + Case Types.Dark + Return 1 + Case Types.Fairy + Return 2 + Case Else + Return 1 + End Select Case Types.Ground - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 0 + Case Types.Poison + Return 2 + Case Types.Ground + Return 1 + Case Types.Rock + Return 2 + Case Types.Bug + Return 0.5F + Case Types.Ghost + Return 1 + Case Types.Steel + Return 2 + Case Types.Fire + Return 2 + Case Types.Water + Return 1 + Case Types.Grass + Return 0.5F + Case Types.Electric + Return 2 + Case Types.Psychic + Return 1 + Case Types.Ice + Return 1 + Case Types.Dragon + Return 1 + Case Types.Dark + Return 1 + Case Else + Return 1 + End Select Case Types.Rock - Return 0.5F + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 0.5F + Case Types.Flying + Return 2 + Case Types.Poison + Return 1 + Case Types.Ground + Return 0.5F + Case Types.Rock + Return 1 + Case Types.Bug + Return 2 + Case Types.Ghost + Return 1 + Case Types.Steel + Return 0.5F + Case Types.Fire + Return 2 + Case Types.Water + Return 1 + Case Types.Grass + Return 1 + Case Types.Electric + Return 1 + Case Types.Psychic + Return 1 + Case Types.Ice + Return 2 + Case Types.Dragon + Return 1 + Case Types.Dark + Return 1 + Case Else + Return 1 + End Select Case Types.Bug - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 0.5F + Case Types.Flying + Return 0.5F + Case Types.Poison + Return 0.5F + Case Types.Ground + Return 1 + Case Types.Rock + Return 1 + Case Types.Bug + Return 1 + Case Types.Ghost + Return 0.5F + Case Types.Steel + Return 0.5F + Case Types.Fire + Return 0.5F + Case Types.Water + Return 1 + Case Types.Grass + Return 2 + Case Types.Electric + Return 1 + Case Types.Psychic + Return 2 + Case Types.Ice + Return 1 + Case Types.Dragon + Return 1 + Case Types.Dark + Return 2 + Case Types.Fairy + Return 0.5F + Case Else + Return 1 + End Select Case Types.Ghost - Return 0 + Select Case d.Type + Case Types.Normal + Return 0 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 1 + Case Types.Poison + Return 1 + Case Types.Ground + Return 1 + Case Types.Rock + Return 1 + Case Types.Bug + Return 1 + Case Types.Ghost + Return 2 + Case Types.Steel + Return 1 + Case Types.Fire + Return 1 + Case Types.Water + Return 1 + Case Types.Grass + Return 1 + Case Types.Electric + Return 1 + Case Types.Psychic + Return 2 + Case Types.Ice + Return 1 + Case Types.Dragon + Return 1 + Case Types.Dark + Return 0.5F + Case Else + Return 1 + End Select Case Types.Steel - Return 0.5F + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 1 + Case Types.Poison + Return 1 + Case Types.Ground + Return 1 + Case Types.Rock + Return 2 + Case Types.Bug + Return 1 + Case Types.Ghost + Return 1 + Case Types.Steel + Return 0.5F + Case Types.Fire + Return 0.5F + Case Types.Water + Return 0.5F + Case Types.Grass + Return 1 + Case Types.Electric + Return 0.5F + Case Types.Psychic + Return 1 + Case Types.Ice + Return 2 + Case Types.Dragon + Return 1 + Case Types.Dark + Return 1 + Case Types.Fairy + Return 2 + Case Else + Return 1 + End Select Case Types.Fire - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 1 + Case Types.Poison + Return 1 + Case Types.Ground + Return 1 + Case Types.Rock + Return 0.5F + Case Types.Bug + Return 2 + Case Types.Ghost + Return 1 + Case Types.Steel + Return 2 + Case Types.Fire + Return 0.5F + Case Types.Water + Return 0.5F + Case Types.Grass + Return 2 + Case Types.Electric + Return 1 + Case Types.Psychic + Return 1 + Case Types.Ice + Return 2 + Case Types.Dragon + Return 0.5F + Case Types.Dark + Return 1 + Case Else + Return 1 + End Select Case Types.Water - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 1 + Case Types.Poison + Return 1 + Case Types.Ground + Return 2 + Case Types.Rock + Return 2 + Case Types.Bug + Return 1 + Case Types.Ghost + Return 1 + Case Types.Steel + Return 1 + Case Types.Fire + Return 2 + Case Types.Water + Return 0.5F + Case Types.Grass + Return 0.5F + Case Types.Electric + Return 1 + Case Types.Psychic + Return 1 + Case Types.Ice + Return 1 + Case Types.Dragon + Return 0.5F + Case Types.Dark + Return 1 + Case Else + Return 1 + End Select Case Types.Grass - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 0.5F + Case Types.Poison + Return 0.5F + Case Types.Ground + Return 2 + Case Types.Rock + Return 2 + Case Types.Bug + Return 0.5F + Case Types.Ghost + Return 1 + Case Types.Steel + Return 0.5F + Case Types.Fire + Return 0.5F + Case Types.Water + Return 2 + Case Types.Grass + Return 0.5F + Case Types.Electric + Return 1 + Case Types.Psychic + Return 1 + Case Types.Ice + Return 1 + Case Types.Dragon + Return 0.5F + Case Types.Dark + Return 1 + Case Else + Return 1 + End Select Case Types.Electric - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 2 + Case Types.Poison + Return 1 + Case Types.Ground + Return 0 + Case Types.Rock + Return 1 + Case Types.Bug + Return 1 + Case Types.Ghost + Return 1 + Case Types.Steel + Return 1 + Case Types.Fire + Return 1 + Case Types.Water + Return 2 + Case Types.Grass + Return 0.5F + Case Types.Electric + Return 0.5F + Case Types.Psychic + Return 1 + Case Types.Ice + Return 1 + Case Types.Dragon + Return 0.5F + Case Types.Dark + Return 1 + Case Else + Return 1 + End Select Case Types.Psychic - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 2 + Case Types.Flying + Return 1 + Case Types.Poison + Return 2 + Case Types.Ground + Return 1 + Case Types.Rock + Return 1 + Case Types.Bug + Return 1 + Case Types.Ghost + Return 1 + Case Types.Steel + Return 0.5F + Case Types.Fire + Return 1 + Case Types.Water + Return 1 + Case Types.Grass + Return 1 + Case Types.Electric + Return 1 + Case Types.Psychic + Return 0.5F + Case Types.Ice + Return 1 + Case Types.Dragon + Return 1 + Case Types.Dark + Return 0 + Case Else + Return 1 + End Select Case Types.Ice - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 2 + Case Types.Poison + Return 1 + Case Types.Ground + Return 2 + Case Types.Rock + Return 1 + Case Types.Bug + Return 1 + Case Types.Ghost + Return 1 + Case Types.Steel + Return 0.5F + Case Types.Fire + Return 0.5F + Case Types.Water + Return 0.5F + Case Types.Grass + Return 2 + Case Types.Electric + Return 1 + Case Types.Psychic + Return 1 + Case Types.Ice + Return 0.5F + Case Types.Dragon + Return 2 + Case Types.Dark + Return 1 + Case Else + Return 1 + End Select Case Types.Dragon - Return 1 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 1 + Case Types.Flying + Return 1 + Case Types.Poison + Return 1 + Case Types.Ground + Return 1 + Case Types.Rock + Return 1 + Case Types.Bug + Return 1 + Case Types.Ghost + Return 1 + Case Types.Steel + Return 0.5F + Case Types.Fire + Return 1 + Case Types.Water + Return 1 + Case Types.Grass + Return 1 + Case Types.Electric + Return 1 + Case Types.Psychic + Return 1 + Case Types.Ice + Return 1 + Case Types.Dragon + Return 2 + Case Types.Dark + Return 1 + Case Types.Fairy + Return 0 + Case Else + Return 1 + End Select Case Types.Dark - Return 1 - Case Else - Return 1 - End Select - Case Types.Fighting - Select Case d._type - Case Types.Normal - Return 2 - Case Types.Fighting - Return 1 - Case Types.Flying - Return 0.5F - Case Types.Poison - Return 0.5F - Case Types.Ground - Return 1 - Case Types.Rock - Return 2 - Case Types.Bug - Return 0.5F - Case Types.Ghost - Return 0 - Case Types.Steel - Return 2 - Case Types.Fire - Return 1 - Case Types.Water - Return 1 - Case Types.Grass - Return 1 - Case Types.Electric - Return 1 - Case Types.Psychic - Return 0.5F - Case Types.Ice - Return 2 - Case Types.Dragon - Return 1 - Case Types.Dark - Return 2 + Select Case d.Type + Case Types.Normal + Return 1 + Case Types.Fighting + Return 0.5F + Case Types.Flying + Return 1 + Case Types.Poison + Return 1 + Case Types.Ground + Return 1 + Case Types.Rock + Return 1 + Case Types.Bug + Return 1 + Case Types.Ghost + Return 2 + Case Types.Steel + Return 1 + Case Types.Fire + Return 1 + Case Types.Water + Return 1 + Case Types.Grass + Return 1 + Case Types.Electric + Return 1 + Case Types.Psychic + Return 2 + Case Types.Ice + Return 1 + Case Types.Dragon + Return 1 + Case Types.Dark + Return 0.5F + Case Types.Fairy + Return 0.5F + Case Else + Return 1 + End Select Case Types.Fairy - Return 0.5F - Case Else - Return 1 - End Select - Case Types.Flying - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 2 - Case Types.Flying - Return 1 - Case Types.Poison - Return 1 - Case Types.Ground - Return 1 - Case Types.Rock - Return 0.5F - Case Types.Bug - Return 2 - Case Types.Ghost - Return 1 - Case Types.Steel - Return 0.5F - Case Types.Fire - Return 1 - Case Types.Water - Return 1 - Case Types.Grass - Return 2 - Case Types.Electric - Return 0.5F - Case Types.Psychic - Return 1 - Case Types.Ice - Return 1 - Case Types.Dragon - Return 1 - Case Types.Dark - Return 1 - Case Else - Return 1 - End Select - Case Types.Poison - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 1 - Case Types.Flying - Return 1 - Case Types.Poison - Return 0.5F - Case Types.Ground - Return 0.5F - Case Types.Rock - Return 0.5F - Case Types.Bug - Return 1 - Case Types.Ghost - Return 0.5F - Case Types.Steel - Return 0 - Case Types.Fire - Return 1 - Case Types.Water - Return 1 - Case Types.Grass - Return 2 - Case Types.Electric - Return 1 - Case Types.Psychic - Return 1 - Case Types.Ice - Return 1 - Case Types.Dragon - Return 1 - Case Types.Dark - Return 1 - Case Types.Fairy - Return 2 - Case Else - Return 1 - End Select - Case Types.Ground - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 1 - Case Types.Flying - Return 0 - Case Types.Poison - Return 2 - Case Types.Ground - Return 1 - Case Types.Rock - Return 2 - Case Types.Bug - Return 0.5F - Case Types.Ghost - Return 1 - Case Types.Steel - Return 2 - Case Types.Fire - Return 2 - Case Types.Water - Return 1 - Case Types.Grass - Return 0.5F - Case Types.Electric - Return 2 - Case Types.Psychic - Return 1 - Case Types.Ice - Return 1 - Case Types.Dragon - Return 1 - Case Types.Dark - Return 1 - Case Else - Return 1 - End Select - Case Types.Rock - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 0.5F - Case Types.Flying - Return 2 - Case Types.Poison - Return 1 - Case Types.Ground - Return 0.5F - Case Types.Rock - Return 1 - Case Types.Bug - Return 2 - Case Types.Ghost - Return 1 - Case Types.Steel - Return 0.5F - Case Types.Fire - Return 2 - Case Types.Water - Return 1 - Case Types.Grass - Return 1 - Case Types.Electric - Return 1 - Case Types.Psychic - Return 1 - Case Types.Ice - Return 2 - Case Types.Dragon - Return 1 - Case Types.Dark - Return 1 - Case Else - Return 1 - End Select - Case Types.Bug - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 0.5F - Case Types.Flying - Return 0.5F - Case Types.Poison - Return 0.5F - Case Types.Ground - Return 1 - Case Types.Rock - Return 1 - Case Types.Bug - Return 1 - Case Types.Ghost - Return 0.5F - Case Types.Steel - Return 0.5F - Case Types.Fire - Return 0.5F - Case Types.Water - Return 1 - Case Types.Grass - Return 2 - Case Types.Electric - Return 1 - Case Types.Psychic - Return 2 - Case Types.Ice - Return 1 - Case Types.Dragon - Return 1 - Case Types.Dark - Return 2 - Case Types.Fairy - Return 0.5F - Case Else - Return 1 - End Select - Case Types.Ghost - Select Case d._type - Case Types.Normal - Return 0 - Case Types.Fighting - Return 1 - Case Types.Flying - Return 1 - Case Types.Poison - Return 1 - Case Types.Ground - Return 1 - Case Types.Rock - Return 1 - Case Types.Bug - Return 1 - Case Types.Ghost - Return 2 - Case Types.Steel - Return 1 - Case Types.Fire - Return 1 - Case Types.Water - Return 1 - Case Types.Grass - Return 1 - Case Types.Electric - Return 1 - Case Types.Psychic - Return 2 - Case Types.Ice - Return 1 - Case Types.Dragon - Return 1 - Case Types.Dark - Return 0.5F - Case Else - Return 1 - End Select - Case Types.Steel - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 1 - Case Types.Flying - Return 1 - Case Types.Poison - Return 1 - Case Types.Ground - Return 1 - Case Types.Rock - Return 2 - Case Types.Bug - Return 1 - Case Types.Ghost - Return 1 - Case Types.Steel - Return 0.5F - Case Types.Fire - Return 0.5F - Case Types.Water - Return 0.5F - Case Types.Grass - Return 1 - Case Types.Electric - Return 0.5F - Case Types.Psychic - Return 1 - Case Types.Ice - Return 2 - Case Types.Dragon - Return 1 - Case Types.Dark - Return 1 - Case Types.Fairy - Return 2 - Case Else - Return 1 - End Select - Case Types.Fire - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 1 - Case Types.Flying - Return 1 - Case Types.Poison - Return 1 - Case Types.Ground - Return 1 - Case Types.Rock - Return 0.5F - Case Types.Bug - Return 2 - Case Types.Ghost - Return 1 - Case Types.Steel - Return 2 - Case Types.Fire - Return 0.5F - Case Types.Water - Return 0.5F - Case Types.Grass - Return 2 - Case Types.Electric - Return 1 - Case Types.Psychic - Return 1 - Case Types.Ice - Return 2 - Case Types.Dragon - Return 0.5F - Case Types.Dark - Return 1 - Case Else - Return 1 - End Select - Case Types.Water - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 1 - Case Types.Flying - Return 1 - Case Types.Poison - Return 1 - Case Types.Ground - Return 2 - Case Types.Rock - Return 2 - Case Types.Bug - Return 1 - Case Types.Ghost - Return 1 - Case Types.Steel - Return 1 - Case Types.Fire - Return 2 - Case Types.Water - Return 0.5F - Case Types.Grass - Return 0.5F - Case Types.Electric - Return 1 - Case Types.Psychic - Return 1 - Case Types.Ice - Return 1 - Case Types.Dragon - Return 0.5F - Case Types.Dark - Return 1 - Case Else - Return 1 - End Select - Case Types.Grass - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 1 - Case Types.Flying - Return 0.5F - Case Types.Poison - Return 0.5F - Case Types.Ground - Return 2 - Case Types.Rock - Return 2 - Case Types.Bug - Return 0.5F - Case Types.Ghost - Return 1 - Case Types.Steel - Return 0.5F - Case Types.Fire - Return 0.5F - Case Types.Water - Return 2 - Case Types.Grass - Return 0.5F - Case Types.Electric - Return 1 - Case Types.Psychic - Return 1 - Case Types.Ice - Return 1 - Case Types.Dragon - Return 0.5F - Case Types.Dark - Return 1 - Case Else - Return 1 - End Select - Case Types.Electric - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 1 - Case Types.Flying - Return 2 - Case Types.Poison - Return 1 - Case Types.Ground - Return 0 - Case Types.Rock - Return 1 - Case Types.Bug - Return 1 - Case Types.Ghost - Return 1 - Case Types.Steel - Return 1 - Case Types.Fire - Return 1 - Case Types.Water - Return 2 - Case Types.Grass - Return 0.5F - Case Types.Electric - Return 0.5F - Case Types.Psychic - Return 1 - Case Types.Ice - Return 1 - Case Types.Dragon - Return 0.5F - Case Types.Dark - Return 1 - Case Else - Return 1 - End Select - Case Types.Psychic - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 2 - Case Types.Flying - Return 1 - Case Types.Poison - Return 2 - Case Types.Ground - Return 1 - Case Types.Rock - Return 1 - Case Types.Bug - Return 1 - Case Types.Ghost - Return 1 - Case Types.Steel - Return 0.5F - Case Types.Fire - Return 1 - Case Types.Water - Return 1 - Case Types.Grass - Return 1 - Case Types.Electric - Return 1 - Case Types.Psychic - Return 0.5F - Case Types.Ice - Return 1 - Case Types.Dragon - Return 1 - Case Types.Dark - Return 0 - Case Else - Return 1 - End Select - Case Types.Ice - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 1 - Case Types.Flying - Return 2 - Case Types.Poison - Return 1 - Case Types.Ground - Return 2 - Case Types.Rock - Return 1 - Case Types.Bug - Return 1 - Case Types.Ghost - Return 1 - Case Types.Steel - Return 0.5F - Case Types.Fire - Return 0.5F - Case Types.Water - Return 0.5F - Case Types.Grass - Return 2 - Case Types.Electric - Return 1 - Case Types.Psychic - Return 1 - Case Types.Ice - Return 0.5F - Case Types.Dragon - Return 2 - Case Types.Dark - Return 1 - Case Else - Return 1 - End Select - Case Types.Dragon - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 1 - Case Types.Flying - Return 1 - Case Types.Poison - Return 1 - Case Types.Ground - Return 1 - Case Types.Rock - Return 1 - Case Types.Bug - Return 1 - Case Types.Ghost - Return 1 - Case Types.Steel - Return 0.5F - Case Types.Fire - Return 1 - Case Types.Water - Return 1 - Case Types.Grass - Return 1 - Case Types.Electric - Return 1 - Case Types.Psychic - Return 1 - Case Types.Ice - Return 1 - Case Types.Dragon - Return 2 - Case Types.Dark - Return 1 - Case Types.Fairy - Return 0 - Case Else - Return 1 - End Select - Case Types.Dark - Select Case d._type - Case Types.Normal - Return 1 - Case Types.Fighting - Return 0.5F - Case Types.Flying - Return 1 - Case Types.Poison - Return 1 - Case Types.Ground - Return 1 - Case Types.Rock - Return 1 - Case Types.Bug - Return 1 - Case Types.Ghost - Return 2 - Case Types.Steel - Return 1 - Case Types.Fire - Return 1 - Case Types.Water - Return 1 - Case Types.Grass - Return 1 - Case Types.Electric - Return 1 - Case Types.Psychic - Return 2 - Case Types.Ice - Return 1 - Case Types.Dragon - Return 1 - Case Types.Dark - Return 0.5F - Case Types.Fairy - Return 0.5F - Case Else - Return 1 - End Select - Case Types.Fairy - Select Case d._type - Case Types.Fire - Return 0.5F - Case Types.Fighting - Return 2.0F - Case Types.Poison - Return 0.5F - Case Types.Dragon - Return 2.0F - Case Types.Dark - Return 2.0F - Case Types.Steel - Return 0.5F - End Select - Case Types.Shadow - Select Case d._type + Select Case d.Type + Case Types.Fire + Return 0.5F + Case Types.Fighting + Return 2.0F + Case Types.Poison + Return 0.5F + Case Types.Dragon + Return 2.0F + Case Types.Dark + Return 2.0F + Case Types.Steel + Return 0.5F + End Select Case Types.Shadow - Return 0.5F + Select Case d.Type + Case Types.Shadow + Return 0.5F + Case Else + Return 2 + End Select Case Else - Return 2 + Return 1 End Select - Case Else - Return 1 - End Select + Else + If d.gmEffectivenessDefense.ContainsKey(a.Type) Then + Return d.gmEffectivenessDefense(a.Type) + End If + End If + Else + If a.gmEffectivenessDefense.ContainsKey(d.Type) Then + Return a.gmEffectivenessDefense(d.Type) + End If + End If Return 1 End Function @@ -876,108 +913,116 @@ Public Class Element ''' Public Function GetElementImage() As Rectangle Dim r As New Rectangle(0, 0, 0, 0) - - Select Case Me._type - Case Types.Normal - r = New Rectangle(0, 0, 48, 16) - Case Types.Grass - r = New Rectangle(0, 16, 48, 16) - Case Types.Fire - r = New Rectangle(0, 32, 48, 16) - Case Types.Water - r = New Rectangle(0, 48, 48, 16) - Case Types.Electric - r = New Rectangle(0, 64, 48, 16) - Case Types.Ground - r = New Rectangle(0, 80, 48, 16) - Case Types.Rock - r = New Rectangle(0, 96, 48, 16) - Case Types.Ice - r = New Rectangle(0, 112, 48, 16) - Case Types.Steel - r = New Rectangle(0, 128, 48, 16) - Case Types.Bug - r = New Rectangle(48, 0, 48, 16) - Case Types.Fighting - r = New Rectangle(48, 16, 48, 16) - Case Types.Flying - r = New Rectangle(48, 32, 48, 16) - Case Types.Poison - r = New Rectangle(48, 48, 48, 16) - Case Types.Ghost - r = New Rectangle(48, 64, 48, 16) - Case Types.Dark - r = New Rectangle(48, 80, 48, 16) - Case Types.Psychic - r = New Rectangle(48, 96, 48, 16) - Case Types.Dragon - r = New Rectangle(48, 128, 48, 16) - Case Types.Fairy - r = New Rectangle(96, 48, 48, 16) - Case Types.Shadow - r = New Rectangle(96, 64, 48, 16) - Case Types.Blank - r = New Rectangle(48, 112, 48, 16) - Case Else - r = New Rectangle(48, 112, 48, 16) - End Select + If Me.IsGameModeElement = False Then + Select Case Me._type + Case Types.Normal + r = New Rectangle(0, 0, 48, 16) + Case Types.Grass + r = New Rectangle(0, 16, 48, 16) + Case Types.Fire + r = New Rectangle(0, 32, 48, 16) + Case Types.Water + r = New Rectangle(0, 48, 48, 16) + Case Types.Electric + r = New Rectangle(0, 64, 48, 16) + Case Types.Ground + r = New Rectangle(0, 80, 48, 16) + Case Types.Rock + r = New Rectangle(0, 96, 48, 16) + Case Types.Ice + r = New Rectangle(0, 112, 48, 16) + Case Types.Steel + r = New Rectangle(0, 128, 48, 16) + Case Types.Bug + r = New Rectangle(48, 0, 48, 16) + Case Types.Fighting + r = New Rectangle(48, 16, 48, 16) + Case Types.Flying + r = New Rectangle(48, 32, 48, 16) + Case Types.Poison + r = New Rectangle(48, 48, 48, 16) + Case Types.Ghost + r = New Rectangle(48, 64, 48, 16) + Case Types.Dark + r = New Rectangle(48, 80, 48, 16) + Case Types.Psychic + r = New Rectangle(48, 96, 48, 16) + Case Types.Dragon + r = New Rectangle(48, 128, 48, 16) + Case Types.Fairy + r = New Rectangle(96, 48, 48, 16) + Case Types.Shadow + r = New Rectangle(96, 64, 48, 16) + Case Types.Blank + r = New Rectangle(48, 112, 48, 16) + Case Else + r = New Rectangle(48, 112, 48, 16) + End Select + Else + r = gmTypeRectangle + End If Return r End Function Public Overrides Function ToString() As String - Select Case Me._type - Case Types.Blank - Return "Blank" - Case Types.Bug - Return "Bug" - Case Types.Dark - Return "Dark" - Case Types.Dragon - Return "Dragon" - Case Types.Electric - Return "Electric" - Case Types.Fairy - Return "Fairy" - Case Types.Fighting - Return "Fighting" - Case Types.Fire - Return "Fire" - Case Types.Flying - Return "Flying" - Case Types.Ghost - Return "Ghost" - Case Types.Grass - Return "Grass" - Case Types.Ground - Return "Ground" - Case Types.Ice - Return "Ice" - Case Types.Normal - Return "Normal" - Case Types.Poison - Return "Poison" - Case Types.Psychic - Return "Psychic" - Case Types.Rock - Return "Rock" - Case Types.Shadow - Return "Shadow" - Case Types.Steel - Return "Steel" - Case Types.Water - Return "Water" - Case Else - Return "Blank" - End Select + If IsGameModeElement = False Then + Select Case Me._type + Case Types.Blank + Return "Blank" + Case Types.Bug + Return "Bug" + Case Types.Dark + Return "Dark" + Case Types.Dragon + Return "Dragon" + Case Types.Electric + Return "Electric" + Case Types.Fairy + Return "Fairy" + Case Types.Fighting + Return "Fighting" + Case Types.Fire + Return "Fire" + Case Types.Flying + Return "Flying" + Case Types.Ghost + Return "Ghost" + Case Types.Grass + Return "Grass" + Case Types.Ground + Return "Ground" + Case Types.Ice + Return "Ice" + Case Types.Normal + Return "Normal" + Case Types.Poison + Return "Poison" + Case Types.Psychic + Return "Psychic" + Case Types.Rock + Return "Rock" + Case Types.Shadow + Return "Shadow" + Case Types.Steel + Return "Steel" + Case Types.Water + Return "Water" + Case Else + Return "Blank" + End Select + Else + Return gmName + End If + End Function Public Shared Operator =(ByVal Element1 As Element, ByVal Element2 As Element) As Boolean - Return Element1._type = Element2._type + Return Element1.Type = Element2.Type End Operator Public Shared Operator <>(ByVal Element1 As Element, ByVal Element2 As Element) As Boolean - Return Element1._type <> Element2._type + Return Element1.Type <> Element2.Type End Operator End Class diff --git a/P3D/Pokemon/Monster/EvolutionCondition.vb b/P3D/Pokemon/Monster/EvolutionCondition.vb index 1dd71ca8e..30ae59829 100644 --- a/P3D/Pokemon/Monster/EvolutionCondition.vb +++ b/P3D/Pokemon/Monster/EvolutionCondition.vb @@ -207,7 +207,7 @@ Public Class EvolutionCondition Case ConditionTypes.InPartyType Dim isInParty As Boolean = False For Each pokemon As Pokemon In Core.Player.Pokemons - If pokemon.IsType(New Element(c.Argument).Type) = True Then + If pokemon.IsType(BattleSystem.GameModeElementLoader.GetElementByName(c.Argument).Type) = True Then isInParty = True Exit For End If diff --git a/P3D/Pokemon/Monster/GameModeElementLoader.vb b/P3D/Pokemon/Monster/GameModeElementLoader.vb new file mode 100644 index 000000000..98e321501 --- /dev/null +++ b/P3D/Pokemon/Monster/GameModeElementLoader.vb @@ -0,0 +1,291 @@ +Namespace BattleSystem + + ''' + ''' Provides an interface to load additional GameMode moves. + ''' + Public Class GameModeElementLoader + + 'The default relative path to load moves from (Content folder). + Const PATH As String = "Data\Types\" + + 'List of loaded moves. + Shared LoadedElements As New List(Of Element) + + ''' + ''' Load the attack list for the loaded GameMode. + ''' + ''' The game won't try to load the list if the default GameMode is selected. + Public Shared Sub Load() + LoadedElements.Clear() + + If GameModeManager.ActiveGameMode.IsDefaultGamemode = False Then + If System.IO.Directory.Exists(GameController.GamePath & "\" & GameModeManager.ActiveGameMode.ContentPath & "\" & PATH) = True Then + For Each file As String In System.IO.Directory.GetFiles(GameController.GamePath & "\" & GameModeManager.ActiveGameMode.ContentPath & PATH, "*.dat") + LoadElement(file) + Next + End If + End If + If LoadedElements.Count > 0 Then + For Each e As Element In LoadedElements + For Each id As Element In LoadedElements + If e.gmEffectivenessAttack.ContainsKey(id.Type) = False Then + e.gmEffectivenessAttack.Add(id.Type, 1.0F) + End If + If e.gmEffectivenessDefense.ContainsKey(id.Type) = False Then + e.gmEffectivenessDefense.Add(id.Type, 1.0F) + End If + Next + Next + + Logger.Debug("Loaded " & LoadedElements.Count.ToString() & " GameMode type(s).") + End If + End Sub + + ''' + ''' Loads a move from a file. + ''' + ''' The file to load the move from. + Private Shared Sub LoadElement(ByVal file As String) + Dim element As New Element() 'Load a blank Element. + element.IsGameModeElement = True + + Dim content() As String = System.IO.File.ReadAllLines(file) + + Dim key As String = "" + Dim value As String = "" + + Dim setID As Boolean = False 'Controls if the move sets its ID. + Dim nonCommentLines As Integer = 0 + + Try + 'Go through lines of the file and set the properties depending on the content. + 'Lines starting with # are comments. + For Each l As String In content + If l.Contains("|") = True And l.StartsWith("#") = False Then + nonCommentLines += 1 + key = l.Remove(l.IndexOf("|")) + value = l.Remove(0, l.IndexOf("|") + 1) + + Select Case key.ToLower() + Case "id" + element.Type = CInt(value) + setID = True + Case "name" + element.gmOriginalName = value + Case "typeimageoffset" + element.gmTypeRectangle = New Rectangle(CInt(value.GetSplit(0, ",")), CInt(value.GetSplit(1, ",")), 48, 16) + Case "itemtexturesource" + element.gmMachineTextureSource = value + Case "itemtextureoffset" + element.gmMachineTextureRectangle = New Rectangle(CInt(value.GetSplit(0, ",")), CInt(value.GetSplit(1, ",")), 24, 24) + Case "effectivenessattack" + Dim data() As String = value.Split(";") + For i = 0 To data.Count - 1 + Dim typeID As Integer = -1 + If StringHelper.IsNumeric(data(i).GetSplit(0, ",")) = True Then + typeID = CInt(data(i).GetSplit(0, ",")) + Else + Select Case data(i).GetSplit(0, ",") + Case "normal" + typeID = element.Types.Normal + Case "fighting" + typeID = element.Types.Fighting + Case "flying" + typeID = element.Types.Flying + Case "poison" + typeID = element.Types.Poison + Case "ground" + typeID = element.Types.Ground + Case "rock" + typeID = element.Types.Rock + Case "bug" + typeID = element.Types.Bug + Case "ghost" + typeID = element.Types.Ghost + Case "steel" + typeID = element.Types.Steel + Case "fire" + typeID = element.Types.Fire + Case "water" + typeID = element.Types.Water + Case "grass" + typeID = element.Types.Grass + Case "electric" + typeID = element.Types.Electric + Case "psychic" + typeID = element.Types.Psychic + Case "ice" + typeID = element.Types.Ice + Case "dragon" + typeID = element.Types.Dragon + Case "dark" + typeID = element.Types.Dark + Case "fairy" + typeID = element.Types.Fairy + Case "shadow" + typeID = element.Types.Shadow + End Select + End If + element.gmEffectivenessAttack.Add(typeID, CSng(data(i).GetSplit(1, ",").InsertDecSeparator)) + Next + Case "effectivenessdefense" + Dim data() As String = value.Split(";") + For i = 0 To data.Count - 1 + Dim typeID As Integer = -1 + If StringHelper.IsNumeric(data(i).GetSplit(0, ",")) = True Then + typeID = CInt(data(i).GetSplit(0, ",")) + Else + Select Case data(i).GetSplit(0, ",") + Case "normal" + typeID = element.Types.Normal + Case "fighting" + typeID = element.Types.Fighting + Case "flying" + typeID = element.Types.Flying + Case "poison" + typeID = element.Types.Poison + Case "ground" + typeID = element.Types.Ground + Case "rock" + typeID = element.Types.Rock + Case "bug" + typeID = element.Types.Bug + Case "ghost" + typeID = element.Types.Ghost + Case "steel" + typeID = element.Types.Steel + Case "fire" + typeID = element.Types.Fire + Case "water" + typeID = element.Types.Water + Case "grass" + typeID = element.Types.Grass + Case "electric" + typeID = element.Types.Electric + Case "psychic" + typeID = element.Types.Psychic + Case "ice" + typeID = element.Types.Ice + Case "dragon" + typeID = element.Types.Dragon + Case "dark" + typeID = element.Types.Dark + Case "fairy" + typeID = element.Types.Fairy + Case "shadow" + typeID = element.Types.Shadow + End Select + End If + element.gmEffectivenessDefense.Add(typeID, CSng(data(i).GetSplit(1, ",").InsertDecSeparator)) + Next + End Select + End If + Next + Catch ex As Exception + 'If an error occurs loading a move, log the error. + Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeElementLoader.vb: Error loading GameMode element from file """ & file & """: " & ex.Message & "; Last Key/Value pair successfully loaded: " & key & "|" & value) + End Try + + If nonCommentLines > 0 Then + If setID = True Then + If element.Type >= 20 Then + If Localization.TokenExists("element_name_" & element.gmOriginalName.ToString) = True Then + element.gmName = Localization.GetString("move_name_" & element.gmOriginalName.ToString) + End If + For i = 0 To 18 + If element.gmEffectivenessAttack.ContainsKey(i) = False Then + element.gmEffectivenessAttack.Add(i, 1.0F) + End If + If element.gmEffectivenessDefense.ContainsKey(i) = False Then + element.gmEffectivenessDefense.Add(i, 1.0F) + End If + Next + LoadedElements.Add(element) 'Add the element. + Else + Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeElementLoader.vb: User defined types are not allowed to have an ID of an already existing type or an ID below 20. The ID for the type loaded from """ & file & """ has the ID " & element.Type.ToString() & ", which is smaller than 20.") + End If + Else + Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeElementLoader.vb: User defined types must set their ID through the ""ID"" property, however the type loaded from """ & file & """ has no ID set so it will be ignored.") + End If + Else + Debug.Print("GameModeElementLoader.vb: The type loaded from """ & file & """ has no valid lines so it will be ignored.") + End If + End Sub + + ''' + ''' Returns an element based on its ID. + ''' + ''' The ID of the element. + ''' Returns an element or nothing. + Public Shared Function GetElementByID(ByVal ID As Integer) As Element + If ID <= 19 Then + Return New Element(ID) + Else + For Each e As Element In LoadedElements + If e.Type = ID Then + Return e + End If + Next + End If + Return Nothing + End Function + ''' + ''' Returns an element based on its name. + ''' + ''' The name of the element. + ''' Returns an element or nothing. + Public Shared Function GetElementByName(ByVal Name As String) As Element + Select Case Name.ToLower + Case "normal" + Return New Element(Element.Types.Normal) + Case "fighting" + Return New Element(Element.Types.Fighting) + Case "flying" + Return New Element(Element.Types.Flying) + Case "poison" + Return New Element(Element.Types.Poison) + Case "ground" + Return New Element(Element.Types.Ground) + Case "rock" + Return New Element(Element.Types.Rock) + Case "bug" + Return New Element(Element.Types.Bug) + Case "ghost" + Return New Element(Element.Types.Ghost) + Case "steel" + Return New Element(Element.Types.Steel) + Case "fire" + Return New Element(Element.Types.Fire) + Case "water" + Return New Element(Element.Types.Water) + Case "grass" + Return New Element(Element.Types.Grass) + Case "electric" + Return New Element(Element.Types.Electric) + Case "psychic" + Return New Element(Element.Types.Psychic) + Case "ice" + Return New Element(Element.Types.Ice) + Case "dragon" + Return New Element(Element.Types.Dragon) + Case "dark" + Return New Element(Element.Types.Dark) + Case "fairy" + Return New Element(Element.Types.Fairy) + Case "shadow" + Return New Element(Element.Types.Shadow) + Case "blank" + Return New Element(Element.Types.Blank) + Case Else + For Each e As Element In LoadedElements + If e.ToString.ToLower = Name.ToLower Then + Return e + End If + Next + End Select + Return Nothing + End Function + + End Class + +End Namespace \ No newline at end of file diff --git a/P3D/Pokemon/Monster/Pokemon.vb b/P3D/Pokemon/Monster/Pokemon.vb index eeedd064f..48b82399f 100644 --- a/P3D/Pokemon/Monster/Pokemon.vb +++ b/P3D/Pokemon/Monster/Pokemon.vb @@ -2951,7 +2951,7 @@ Public Class Pokemon ''' Checks if the Pokémon is of a certain type. ''' ''' The type to check. - Public Function IsType(ByVal CheckType As Element.Types) As Boolean + Public Function IsType(ByVal CheckType As Integer) As Boolean If Type1.Type = CheckType Or Type2.Type = CheckType Then Return True End If diff --git a/P3D/Pokemon/Monster/PokemonInteractions.vb b/P3D/Pokemon/Monster/PokemonInteractions.vb index d245a750c..b5659d75e 100644 --- a/P3D/Pokemon/Monster/PokemonInteractions.vb +++ b/P3D/Pokemon/Monster/PokemonInteractions.vb @@ -721,7 +721,7 @@ Public Daytime As Integer = -1 Public Weather As Integer = -1 Public Season As Integer = -1 - Public Types As New List(Of Element.Types) + Public Types As New List(Of Integer) Public Probability As Integer = 100 Public Sub New(ByVal dataLine As String) @@ -758,7 +758,7 @@ If dataParts(5) <> "-1" Then For Each typePart As String In dataParts(5).Split(CChar(",")) - Me.Types.Add(New Element(typePart).Type) + Me.Types.Add(BattleSystem.GameModeElementLoader.GetElementByName(typePart).Type) Next End If @@ -856,7 +856,7 @@ End If If Me.Types.Count > 0 Then - For Each t As Element.Types In Me.Types + For Each t As Integer In Me.Types If p.IsType(t) = False Then Return False End If diff --git a/P3D/Pokemon/Monster/Resource/PokemonForms.vb b/P3D/Pokemon/Monster/Resource/PokemonForms.vb index 3d501b8b6..5c72d77f5 100644 --- a/P3D/Pokemon/Monster/Resource/PokemonForms.vb +++ b/P3D/Pokemon/Monster/Resource/PokemonForms.vb @@ -80,48 +80,53 @@ Public Class PokemonForms form.WildFormTriggers.Add(arguments(10)) End If If arguments.Count >= 12 Then - Select Case arguments(11).ToLower - Case "normal" - form.TypeChange = Element.Types.Normal - Case "fighting" - form.TypeChange = Element.Types.Fighting - Case "flying" - form.TypeChange = Element.Types.Flying - Case "poison" - form.TypeChange = Element.Types.Poison - Case "ground" - form.TypeChange = Element.Types.Ground - Case "rock" - form.TypeChange = Element.Types.Rock - Case "bug" - form.TypeChange = Element.Types.Bug - Case "ghost" - form.TypeChange = Element.Types.Ghost - Case "steel" - form.TypeChange = Element.Types.Steel - Case "fire" - form.TypeChange = Element.Types.Fire - Case "water" - form.TypeChange = Element.Types.Water - Case "grass" - form.TypeChange = Element.Types.Grass - Case "electric" - form.TypeChange = Element.Types.Electric - Case "psychic" - form.TypeChange = Element.Types.Psychic - Case "ice" - form.TypeChange = Element.Types.Ice - Case "dragon" - form.TypeChange = Element.Types.Dragon - Case "dark" - form.TypeChange = Element.Types.Dark - Case "fairy" - form.TypeChange = Element.Types.Fairy - Case "shadow" - form.TypeChange = Element.Types.Shadow - Case Else - form.TypeChange = Element.Types.Blank - End Select + If StringHelper.IsNumeric(arguments(11)) = False Then + + Select Case arguments(11).ToLower + Case "normal" + form.TypeChange = Element.Types.Normal + Case "fighting" + form.TypeChange = Element.Types.Fighting + Case "flying" + form.TypeChange = Element.Types.Flying + Case "poison" + form.TypeChange = Element.Types.Poison + Case "ground" + form.TypeChange = Element.Types.Ground + Case "rock" + form.TypeChange = Element.Types.Rock + Case "bug" + form.TypeChange = Element.Types.Bug + Case "ghost" + form.TypeChange = Element.Types.Ghost + Case "steel" + form.TypeChange = Element.Types.Steel + Case "fire" + form.TypeChange = Element.Types.Fire + Case "water" + form.TypeChange = Element.Types.Water + Case "grass" + form.TypeChange = Element.Types.Grass + Case "electric" + form.TypeChange = Element.Types.Electric + Case "psychic" + form.TypeChange = Element.Types.Psychic + Case "ice" + form.TypeChange = Element.Types.Ice + Case "dragon" + form.TypeChange = Element.Types.Dragon + Case "dark" + form.TypeChange = Element.Types.Dark + Case "fairy" + form.TypeChange = Element.Types.Fairy + Case "shadow" + form.TypeChange = Element.Types.Shadow + Case Else + form.TypeChange = Element.Types.Blank + End Select + Else + form.TypeChange = BattleSystem.GameModeElementLoader.GetElementByID(CInt(arguments(11))).Type + End If If arguments.Count >= 13 Then If arguments(12) <> "" Then form.IncludeBaseFormInDexCount = CBool(arguments(12)) @@ -562,7 +567,7 @@ Public Class PokemonForms Public OverworldSpriteFileSuffix As String = "" Public CryFileSuffix As String = "" Public WildFormTriggers As New List(Of String) - Public TypeChange As Element.Types = Element.Types.Blank + Public TypeChange As Integer = Element.Types.Blank Public IncludeBaseFormInDexCount As Boolean = False Public Overridable Function GetInitialAdditionalData(ByVal P As Pokemon) As String @@ -587,13 +592,13 @@ Public Class PokemonForms ElseIf trigger(0).ToLower = "gender" Then If GetGenderFormMatch(P, True) = "match" Then If TypeChange <> Element.Types.Blank Then - Return TypeChange.ToString + Return BattleSystem.GameModeElementLoader.GetElementByName(TypeChange).ToString Else Return AdditionalValue End If End If ElseIf trigger(0).ToLower = "season" Then - If GetSeasonFormMatch(true) = "match" Then + If GetSeasonFormMatch(True) = "match" Then If TypeChange <> Element.Types.Blank Then Return TypeChange.ToString Else diff --git a/P3D/Screens/MainMenu/NewNewGameScreen.vb b/P3D/Screens/MainMenu/NewNewGameScreen.vb index cc0ba5f39..bf1553fd1 100644 --- a/P3D/Screens/MainMenu/NewNewGameScreen.vb +++ b/P3D/Screens/MainMenu/NewNewGameScreen.vb @@ -21,6 +21,7 @@ ContentPackManager.Load(GameController.GamePath & "\ContentPacks\" & s & "\exceptions.dat") Next + BattleSystem.GameModeElementLoader.Load() BattleSystem.GameModeAttackLoader.Load() GameModeItemLoader.Load() diff --git a/P3D/Screens/NewGameScreen.vb b/P3D/Screens/NewGameScreen.vb index bef061c30..71ec6c926 100644 --- a/P3D/Screens/NewGameScreen.vb +++ b/P3D/Screens/NewGameScreen.vb @@ -49,6 +49,7 @@ ContentPackManager.Load(GameController.GamePath & "\ContentPacks\" & s & "\exceptions.dat") Next + BattleSystem.GameModeElementLoader.Load() BattleSystem.GameModeAttackLoader.Load() SmashRock.Load()