Base class rewrite

This commit is contained in:
nilllzz 2016-09-20 02:18:12 +02:00
parent 576a3a7c5d
commit 2dba651d7a
18 changed files with 193 additions and 416 deletions

View File

@ -1037,6 +1037,7 @@
<Compile Include="Pokemon\Items\FileItem.vb" /> <Compile Include="Pokemon\Items\FileItem.vb" />
<Compile Include="Pokemon\Items\Item.vb" /> <Compile Include="Pokemon\Items\Item.vb" />
<Compile Include="Pokemon\Items\ItemAttribute.vb" /> <Compile Include="Pokemon\Items\ItemAttribute.vb" />
<Compile Include="Pokemon\Items\ItemType.vb" />
<Compile Include="Pokemon\Items\KeyItems\BasementKey.vb" /> <Compile Include="Pokemon\Items\KeyItems\BasementKey.vb" />
<Compile Include="Pokemon\Items\KeyItems\Bicycle.vb" /> <Compile Include="Pokemon\Items\KeyItems\Bicycle.vb" />
<Compile Include="Pokemon\Items\KeyItems\BlueCard.vb" /> <Compile Include="Pokemon\Items\KeyItems\BlueCard.vb" />

View File

@ -43,21 +43,21 @@ Public Class PlayerInventory
''' </summary> ''' </summary>
Public Function GetItemPocketChar(ByVal Item As Item) As String Public Function GetItemPocketChar(ByVal Item As Item) As String
Select Case Item.ItemType Select Case Item.ItemType
Case Item.ItemTypes.Standard Case Items.ItemTypes.Standard
Return ChrW(128) Return ChrW(128)
Case Item.ItemTypes.BattleItems Case Items.ItemTypes.BattleItems
Return ChrW(135) Return ChrW(135)
Case Item.ItemTypes.KeyItems Case Items.ItemTypes.KeyItems
Return ChrW(129) Return ChrW(129)
Case Item.ItemTypes.Machines Case Items.ItemTypes.Machines
Return ChrW(130) Return ChrW(130)
Case Item.ItemTypes.Mail Case Items.ItemTypes.Mail
Return ChrW(131) Return ChrW(131)
Case Item.ItemTypes.Medicine Case Items.ItemTypes.Medicine
Return ChrW(132) Return ChrW(132)
Case Item.ItemTypes.Plants Case Items.ItemTypes.Plants
Return ChrW(133) Return ChrW(133)
Case Item.ItemTypes.Pokéballs Case Items.ItemTypes.Pokéballs
Return ChrW(134) Return ChrW(134)
End Select End Select

View File

@ -34,8 +34,13 @@
Public Type As Element.Types Public Type As Element.Types
Public Power As Integer = 60 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) Public Overrides ReadOnly Property PokeDollarPrice As Integer = 100
MyBase.New(Name, 100, ItemTypes.Plants, ID, 1, ID - 1999, New Rectangle(0, 0, 32, 32), Description) 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.PhaseTime = PhaseTime
Me.Size = Size Me.Size = Size
@ -43,8 +48,6 @@
BerryIndex = Me.ID - 2000 BerryIndex = Me.ID - 2000
Me.minBerries = minBerries Me.minBerries = minBerries
Me.maxBerries = maxBerries Me.maxBerries = maxBerries
_pokeDollarPrice = 100
_flingDamage = 10
Dim x As Integer = BerryIndex * 128 Dim x As Integer = BerryIndex * 128
Dim y As Integer = 0 Dim y As Integer = 0
@ -53,10 +56,8 @@
y += 32 y += 32
End While End While
Dim r As New Rectangle(x, y, 32, 32) _textureSource = "Berries"
_texture = TextureManager.GetTexture("Berries", r) _textureRectangle = New Rectangle(x, y, 32, 32)
_isBerry = True
End Sub End Sub
Public ReadOnly Property Flavour() As Flavours Public ReadOnly Property Flavour() As Flavours

View File

