Option Explicit

 

Private sName As String

Private sType As String

Private sDescription As String

'Used to determine the upper and lower range of a weapon's damage

'Ex. 1-10, 3-18, etc

Private sDamageRange As String

Private iWeight As Integer

Private bMagical As Boolean

Private bEpicItem As Boolean

Private iEpicItemPiece As Integer

Private iEpicNum As Integer

Private objSurface As DirectDrawSurface7

'Special off/def bonuses

Private objDefBonus() As udtBonus

Private objOffBonus() As udtBonus

 

Private iHP As Integer

Private iBaseHP As Integer

Private colSpells As Collection

'Used to determine if a weapon is being held in a character's off hand

'This is used when a character has a modification to off/def when using

'an off hand weapon

Private bOffHand As Boolean

Private byteStrReq As Byte

 

Private iRange As Integer

 

'bitmap used when object is laying on the ground

Private objGroundBitmap As DirectDrawSurface7

 

Public Property Get Name() As String

    Name = sName

End Property

 

Public Property Get WeaponType() As String

    WeaponType = sType

End Property

 

Public Property Get Description() As String

    Description = sDescription

End Property

 

Public Property Let Description(sData As String)

    sDescription = sData

End Property

 

Public Property Get Damage() As String

    'To be filled in during a later tutorial

End Property

 

Public Property Get Magical() As Boolean

    Magical = bMagical

End Property

 

Public Property Get Weight() As Integer

    Weight = iWeight

End Property

 

Public Property Set ObjectSurface(ByVal objData As DirectDrawSurface7)

    Set objSurface = objData

End Property

 

Public Property Get ObjectSurface() As DirectDrawSurface7

    Set ObjectSurface = objSurface

End Property

 

Public Property Let Name(ByVal sData As String)

    sName = sData

End Property

 

Public Property Let WeaponType(ByVal sData As String)

    sType = sData

End Property

 

Public Property Let Damage(ByVal sData As String)

    sDamageRange = sData

End Property

 

Public Property Let Magical(ByVal bData As Boolean)

    bMagical = bData

End Property

 

Public Property Let Weight(ByVal iData As Integer)

    iWeight = iData

End Property

 

Public Property Get EpicItem() As Boolean

    EpicItem = bEpicItem

End Property

 

Public Property Let EpicItem(ByVal bData As Boolean)

    bEpicItem = bData

End Property

 

Public Property Get EpicNum() As Integer

    EpicNum = iEpicNum

End Property

 

Public Property Let EpicNum(ByVal iData As Integer)

    iEpicNum = iData

End Property

 

Public Property Get EpicItemPiece() As Integer

    EpicItemPiece = iEpicItemPiece

End Property

 

Public Property Let EpicItemPiece(ByVal iData As Integer)

    iEpicItemPiece = iData

End Property

 

Private Sub Class_Terminate()

    Set ObjectSurface = Nothing

End Sub

 

Public Property Get HP() As Integer

    HP = iHP

End Property

 

Public Property Let HP(ByVal iData As Integer)

    iHP = iData

End Property

 

Public Property Get BaseHP() As Integer

    BaseHP = iBaseHP

End Property

 

Public Property Let BaseHP(ByVal iData As Integer)

    iBaseHP = iData

End Property

 

Public Property Let Spells(ByVal colData As Collection)

    Set colSpells = colData

End Property

 

Public Property Get Spells() As Collection

    Set Spells = colSpells

End Property

 

Public Function GetDefBonus() As Integer

   

    Dim iLp As Integer

    Dim iTotal As Integer

   

    iTotal = 0

   

    For iLp = 0 To UBound(objDefBonus)

        iTotal = iTotal + objDefBonus(iLp).iAmount

    Next iLp

   

    GetDefBonus = iTotal

   

End Function

 

Public Sub SetDefBonus(ByVal iAmount As Integer, ByVal iTimeStarted As Integer, ByVal iDuration As Integer)

 

    Dim iIndex As Integer

   

    On Error Resume Next

   

    iIndex = -1

   

    iIndex = UBound(objDefBonus)

   

    If iIndex = -1 Then

        iIndex = 0

        ReDim objDefBonus(iIndex)

    Else

        iIndex = iIndex + 1

        ReDim Preserve objDefBonus(iIndex)

    End If

   

    With objDefBonus(iIndex)

        .iAmount = iAmount

        .iDuration = iDuration

        .iTimeStarted = iTimeStarted

    End With

   

End Sub

 

Public Function GetOffBonus() As Integer

 

    Dim iLp As Integer

    Dim iTotal As Integer

   

    iTotal = 0

   

    For iLp = 0 To UBound(objOffBonus)

        iTotal = iTotal + objOffBonus(iLp).iAmount

    Next iLp

   

    GetOffBonus = iTotal

End Function

 

Public Sub SetOffBonus(ByVal iAmount As Integer, ByVal iTimeStarted As Integer, ByVal iDuration As Integer)

 

    Dim iIndex As Integer

   

    On Error Resume Next

   

    iIndex = -1

   

    iIndex = UBound(objOffBonus)

   

    If iIndex = -1 Then

        iIndex = 0

        ReDim objOffBonus(iIndex)

    Else

        iIndex = iIndex + 1

        ReDim Preserve objOffBonus(iIndex)

    End If

   

    With objOffBonus(iIndex)

        .iAmount = iAmount

        .iDuration = iDuration

        .iTimeStarted = iTimeStarted

    End With

 

End Sub

 

Public Property Let OffHand(ByVal bData As Boolean)

    bOffHand = bData

End Property

 

Public Property Get OffHand() As Boolean

    OffHand = bOffHand

End Property

 

Public Property Get StrReq() As Byte

    StrReq = byteStrReq

End Property

 

Public Property Let StrReq(ByVal byteData As Byte)

    byteStrReq = byteData

End Property

 

Public Property Let Range(ByVal iData As Integer)

    iRange = iData

End Property

 

Public Property Get Range() As Integer

    Range = iRange

End Property