VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "spell"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False

Public Rune1 As Byte
Public Rune2 As Byte
Public Rune3 As Byte
Public Rune4 As Byte
Public Difficulty As Byte
Public Skill As Byte
Public word6 As Long

Public Function SpellType() As Long
    SpellType = word6 And &HF
End Function
Public Function Result() As Long
    Result = (word6 And &H3F0) / &H10
End Function
Public Function Fatigue() As Long
    Fatigue = (word6 And &HFC00) / &H400
End Function

Public Function tostring() As String
    If Rune1 >= 96 And Rune1 < 102 Then
        tostring = Trim(Str(Rune1 - 95))
    Else
        tostring = "x"
    End If
    
    If Rune2 >= 102 And Rune2 < 108 Then
        tostring = tostring + Trim(Str(Rune2 - 101))
    ElseIf Rune2 = 0 Then
        tostring = tostring + "x"
    Else
        tostring = tostring + "?"
    End If
    If Rune3 >= 108 And Rune3 < 114 Then
        tostring = tostring + Trim(Str(Rune3 - 107))
    ElseIf Rune3 = 0 Then
        tostring = tostring + "x"
    Else
        tostring = tostring + "?"
    End If
    If Rune4 >= 114 And Rune4 < 120 Then
        tostring = tostring + Trim(Str(Rune4 - 113))
    ElseIf Rune4 = 0 Then
        tostring = tostring + "x"
    Else
        tostring = tostring + "?"
    End If
    
    tostring = Trim(tostring)
    
End Function
Public Function setspelltype(num As Integer)
    Dim l1 As Long
    
    If num > 15 Then
        num = 15
    End If
    If num < 0 Then
        num = 0
    End If
    
    word6 = (word6 And &HFFF0)
    l1 = num
    word6 = word6 + l1
End Function

Public Function setresult(num As Integer)
    Dim l1 As Long
    
    If num > 63 Then
        num = 63
    End If
    If num < 0 Then
        num = 0
    End If
    
    word6 = (word6 And &HFC0F)
    l1 = num
    l1 = l1 * &H10
    word6 = word6 + l1
End Function

Public Function setfatigue(num As Integer)
    Dim l1 As Long
    
    If num > 64 Then
        num = 64
    End If
    If num < 0 Then
        num = 0
    End If
    
    word6 = (word6 And &H3FF)
    l1 = num
    l1 = l1 * &H400
    word6 = word6 + l1
End Function


