⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modmagic.vb.svn-base

📁 MirUnleashed vb.net Module modMainServer Public WithEvents Socket As New WinsockServer Pub
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
                    Dim Player As clsPlayer = ObjectList(MagicAttack.OwnerId)

                    Select Case MagicAttack.EffectType

                        '###################################'
                        '### Accuracy1/Acuracy2/HitBoost ###'
                        '###################################'
                        Case MagEffectTypes.Accuracy1, MagEffectTypes.Accuracy2, MagEffectTypes.HitBoost
                            'In CalcMagicStats within clsPlayer


                            '###################'
                            '### ShootDamage ###'
                            '###################'
                        Case MagEffectTypes.ShootDamage
                            'Dim CheckMap As Map = Maps(Player.Map)
                            '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
                            '!!!!CHECK IF TARGET IS IN A SAFEZONE RANGE!!!!'
                            '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'

                            Dim Damage As Integer
                            Player.MP -= MagicAttack.ManaCost
                            Player.HP -= MagicAttack.HealthCost
                            Damage = GetDamage(MagicAttack.Power, MagicAttack.MaxPower, 0)

                            Dim TargetId As Object
                            Dim tRace As Races
                            tRace = Races.None

                            Dim en As IDictionaryEnumerator = MagicAttack.Targets.GetEnumerator

                            While en.MoveNext
                                tRace = en.Value
                                TargetId = en.Key
                            End While

                            If Damage > 0 Then
                                Damage = Math.Max(0, Damage - GetAMC(TargetId))
                            End If

                            Select Case tRace
                                Case Races.Player
                                    Dim tPlayer As clsPlayer = ObjectList(TargetId)

                                    tPlayer.HP -= Damage
                                    If tPlayer.HP <= 0 Then tPlayer.Died()
                                Case Races.Monster
                                    Dim tMonster As clsMonster = ObjectList(TargetId)

                                    tMonster.HP -= Damage
                                    If tMonster.HP <= 0 Then tMonster.Died()
                            End Select


                            '#######################'
                            '### NearShootSquare ###'
                            '#######################'
                        Case MagEffectTypes.NearShootSquare2x2, MagEffectTypes.NearShootSquare4x4, MagEffectTypes.NearShootSquare6x6, MagEffectTypes.NearShootSquare8x8
                            'Dim CheckMap As Map = Maps(Player.Map)
                            '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
                            '!!!!CHECK IF TARGET IS IN A SAFEZONE RANGE!!!!'
                            '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'

                            Dim Damage As Integer
                            Player.MP -= MagicAttack.ManaCost
                            Player.HP -= MagicAttack.HealthCost
                            Damage = GetDamage(MagicAttack.Power, MagicAttack.MaxPower, 0)

                            Dim TargetId As Object
                            Dim tRace As Races
                            tRace = Races.None

                            Dim en As IDictionaryEnumerator = MagicAttack.Targets.GetEnumerator

                            While en.MoveNext
                                tRace = en.Value
                                TargetId = en.Key

                                If Damage > 0 Then
                                    Damage = Math.Max(0, Damage - GetAMC(TargetId))
                                End If

                                Select Case tRace
                                    Case Races.Player
                                        Dim tPlayer As clsPlayer = ObjectList(TargetId)

                                        tPlayer.HP -= Damage
                                        If tPlayer.HP <= 0 Then tPlayer.Died()
                                    Case Races.Monster
                                        Dim tMonster As clsMonster = ObjectList(TargetId)

                                        tMonster.HP -= Damage
                                        If tMonster.HP <= 0 Then tMonster.Died()
                                End Select
                            End While
                    End Select

                Case Monster
            End Select
        End Sub

#End Region
    End Class

#End Region