@ -52,7 +52,7 @@
Dim ID As Integer = 0 Dim ID As Integer = 0
Dim Name As String = "" Dim Name As String = ""
Dim Price As Integer = 0 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 CatchMultiplier As Single = 0.0F
Dim SortValue As Integer = 0 Dim SortValue As Integer = 0
Dim Description As String = "" Dim Description As String = ""
@ -84,21 +84,21 @@
Select Case dataArr(3).ToLower() Select Case dataArr(3).ToLower()
Case "standard" Case "standard"
ItemType = net.Pokemon3D.Game.Item.ItemTypes.Standard ItemType = ItemTypes.Standard
Case "medicine" Case "medicine"
ItemType = net.Pokemon3D.Game.Item.ItemTypes.Medicine ItemType = ItemTypes.Medicine
Case "plants" Case "plants"
ItemType = net.Pokemon3D.Game.Item.ItemTypes.Plants ItemType = ItemTypes.Plants
Case "pokeballs", "pokéballs" Case "pokeballs", "pokéballs"
ItemType = net.Pokemon3D.Game.Item.ItemTypes.Pokéballs ItemType = ItemTypes.Pokéballs
Case "machines" Case "machines"
ItemType = net.Pokemon3D.Game.Item.ItemTypes.Machines ItemType = ItemTypes.Machines
Case "keyitems", "keyitem" Case "keyitems", "keyitem"
ItemType = net.Pokemon3D.Game.Item.ItemTypes.KeyItems ItemType = ItemTypes.KeyItems
Case "mail" Case "mail"
ItemType = net.Pokemon3D.Game.Item.ItemTypes.Mail ItemType = ItemTypes.Mail
Case "battleitems" Case "battleitems"
ItemType = net.Pokemon3D.Game.Item.ItemTypes.BattleItems ItemType = ItemTypes.BattleItems
Case Else Case Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""ItemType"" did not contain an ItemType data type.") Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""ItemType"" did not contain an ItemType data type.")
Me._isValid = False Me._isValid = False

View File

