VERSION 5.00
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form AttackEditor 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Attack Editor"
   ClientHeight    =   6360
   ClientLeft      =   2100
   ClientTop       =   1800
   ClientWidth     =   8505
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   424
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   567
   Begin VB.TextBox Fatigue 
      Height          =   285
      Left            =   5400
      TabIndex        =   22
      Top             =   2880
      Width           =   735
   End
   Begin VB.TextBox Damage 
      Height          =   285
      Left            =   5400
      TabIndex        =   21
      Top             =   2520
      Width           =   735
   End
   Begin VB.TextBox Hitprob 
      Height          =   285
      Left            =   5400
      TabIndex        =   20
      Top             =   2160
      Width           =   735
   End
   Begin VB.TextBox Stamina 
      Height          =   285
      Left            =   5400
      TabIndex        =   19
      Top             =   1800
      Width           =   735
   End
   Begin VB.TextBox Defense 
      Height          =   285
      Left            =   5400
      TabIndex        =   18
      Top             =   1440
      Width           =   735
   End
   Begin VB.TextBox Exp 
      Height          =   285
      Left            =   5400
      TabIndex        =   17
      Top             =   1080
      Width           =   735
   End
   Begin VB.ComboBox CBSkill 
      Height          =   315
      Left            =   6240
      Style           =   2  'Dropdown List
      TabIndex        =   16
      Top             =   720
      Width           =   2175
   End
   Begin VB.TextBox Skill 
      Height          =   285
      Left            =   5400
      TabIndex        =   15
      Top             =   720
      Width           =   735
   End
   Begin VB.TextBox AttackName 
      Height          =   285
      Left            =   5400
      TabIndex        =   14
      Top             =   360
      Width           =   3015
   End
   Begin MSForms.ListBox AttackList 
      Height          =   4560
      Left            =   120
      TabIndex        =   23
      Top             =   120
      Width           =   4095
      ScrollBars      =   3
      DisplayStyle    =   2
      Size            =   "7223;8043"
      ColumnCount     =   2
      cColumnInfo     =   1
      MatchEntry      =   0
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      Object.Width           =   "987"
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "fatigue:"
      Height          =   255
      Index           =   9
      Left            =   4320
      TabIndex        =   13
      Top             =   2880
      Width           =   975
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "damage:"
      Height          =   255
      Index           =   8
      Left            =   4320
      TabIndex        =   12
      Top             =   2520
      Width           =   975
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "hitprob:"
      Height          =   255
      Index           =   7
      Left            =   4320
      TabIndex        =   11
      Top             =   2160
      Width           =   975
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "stamina:"
      Height          =   255
      Index           =   6
      Left            =   4320
      TabIndex        =   10
      Top             =   1800
      Width           =   975
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "defense:"
      Height          =   255
      Index           =   5
      Left            =   4320
      TabIndex        =   9
      Top             =   1440
      Width           =   975
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "experience:"
      Height          =   255
      Index           =   4
      Left            =   4320
      TabIndex        =   8
      Top             =   1080
      Width           =   975
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "skill:"
      Height          =   255
      Index           =   3
      Left            =   4320
      TabIndex        =   7
      Top             =   720
      Width           =   975
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "name:"
      Height          =   255
      Index           =   2
      Left            =   4320
      TabIndex        =   6
      Top             =   360
      Width           =   975
   End
   Begin MSForms.ListBox ItemList 
      Height          =   855
      Left            =   4320
      TabIndex        =   5
      Top             =   4920
      Width           =   4095
      ScrollBars      =   3
      DisplayStyle    =   2
      Size            =   "7223;1508"
      ColumnCount     =   2
      cColumnInfo     =   1
      MatchEntry      =   0
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      Object.Width           =   "1340"
   End
   Begin VB.Label ST 
      Alignment       =   2  'Center
      Caption         =   "items with this attack"
      Height          =   255
      Index           =   1
      Left            =   4320
      TabIndex        =   4
      Top             =   4680
      Width           =   4095
   End
   Begin VB.Label ST 
      Alignment       =   2  'Center
      Caption         =   "combos with this attack"
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   3
      Top             =   4680
      Width           =   4095
   End
   Begin MSForms.CommandButton Ok 
      Default         =   -1  'True
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   5880
      Width           =   1335
      Caption         =   "Ok"
      Size            =   "2355;661"
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton Cancel 
      Cancel          =   -1  'True
      Height          =   375
      Left            =   7080
      TabIndex        =   1
      Top             =   5880
      Width           =   1335
      Caption         =   "Cancel"
      Size            =   "2355;661"
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.ListBox ComboList 
      Height          =   855
      Left            =   120
      TabIndex        =   0
      Top             =   4920
      Width           =   4095
      ScrollBars      =   3
      DisplayStyle    =   2
      Size            =   "7223;1508"
      ColumnCount     =   2
      cColumnInfo     =   1
      MatchEntry      =   0
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      Object.Width           =   "1340"
   End