#Region "Magic Effect Types"

    Public Enum MagEffectTypes
        HitBoost = 0 'Increases damage for the hit
        ShootDamage = 1 'Shoots damage at a target
        Heal = 2 'Heals a target
        Poison = 3 'Poisons a target
        Repel = 4 'Repels everyone around caster
        HitLine2 = 5 'Damages targets straight ahead two squares
        HitLine4 = 6 'Damages targets straight ahead four squares
        Hitline6 = 7 'Damages targets straight ahead six squares
        Hitline8 = 8 'Damages targets straight ahead eight squares
        RaiseAC = 9 'Raises MaxAC of caster
        RaiseAMC = 10 'Raises MaxAMC of caster for a period of time
        RaiseDC = 11 'Raises MaxDC of caster for a period of time
        RaiseMC = 12 'Raises MaxMC of caster for a period of time
        RaiseSC = 13 'Raises MaxSC of caster for a period of time
        RaiseHP = 14 'Raises MaxHP of caster for a period of time
        RaiseMP = 15 'Raises MaxMP of caster for a period of time
        MassRaiseAC = 16 'Raises MaxAC in target area for a period of time
        MassRaiseAMC = 17 'Raises MaxAMC in target area for a period of time
        MassRaiseDC = 18 'Raises MaxDC in target area for a period of time
        MassRaiseMC = 19 'Raises MaxMC in target area for a period of time
        MassRaiseSC = 20 'Raises MaxSC in target area for a period of time
        MassRaiseHP = 21 'Raises MaxHP in target area for a period of time
        MassRaiseMP = 22 'Raises MaxMP in target area for a period of time
        Trap = 23 'Paralyses monsters in target area for a period of time
        Summon = 24 'Summons a pet for the caster
        Hide = 25 'Caster becomes invisible to monsters for a period of time
        MassHide = 26 'Target area invisible to monsters for period of time
        Tame = 27 'Tames target monster
        Teleport = 28 'Randomly teleports caster
        DamageSquare2x2 = 29 'Target 2x2 square causes damage for a period of time
        DamageSquare4x4 = 30 'Target 4x4 square causes damage for a period of time
        DamageSquare6x6 = 31 'Target 6x6 square causes damage for a period of time
        DamageSquare8x8 = 32 'Target 8x8 square causes damage for a period of time
        ShootSquare2x2 = 33 'Shoots damage at a target 2x2 square
        ShootSquare4x4 = 34 'Shoots damage at a target 4x4 square
        ShootSquare6x6 = 35 'Shoots damage at a target 6x6 square
        ShootSquare8x8 = 36 'Shoots damage at a target 8x8 square
        NearShootSquare2x2 = 37 'Shoots damage from caster in a 2x2 square
        NearShootSquare4x4 = 38 'Shoots damage from caster in a 4x4 square
        NearShootSquare6x6 = 39 'Shoots damage from caster in a 6x6 square
        NearShootSquare8x8 = 40 'Shoots damage from caster in a 8x8 square
        HitHalf = 41 'Damages targets halfway around caster
        HitHalf2 = 42 'Damages targets halfway around and two squares away from caster
        HitFull = 43 'Damages all targets around caster
        HitFull2 = 44 'Damages all targets around and two squares away from caster
        Push = 45 'Pushes target infront of caster in a line
        DisplayHP = 46 'Displays targets health bar for a period of time
        DisplayMP = 47 'Displays targets mana bar for a period o time
        Shield = 48 'Puts shield around caster for a period of time
        MassShield = 49 'Puts shield around target area for a period of time
        KillUndead = 50 'Kills undead monsters
        Accuracy1 = 51 'Increases accuracy forever
        Accuracy2 = 52 'Inreases accuracy forever by more
    End Enum

    Public Enum MagSizes
        m2x2 = 0
        m4x4 = 1
        m6x6 = 2
        m8x8 = 3
    End Enum

#End Region
#Region "clsMagicAttack"

    Public Class clsMagicAttack
        Public Owner As Races
        Public OwnerId As Object
        Public EffectType As MagEffectTypes
        Public Power As Integer
        Public MaxPower As Integer
        Public ManaCost As Integer
        Public HealthCost As Integer
        Public RequireItem As String
        Public ItemCost As Integer
        Public Targets As New Hashtable 'Key = TargetId, Value = TargetRace
    End Class

#End Region

#Region "LoadMagics"

    Public Sub LoadMagics()
        Dim ReadMagic As clsMagic 'this is the temp magic object used to save the data in before adding to hashtable

        Try
            Dim DR As System.Data.SqlClient.SqlDataReader
            Dim StrSQL As String = "Select * From TBL_Magic"
            Dim SqlComm As New System.Data.SqlClient.SqlCommand(StrSQL, SqlConnDB)
            Dim MagicCount As Integer
            DR = SqlComm.ExecuteReader

            Do While DR.Read()
                ReadMagic = New clsMagic
                ReadMagic.Name = DR.Item("Name")
                ReadMagic.Looks = DR.Item("Looks")
                ReadMagic.EffectType = DR.Item("EffectType")
                ReadMagic.ManaCost = DR.Item("ManaCost")
                ReadMagic.HealthCost = DR.Item("HealthCost")
                ReadMagic.RequireItem = DR.Item("RequireItem")
                ReadMagic.ItemCost = DR.Item("ItemCost")
                ReadMagic.Power = DR.Item("Power")
                ReadMagic.MaxPower = DR.Item("MaxPower")
                ReadMagic.AttackRange = DR.Item("AttackRange")
                ReadMagic.Job = DR.Item("Job")
                ReadMagic.NeedLevel1 = DR.Item("NeedLevel1")
                ReadMagic.Level1Exp = DR.Item("Level1Exp")
                ReadMagic.NeedLevel2 = DR.Item("NeedLevel2")
                ReadMagic.Level2Exp = DR.Item("Level2Exp")
                ReadMagic.NeedLevel3 = DR.Item("NeedLevel3")
                ReadMagic.Level3Exp = DR.Item("Level3Exp")
                ReadMagic.RechargeTime = DR.Item("RechargeTime")
                ReadMagic.MagicId = MagicCount
                MagicCount += 1
                If MagicList.Contains(ReadMagic.Name) = False Then
                    MagicList.Add(ReadMagic.Name, ReadMagic)
                    MagicKeyList.Add(ReadMagic.MagicId, ReadMagic.Name)
                End If
            Loop

            DR.Close()
            SqlComm.Dispose()
            DR = Nothing
            SqlComm = Nothing
        Catch ex As Exception
            MessageBox.Show("Reading magics failed." & vbCrLf & ex.Message)
        End Try
    End Sub

#End Region

End Module

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -