diff --git a/2.5DHero/2.5DHero/2.5DHero.vbproj b/2.5DHero/2.5DHero/2.5DHero.vbproj index 7e6afaa1a..bd510cf5e 100644 --- a/2.5DHero/2.5DHero/2.5DHero.vbproj +++ b/2.5DHero/2.5DHero/2.5DHero.vbproj @@ -1037,6 +1037,7 @@ + diff --git a/2.5DHero/2.5DHero/Player/PlayerInventory.vb b/2.5DHero/2.5DHero/Player/PlayerInventory.vb index a697062dd..3464e823e 100644 --- a/2.5DHero/2.5DHero/Player/PlayerInventory.vb +++ b/2.5DHero/2.5DHero/Player/PlayerInventory.vb @@ -43,21 +43,21 @@ Public Class PlayerInventory ''' Public Function GetItemPocketChar(ByVal Item As Item) As String Select Case Item.ItemType - Case Item.ItemTypes.Standard + Case Items.ItemTypes.Standard Return ChrW(128) - Case Item.ItemTypes.BattleItems + Case Items.ItemTypes.BattleItems Return ChrW(135) - Case Item.ItemTypes.KeyItems + Case Items.ItemTypes.KeyItems Return ChrW(129) - Case Item.ItemTypes.Machines + Case Items.ItemTypes.Machines Return ChrW(130) - Case Item.ItemTypes.Mail + Case Items.ItemTypes.Mail Return ChrW(131) - Case Item.ItemTypes.Medicine + Case Items.ItemTypes.Medicine Return ChrW(132) - Case Item.ItemTypes.Plants + Case Items.ItemTypes.Plants Return ChrW(133) - Case Item.ItemTypes.Pokéballs + Case Items.ItemTypes.Pokéballs Return ChrW(134) End Select diff --git a/2.5DHero/2.5DHero/Pokemon/Items/Berry.vb b/2.5DHero/2.5DHero/Pokemon/Items/Berry.vb index daa6788f7..34ed5d752 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/Berry.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/Berry.vb @@ -34,8 +34,13 @@ Public Type As Element.Types Public Power As Integer = 60 - Public Sub New(ByVal ID As Integer, ByVal Name As String, ByVal PhaseTime As Integer, ByVal Description As String, ByVal Size As String, ByVal Firmness As String, ByVal minBerries As Integer, ByVal maxBerries As Integer) - MyBase.New(Name, 100, ItemTypes.Plants, ID, 1, ID - 1999, New Rectangle(0, 0, 32, 32), Description) + Public Overrides ReadOnly Property PokeDollarPrice As Integer = 100 + Public Overrides ReadOnly Property FlingDamage As Integer = 10 + Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Plants + Public Overrides ReadOnly Property SortValue As Integer + + Public Sub New(ByVal PhaseTime As Integer, ByVal Description As String, ByVal Size As String, ByVal Firmness As String, ByVal minBerries As Integer, ByVal maxBerries As Integer) + SortValue = ID - 1999 Me.PhaseTime = PhaseTime Me.Size = Size @@ -43,8 +48,6 @@ BerryIndex = Me.ID - 2000 Me.minBerries = minBerries Me.maxBerries = maxBerries - _pokeDollarPrice = 100 - _flingDamage = 10 Dim x As Integer = BerryIndex * 128 Dim y As Integer = 0 @@ -53,10 +56,8 @@ y += 32 End While - Dim r As New Rectangle(x, y, 32, 32) - _texture = TextureManager.GetTexture("Berries", r) - - _isBerry = True + _textureSource = "Berries" + _textureRectangle = New Rectangle(x, y, 32, 32) End Sub Public ReadOnly Property Flavour() As Flavours diff --git a/2.5DHero/2.5DHero/Pokemon/Items/FileItem.vb b/2.5DHero/2.5DHero/Pokemon/Items/FileItem.vb index 5342f9bdc..ac2bb5865 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/FileItem.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/FileItem.vb @@ -52,7 +52,7 @@ Dim ID As Integer = 0 Dim Name As String = "" Dim Price As Integer = 0 - Dim ItemType As Item.ItemTypes = net.Pokemon3D.Game.Item.ItemTypes.Standard + Dim ItemType As Items.ItemTypes = Game.Items.ItemTypes.Standard Dim CatchMultiplier As Single = 0.0F Dim SortValue As Integer = 0 Dim Description As String = "" @@ -84,21 +84,21 @@ Select Case dataArr(3).ToLower() Case "standard" - ItemType = net.Pokemon3D.Game.Item.ItemTypes.Standard + ItemType = ItemTypes.Standard Case "medicine" - ItemType = net.Pokemon3D.Game.Item.ItemTypes.Medicine + ItemType = ItemTypes.Medicine Case "plants" - ItemType = net.Pokemon3D.Game.Item.ItemTypes.Plants + ItemType = ItemTypes.Plants Case "pokeballs", "pokéballs" - ItemType = net.Pokemon3D.Game.Item.ItemTypes.Pokéballs + ItemType = ItemTypes.Pokéballs Case "machines" - ItemType = net.Pokemon3D.Game.Item.ItemTypes.Machines + ItemType = ItemTypes.Machines Case "keyitems", "keyitem" - ItemType = net.Pokemon3D.Game.Item.ItemTypes.KeyItems + ItemType = ItemTypes.KeyItems Case "mail" - ItemType = net.Pokemon3D.Game.Item.ItemTypes.Mail + ItemType = ItemTypes.Mail Case "battleitems" - ItemType = net.Pokemon3D.Game.Item.ItemTypes.BattleItems + ItemType = ItemTypes.BattleItems Case Else Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""ItemType"" did not contain an ItemType data type.") Me._isValid = False diff --git a/2.5DHero/2.5DHero/Pokemon/Items/Item.vb b/2.5DHero/2.5DHero/Pokemon/Items/Item.vb index 9b36f3954..b1aedc382 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/Item.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/Item.vb @@ -1,365 +1,194 @@ Imports net.Pokemon3D.Game.Items + ''' ''' An item the player stores in their inventory. ''' -Public Class Item +Public MustInherit Class Item - ''' - ''' The type of item. This is also the bag they get sorted into. - ''' - Public Enum ItemTypes - ''' - ''' The default item category for misc. items. - ''' - Standard - ''' - ''' Medicine items that restore Pokémon. - ''' - Medicine - ''' - ''' Plants, like berries and apricorns. - ''' - Plants - ''' - ''' All Poké Balls. - ''' - Pokéballs - ''' - ''' TMs and HMs. - ''' - Machines - ''' - ''' Keyitems of the game. - ''' - KeyItems - ''' - ''' Mail items. - ''' - Mail - ''' - ''' Items to be used in battle. - ''' - BattleItems - End Enum + Protected _textureSource As String = "Items\ItemSheet" + Protected _textureRectangle As Rectangle + Private _texture As Texture2D -#Region "Fields" + Private _attribute As ItemAttribute - Private _id As Integer = 0 - Protected _name As String = "" - Protected _pluralName As String = "" - Protected _description As String = "" + Private Function GetAttribute() As ItemAttribute + If _attribute Is Nothing Then + _attribute = CType([GetType]().GetCustomAttributes(GetType(ItemAttribute), False)(0), ItemAttribute) + End If - Protected _pokeDollarPrice As Integer = 0 - Protected _battlePointsPrice As Integer = 1 - Protected _itemType As ItemTypes = ItemTypes.Standard - Protected _catchMultiplier As Single = 1.0F - Protected _maxStack As Integer = 999 - Protected _sortValue As Integer = 0 - - Protected _texture As Texture2D - Private _additionalData As String = "" - - Protected _canBeTraded As Boolean = True - Protected _canBeHold As Boolean = True - Protected _canBeUsed As Boolean = True - Protected _canBeUsedInBattle As Boolean = True - Protected _canBeTossed As Boolean = True - - Protected _isBall As Boolean = False - Protected _isBerry As Boolean = False - Protected _isHealingItem As Boolean = False - Protected _isMail As Boolean = False - Protected _isMegaStone As Boolean = False - Protected _isPlate As Boolean = False - - Protected _flingDamage As Integer = 30 - Protected _requiresPokemonSelectInBattle As Boolean = True - -#End Region - -#Region "Properties" + Return _attribute + End Function ''' ''' The singular item name. ''' - Public ReadOnly Property Name() As String + Public Overridable ReadOnly Property Name As String Get - Return Me._name + Return GetAttribute().Name End Get End Property ''' ''' The ID of the item. ''' - Public ReadOnly Property ID() As Integer + Public Overridable ReadOnly Property ID As Integer Get - Return Me._id + Return GetAttribute().Id End Get End Property ''' ''' The plural name of the item. ''' - Public ReadOnly Property PluralName() As String + Public Overridable ReadOnly Property PluralName As String Get - Return Me._pluralName + Return Name & "s" 'Default plural name with "s" at the end. End Get End Property ''' ''' The price of this item if the player purchases it in exchange for PokéDollars. This halves when selling an item to the store. ''' - Public ReadOnly Property PokéDollarPrice() As Integer - Get - Return Me._pokeDollarPrice - End Get - End Property + Public Overridable ReadOnly Property PokeDollarPrice As Integer = 0 ''' ''' The price of this item if the player purchases it exchange for BattlePoints. ''' - Public ReadOnly Property BattlePointsPrice() As Integer - Get - Return Me._battlePointsPrice - End Get - End Property + Public Overridable ReadOnly Property BattlePointsPrice As Integer = 1 ''' ''' The type of this item. This also controls in which bag this item gets sorted. ''' - Public ReadOnly Property ItemType() As ItemTypes - Get - Return Me._itemType - End Get - End Property + Public Overridable ReadOnly Property ItemType As ItemTypes = ItemTypes.Standard ''' ''' The default catch multiplier if the item gets used as a Pokéball. ''' - Public ReadOnly Property CatchMultiplier() As Single - Get - Return Me._catchMultiplier - End Get - End Property + Public Overridable ReadOnly Property CatchMultiplier As Single = 1.0F ''' ''' The maximum amount of this item type (per ID) that can be stored in the bag. ''' - Public ReadOnly Property MaxStack() As Integer - Get - Return Me._maxStack - End Get - End Property + Public Overridable ReadOnly Property MaxStack As Integer = 999 ''' ''' A value that can be used to sort items in the bag after. Lower values make items appear closer to the top. ''' - Public ReadOnly Property SortValue() As Integer - Get - Return Me._sortValue - End Get - End Property + Public Overridable ReadOnly Property SortValue As Integer = 0 ''' ''' The texture of this item. ''' - Public ReadOnly Property Texture() As Texture2D + Public ReadOnly Property Texture As Texture2D Get - Return Me._texture + If _texture Is Nothing Then + _texture = TextureManager.GetTexture(_textureSource, _textureRectangle, "") + End If + + Return _texture End Get End Property ''' ''' The bag description of this item. ''' - Public ReadOnly Property Description() As String - Get - Return Me._description - End Get - End Property + Public Overridable ReadOnly Property Description As String = "" ''' ''' The additional data that is stored with this item. ''' - Public Property AdditionalData() As String - Get - Return Me._additionalData - End Get - Set(value As String) - Me._additionalData = value - End Set - End Property + Public Property AdditionalData As String = "" ''' ''' The damage the Fling move does when this item is attached to a Pokémon. ''' - Public ReadOnly Property FlingDamage() As Integer - Get - Return Me._flingDamage - End Get - End Property + Public Overridable ReadOnly Property FlingDamage As Integer = 30 ''' ''' If this item can be traded in for money. ''' - Public ReadOnly Property CanBeTraded() As Boolean - Get - Return Me._canBeTraded - End Get - End Property + Public Overridable ReadOnly Property CanBeTraded As Boolean = True ''' ''' If this item can be given to a Pokémon. ''' - Public ReadOnly Property CanBeHold() As Boolean - Get - Return Me._canBeHold - End Get - End Property + Public Overridable ReadOnly Property CanBeHold As Boolean = True ''' ''' If this item can be used from the bag. ''' - Public ReadOnly Property CanBeUsed() As Boolean - Get - Return Me._canBeUsed - End Get - End Property + Public Overridable ReadOnly Property CanBeUsed As Boolean = True ''' ''' If this item can be used in battle. ''' - Public ReadOnly Property CanBeUsedInBattle() As Boolean - Get - Return Me._canBeUsedInBattle - End Get - End Property + Public Overridable ReadOnly Property CanBeUsedInBattle As Boolean = True ''' ''' If this item can be tossed in the bag. ''' - Public ReadOnly Property CanBeTossed() As Boolean - Get - Return Me._canBeTossed - End Get - End Property + Public Overridable ReadOnly Property CanBeTossed As Boolean = True ''' ''' If this item requires the player to select a Pokémon to use the item on in battle. ''' - Public ReadOnly Property BattleSelectPokemon() As Boolean - Get - Return Me._requiresPokemonSelectInBattle - End Get - End Property + Public Overridable ReadOnly Property BattleSelectPokemon As Boolean = True ''' ''' If this item is a Pokéball item. ''' - Public ReadOnly Property IsBall() As Boolean - Get - Return Me._isBall - End Get - End Property - - ''' - ''' If this item is a Berry item. - ''' - Public ReadOnly Property IsBerry() As Boolean - Get - Return Me._isBerry - End Get - End Property + Public Overridable ReadOnly Property IsBall As Boolean = False ''' ''' If this item is a Healing item. ''' - Public ReadOnly Property IsHealingItem() As Boolean + Public Overridable ReadOnly Property IsHealingItem As Boolean = False + + ''' + ''' If this item is a Berry item. + ''' + Public ReadOnly Property IsBerry As Boolean Get - Return Me._isHealingItem + Return [GetType]().IsSubclassOf(GetType(Berry)) End Get End Property ''' ''' If this item is a Mail item. ''' - Public ReadOnly Property IsMail() As Boolean + Public ReadOnly Property IsMail As Boolean Get - Return Me._isMail + Return [GetType]().IsSubclassOf(GetType(MailItem)) End Get End Property ''' ''' If this item is a Mega Stone. ''' - Public ReadOnly Property IsMegaStone() As Boolean + Public ReadOnly Property IsMegaStone As Boolean Get - Return Me._isMegaStone + Return [GetType]().IsSubclassOf(GetType(MegaStone)) End Get End Property ''' ''' If this item is a Plate. ''' - Public ReadOnly Property IsPlate() As Boolean + Public ReadOnly Property IsPlate As Boolean Get - Return Me._isPlate + Return [GetType]().IsSubclassOf(GetType(PlateItem)) End Get End Property ''' ''' The color for player dialogues. ''' - Public Shared ReadOnly Property PlayerDialogueColor() As Color + Public Shared ReadOnly Property PlayerDialogueColor As Color Get Return New Color(0, 128, 227) End Get End Property -#End Region - - ''' - ''' Creates a new instance of the Item class. - ''' - ''' The name of the Item. - ''' The purchase price. - ''' The type of Item. - ''' The ID of this Item. - ''' The CatchMultiplier of this Item. - ''' The SortValue of this Item. - ''' The TextureRectangle from the "Items\ItemSheet" texture. - ''' The description of this Item. - Public Sub New(ByVal Name As String, ByVal Price As Integer, ByVal ItemType As ItemTypes, ByVal ID As Integer, ByVal CatchMultiplier As Single, ByVal SortValue As Integer, ByVal TextureRectangle As Rectangle, ByVal Description As String) - Me.Initialize(Name, Price, ItemType, ID, CatchMultiplier, SortValue, TextureRectangle, Description) - End Sub - - Friend Sub New() - End Sub - - ''' - ''' Sets most properties of an Item class instance. - ''' - ''' The name of the Item. - ''' The purchase price. - ''' The type of Item. - ''' The ID of this Item. - ''' The CatchMultiplier of this Item. - ''' The SortValue of this Item. - ''' The TextureRectangle from the "Items\ItemSheet" texture. - ''' The description of this Item. - Protected Sub Initialize(ByVal Name As String, ByVal Price As Integer, ByVal ItemType As ItemTypes, ByVal ID As Integer, ByVal CatchMultiplier As Single, ByVal SortValue As Integer, ByVal TextureRectangle As Rectangle, ByVal Description As String) - Me._name = Name - Me._pluralName = Name & "s" 'Default plural name with "s" at the end. - Me._pokeDollarPrice = Price - Me._itemType = ItemType - Me._id = ID - Me._catchMultiplier = CatchMultiplier - Me._sortValue = SortValue - Me._description = Description - - Me._texture = TextureManager.GetTexture("Items\ItemSheet", TextureRectangle, "") - End Sub - ''' ''' The item gets used from the bag. ''' diff --git a/2.5DHero/2.5DHero/Pokemon/Items/ItemType.vb b/2.5DHero/2.5DHero/Pokemon/Items/ItemType.vb new file mode 100644 index 000000000..dc4b67d4d --- /dev/null +++ b/2.5DHero/2.5DHero/Pokemon/Items/ItemType.vb @@ -0,0 +1,41 @@ +Namespace Items + + ''' + ''' The type of item. This is also the bag they get sorted into. + ''' + Public Enum ItemTypes + ''' + ''' The default item category for misc. items. + ''' + Standard + ''' + ''' Medicine items that restore Pokémon. + ''' + Medicine + ''' + ''' Plants, like berries and apricorns. + ''' + Plants + ''' + ''' All Poké Balls. + ''' + Pokéballs + ''' + ''' TMs and HMs. + ''' + Machines + ''' + ''' Keyitems of the game. + ''' + KeyItems + ''' + ''' Mail items. + ''' + Mail + ''' + ''' Items to be used in battle. + ''' + BattleItems + End Enum + +End Namespace diff --git a/2.5DHero/2.5DHero/Pokemon/Items/Machines/HM01.vb b/2.5DHero/2.5DHero/Pokemon/Items/Machines/HM01.vb index 51ed09645..2defb699f 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/Machines/HM01.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/Machines/HM01.vb @@ -1,6 +1,6 @@ Namespace Items.Machines - + Public Class HM01 Inherits TechMachine diff --git a/2.5DHero/2.5DHero/Pokemon/Items/Machines/HM05.vb b/2.5DHero/2.5DHero/Pokemon/Items/Machines/HM05.vb index 042a9c888..ff62b08c1 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/Machines/HM05.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/Machines/HM05.vb @@ -1,6 +1,6 @@ Namespace Items.Machines - + Public Class HM05 Inherits TechMachine diff --git a/2.5DHero/2.5DHero/Pokemon/Items/MailItem.vb b/2.5DHero/2.5DHero/Pokemon/Items/MailItem.vb index 6a59ef186..bf7da2fca 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/MailItem.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/MailItem.vb @@ -18,24 +18,8 @@ Namespace Items Dim MailRead As Boolean End Structure - ''' - ''' Creates a new instance of the Mail Item class. - ''' - ''' The name of the Mail. - ''' The price when purchased. - ''' The ID of the Item. - ''' The TextureRectangle of the Item. - ''' The Description of the Item. - Public Sub New(ByVal Name As String, ByVal Price As Integer, ByVal ID As Integer, ByVal TextureRectangle As Rectangle, ByVal Description As String) - MyBase.New(Name, Price, ItemTypes.Mail, ID, 1.0F, 0, TextureRectangle, Description) - - Me._canBeUsed = True - Me._canBeUsedInBattle = False - Me._canBeTraded = True - Me._canBeHold = True - - Me._isMail = True - End Sub + Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False + Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Mail Public Shared Function GetMailDataFromString(ByVal s As String) As MailData If s.Contains("|") = True Then diff --git a/2.5DHero/2.5DHero/Pokemon/Items/MedicineItem.vb b/2.5DHero/2.5DHero/Pokemon/Items/MedicineItem.vb index 08d95c85c..b1628c99e 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/MedicineItem.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/MedicineItem.vb @@ -7,20 +7,7 @@ Namespace Items Inherits Item - ''' - ''' Creates a new instance of the Item class. - ''' - ''' The name of the Item. - ''' The purchase price. - ''' The type of Item. - ''' The ID of this Item. - ''' The CatchMultiplier of this Item. - ''' The SortValue of this Item. - ''' The TextureRectangle from the "Items\ItemSheet" texture. - ''' The description of this Item. - Public Sub New(ByVal Name As String, ByVal Price As Integer, ByVal ItemType As ItemTypes, ByVal ID As Integer, ByVal CatchMultiplier As Single, ByVal SortValue As Integer, ByVal TextureRectangle As Rectangle, ByVal Description As String) - MyBase.New(Name, Price, ItemType, ID, CatchMultiplier, SortValue, TextureRectangle, Description) - End Sub + Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Medicine ''' ''' Tries to heal a Pokémon from the player's party. If this succeeds, the method returns True. diff --git a/2.5DHero/2.5DHero/Pokemon/Items/MegaStone.vb b/2.5DHero/2.5DHero/Pokemon/Items/MegaStone.vb index d5c8c5fec..38eba523d 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/MegaStone.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/MegaStone.vb @@ -7,29 +7,21 @@ Namespace Items Inherits Item - Private _megaPokemonNumber As Integer = 0 + Public ReadOnly Property MegaPokemonNumber As Integer - Public Sub New(ByVal Name As String, ByVal ID As Integer, ByVal TextureRectangle As Rectangle, ByVal MegaPokemonName As String, ByVal MegaPokemonNumber As Integer) - MyBase.New(Name, 100, ItemTypes.Standard, ID, 1.0F, 0, TextureRectangle, "One variety of the mysterious Mega Stones. Have " & MegaPokemonName & " hold it, and this stone will enable it to Mega Evolve during battle.") + Public Overrides ReadOnly Property Description As String + Public Overrides ReadOnly Property CanBeTossed As Boolean = False + Public Overrides ReadOnly Property CanBeTraded As Boolean = False + Public Overrides ReadOnly Property CanBeUsed As Boolean = False + Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False - Me._texture = TextureManager.GetTexture("Items\MegaStones", TextureRectangle, "") + Public Sub New(ByVal MegaPokemonName As String, ByVal MegaPokemonNumber As Integer) + Description = "One variety of the mysterious Mega Stones. Have " & MegaPokemonName & " hold it, and this stone will enable it to Mega Evolve during battle." + _textureSource = "Items\MegaStones" - Me._canBeHold = True - Me._canBeTossed = False - Me._canBeTraded = False - Me._canBeUsed = False - Me._canBeUsedInBattle = False - - Me._isMegaStone = True - Me._megaPokemonNumber = MegaPokemonNumber + MegaPokemonNumber = MegaPokemonNumber End Sub - Public ReadOnly Property MegaPokemonNumber() As Integer - Get - Return Me._megaPokemonNumber - End Get - End Property - End Class End Namespace diff --git a/2.5DHero/2.5DHero/Pokemon/Items/PlateItem.vb b/2.5DHero/2.5DHero/Pokemon/Items/PlateItem.vb index 38db1918e..a50240633 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/PlateItem.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/PlateItem.vb @@ -7,18 +7,16 @@ Namespace Items Inherits Item - Public Sub New(ByVal Name As String, ByVal ID As Integer, ByVal Type As Element.Types) - MyBase.New(Name, 1000, ItemTypes.Standard, ID, 1.0F, 0, New Rectangle(0, 0, 24, 24), "An item to be held by a Pokémon. It's a stone tablet that boosts the power of " & Type.ToString() & "-type moves.") + Public Overrides ReadOnly Property CanBeUsed As Boolean = False + Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False + Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Standard + Public Overrides ReadOnly Property Description As String + Public Overrides ReadOnly Property PokeDollarPrice As Integer = 1000 - Me._texture = TextureManager.GetTexture("Items\Plates", GetTextureRectangle(Type), "") - - Me._canBeHold = True - Me._canBeTossed = True - Me._canBeTraded = True - Me._canBeUsed = False - Me._canBeUsedInBattle = False - - Me._isPlate = True + Public Sub New(ByVal Type As Element.Types) + Description = "An item to be held by a Pokémon. It's a stone tablet that boosts the power of " & Type.ToString() & "-type moves." + _textureSource = "Items\Plates" + _textureRectangle = GetTextureRectangle(Type) End Sub Private Function GetTextureRectangle(ByVal Type As Element.Types) As Rectangle diff --git a/2.5DHero/2.5DHero/Pokemon/Items/StoneItem.vb b/2.5DHero/2.5DHero/Pokemon/Items/StoneItem.vb index 138fde6ba..39dde849f 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/StoneItem.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/StoneItem.vb @@ -4,25 +4,7 @@ Namespace Items Inherits Item - ''' - ''' Creates a new instance of the StoneItem class. - ''' - ''' The name of the Item. - ''' The purchase price. - ''' The type of Item. - ''' The ID of this Item. - ''' The CatchMultiplier of this Item. - ''' The SortValue of this Item. - ''' The TextureRectangle from the "Items\ItemSheet" texture. - ''' The description of this Item. - Public Sub New(ByVal Name As String, ByVal Price As Integer, ByVal ItemType As ItemTypes, ByVal ID As Integer, ByVal CatchMultiplier As Single, ByVal SortValue As Integer, ByVal TextureRectangle As Rectangle, ByVal Description As String) - MyBase.New(Name, Price, ItemType, ID, CatchMultiplier, SortValue, TextureRectangle, Description) - - Me._canBeHold = True - Me._canBeTraded = True - Me._canBeUsed = True - Me._canBeUsedInBattle = False - End Sub + Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False Public Overrides Sub Use() Core.SetScreen(New ChoosePokemonScreen(Core.CurrentScreen, Me, AddressOf Me.UseOnPokemon, "Use " & Me.Name, True)) diff --git a/2.5DHero/2.5DHero/Pokemon/Items/TechMachine.vb b/2.5DHero/2.5DHero/Pokemon/Items/TechMachine.vb index b769b06c1..da65dc5dc 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/TechMachine.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/TechMachine.vb @@ -14,43 +14,36 @@ Public CanTeachWhenFullyEvolved As Boolean = False Public CanTeachWhenGender As Boolean = False - Public Sub New(ByVal ID As Integer, ByVal IsTM As Boolean, ByVal Price As Integer, ByVal AttackID As Integer) - Me.New(ID, IsTM, Price, AttackID, (ID - 190)) - End Sub - - Public Sub New(ByVal ID As Integer, ByVal IsTM As Boolean, ByVal Price As Integer, ByVal AttackID As Integer, ByVal NameNumber As Integer) - MyBase.New("TM " & NameNumber.ToString(), Price, ItemTypes.Machines, ID, 1.0F, ID - 191, New Rectangle(0, 0, 1, 1), "DUMMY") - If _name.Length = 4 Then - _name = "TM 0" & NameNumber.ToString() - End If + Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False + Public Overrides ReadOnly Property CanBeHold As Boolean = False + Public Overrides ReadOnly Property CanBeTraded As Boolean = True + Public Overrides ReadOnly Property CanBeTossed As Boolean = True + Public Overrides ReadOnly Property SortValue As Integer + Public Overrides ReadOnly Property Description As String + Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Machines + Public Sub New(ByVal IsTM As Boolean, ByVal AttackID As Integer) Attack = BattleSystem.Attack.GetAttackByID(AttackID) Me.IsTM = IsTM - _canBeUsedInBattle = False TechID = ID - 190 HiddenID = ID - 242 - _canBeHold = False If Me.IsTM = False Then - _name = "HM " & (Me.ID - 242).ToString() - If Name.Length = 4 Then - _name = "HM 0" & (Me.ID - 242).ToString() - End If - _canBeTraded = False - _canBeTossed = False + _CanBeTraded = False + _CanBeTossed = False 'Sets the sortvalue to something very low so the HMs will always be in first place: - _sortValue = -100000 + NameNumber + _SortValue = -100000 + ID Else - _sortValue = NameNumber + _SortValue = ID End If - _description = "Teaches """ & Attack.Name & """ to a Pokémon." + _Description = "Teaches """ & Attack.Name & """ to a Pokémon." - SetTexture() + SetTextureRectangle() End Sub - Private Sub SetTexture() + Private Sub SetTextureRectangle() Dim r As New Rectangle(144, 168, 24, 24) Select Case Attack.Type.Type @@ -92,7 +85,7 @@ r = New Rectangle(192, 168, 24, 24) End Select - _texture = TextureManager.GetTexture("Items\ItemSheet", r, "") + _textureRectangle = r End Sub Public Overrides Sub Use() diff --git a/2.5DHero/2.5DHero/Pokemon/Items/VitaminItem.vb b/2.5DHero/2.5DHero/Pokemon/Items/VitaminItem.vb index a76904f8e..208e31044 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/VitaminItem.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/VitaminItem.vb @@ -7,27 +7,14 @@ Namespace Items Inherits Item - ''' - ''' Creates a new instance of the Item class. - ''' - ''' The name of the Item. - ''' The purchase price. - ''' The type of Item. - ''' The ID of this Item. - ''' The CatchMultiplier of this Item. - ''' The SortValue of this Item. - ''' The TextureRectangle from the "Items\ItemSheet" texture. - ''' The description of this Item. - Public Sub New(ByVal Name As String, ByVal Price As Integer, ByVal ItemType As ItemTypes, ByVal ID As Integer, ByVal CatchMultiplier As Single, ByVal SortValue As Integer, ByVal TextureRectangle As Rectangle, ByVal Description As String) - MyBase.New(Name, Price, ItemType, ID, CatchMultiplier, SortValue, TextureRectangle, Description) - End Sub + Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Medicine ''' ''' Checks if a Vitamin can be used on a Pokémon. ''' ''' An integer representing the stat that should be upped by the Vitamin. ''' The Pokémon that the Vitamin should be used on. - Protected Function CanUseVitamin(ByVal stat As Integer, ByVal p As Pokemon) As Boolean + Protected Shared Function CanUseVitamin(ByVal stat As Integer, ByVal p As Pokemon) As Boolean If stat < 100 Then Dim allStats As Integer = p.EVAttack + p.EVDefense + p.EVSpAttack + p.EVSpDefense + p.EVHP + p.EVSpeed If allStats < 510 Then diff --git a/2.5DHero/2.5DHero/Pokemon/Items/WingItem.vb b/2.5DHero/2.5DHero/Pokemon/Items/WingItem.vb index 0746fb6e1..984265df8 100644 --- a/2.5DHero/2.5DHero/Pokemon/Items/WingItem.vb +++ b/2.5DHero/2.5DHero/Pokemon/Items/WingItem.vb @@ -7,27 +7,9 @@ Namespace Items Inherits Item - ''' - ''' Creates a new instance of the Item class. - ''' - ''' The name of the Item. - ''' The purchase price. - ''' The type of Item. - ''' The ID of this Item. - ''' The CatchMultiplier of this Item. - ''' The SortValue of this Item. - ''' The TextureRectangle from the "Items\ItemSheet" texture. - ''' The description of this Item. - Public Sub New(ByVal Name As String, ByVal Price As Integer, ByVal ItemType As ItemTypes, ByVal ID As Integer, ByVal CatchMultiplier As Single, ByVal SortValue As Integer, ByVal TextureRectangle As Rectangle, ByVal Description As String) - MyBase.New(Name, Price, ItemType, ID, CatchMultiplier, SortValue, TextureRectangle, Description) - - Me._canBeHold = True - Me._canBeTraded = True - Me._canBeUsed = True - Me._canBeUsedInBattle = False - - Me._flingDamage = 20 - End Sub + Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Medicine + Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False + Public Overrides ReadOnly Property FlingDamage As Integer = 20 Public Overrides Sub Use() Core.SetScreen(New ChoosePokemonScreen(Core.CurrentScreen, Me, AddressOf Me.UseOnPokemon, "Use " & Me.Name, True)) @@ -38,7 +20,7 @@ Namespace Items ''' ''' An integer representing the stat that should be upped by the Wing. ''' The Pokémon that the Wing should be used on. - Protected Function CanUseWing(ByVal stat As Integer, ByVal p As Pokemon) As Boolean + Protected Shared Function CanUseWing(ByVal stat As Integer, ByVal p As Pokemon) As Boolean If stat < 255 Then Dim allStats As Integer = p.EVAttack + p.EVDefense + p.EVSpAttack + p.EVSpDefense + p.EVHP + p.EVSpeed If allStats < 510 Then diff --git a/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb b/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb index ba748c4cb..8e8301b18 100644 --- a/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb @@ -5,7 +5,7 @@ Dim index(8) As Integer Dim scrollIndex(8) As Integer Dim bagIndex As Integer = 0 - Dim bagIdentifier As Item.ItemTypes + Dim bagIdentifier As Items.ItemTypes Dim Items As New Dictionary(Of Item, Integer) Dim cItems As New Dictionary(Of Item, Integer) @@ -174,21 +174,21 @@ Private Sub ChangeBag() Select Case bagIndex Case 0 - bagIdentifier = Item.ItemTypes.Standard + bagIdentifier = Game.Items.ItemTypes.Standard Case 1 - bagIdentifier = Item.ItemTypes.Medicine + bagIdentifier = Game.Items.ItemTypes.Medicine Case 2 - bagIdentifier = Item.ItemTypes.Machines + bagIdentifier = Game.Items.ItemTypes.Machines Case 3 - bagIdentifier = Item.ItemTypes.Pokéballs + bagIdentifier = Game.Items.ItemTypes.Pokéballs Case 4 - bagIdentifier = Item.ItemTypes.Plants + bagIdentifier = Game.Items.ItemTypes.Plants Case 5 - bagIdentifier = Item.ItemTypes.Mail + bagIdentifier = Game.Items.ItemTypes.Mail Case 6 - bagIdentifier = Item.ItemTypes.BattleItems + bagIdentifier = Game.Items.ItemTypes.BattleItems Case 7 - bagIdentifier = Item.ItemTypes.KeyItems + bagIdentifier = Game.Items.ItemTypes.KeyItems End Select cItems.Clear() diff --git a/2.5DHero/2.5DHero/Screens/TradeScreen.vb b/2.5DHero/2.5DHero/Screens/TradeScreen.vb index 68082989b..35c857be1 100644 --- a/2.5DHero/2.5DHero/Screens/TradeScreen.vb +++ b/2.5DHero/2.5DHero/Screens/TradeScreen.vb @@ -14,7 +14,7 @@ Public Class TradeScreen End Enum Private MenuState As MenuStates = MenuStates.MainPage - Private CurrentCategory As Item.ItemTypes = Item.ItemTypes.Medicine + Private CurrentCategory As Items.ItemTypes = Items.ItemTypes.Medicine Private MainCursor As Integer = 0 Private CategoryCursor As Integer = 0 @@ -98,7 +98,7 @@ Public Class TradeScreen If Currency = Currencies.BattlePoints Then Me.Price = i.BattlePointsPrice ElseIf Currency = Currencies.Pokédollar Then - Me.Price = i.PokéDollarPrice + Me.Price = i.PokeDollarPrice End If Else Me.Price = Price @@ -350,7 +350,7 @@ Public Class TradeScreen #Region "BuyCategoryScreen" - Private loadedBuyCategories As New List(Of Item.ItemTypes) + Private loadedBuyCategories As New List(Of Items.ItemTypes) Private Sub LoadBuyCategoriesItems() Me.loadedBuyCategories.Clear() @@ -361,7 +361,7 @@ Public Class TradeScreen loadedBuyCategories.Add(item.ItemType) End If Next - Me.loadedBuyCategories = (From c As Item.ItemTypes In Me.loadedBuyCategories Order By CInt(c)).ToList() + Me.loadedBuyCategories = (From c As Items.ItemTypes In Me.loadedBuyCategories Order By CInt(c)).ToList() End Sub Private Sub UpdateBuyCategory() @@ -760,7 +760,7 @@ Public Class TradeScreen #Region "SellCatetoryScreen" - Private loadedSellCategories As New List(Of Item.ItemTypes) + Private loadedSellCategories As New List(Of Items.ItemTypes) Private Sub LoadSellCategoryItems() Me.loadedSellCategories.Clear() @@ -771,7 +771,7 @@ Public Class TradeScreen loadedSellCategories.Add(i.ItemType) End If Next - Me.loadedSellCategories = (From c As Item.ItemTypes In Me.loadedSellCategories Order By CInt(c)).ToList() + Me.loadedSellCategories = (From c As Items.ItemTypes In Me.loadedSellCategories Order By CInt(c)).ToList() End Sub Private Sub UpdateSellCategory() @@ -1220,24 +1220,24 @@ Public Class TradeScreen Core.SpriteBatch.DrawString(Font, Text, New Vector2(Position.X + Height + 10, Position.Y + textY), Color.White) End Sub - Private Function GetItemTypeTexture(ByVal itemType As Item.ItemTypes) As Texture2D + Private Function GetItemTypeTexture(ByVal itemType As Items.ItemTypes) As Texture2D Dim i As Integer = 0 Select Case itemType - Case Item.ItemTypes.Standard + Case Items.ItemTypes.Standard i = 0 - Case Item.ItemTypes.Medicine + Case Items.ItemTypes.Medicine i = 1 - Case Item.ItemTypes.Machines + Case Items.ItemTypes.Machines i = 2 - Case Item.ItemTypes.Pokéballs + Case Items.ItemTypes.Pokéballs i = 3 - Case Item.ItemTypes.Plants + Case Items.ItemTypes.Plants i = 4 - Case Item.ItemTypes.Mail + Case Items.ItemTypes.Mail i = 5 - Case Item.ItemTypes.BattleItems + Case Items.ItemTypes.BattleItems i = 6 - Case Item.ItemTypes.KeyItems + Case Items.ItemTypes.KeyItems i = 7 End Select