@ -1,365 +1,194 @@
Imports net.Pokemon3D.Game.Items Imports net.Pokemon3D.Game.Items
''' <summary> ''' <summary>
''' An item the player stores in their inventory. ''' An item the player stores in their inventory.
''' </summary> ''' </summary>
Public Class Item Public MustInherit Class Item
''' <summary> Protected _textureSource As String = "Items\ItemSheet"
''' The type of item. This is also the bag they get sorted into. Protected _textureRectangle As Rectangle
''' </summary> Private _texture As Texture2D
Public Enum ItemTypes
''' <summary>
''' The default item category for misc. items.
''' </summary>
Standard
''' <summary>
''' Medicine items that restore Pokémon.
''' </summary>
Medicine
''' <summary>
''' Plants, like berries and apricorns.
''' </summary>
Plants
''' <summary>
''' All Poké Balls.
''' </summary>
Pokéballs
''' <summary>
''' TMs and HMs.
''' </summary>
Machines
''' <summary>
''' Keyitems of the game.
''' </summary>
KeyItems
''' <summary>
''' Mail items.
''' </summary>
Mail
''' <summary>
''' Items to be used in battle.
''' </summary>
BattleItems
End Enum
#Region "Fields" Private _attribute As ItemAttribute
Private _id As Integer = 0 Private Function GetAttribute() As ItemAttribute
Protected _name As String = "" If _attribute Is Nothing Then
Protected _pluralName As String = "" _attribute = CType([GetType]().GetCustomAttributes(GetType(ItemAttribute), False)(0), ItemAttribute)
Protected _description As String = "" End If
Protected _pokeDollarPrice As Integer = 0 Return _attribute
Protected _battlePointsPrice As Integer = 1 End Function
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"
''' <summary> ''' <summary>
''' The singular item name. ''' The singular item name.
''' </summary> ''' </summary>
Public ReadOnly Property Name() As String Public Overridable ReadOnly Property Name As String
Get Get
Return Me._name Return GetAttribute().Name
End Get End Get
End Property End Property
''' <summary> ''' <summary>
''' The ID of the item. ''' The ID of the item.
''' </summary> ''' </summary>
Public ReadOnly Property ID() As Integer Public Overridable ReadOnly Property ID As Integer
Get Get
Return Me._id Return GetAttribute().Id
End Get End Get
End Property End Property
''' <summary> ''' <summary>
''' The plural name of the item. ''' The plural name of the item.
''' </summary> ''' </summary>
Public ReadOnly Property PluralName() As String Public Overridable ReadOnly Property PluralName As String
Get Get
Return Me._pluralName Return Name & "s" 'Default plural name with "s" at the end.
End Get End Get
End Property End Property
''' <summary> ''' <summary>
''' The price of this item if the player purchases it in exchange for PokéDollars. This halves when selling an item to the store. ''' The price of this item if the player purchases it in exchange for PokéDollars. This halves when selling an item to the store.
''' </summary> ''' </summary>
Public ReadOnly Property PokéDollarPrice() As Integer Public Overridable ReadOnly Property PokeDollarPrice As Integer = 0
Get
Return Me._pokeDollarPrice
End Get
End Property
''' <summary> ''' <summary>
''' The price of this item if the player purchases it exchange for BattlePoints. ''' The price of this item if the player purchases it exchange for BattlePoints.
''' </summary> ''' </summary>
Public ReadOnly Property BattlePointsPrice() As Integer Public Overridable ReadOnly Property BattlePointsPrice As Integer = 1
Get
Return Me._battlePointsPrice
End Get
End Property
''' <summary> ''' <summary>
''' The type of this item. This also controls in which bag this item gets sorted. ''' The type of this item. This also controls in which bag this item gets sorted.
''' </summary> ''' </summary>
Public ReadOnly Property ItemType() As ItemTypes Public Overridable ReadOnly Property ItemType As ItemTypes = ItemTypes.Standard
Get
Return Me._itemType
End Get
End Property
''' <summary> ''' <summary>
''' The default catch multiplier if the item gets used as a Pokéball. ''' The default catch multiplier if the item gets used as a Pokéball.
''' </summary> ''' </summary>
Public ReadOnly Property CatchMultiplier() As Single Public Overridable ReadOnly Property CatchMultiplier As Single = 1.0F
Get
Return Me._catchMultiplier
End Get
End Property
''' <summary> ''' <summary>
''' The maximum amount of this item type (per ID) that can be stored in the bag. ''' The maximum amount of this item type (per ID) that can be stored in the bag.
''' </summary> ''' </summary>
Public ReadOnly Property MaxStack() As Integer Public Overridable ReadOnly Property MaxStack As Integer = 999
Get
Return Me._maxStack
End Get
End Property
''' <summary> ''' <summary>
''' A value that can be used to sort items in the bag after. Lower values make items appear closer to the top. ''' A value that can be used to sort items in the bag after. Lower values make items appear closer to the top.
''' </summary> ''' </summary>
Public ReadOnly Property SortValue() As Integer Public Overridable ReadOnly Property SortValue As Integer = 0
Get
Return Me._sortValue
End Get
End Property
''' <summary> ''' <summary>
''' The texture of this item. ''' The texture of this item.
''' </summary> ''' </summary>
Public ReadOnly Property Texture() As Texture2D Public ReadOnly Property Texture As Texture2D
Get Get
Return Me._texture If _texture Is Nothing Then
_texture = TextureManager.GetTexture(_textureSource, _textureRectangle, "")
End If
Return _texture
End Get End Get
End Property End Property
''' <summary> ''' <summary>
''' The bag description of this item. ''' The bag description of this item.
''' </summary> ''' </summary>
Public ReadOnly Property Description() As String Public Overridable ReadOnly Property Description As String = ""
Get
Return Me._description
End Get
End Property
''' <summary> ''' <summary>
''' The additional data that is stored with this item. ''' The additional data that is stored with this item.
''' </summary> ''' </summary>
Public Property AdditionalData() As String Public Property AdditionalData As String = ""
Get
Return Me._additionalData
End Get
Set(value As String)
Me._additionalData = value
End Set
End Property
''' <summary> ''' <summary>
''' The damage the Fling move does when this item is attached to a Pokémon. ''' The damage the Fling move does when this item is attached to a Pokémon.
''' </summary> ''' </summary>
Public ReadOnly Property FlingDamage() As Integer Public Overridable ReadOnly Property FlingDamage As Integer = 30
Get
Return Me._flingDamage
End Get
End Property
''' <summary> ''' <summary>
''' If this item can be traded in for money. ''' If this item can be traded in for money.
''' </summary> ''' </summary>
Public ReadOnly Property CanBeTraded() As Boolean Public Overridable ReadOnly Property CanBeTraded As Boolean = True
Get
Return Me._canBeTraded
End Get
End Property
''' <summary> ''' <summary>
''' If this item can be given to a Pokémon. ''' If this item can be given to a Pokémon.
''' </summary> ''' </summary>
Public ReadOnly Property CanBeHold() As Boolean Public Overridable ReadOnly Property CanBeHold As Boolean = True
Get
Return Me._canBeHold
End Get
End Property
''' <summary> ''' <summary>
''' If this item can be used from the bag. ''' If this item can be used from the bag.
''' </summary> ''' </summary>
Public ReadOnly Property CanBeUsed() As Boolean Public Overridable ReadOnly Property CanBeUsed As Boolean = True
Get
Return Me._canBeUsed
End Get
End Property
''' <summary> ''' <summary>
''' If this item can be used in battle. ''' If this item can be used in battle.
''' </summary> ''' </summary>
Public ReadOnly Property CanBeUsedInBattle() As Boolean Public Overridable ReadOnly Property CanBeUsedInBattle As Boolean = True
Get
Return Me._canBeUsedInBattle
End Get
End Property
''' <summary> ''' <summary>
''' If this item can be tossed in the bag. ''' If this item can be tossed in the bag.
''' </summary> ''' </summary>
Public ReadOnly Property CanBeTossed() As Boolean Public Overridable ReadOnly Property CanBeTossed As Boolean = True
Get
Return Me._canBeTossed
End Get
End Property
''' <summary> ''' <summary>
''' If this item requires the player to select a Pokémon to use the item on in battle. ''' If this item requires the player to select a Pokémon to use the item on in battle.
''' </summary> ''' </summary>
Public ReadOnly Property BattleSelectPokemon() As Boolean Public Overridable ReadOnly Property BattleSelectPokemon As Boolean = True
Get
Return Me._requiresPokemonSelectInBattle
End Get
End Property
''' <summary> ''' <summary>
''' If this item is a Pokéball item. ''' If this item is a Pokéball item.
''' </summary> ''' </summary>
Public ReadOnly Property IsBall() As Boolean Public Overridable ReadOnly Property IsBall As Boolean = False
Get
Return Me._isBall
End Get
End Property
''' <summary>
''' If this item is a Berry item.
''' </summary>
Public ReadOnly Property IsBerry() As Boolean
Get
Return Me._isBerry
End Get
End Property
''' <summary> ''' <summary>
''' If this item is a Healing item. ''' If this item is a Healing item.
''' </summary> ''' </summary>
Public ReadOnly Property IsHealingItem() As Boolean Public Overridable ReadOnly Property IsHealingItem As Boolean = False
''' <summary>
''' If this item is a Berry item.
''' </summary>
Public ReadOnly Property IsBerry As Boolean
Get Get
Return Me._isHealingItem Return [GetType]().IsSubclassOf(GetType(Berry))
End Get End Get
End Property End Property
''' <summary> ''' <summary>
''' If this item is a Mail item. ''' If this item is a Mail item.
''' </summary> ''' </summary>
Public ReadOnly Property IsMail() As Boolean Public ReadOnly Property IsMail As Boolean
Get Get
Return Me._isMail Return [GetType]().IsSubclassOf(GetType(MailItem))
End Get End Get
End Property End Property
''' <summary> ''' <summary>
''' If this item is a Mega Stone. ''' If this item is a Mega Stone.
''' </summary> ''' </summary>
Public ReadOnly Property IsMegaStone() As Boolean Public ReadOnly Property IsMegaStone As Boolean
Get Get
Return Me._isMegaStone Return [GetType]().IsSubclassOf(GetType(MegaStone))
End Get End Get
End Property End Property
''' <summary> ''' <summary>
''' If this item is a Plate. ''' If this item is a Plate.
''' </summary> ''' </summary>
Public ReadOnly Property IsPlate() As Boolean Public ReadOnly Property IsPlate As Boolean
Get Get
Return Me._isPlate Return [GetType]().IsSubclassOf(GetType(PlateItem))
End Get End Get
End Property End Property
''' <summary> ''' <summary>
''' The color for player dialogues. ''' The color for player dialogues.
''' </summary> ''' </summary>
Public Shared ReadOnly Property PlayerDialogueColor() As Color Public Shared ReadOnly Property PlayerDialogueColor As Color
Get Get
Return New Color(0, 128, 227) Return New Color(0, 128, 227)
End Get End Get
End Property End Property
#End Region
''' <summary>
''' Creates a new instance of the Item class.
''' </summary>
''' <param name="Name">The name of the Item.</param>
''' <param name="Price">The purchase price.</param>
''' <param name="ItemType">The type of Item.</param>
''' <param name="ID">The ID of this Item.</param>
''' <param name="CatchMultiplier">The CatchMultiplier of this Item.</param>
''' <param name="SortValue">The SortValue of this Item.</param>
''' <param name="TextureRectangle">The TextureRectangle from the "Items\ItemSheet" texture.</param>
''' <param name="Description">The description of this Item.</param>
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
''' <summary>
''' Sets most properties of an Item class instance.
''' </summary>
''' <param name="Name">The name of the Item.</param>
''' <param name="Price">The purchase price.</param>
''' <param name="ItemType">The type of Item.</param>
''' <param name="ID">The ID of this Item.</param>
''' <param name="CatchMultiplier">The CatchMultiplier of this Item.</param>
''' <param name="SortValue">The SortValue of this Item.</param>
''' <param name="TextureRectangle">The TextureRectangle from the "Items\ItemSheet" texture.</param>
''' <param name="Description">The description of this Item.</param>
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
''' <summary> ''' <summary>
''' The item gets used from the bag. ''' The item gets used from the bag.
''' </summary> ''' </summary>

View File

@ -0,0 +1,41 @@
Namespace Items
''' <summary>
''' The type of item. This is also the bag they get sorted into.
''' </summary>
Public Enum ItemTypes
''' <summary>
''' The default item category for misc. items.
''' </summary>
Standard
''' <summary>
''' Medicine items that restore Pokémon.
''' </summary>
Medicine
''' <summary>
''' Plants, like berries and apricorns.
''' </summary>
Plants
''' <summary>
''' All Poké Balls.
''' </summary>
Pokéballs
''' <summary>
''' TMs and HMs.
''' </summary>
Machines
''' <summary>
''' Keyitems of the game.
''' </summary>
KeyItems
''' <summary>
''' Mail items.
''' </summary>
Mail
''' <summary>
''' Items to be used in battle.
''' </summary>
BattleItems
End Enum
End Namespace

