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\Item.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\Bicycle.vb" />
<Compile Include="Pokemon\Items\KeyItems\BlueCard.vb" />

View File

@ -43,21 +43,21 @@ Public Class PlayerInventory
''' </summary>
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

View File

@ -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

View File

@ -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

View File

@ -1,365 +1,194 @@
Imports net.Pokemon3D.Game.Items
''' <summary>
''' An item the player stores in their inventory.
''' </summary>
Public Class Item
Public MustInherit Class Item
''' <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
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
''' <summary>
''' The singular item name.
''' </summary>
Public ReadOnly Property Name() As String
Public Overridable ReadOnly Property Name As String
Get
Return Me._name
Return GetAttribute().Name
End Get
End Property
''' <summary>
''' The ID of the item.
''' </summary>
Public ReadOnly Property ID() As Integer
Public Overridable ReadOnly Property ID As Integer
Get
Return Me._id
Return GetAttribute().Id
End Get
End Property
''' <summary>
''' The plural name of the item.
''' </summary>
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
''' <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.
''' </summary>
Public ReadOnly Property PokéDollarPrice() As Integer
Get
Return Me._pokeDollarPrice
End Get
End Property
Public Overridable ReadOnly Property PokeDollarPrice As Integer = 0
''' <summary>
''' The price of this item if the player purchases it exchange for BattlePoints.
''' </summary>
Public ReadOnly Property BattlePointsPrice() As Integer
Get
Return Me._battlePointsPrice
End Get
End Property
Public Overridable ReadOnly Property BattlePointsPrice As Integer = 1
''' <summary>
''' The type of this item. This also controls in which bag this item gets sorted.
''' </summary>
Public ReadOnly Property ItemType() As ItemTypes
Get
Return Me._itemType
End Get
End Property
Public Overridable ReadOnly Property ItemType As ItemTypes = ItemTypes.Standard
''' <summary>
''' The default catch multiplier if the item gets used as a Pokéball.
''' </summary>
Public ReadOnly Property CatchMultiplier() As Single
Get
Return Me._catchMultiplier
End Get
End Property
Public Overridable ReadOnly Property CatchMultiplier As Single = 1.0F
''' <summary>
''' The maximum amount of this item type (per ID) that can be stored in the bag.
''' </summary>
Public ReadOnly Property MaxStack() As Integer
Get
Return Me._maxStack
End Get
End Property
Public Overridable ReadOnly Property MaxStack As Integer = 999
''' <summary>
''' A value that can be used to sort items in the bag after. Lower values make items appear closer to the top.
''' </summary>
Public ReadOnly Property SortValue() As Integer
Get
Return Me._sortValue
End Get
End Property
Public Overridable ReadOnly Property SortValue As Integer = 0
''' <summary>
''' The texture of this item.
''' </summary>
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
''' <summary>
''' The bag description of this item.
''' </summary>
Public ReadOnly Property Description() As String
Get
Return Me._description
End Get
End Property
Public Overridable ReadOnly Property Description As String = ""
''' <summary>
''' The additional data that is stored with this item.
''' </summary>
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 = ""
''' <summary>
''' The damage the Fling move does when this item is attached to a Pokémon.
''' </summary>
Public ReadOnly Property FlingDamage() As Integer
Get
Return Me._flingDamage
End Get
End Property
Public Overridable ReadOnly Property FlingDamage As Integer = 30
''' <summary>
''' If this item can be traded in for money.
''' </summary>
Public ReadOnly Property CanBeTraded() As Boolean
Get
Return Me._canBeTraded
End Get
End Property
Public Overridable ReadOnly Property CanBeTraded As Boolean = True
''' <summary>
''' If this item can be given to a Pokémon.
''' </summary>
Public ReadOnly Property CanBeHold() As Boolean
Get
Return Me._canBeHold
End Get
End Property
Public Overridable ReadOnly Property CanBeHold As Boolean = True
''' <summary>
''' If this item can be used from the bag.
''' </summary>
Public ReadOnly Property CanBeUsed() As Boolean
Get
Return Me._canBeUsed
End Get
End Property
Public Overridable ReadOnly Property CanBeUsed As Boolean = True
''' <summary>
''' If this item can be used in battle.
''' </summary>
Public ReadOnly Property CanBeUsedInBattle() As Boolean
Get
Return Me._canBeUsedInBattle
End Get
End Property
Public Overridable ReadOnly Property CanBeUsedInBattle As Boolean = True
''' <summary>
''' If this item can be tossed in the bag.
''' </summary>
Public ReadOnly Property CanBeTossed() As Boolean
Get
Return Me._canBeTossed
End Get
End Property
Public Overridable ReadOnly Property CanBeTossed As Boolean = True
''' <summary>
''' If this item requires the player to select a Pokémon to use the item on in battle.
''' </summary>
Public ReadOnly Property BattleSelectPokemon() As Boolean
Get
Return Me._requiresPokemonSelectInBattle
End Get
End Property
Public Overridable ReadOnly Property BattleSelectPokemon As Boolean = True
''' <summary>
''' If this item is a Pokéball item.
''' </summary>
Public ReadOnly Property IsBall() As Boolean
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
Public Overridable ReadOnly Property IsBall As Boolean = False
''' <summary>
''' If this item is a Healing item.
''' </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
Return Me._isHealingItem
Return [GetType]().IsSubclassOf(GetType(Berry))
End Get
End Property
''' <summary>
''' If this item is a Mail item.
''' </summary>
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
''' <summary>
''' If this item is a Mega Stone.
''' </summary>
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
''' <summary>
''' If this item is a Plate.
''' </summary>
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
''' <summary>
''' The color for player dialogues.
''' </summary>
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
''' <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>
''' The item gets used from the bag.
''' </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
<Item(247, "HM 05")>
<Item(247, "HM 01")>
Public Class HM01
Inherits TechMachine

View File

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

View File

@ -18,24 +18,8 @@ Namespace Items
Dim MailRead As Boolean
End Structure
''' <summary>
''' Creates a new instance of the Mail Item class.
''' </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 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

View File

@ -7,20 +7,7 @@ Namespace Items
Inherits Item
''' <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)
MyBase.New(Name, Price, ItemType, ID, CatchMultiplier, SortValue, TextureRectangle, Description)
End Sub
Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Medicine
''' <summary>
''' 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
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

View File

@ -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

View File

@ -4,25 +4,7 @@ Namespace Items
Inherits Item
''' <summary>
''' 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 ReadOnly Property CanBeUsedInBattle As Boolean = False
Public Overrides Sub Use()
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 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()

View File

@ -7,27 +7,14 @@ Namespace Items
Inherits Item
''' <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)
MyBase.New(Name, Price, ItemType, ID, CatchMultiplier, SortValue, TextureRectangle, Description)
End Sub
Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Medicine
''' <summary>
''' Checks if a Vitamin can be used on a Pokémon.
''' </summary>
''' <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>
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

View File

@ -7,27 +7,9 @@ Namespace Items
Inherits Item
''' <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)
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
''' </summary>
''' <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>
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

View File

@ -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()

View File

@ -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