End
Attribute VB_Name = "AttackEditor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Attacks(44) As New attack
Public selectedattack As Integer
Public subchange As Boolean


Public Function modifiedattack(ByVal num As Integer)

    Dim i As Integer
    Dim atk As Integer
    
    i = num
    
    AttackList.List(i - 1, 0) = zerostr(i - 1, 2)
    AttackList.List(i - 1, 1) = Attacks(num).name
    
End Function
Public Function init()
    Dim i As Integer
    
    AttackList.Clear
    
    For i = 1 To 44
        Attacks(i).Damage = App.graphics.f560.attack(i).Damage
        Attacks(i).Defense = App.graphics.f560.attack(i).Defense
        Attacks(i).Exp = App.graphics.f560.attack(i).Exp
        Attacks(i).Fatigue = App.graphics.f560.attack(i).Fatigue
        Attacks(i).HitProb = App.graphics.f560.attack(i).HitProb
        Attacks(i).name = App.graphics.f560.attack(i).name
        Attacks(i).Skill = App.graphics.f560.attack(i).Skill
        Attacks(i).Stamina = App.graphics.f560.attack(i).Stamina
        
        AttackList.AddItem
        modifiedattack (i)
    Next
    
    CBSkill.AddItem "00 - Fighter 1"
    CBSkill.AddItem "01 - Ninja 1"
    CBSkill.AddItem "02 - Priest 1"
    CBSkill.AddItem "03 - Wizard 1"
    CBSkill.AddItem "04 - Fighter 2"
    CBSkill.AddItem "05 - Fighter 3"
    CBSkill.AddItem "06 - Fighter 4"
    CBSkill.AddItem "07 - Fighter 5"
    CBSkill.AddItem "08 - Ninja 2"
    CBSkill.AddItem "09 - Ninja 3"
    CBSkill.AddItem "10 - Ninja 4"
    CBSkill.AddItem "11 - Ninja 5"
    CBSkill.AddItem "12 - Priest 2"
    CBSkill.AddItem "13 - Priest 3"
    CBSkill.AddItem "14 - Priest 4"
    CBSkill.AddItem "15 - Priest 5"
    CBSkill.AddItem "16 - Wizard 2"
    CBSkill.AddItem "17 - Wizard 3"
    CBSkill.AddItem "18 - Wizard 4"
    CBSkill.AddItem "19 - Wizard 5"
    
    selectattack (1)
End Function

Public Function selectattack(ByVal num As Integer)
    selectedattack = num
    subchange = True
    AttackList.ListIndex = num - 1
    
    init_itemlist
    init_combolist
    
    AttackName.Text = Attacks(selectedattack).name
    Skill.Text = Str(Attacks(selectedattack).Skill)
    If Attacks(selectedattack).Skill >= 0 And Attacks(selectedattack).Skill < 20 Then
        CBSkill.ListIndex = Attacks(selectedattack).Skill
    Else
        CBSkill.ListIndex = 0
    End If
    Exp.Text = Str(Attacks(selectedattack).Exp)
    Defense.Text = Str(Attacks(selectedattack).Defense)
    Stamina.Text = Str(Attacks(selectedattack).Stamina)
    HitProb.Text = Str(Attacks(selectedattack).HitProb)
    Damage.Text = Str(Attacks(selectedattack).Damage)
    Fatigue.Text = Str(Attacks(selectedattack).Fatigue)
    
    subchange = False