View File

@ -1,6 +1,6 @@
Namespace Items.Machines Namespace Items.Machines
<Item(247, "HM 05")> <Item(247, "HM 01")>
Public Class HM01 Public Class HM01
Inherits TechMachine Inherits TechMachine

View File

@ -1,6 +1,6 @@
Namespace Items.Machines Namespace Items.Machines
<Item(243, "HM 01")> <Item(243, "HM 05")>
Public Class HM05 Public Class HM05
Inherits TechMachine Inherits TechMachine

View File

@ -18,24 +18,8 @@ Namespace Items
Dim MailRead As Boolean Dim MailRead As Boolean
End Structure End Structure
''' <summary> Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False
''' Creates a new instance of the Mail Item class. Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Mail
''' </summary>
''' <param name="Name">The name of the Mail.</param>
''' <param name="Price">The price when purchased.</param>
''' <param name="ID">The ID of the Item.</param>
''' <param name="TextureRectangle">The TextureRectangle of the Item.</param>
''' <param name="Description">The Description of the Item.</param>
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 Shared Function GetMailDataFromString(ByVal s As String) As MailData Public Shared Function GetMailDataFromString(ByVal s As String) As MailData
If s.Contains("|") = True Then If s.Contains("|") = True Then

View File

@ -7,20 +7,7 @@ Namespace Items
Inherits Item Inherits Item
''' <summary> Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Medicine
''' Creates a new instance of the Item class.
''' </summary>
''' <param name="Name">The name of the Item.</param>
''' <param name="Price">The purchase price.</param>
''' <param name="ItemType">The type of Item.</param>
''' <param name="ID">The ID of this Item.</param>
''' <param name="CatchMultiplier">The CatchMultiplier of this Item.</param>
''' <param name="SortValue">The SortValue of this Item.</param>
''' <param name="TextureRectangle">The TextureRectangle from the "Items\ItemSheet" texture.</param>
''' <param name="Description">The description of this Item.</param>
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
''' <summary> ''' <summary>
''' Tries to heal a Pokémon from the player's party. If this succeeds, the method returns True. ''' Tries to heal a Pokémon from the player's party. If this succeeds, the method returns True.