End Function

Public Function init_itemlist()

    ItemList.Clear
    ItemList.ListIndex = -1
    
    Dim i, j As Integer
    Dim Combo As Integer
    j = 0
    For i = 1 To 180
        Combo = App.graphics.f559.obj(i).Combos
        If Combo >= 0 And Combo < 44 Then
            If App.graphics.f560.Combo(Combo + 1).attack1 = selectedattack - 1 Then
                ItemList.AddItem
                ItemList.List(j, 0) = zerostr(i - 1, 3)
                ItemList.List(j, 1) = App.graphics.f556.objstring(App.graphics.f559.obj(i).ItemType + 1)
                j = j + 1
            ElseIf App.graphics.f560.Combo(Combo + 1).attack2 = selectedattack - 1 Then
                ItemList.AddItem
                ItemList.List(j, 0) = zerostr(i - 1, 3)
                ItemList.List(j, 1) = App.graphics.f556.objstring(App.graphics.f559.obj(i).ItemType + 1)
                j = j + 1
            ElseIf App.graphics.f560.Combo(Combo + 1).attack3 = selectedattack - 1 Then
                ItemList.AddItem
                ItemList.List(j, 0) = zerostr(i - 1, 3)
                ItemList.List(j, 1) = App.graphics.f556.objstring(App.graphics.f559.obj(i).ItemType + 1)
                j = j + 1
            End If
        End If
    Next
    
End Function

Public Function init_combolist()

    ComboList.Clear
    ComboList.ListIndex = -1
    
    Dim i, j As Integer
    Dim Combo As Integer
    j = 0
    For i = 1 To 44
        If App.graphics.f560.Combo(i).attack1 = selectedattack - 1 Then
            ComboList.AddItem
            ComboList.List(j, 0) = zerostr(i - 1, 2)
            ComboList.List(j, 1) = App.graphics.f560.Combo(i).tostring
            j = j + 1
       ElseIf App.graphics.f560.Combo(i).attack2 = selectedattack - 1 Then
            ComboList.AddItem
            ComboList.List(j, 0) = zerostr(i - 1, 2)
            ComboList.List(j, 1) = App.graphics.f560.Combo(i).tostring
            j = j + 1
        ElseIf App.graphics.f560.Combo(i).attack3 = selectedattack - 1 Then
            ComboList.AddItem
            ComboList.List(j, 0) = zerostr(i - 1, 2)
            ComboList.List(j, 1) = App.graphics.f560.Combo(i).tostring
            j = j + 1
        End If
    Next
    
End Function

Private Sub AttackName_Change()
    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    
    Attacks(selectedattack).name = AttackName.Text
    modifiedattack (selectedattack)
   
    subchange = False
End Sub

Private Sub Cancel_Click()
    Hide
    
End Sub

Private Sub AttackList_Click()

    selectattack (AttackList.ListIndex + 1)
End Sub

Private Sub CBSkill_Click()


    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    
    Attacks(selectedattack).Skill = CBSkill.ListIndex
    Skill.Text = Str(Attacks(selectedattack).Skill)
    
    subchange = False
End Sub

Private Sub ComboList_DblClick(Cancel As MSForms.ReturnBoolean)
    
    App.dlg_comboeditor.init
    App.dlg_comboeditor.selectcombo (val(Mid(ComboList.List(ComboList.ListIndex, 0), 2)) + 1)
    App.dlg_comboeditor.Show
End Sub


Private Sub damage_Change()


    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    
    Attacks(selectedattack).Damage = EFChange8(Damage, 0, 255)
    
    subchange = False
End Sub

Private Sub Defense_Change()


    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    
    Attacks(selectedattack).Defense = EFChange8(Defense, -127, 127) 'fixme
    
    subchange = False
End Sub

Private Sub Exp_Change()

    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    
    Attacks(selectedattack).Exp = EFChange8(Exp, 0, 255)
    
    subchange = False
End Sub

Private Sub Fatigue_Change()


    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    
    Attacks(selectedattack).Fatigue = EFChange8(Fatigue, 0, 255)
    
    subchange = False
End Sub

Private Sub hitprob_Change()


    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    
    Attacks(selectedattack).HitProb = EFChange8(HitProb, 0, 255)
    
    subchange = False
End Sub

Private Sub ItemList_DblClick(Cancel As MSForms.ReturnBoolean)
    'Dim dlg_miscobjecteditor As MiscObjectEditor
    'Set dlg_miscobjecteditor = New MiscObjectEditor
    'dlg_miscobjecteditor.itemnum = val(Mid(ItemList.List(ItemList.ListIndex, 0), 2) + 1)
    'dlg_miscobjecteditor.init
    'dlg_miscobjecteditor.parenttype = 2
    'Set dlg_miscobjecteditor.dlg_attackeditor = Me
    'dlg_miscobjecteditor.Show
    
    Dim itemnum As Integer
    Dim ItemType As String
    
    'itemnum = ObjectList.ListIndex + 1
    itemnum = val(Mid(ItemList.List(ItemList.ListIndex, 0), 2) + 1)
    ItemType = graphics.f556.objtype(itemnum)
    
    If ItemType = "Food" Then
        Dim dlg_foodeditor As FoodEditor
        Set dlg_foodeditor = New FoodEditor
        dlg_foodeditor.itemnum = itemnum
        dlg_foodeditor.init
        dlg_foodeditor.parenttype = 2
        Set dlg_foodeditor.dlg_attackeditor = Me
        dlg_foodeditor.Show
    ElseIf ItemType = "Armor" Then
        Dim dlg_armoreditor As ArmorEditor
        Set dlg_armoreditor = New ArmorEditor
        dlg_armoreditor.itemnum = itemnum
        dlg_armoreditor.init
        dlg_armoreditor.parenttype = 2
        Set dlg_armoreditor.dlg_attackeditor = Me
        dlg_armoreditor.Show
        
    ElseIf ItemType = "Weapon" Then
        Dim dlg_weaponeditor As WeaponEditor
        Set dlg_weaponeditor = New WeaponEditor
        dlg_weaponeditor.itemnum = itemnum
        dlg_weaponeditor.init
        dlg_weaponeditor.parenttype = 2
        Set dlg_weaponeditor.dlg_attackeditor = Me
        dlg_weaponeditor.Show
    ElseIf ItemType = "Misc" Then
        Dim dlg_miscobjecteditor As MiscObjectEditor
        Set dlg_miscobjecteditor = New MiscObjectEditor
        dlg_miscobjecteditor.itemnum = itemnum
        dlg_miscobjecteditor.init
        dlg_miscobjecteditor.parenttype = 2
        Set dlg_miscobjecteditor.dlg_attackeditor = Me
        dlg_miscobjecteditor.Show
    Else
        MsgBox ("Invalid item type")
    End If
End Sub

Private Sub Ok_Click()
    For i = 1 To 44
        App.graphics.f560.attack(i).Damage = Attacks(i).Damage
        App.graphics.f560.attack(i).Defense = Attacks(i).Defense
        App.graphics.f560.attack(i).Exp = Attacks(i).Exp
        App.graphics.f560.attack(i).Fatigue = Attacks(i).Fatigue
        App.graphics.f560.attack(i).HitProb = Attacks(i).HitProb
        App.graphics.f560.attack(i).name = Attacks(i).name
        App.graphics.f560.attack(i).Skill = Attacks(i).Skill
        App.graphics.f560.attack(i).Stamina = Attacks(i).Stamina
    Next
    App.graphics.f560.update
    Hide
End Sub

Private Sub Skill_Change()
    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    
    Attacks(selectedattack).Skill = EFChange8(Skill, 0, 19) 'fixme

    If Attacks(selectedattack).Skill >= 0 And Attacks(selectedattack).Skill < 20 Then
        CBSkill.ListIndex = Attacks(selectedattack).Skill
    Else
        CBSkill.ListIndex = 0
    End If
    
    subchange = False
    
End Sub

Private Sub Stamina_Change()


    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    
    Attacks(selectedattack).Stamina = EFChange8(Stamina, 0, 255)
    
    subchange = False
End Sub