View File

@ -7,29 +7,21 @@ Namespace Items
Inherits Item 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) Public Overrides ReadOnly Property Description As String
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 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 MegaPokemonNumber = MegaPokemonNumber
Me._canBeTossed = False
Me._canBeTraded = False
Me._canBeUsed = False
Me._canBeUsedInBattle = False
Me._isMegaStone = True
Me._megaPokemonNumber = MegaPokemonNumber
End Sub End Sub
Public ReadOnly Property MegaPokemonNumber() As Integer
Get
Return Me._megaPokemonNumber
End Get
End Property
End Class End Class
End Namespace End Namespace

View File

@ -7,18 +7,16 @@ Namespace Items
Inherits Item Inherits Item
Public Sub New(ByVal Name As String, ByVal ID As Integer, ByVal Type As Element.Types) Public Overrides ReadOnly Property CanBeUsed As Boolean = False
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 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), "") 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."
Me._canBeHold = True _textureSource = "Items\Plates"
Me._canBeTossed = True _textureRectangle = GetTextureRectangle(Type)
Me._canBeTraded = True
Me._canBeUsed = False
Me._canBeUsedInBattle = False
Me._isPlate = True
End Sub End Sub
Private Function GetTextureRectangle(ByVal Type As Element.Types) As Rectangle Private Function GetTextureRectangle(ByVal Type As Element.Types) As Rectangle

View File

@ -4,25 +4,7 @@ Namespace Items
Inherits Item Inherits Item
''' <summary> Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False
''' Creates a new instance of the StoneItem class.
''' </summary>
''' <param name="Name">The name of the Item.</param>
''' <param name="Price">The purchase price.</param>
''' <param name="ItemType">The type of Item.</param>
''' <param name="ID">The ID of this Item.</param>
''' <param name="CatchMultiplier">The CatchMultiplier of this Item.</param>
''' <param name="SortValue">The SortValue of this Item.</param>
''' <param name="TextureRectangle">The TextureRectangle from the "Items\ItemSheet" texture.</param>
''' <param name="Description">The description of this Item.</param>
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 Sub Use() Public Overrides Sub Use()
Core.SetScreen(New ChoosePokemonScreen(Core.CurrentScreen, Me, AddressOf Me.UseOnPokemon, "Use " & Me.Name, True)) Core.SetScreen(New ChoosePokemonScreen(Core.CurrentScreen, Me, AddressOf Me.UseOnPokemon, "Use " & Me.Name, True))

View File

@ -14,43 +14,36 @@
Public CanTeachWhenFullyEvolved As Boolean = False Public CanTeachWhenFullyEvolved As Boolean = False
Public CanTeachWhenGender 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) Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False
Me.New(ID, IsTM, Price, AttackID, (ID - 190)) Public Overrides ReadOnly Property CanBeHold As Boolean = False
End Sub Public Overrides ReadOnly Property CanBeTraded As Boolean = True
Public Overrides ReadOnly Property CanBeTossed As Boolean = True
Public Sub New(ByVal ID As Integer, ByVal IsTM As Boolean, ByVal Price As Integer, ByVal AttackID As Integer, ByVal NameNumber As Integer) Public Overrides ReadOnly Property SortValue As Integer
MyBase.New("TM " & NameNumber.ToString(), Price, ItemTypes.Machines, ID, 1.0F, ID - 191, New Rectangle(0, 0, 1, 1), "DUMMY") Public Overrides ReadOnly Property Description As String
If _name.Length = 4 Then Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Machines
_name = "TM 0" & NameNumber.ToString()
End If
Public Sub New(ByVal IsTM As Boolean, ByVal AttackID As Integer)
Attack = BattleSystem.Attack.GetAttackByID(AttackID) Attack = BattleSystem.Attack.GetAttackByID(AttackID)
Me.IsTM = IsTM Me.IsTM = IsTM
_canBeUsedInBattle = False
TechID = ID - 190 TechID = ID - 190
HiddenID = ID - 242 HiddenID = ID - 242
_canBeHold = False
If Me.IsTM = False Then If Me.IsTM = False Then
_name = "HM " & (Me.ID - 242).ToString() _CanBeTraded = False
If Name.Length = 4 Then _CanBeTossed = False
_name = "HM 0" & (Me.ID - 242).ToString()
End If
_canBeTraded = False
_canBeTossed = False
'Sets the sortvalue to something very low so the HMs will always be in first place: 'Sets the sortvalue to something very low so the HMs will always be in first place:
_sortValue = -100000 + NameNumber _SortValue = -100000 + ID
Else Else
_sortValue = NameNumber _SortValue = ID
End If End If
_description = "Teaches """ & Attack.Name & """ to a Pokémon." _Description = "Teaches """ & Attack.Name & """ to a Pokémon."
SetTexture() SetTextureRectangle()
End Sub End Sub
Private Sub SetTexture() Private Sub SetTextureRectangle()
Dim r As New Rectangle(144, 168, 24, 24) Dim r As New Rectangle(144, 168, 24, 24)
Select Case Attack.Type.Type Select Case Attack.Type.Type
@ -92,7 +85,7 @@
r = New Rectangle(192, 168, 24, 24) r = New Rectangle(192, 168, 24, 24)
End Select End Select
_texture = TextureManager.GetTexture("Items\ItemSheet", r, "") _textureRectangle = r
End Sub End Sub
Public Overrides Sub Use() Public Overrides Sub Use()

View File

@ -7,27 +7,14 @@ Namespace Items
Inherits Item Inherits Item
''' <summary> Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Medicine
''' Creates a new instance of the Item class.
''' </summary>
''' <param name="Name">The name of the Item.</param>
''' <param name="Price">The purchase price.</param>
''' <param name="ItemType">The type of Item.</param>
''' <param name="ID">The ID of this Item.</param>
''' <param name="CatchMultiplier">The CatchMultiplier of this Item.</param>
''' <param name="SortValue">The SortValue of this Item.</param>
''' <param name="TextureRectangle">The TextureRectangle from the "Items\ItemSheet" texture.</param>
''' <param name="Description">The description of this Item.</param>
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
''' <summary> ''' <summary>
''' Checks if a Vitamin can be used on a Pokémon. ''' Checks if a Vitamin can be used on a Pokémon.
''' </summary> ''' </summary>
''' <param name="stat">An integer representing the stat that should be upped by the Vitamin.</param> ''' <param name="stat">An integer representing the stat that should be upped by the Vitamin.</param>
''' <param name="p">The Pokémon that the Vitamin should be used on.</param> ''' <param name="p">The Pokémon that the Vitamin should be used on.</param>
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 If stat < 100 Then
Dim allStats As Integer = p.EVAttack + p.EVDefense + p.EVSpAttack + p.EVSpDefense + p.EVHP + p.EVSpeed Dim allStats As Integer = p.EVAttack + p.EVDefense + p.EVSpAttack + p.EVSpDefense + p.EVHP + p.EVSpeed
If allStats < 510 Then If allStats < 510 Then

View File

@ -7,27 +7,9 @@ Namespace Items
Inherits Item Inherits Item
''' <summary> Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Medicine
''' Creates a new instance of the Item class. Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False
''' </summary> Public Overrides ReadOnly Property FlingDamage As Integer = 20
''' <param name="Name">The name of the Item.</param>
''' <param name="Price">The purchase price.</param>
''' <param name="ItemType">The type of Item.</param>
''' <param name="ID">The ID of this Item.</param>
''' <param name="CatchMultiplier">The CatchMultiplier of this Item.</param>
''' <param name="SortValue">The SortValue of this Item.</param>
''' <param name="TextureRectangle">The TextureRectangle from the "Items\ItemSheet" texture.</param>
''' <param name="Description">The description of this Item.</param>
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 Sub Use() Public Overrides Sub Use()
Core.SetScreen(New ChoosePokemonScreen(Core.CurrentScreen, Me, AddressOf Me.UseOnPokemon, "Use " & Me.Name, True)) Core.SetScreen(New ChoosePokemonScreen(Core.CurrentScreen, Me, AddressOf Me.UseOnPokemon, "Use " & Me.Name, True))
@ -38,7 +20,7 @@ Namespace Items
''' </summary> ''' </summary>
''' <param name="stat">An integer representing the stat that should be upped by the Wing.</param> ''' <param name="stat">An integer representing the stat that should be upped by the Wing.</param>
''' <param name="p">The Pokémon that the Wing should be used on.</param> ''' <param name="p">The Pokémon that the Wing should be used on.</param>
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 If stat < 255 Then
Dim allStats As Integer = p.EVAttack + p.EVDefense + p.EVSpAttack + p.EVSpDefense + p.EVHP + p.EVSpeed Dim allStats As Integer = p.EVAttack + p.EVDefense + p.EVSpAttack + p.EVSpDefense + p.EVHP + p.EVSpeed
If allStats < 510 Then If allStats < 510 Then

View File

@ -5,7 +5,7 @@
Dim index(8) As Integer Dim index(8) As Integer
Dim scrollIndex(8) As Integer Dim scrollIndex(8) As Integer
Dim bagIndex As Integer = 0 Dim bagIndex As Integer = 0
Dim bagIdentifier As Item.ItemTypes Dim bagIdentifier As Items.ItemTypes
Dim Items As New Dictionary(Of Item, Integer) Dim Items As New Dictionary(Of Item, Integer)
Dim cItems As New Dictionary(Of Item, Integer) Dim cItems As New Dictionary(Of Item, Integer)
@ -174,21 +174,21 @@
Private Sub ChangeBag() Private Sub ChangeBag()
Select Case bagIndex Select Case bagIndex
Case 0 Case 0
bagIdentifier = Item.ItemTypes.Standard bagIdentifier = Game.Items.ItemTypes.Standard
Case 1 Case 1
bagIdentifier = Item.ItemTypes.Medicine bagIdentifier = Game.Items.ItemTypes.Medicine
Case 2 Case 2
bagIdentifier = Item.ItemTypes.Machines bagIdentifier = Game.Items.ItemTypes.Machines
Case 3 Case 3
bagIdentifier = Item.ItemTypes.Pokéballs bagIdentifier = Game.Items.ItemTypes.Pokéballs
Case 4 Case 4
bagIdentifier = Item.ItemTypes.Plants bagIdentifier = Game.Items.ItemTypes.Plants
Case 5 Case 5
bagIdentifier = Item.ItemTypes.Mail bagIdentifier = Game.Items.ItemTypes.Mail
Case 6 Case 6
bagIdentifier = Item.ItemTypes.BattleItems bagIdentifier = Game.Items.ItemTypes.BattleItems
Case 7 Case 7
bagIdentifier = Item.ItemTypes.KeyItems bagIdentifier = Game.Items.ItemTypes.KeyItems
End Select End Select
cItems.Clear() cItems.Clear()

View File

@ -14,7 +14,7 @@ Public Class TradeScreen
End Enum End Enum
Private MenuState As MenuStates = MenuStates.MainPage 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 MainCursor As Integer = 0
Private CategoryCursor As Integer = 0 Private CategoryCursor As Integer = 0
@ -98,7 +98,7 @@ Public Class TradeScreen
If Currency = Currencies.BattlePoints Then If Currency = Currencies.BattlePoints Then
Me.Price = i.BattlePointsPrice Me.Price = i.BattlePointsPrice
ElseIf Currency = Currencies.Pokédollar Then ElseIf Currency = Currencies.Pokédollar Then
Me.Price = i.PokéDollarPrice Me.Price = i.PokeDollarPrice
End If End If
Else Else
Me.Price = Price Me.Price = Price
@ -350,7 +350,7 @@ Public Class TradeScreen
#Region "BuyCategoryScreen" #Region "BuyCategoryScreen"
Private loadedBuyCategories As New List(Of Item.ItemTypes) Private loadedBuyCategories As New List(Of Items.ItemTypes)
Private Sub LoadBuyCategoriesItems() Private Sub LoadBuyCategoriesItems()
Me.loadedBuyCategories.Clear() Me.loadedBuyCategories.Clear()
@ -361,7 +361,7 @@ Public Class TradeScreen
loadedBuyCategories.Add(item.ItemType) loadedBuyCategories.Add(item.ItemType)
End If End If
Next 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 End Sub
Private Sub UpdateBuyCategory() Private Sub UpdateBuyCategory()
@ -760,7 +760,7 @@ Public Class TradeScreen
#Region "SellCatetoryScreen" #Region "SellCatetoryScreen"
Private loadedSellCategories As New List(Of Item.ItemTypes) Private loadedSellCategories As New List(Of Items.ItemTypes)
Private Sub LoadSellCategoryItems() Private Sub LoadSellCategoryItems()
Me.loadedSellCategories.Clear() Me.loadedSellCategories.Clear()
@ -771,7 +771,7 @@ Public Class TradeScreen
loadedSellCategories.Add(i.ItemType) loadedSellCategories.Add(i.ItemType)
End If End If
Next 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 End Sub
Private Sub UpdateSellCategory() 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) Core.SpriteBatch.DrawString(Font, Text, New Vector2(Position.X + Height + 10, Position.Y + textY), Color.White)
End Sub 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 Dim i As Integer = 0
Select Case itemType Select Case itemType
Case Item.ItemTypes.Standard Case Items.ItemTypes.Standard
i = 0 i = 0
Case Item.ItemTypes.Medicine Case Items.ItemTypes.Medicine
i = 1 i = 1
Case Item.ItemTypes.Machines Case Items.ItemTypes.Machines
i = 2 i = 2
Case Item.ItemTypes.Pokéballs Case Items.ItemTypes.Pokéballs
i = 3 i = 3
Case Item.ItemTypes.Plants Case Items.ItemTypes.Plants
i = 4 i = 4
Case Item.ItemTypes.Mail Case Items.ItemTypes.Mail
i = 5 i = 5
Case Item.ItemTypes.BattleItems Case Items.ItemTypes.BattleItems
i = 6 i = 6
Case Item.ItemTypes.KeyItems Case Items.ItemTypes.KeyItems
i = 7 i = 7
End Select End Select