公共函数.bas
资源名称:vbmcrisrc.rar [点击查看]
上传用户:pcw2004
上传日期:2022-02-02
资源大小:743k
文件大小:85k
源码类别:
DirextX编程
开发平台:
Visual Basic
- Attribute VB_Name = "公共函数"
- Option Explicit
- '/////// 载入地图数据
- Public Sub LoadMap(mMap As String)
- Dim i As Long, j As Long
- End Sub
- '////// 怪Y排序
- Public Sub MonPaiXu()
- Dim i As Long
- Dim Work As Boolean
- Dim PMon As MonInfo
- Work = True
- Do
- Work = False
- For i = 1 To MonCount - 1
- If Mon(i).Y > Mon(i + 1).Y Then
- PMon = Mon(i)
- Mon(i) = Mon(i + 1)
- Mon(i + 1) = PMon
- Work = True
- End If
- Next
- DoEvents
- Loop While Work = True
- End Sub
- Public Sub MouseSelMonNum()
- Dim i As Long, mSel As Boolean
- Mouse.MSelMonNum = 0
- mSel = False
- For i = 1 To MonCount
- If Mon(i).X = Mouse.SelX And Mon(i).Y = Mouse.SelY + 1 Then
- Mouse.MSelMonNum = i
- mSel = True
- Exit For
- End If
- Next
- If mSel = False Then
- For i = 1 To MonCount
- If Mon(i).X = Mouse.SelX And Mon(i).Y = Mouse.SelY Then
- Mouse.MSelMonNum = i
- mSel = True
- Exit For
- End If
- Next
- End If
- End Sub
- '///// 魔法锁定函数
- Public Sub GetMagicLock()
- Dim i As Integer
- MouseSelMonNum
- If Mouse.MSelMonNum > 0 Then
- If UBound(Mon) >= Mouse.MSelMonNum Then
- If Mouse.SelX = Mon(Mouse.MSelMonNum).X And Mouse.SelY = Mon(Mouse.MSelMonNum).Y Then
- Hero.MagicLock = True
- Hero.MagicLockType = 0
- Hero.MagicLockNum = Mouse.MSelMonNum
- End If
- End If
- End If
- If Hero.MagicLock = True Then
- If Hero.MagicLockType = 0 Then
- If UBound(Mon) < Hero.MagicLockNum Then GoTo aErr
- Hero.MagicX = Mon(Hero.MagicLockNum).X
- Hero.MagicY = Mon(Hero.MagicLockNum).Y
- ElseIf Hero.MagicLockType = 1 Then
- Hero.MagicX = Player(Hero.MagicLockNum).X
- Hero.MagicY = Player(Hero.MagicLockNum).Y
- End If
- Else
- aErr:
- Hero.MagicX = Mouse.SelX
- Hero.MagicY = Mouse.SelY
- End If
- End Sub
- '///////// 鼠标选取怪物编号
- '///////// 得到物品
- Public Sub GetItems(mItem As ItemType, mCount As Integer)
- Dim i As Integer
- For i = 0 To 39
- If Bag(i).State = False Then
- Bag(i).State = True
- Bag(i).Item = mItem
- mCount = mCount - 1
- If mCount <= 0 Then Exit For
- End If
- Next
- End Sub
- '//////////将一条长的信息自动换行
- Public Function InfoHuangHang(mStr As String) As PlayerTalkType
- Dim i As Integer, MM() As String
- ReDim MM(Len(mStr) 10)
- For i = 0 To UBound(MM)
- If i < UBound(MM) Then
- MM(i) = Mid(mStr, i * 10 + 1 + 0, 10)
- ElseIf i = UBound(MM) Then
- MM(i) = Mid(mStr, i * 10 + 1, Len(mStr) - i * 10)
- End If
- Next
- For i = 0 To UBound(MM)
- InfoHuangHang.LiaoTianStr = InfoHuangHang.LiaoTianStr & MM(i) & vbCrLf
- Next
- InfoHuangHang.StrHei = UBound(MM)
- End Function
- '////////// 增加一条聊天记录
- Public Sub AddTalkStr(mStr As String, mColor As Long, Optional PlayerName As String = "")
- TalkCount = TalkCount + 1
- ReDim Preserve TalkStr(TalkCount)
- TalkStr(TalkCount).mStr = mStr
- TalkStr(TalkCount).mColor = mColor
- TalkStr(TalkCount).PlayerName = PlayerName
- If TalkStrStart + 7 < TalkCount Then TalkStrStart = TalkStrStart + 1
- End Sub
- Public Sub GetHeroInfo()
- Dim i As Integer
- Player(MainHeroNum).AC1 = 0
- Player(MainHeroNum).AC2 = Player(MainHeroNum).AC_自身物防
- Player(MainHeroNum).MAC2 = 0
- Player(MainHeroNum).MAC2 = Player(MainHeroNum).MAC_自身魔防
- Player(MainHeroNum).DC1 = 0
- Player(MainHeroNum).DC2 = Player(MainHeroNum).DC_自身攻击
- Player(MainHeroNum).MC1 = 0
- Player(MainHeroNum).MC2 = Player(MainHeroNum).MC_自身魔法
- Player(MainHeroNum).SC1 = 0
- Player(MainHeroNum).SC2 = Player(MainHeroNum).SC_自身道术
- If Player(MainHeroNum).Weapon.State = True Then
- Player(MainHeroNum).DC1 = Player(MainHeroNum).DC1 + Player(MainHeroNum).Weapon.Item.Dc
- Player(MainHeroNum).DC2 = Player(MainHeroNum).DC2 + Player(MainHeroNum).Weapon.Item.DC2
- Player(MainHeroNum).MC1 = Player(MainHeroNum).MC1 + Player(MainHeroNum).Weapon.Item.MC
- Player(MainHeroNum).MC2 = Player(MainHeroNum).MC2 + Player(MainHeroNum).Weapon.Item.MC2
- Player(MainHeroNum).SC1 = Player(MainHeroNum).SC1 + Player(MainHeroNum).Weapon.Item.sc
- Player(MainHeroNum).SC2 = Player(MainHeroNum).SC2 + Player(MainHeroNum).Weapon.Item.SC2
- End If
- If Player(MainHeroNum).Clothing.State = True Then
- Player(MainHeroNum).AC1 = Player(MainHeroNum).AC1 + Player(MainHeroNum).Clothing.Item.AC
- Player(MainHeroNum).AC2 = Player(MainHeroNum).AC2 + Player(MainHeroNum).Clothing.Item.AC2
- Player(MainHeroNum).MAC1 = Player(MainHeroNum).MAC1 + Player(MainHeroNum).Clothing.Item.MAC
- Player(MainHeroNum).MAC2 = Player(MainHeroNum).MAC2 + Player(MainHeroNum).Clothing.Item.MAC2
- Player(MainHeroNum).DC1 = Player(MainHeroNum).DC1 + Player(MainHeroNum).Clothing.Item.Dc
- Player(MainHeroNum).DC2 = Player(MainHeroNum).DC2 + Player(MainHeroNum).Clothing.Item.DC2
- Player(MainHeroNum).MC1 = Player(MainHeroNum).MC1 + Player(MainHeroNum).Clothing.Item.MC
- Player(MainHeroNum).MC2 = Player(MainHeroNum).MC2 + Player(MainHeroNum).Clothing.Item.MC2
- Player(MainHeroNum).SC1 = Player(MainHeroNum).SC1 + Player(MainHeroNum).Clothing.Item.sc
- Player(MainHeroNum).SC2 = Player(MainHeroNum).SC2 + Player(MainHeroNum).Clothing.Item.SC2
- End If
- If Player(MainHeroNum).HeadPiece.State = True Then
- Player(MainHeroNum).AC1 = Player(MainHeroNum).AC1 + Player(MainHeroNum).HeadPiece.Item.AC
- Player(MainHeroNum).AC2 = Player(MainHeroNum).AC2 + Player(MainHeroNum).HeadPiece.Item.AC2
- Player(MainHeroNum).MAC1 = Player(MainHeroNum).MAC1 + Player(MainHeroNum).HeadPiece.Item.MAC
- Player(MainHeroNum).MAC2 = Player(MainHeroNum).MAC2 + Player(MainHeroNum).HeadPiece.Item.MAC2
- Player(MainHeroNum).DC1 = Player(MainHeroNum).DC1 + Player(MainHeroNum).HeadPiece.Item.Dc
- Player(MainHeroNum).DC2 = Player(MainHeroNum).DC2 + Player(MainHeroNum).HeadPiece.Item.DC2
- Player(MainHeroNum).MC1 = Player(MainHeroNum).MC1 + Player(MainHeroNum).HeadPiece.Item.MC
- Player(MainHeroNum).MC2 = Player(MainHeroNum).MC2 + Player(MainHeroNum).HeadPiece.Item.MC2
- Player(MainHeroNum).SC1 = Player(MainHeroNum).SC1 + Player(MainHeroNum).HeadPiece.Item.sc
- Player(MainHeroNum).SC2 = Player(MainHeroNum).SC2 + Player(MainHeroNum).HeadPiece.Item.SC2
- End If
- If Player(MainHeroNum).Necklace.State = True Then
- Player(MainHeroNum).DC1 = Player(MainHeroNum).DC1 + Player(MainHeroNum).Necklace.Item.Dc
- Player(MainHeroNum).DC2 = Player(MainHeroNum).DC2 + Player(MainHeroNum).Necklace.Item.DC2
- Player(MainHeroNum).MC1 = Player(MainHeroNum).MC1 + Player(MainHeroNum).Necklace.Item.MC
- Player(MainHeroNum).MC2 = Player(MainHeroNum).MC2 + Player(MainHeroNum).Necklace.Item.MC2
- Player(MainHeroNum).SC1 = Player(MainHeroNum).SC1 + Player(MainHeroNum).Necklace.Item.sc
- Player(MainHeroNum).SC2 = Player(MainHeroNum).SC2 + Player(MainHeroNum).Necklace.Item.SC2
- End If
- If Player(MainHeroNum).BraceletLeft.State = True Then
- Player(MainHeroNum).AC1 = Player(MainHeroNum).AC1 + Player(MainHeroNum).BraceletLeft.Item.AC
- Player(MainHeroNum).AC2 = Player(MainHeroNum).AC2 + Player(MainHeroNum).BraceletLeft.Item.AC2
- Player(MainHeroNum).MAC1 = Player(MainHeroNum).MAC1 + Player(MainHeroNum).BraceletLeft.Item.MAC
- Player(MainHeroNum).MAC2 = Player(MainHeroNum).MAC2 + Player(MainHeroNum).BraceletLeft.Item.MAC2
- Player(MainHeroNum).DC1 = Player(MainHeroNum).DC1 + Player(MainHeroNum).BraceletLeft.Item.Dc
- Player(MainHeroNum).DC2 = Player(MainHeroNum).DC2 + Player(MainHeroNum).BraceletLeft.Item.DC2
- Player(MainHeroNum).MC1 = Player(MainHeroNum).MC1 + Player(MainHeroNum).BraceletLeft.Item.MC
- Player(MainHeroNum).MC2 = Player(MainHeroNum).MC2 + Player(MainHeroNum).BraceletLeft.Item.MC2
- Player(MainHeroNum).SC1 = Player(MainHeroNum).SC1 + Player(MainHeroNum).BraceletLeft.Item.sc
- Player(MainHeroNum).SC2 = Player(MainHeroNum).SC2 + Player(MainHeroNum).BraceletLeft.Item.SC2
- End If
- If Player(MainHeroNum).BraceletRight.State = True Then
- Player(MainHeroNum).AC1 = Player(MainHeroNum).AC1 + Player(MainHeroNum).BraceletRight.Item.AC
- Player(MainHeroNum).AC2 = Player(MainHeroNum).AC2 + Player(MainHeroNum).BraceletRight.Item.AC2
- Player(MainHeroNum).MAC1 = Player(MainHeroNum).MAC1 + Player(MainHeroNum).BraceletRight.Item.MAC
- Player(MainHeroNum).MAC2 = Player(MainHeroNum).MAC2 + Player(MainHeroNum).BraceletRight.Item.MAC2
- Player(MainHeroNum).DC1 = Player(MainHeroNum).DC1 + Player(MainHeroNum).BraceletRight.Item.Dc
- Player(MainHeroNum).DC2 = Player(MainHeroNum).DC2 + Player(MainHeroNum).BraceletRight.Item.DC2
- Player(MainHeroNum).MC1 = Player(MainHeroNum).MC1 + Player(MainHeroNum).BraceletRight.Item.MC
- Player(MainHeroNum).MC2 = Player(MainHeroNum).MC2 + Player(MainHeroNum).BraceletRight.Item.MC2
- Player(MainHeroNum).SC1 = Player(MainHeroNum).SC1 + Player(MainHeroNum).BraceletRight.Item.sc
- Player(MainHeroNum).SC2 = Player(MainHeroNum).SC2 + Player(MainHeroNum).BraceletRight.Item.SC2
- End If
- If Player(MainHeroNum).FingerringLeft.State = True Then
- Player(MainHeroNum).DC1 = Player(MainHeroNum).DC1 + Player(MainHeroNum).FingerringLeft.Item.Dc
- Player(MainHeroNum).DC2 = Player(MainHeroNum).DC2 + Player(MainHeroNum).FingerringLeft.Item.DC2
- Player(MainHeroNum).MC1 = Player(MainHeroNum).MC1 + Player(MainHeroNum).FingerringLeft.Item.MC
- Player(MainHeroNum).MC2 = Player(MainHeroNum).MC2 + Player(MainHeroNum).FingerringLeft.Item.MC2
- Player(MainHeroNum).SC1 = Player(MainHeroNum).SC1 + Player(MainHeroNum).FingerringLeft.Item.sc
- Player(MainHeroNum).SC2 = Player(MainHeroNum).SC2 + Player(MainHeroNum).FingerringLeft.Item.SC2
- End If
- If Player(MainHeroNum).FingerringRight.State = True Then
- Player(MainHeroNum).DC1 = Player(MainHeroNum).DC1 + Player(MainHeroNum).FingerringRight.Item.Dc
- Player(MainHeroNum).DC2 = Player(MainHeroNum).DC2 + Player(MainHeroNum).FingerringRight.Item.DC2
- Player(MainHeroNum).MC1 = Player(MainHeroNum).MC1 + Player(MainHeroNum).FingerringRight.Item.MC
- Player(MainHeroNum).MC2 = Player(MainHeroNum).MC2 + Player(MainHeroNum).FingerringRight.Item.MC2
- Player(MainHeroNum).SC1 = Player(MainHeroNum).SC1 + Player(MainHeroNum).FingerringRight.Item.sc
- Player(MainHeroNum).SC2 = Player(MainHeroNum).SC2 + Player(MainHeroNum).FingerringRight.Item.SC2
- End If
- End Sub
- Public Sub MonTexAct()
- Dim i As Integer
- If MonCount = 0 Then Exit Sub
- For i = 1 To MonCount
- If Mon(i).Act = Stone_怪石化 Then
- If Mon(i).Pic > 0 Then
- Mon(i).PicSpeed = Mon(i).PicSpeed + 1
- If Mon(i).PicSpeed > 5 Then
- Mon(i).PicSpeed = 0
- Mon(i).Pic = Mon(i).Pic + 1
- End If
- End If
- Else
- Mon(i).PicSpeed = Mon(i).PicSpeed + 1
- If Mon(i).PicSpeed > 3 Then
- Mon(i).PicSpeed = 0
- Mon(i).Pic = Mon(i).Pic + 1
- End If
- End If
- Select Case Mon(i).Act
- Case MonActType.Stone_怪石化
- If Mon(i).Pic > 5 Then
- Mon(i).PicSpeed = 0
- Mon(i).Pic = 0
- Mon(i).Act = Stand_怪站立
- End If
- Case MonActType.Stand_怪站立
- If Mon(i).Pic > 3 Then
- Mon(i).PicSpeed = 0
- Mon(i).Pic = 0
- Mon(i).Act = Stand_怪站立
- End If
- Case MonActType.Move_怪移动
- Mon(i).XOFFECT = (5 - Mon(i).Pic) * (48 / 6)
- Mon(i).YOFFECT = (5 - Mon(i).Pic) * (32 / 6)
- If Mon(i).Pic > 5 Then
- Mon(i).Pic = 0
- Mon(i).Act = Stand_怪站立
- Mon(i).PicSpeed = 0
- End If
- Case MonActType.Bruise_怪受伤
- If Mon(i).Pic > 2 Then
- Mon(i).Pic = 0
- Mon(i).Act = Stand_怪站立
- Mon(i).PicSpeed = 0
- End If
- Case MonActType.AttAck_怪攻击
- If Mon(i).Pic > 5 Then
- Mon(i).Pic = 0
- Mon(i).PicSpeed = 0
- Mon(i).Act = Stand_怪站立
- End If
- Case MonActType.Dead_怪死亡
- If Mon(i).DBInfo.Appr_形象代码 = 218 Then
- If Mon(i).Pic > 19 Then
- Mon(i).Pic = 19
- End If
- Else
- If Mon(i).Pic > 9 Then
- Mon(i).Pic = 9
- End If
- End If
- End Select
- Next
- End Sub
- '///////////// 交易情况 ///////////////////////////
- Public Sub JiaoYiOKCancel(JiaoYi成败 As Boolean)
- Dim i As Integer, j As Integer
- Select Case JiaoYi成败
- Case Is = True
- For i = 0 To 9
- If JiaoYi.BeiJiaoYiItems(i).State = True Then
- For j = 0 To 39
- If Bag(j).State = False Then
- Bag(j).State = True
- Bag(j).Item = JiaoYi.BeiJiaoYiItems(i).Item
- JiaoYi.BeiJiaoYiItems(i).State = False
- Exit For
- End If
- Next
- End If
- Next
- Case Is = False
- For i = 0 To 9
- If JiaoYi.JiaoYiItems(i).State = True Then
- For j = 0 To 39
- If Bag(j).State = False Then
- Bag(j).State = True
- Bag(j).Item = JiaoYi.JiaoYiItems(i).Item
- JiaoYi.JiaoYiItems(i).State = False
- Exit For
- End If
- Next
- End If
- Next
- End Select
- JiaoYi.State = False
- For i = 0 To 9
- JiaoYi.BeiJiaoYiItems(i).State = False
- JiaoYi.JiaoYiItems(i).State = False
- Next
- JiaoYi.JiaoYiOK = False
- End Sub
- '//////////////// 检测地图上的玩家编号 ///////////////
- Public Function GetMapXYPlayerNum(PlayerX As Long, PlayerY As Long, PlayerFace As FaceInfo, mSpace As Integer) As Integer
- Dim i As Integer
- Select Case PlayerFace
- Case FaceInfo.UpFace
- For i = 1 To PlayerCount
- If Player(i).X = PlayerX And Player(i).Y = PlayerY - mSpace Then
- If Player(i).Conneted = True And Player(i).Act <> Dead_死亡 Then
- GetMapXYPlayerNum = i
- Exit For
- End If
- End If
- Next
- Case FaceInfo.RightUpFace
- For i = 1 To PlayerCount
- If Player(i).X = PlayerX + mSpace And Player(i).Y = PlayerY - mSpace Then
- If Player(i).Conneted = True And Player(i).Act <> Dead_死亡 Then
- GetMapXYPlayerNum = i
- Exit For
- End If
- End If
- Next
- Case FaceInfo.RightFace
- For i = 1 To PlayerCount
- If Player(i).X = PlayerX + mSpace And Player(i).Y = PlayerY Then
- If Player(i).Conneted = True And Player(i).Act <> Dead_死亡 Then
- GetMapXYPlayerNum = i
- Exit For
- End If
- End If
- Next
- Case FaceInfo.RightDownFace
- For i = 1 To PlayerCount
- If Player(i).X = PlayerX + mSpace And Player(i).Y = PlayerY + mSpace Then
- If Player(i).Conneted = True And Player(i).Act <> Dead_死亡 Then
- GetMapXYPlayerNum = i
- Exit For
- End If
- End If
- Next
- Case FaceInfo.DownFace
- For i = 1 To PlayerCount
- If Player(i).X = PlayerX And Player(i).Y = PlayerY + mSpace Then
- If Player(i).Conneted = True And Player(i).Act <> Dead_死亡 Then
- GetMapXYPlayerNum = i
- Exit For
- End If
- End If
- Next
- Case FaceInfo.LeftDownFace
- For i = 1 To PlayerCount
- If Player(i).X = PlayerX - mSpace And Player(i).Y = PlayerY + mSpace Then
- If Player(i).Conneted = True And Player(i).Act <> Dead_死亡 Then
- GetMapXYPlayerNum = i
- Exit For
- End If
- End If
- Next
- Case FaceInfo.Leftface
- For i = 1 To PlayerCount
- If Player(i).X = PlayerX - mSpace And Player(i).Y = PlayerY Then
- If Player(i).Conneted = True And Player(i).Act <> Dead_死亡 Then
- GetMapXYPlayerNum = i
- Exit For
- End If
- End If
- Next
- Case FaceInfo.LeftUpFace
- For i = 1 To PlayerCount
- If Player(i).X = PlayerX - mSpace And Player(i).Y = PlayerY - mSpace Then
- If Player(i).Conneted = True And Player(i).Act <> Dead_死亡 Then
- GetMapXYPlayerNum = i
- Exit For
- End If
- End If
- Next
- End Select
- End Function
- '/////////// 鼠标选择 窗口
- Public Sub MouseSelFrm()
- Dim i As Integer
- If Mouse.Button1Down = False And Mouse.button2Down = False Then
- Mouse.SelFrm = MainFrom
- If Mouse.X < 190 And Mouse.Y > 385 Then
- Mouse.SelFrm = InfoFrom
- ElseIf Mouse.X >= 190 And Mouse.X < 630 And Mouse.Y > 400 Then
- Mouse.SelFrm = InfoFrom
- ElseIf Mouse.X >= 630 And Mouse.Y > 348 Then
- Mouse.SelFrm = InfoFrom
- End If
- If JiaoYi.State = True Then
- If Mouse.X > 350 And Mouse.X < 570 And _
- Mouse.Y > 20 And Mouse.Y < 195 Or _
- Mouse.X > 350 And Mouse.X < 586 And _
- Mouse.Y > 180 And Mouse.Y < 327 Then
- Mouse.SelFrm = JiaoYiFrom
- End If
- End If
- If NpcFrm.State = True Then
- If Mouse.X > 0 And Mouse.X < PrguseTex(384).Wid And _
- Mouse.Y > 0 And Mouse.Y < PrguseTex(384).Hei Then
- Mouse.SelFrm = NpcFrom
- End If
- End If
- If BagFrm.State = True Then
- If Mouse.X > BagFrm.X And Mouse.X < BagFrm.X + PrguseTex(3).Wid And _
- Mouse.Y > BagFrm.Y And Mouse.Y < BagFrm.Y + PrguseTex(3).Hei Then
- Mouse.SelFrm = BagFrom
- End If
- End If
- If HeroInfoFrm.State = True Then
- If Mouse.X > HeroInfoFrm.X And Mouse.X < HeroInfoFrm.X + Prguse3Tex(207).Wid And _
- Mouse.Y > HeroInfoFrm.Y And Mouse.Y < HeroInfoFrm.Y + Prguse3Tex(207).Hei Then
- Mouse.SelFrm = HeroInfoFrom
- End If
- End If
- If ErrorFrm.State = True Then
- If Mouse.X > ErrorFrm.X And Mouse.X < ErrorFrm.X + PrguseTex(360).Wid And _
- Mouse.Y > ErrorFrm.Y And Mouse.Y < ErrorFrm.Y + PrguseTex(360).Hei Then
- Mouse.SelFrm = ErrorFrom
- End If
- End If
- End If
- End Sub
- Public Function CheckKey(KeyCode As Long) As Boolean
- Dim Key As Long
- Key = GetKeyState(KeyCode)
- If Key And KEY_DOWN Then
- CheckKey = True
- Else
- CheckKey = False
- End If
- End Function
- '/////////// 魔法排序
- Public Sub MagicPaiXu()
- Dim mMagic As MagicActType
- Dim i As Integer, j As Integer
- Dim Work As Boolean
- Work = True
- Do While Work
- Work = False
- For i = 1 To MagicCount
- If i < MagicCount Then
- If Magic(i).Y > Magic(i + 1).Y Then
- mMagic = Magic(i)
- Magic(i) = Magic(i + 1)
- Magic(i + 1) = mMagic
- Work = True
- End If
- End If
- Next
- DoEvents
- Loop
- End Sub
- '////////////////////// 施放魔法效果贴图属性
- Public Sub UserPlayerMagic(PlayerNum As Integer, PlayerName As String, MagicName As String, X As Long, Y As Long)
- Dim i As Integer
- Select Case MagicName
- Case "火球术" '自愈术
- Player(PlayerNum).PlayerMagicCount = Player(PlayerNum).PlayerMagicCount + 1
- ReDim Preserve Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount)
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).MagicName = MagicName
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PlayerNum = PlayerNum
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PlayerName = PlayerName
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).StartPic = 0
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Pic = 0
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PicSpeed = 0
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).MaxPicNum = 9
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).X = X
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Y = Y
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PicSuDu = 2
- For i = 1 To MagicDBCount
- If MagicDB(i).MagName_名称 = MagicName Then
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Effect = MagicDB(i).Effect_魔法效果
- Exit For
- End If
- Next
- Case "治愈术" '自愈术
- Player(PlayerNum).PlayerMagicCount = Player(PlayerNum).PlayerMagicCount + 1
- ReDim Preserve Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount)
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).MagicName = MagicName
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PlayerNum = PlayerNum
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PlayerName = PlayerName
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).StartPic = 200
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Pic = 0
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PicSpeed = 0
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).MaxPicNum = 9
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).X = X
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Y = Y
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PicSuDu = 2
- For i = 1 To MagicDBCount
- If MagicDB(i).MagName_名称 = MagicName Then
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Effect = MagicDB(i).Effect_魔法效果
- Exit For
- End If
- Next
- Case "冰咆哮" '冰咆哮
- Player(PlayerNum).PlayerMagicCount = Player(PlayerNum).PlayerMagicCount + 1
- ReDim Preserve Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount)
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).MagicName = MagicName
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PlayerNum = PlayerNum
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PlayerName = PlayerName
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).StartPic = 3840
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Pic = 0
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PicSpeed = 0
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).MaxPicNum = 9
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).X = X
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Y = Y
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PicSuDu = 2
- For i = 1 To MagicDBCount
- If MagicDB(i).MagName_名称 = MagicName Then
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Effect = MagicDB(i).Effect_魔法效果
- Exit For
- End If
- Next
- Case "魔法盾"
- Player(PlayerNum).PlayerMagicCount = Player(PlayerNum).PlayerMagicCount + 1
- ReDim Preserve Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount)
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).MagicName = MagicName
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PlayerNum = PlayerNum
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PlayerName = PlayerName
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).StartPic = 3880
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Pic = 0
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PicSpeed = 0
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).MaxPicNum = 9
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).X = Player(PlayerNum).X
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Y = Player(PlayerNum).Y
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PicSuDu = 2
- For i = 1 To MagicDBCount
- If MagicDB(i).MagName_名称 = MagicName Then
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Effect = MagicDB(i).Effect_魔法效果
- Exit For
- End If
- Next
- Set LoginGameMusic = DS.CreateSoundBufferFromFile(ResPath & "WavM31-1.wav", DSBDESC)
- LoginGameMusic.SetVolume mVolume
- LoginGameMusic.Play DSBPLAY_DEFAULT
- Case "雷电术"
- Player(PlayerNum).PlayerMagicCount = Player(PlayerNum).PlayerMagicCount + 1
- ReDim Preserve Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount)
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).MagicName = MagicName
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PlayerNum = PlayerNum
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PlayerName = PlayerName
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).StartPic = 20
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Pic = 0
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PicSpeed = 0
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).MaxPicNum = 5
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).X = X
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Y = Y
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).PicSuDu = 3
- For i = 1 To MagicDBCount
- If MagicDB(i).MagName_名称 = MagicName Then
- Player(PlayerNum).PlayerMagic(Player(PlayerNum).PlayerMagicCount).Effect = MagicDB(i).Effect_魔法效果
- Exit For
- End If
- Next
- Case "剑法"
- MagicCount = MagicCount + 1
- ReDim Preserve Magic(MagicCount)
- Magic(MagicCount).MagicName = "剑法"
- Magic(MagicCount).MaxPicNum = 16
- Magic(MagicCount).StartPic = 10
- Magic(MagicCount).Pic = 0
- Magic(MagicCount).PicSpeed = 0
- Magic(MagicCount).PicSuDu = 2
- Magic(MagicCount).Effect = 90
- Magic(MagicCount).Face = Player(PlayerNum).Face
- Magic(MagicCount).X = Player(PlayerNum).X
- Magic(MagicCount).Y = Player(PlayerNum).Y
- Magic(MagicCount).PlayerName = PlayerName
- Magic(MagicCount).PlayerNum = PlayerNum
- End Select
- End Sub
- '/////////// 地面魔法贴图动作
- Public Sub MapMagicTexAct()
- Dim i As Integer, j As Integer, l As Integer, N As Integer
- Dim k As Integer, M As Integer, GongVal As Long
- Dim MM As Integer
- If MagicCount <= 0 Then Exit Sub
- For i = 1 To MagicCount
- If i > MagicCount Then Exit For
- Magic(i).PicSpeed = Magic(i).PicSpeed + 1
- If Magic(i).PicSpeed > Magic(i).PicSuDu Then
- Magic(i).PicSpeed = 0
- Magic(i).Pic = Magic(i).Pic + 1
- If Magic(i).PlayerNum = MainHeroNum And Magic(i).PlayerName = Player(MainHeroNum).Name_名字 Then
- Select Case Magic(i).MagicName
- Case "冰咆哮"
- If Magic(i).Pic = 3 And Magic(i).PicSpeed = 0 Then
- GongVal = Rnd * Abs(Player(MainHeroNum).MC1 - Player(MainHeroNum).MC2) + IIf(Player(MainHeroNum).MC1 < Player(MainHeroNum).MC2, Player(MainHeroNum).MC1, Player(MainHeroNum).MC2) + MagicDB(GetMagicDBNum(Magic(i).MagicName)).Power_基本威力
- For k = -2 To 2
- For M = -2 To 2
- If Hero.攻击模式 <> 和平攻击模式 Then
- For j = 1 To PlayerCount
- '/////////////// 伤害玩家
- If Player(j).X = Magic(i).X + k And Player(j).Y = Magic(i).Y + M Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & j & KONGDATA & GongVal & KONGDATA & 1 & NETKONGDATA
- End If
- Next
- End If
- For j = 1 To MonCount
- If Mon(j).X = Magic(i).X + k And Mon(j).Y = Magic(i).Y + M Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(j).ID & KONGDATA & GongVal & KONGDATA & 1 & NETKONGDATA
- End If
- Next
- Next
- Next
- End If
- Case "雷电术"
- If Magic(i).Pic = 2 And Magic(i).PicSpeed = 0 Then
- GongVal = Rnd * Abs(Player(MainHeroNum).MC1 - Player(MainHeroNum).MC2) + IIf(Player(MainHeroNum).MC1 < Player(MainHeroNum).MC2, Player(MainHeroNum).MC1, Player(MainHeroNum).MC2) + MagicDB(GetMagicDBNum(Magic(i).MagicName)).Power_基本威力
- If Map.Map3(Magic(i).X, Magic(i).Y) > 0 Then
- '/////////////// 伤害玩家
- If Map.Map3(Magic(i).X, Magic(i).Y) <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & Map.Map3(Magic(i).X, Magic(i).Y) & KONGDATA & GongVal & KONGDATA & 1 & NETKONGDATA
- End If
- End If
- For k = 1 To MonCount
- If Mon(k).X = Magic(i).X And Mon(k).Y = Magic(i).Y Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 1 & NETKONGDATA
- End If
- Next
- End If
- Case Is = "剑法"
- If Magic(i).Pic > 3 And Magic(i).Pic < 9 And Magic(i).PicSpeed = 0 Then
- GongVal = Rnd * Abs(Player(MainHeroNum).DC1 - Player(MainHeroNum).DC2) + IIf(Player(MainHeroNum).DC1 < Player(MainHeroNum).DC2, Player(MainHeroNum).DC1, Player(MainHeroNum).DC2) + MagicDB(GetMagicDBNum(Magic(i).MagicName)).Power_基本威力
- Select Case Magic(i).Face
- Case FaceInfo.UpFace
- If Hero.攻击模式 <> 和平攻击模式 Then
- For k = 1 To PlayerCount
- If Player(k).X = Magic(i).X And Player(k).Y = Magic(i).Y - Magic(i).Pic + 3 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- End If
- For k = 1 To MonCount
- If Mon(k).X = Magic(i).X And Mon(k).Y = Magic(i).Y - Magic(i).Pic + 3 Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- Next
- Case FaceInfo.RightUpFace
- If Hero.攻击模式 <> 和平攻击模式 Then
- For k = 1 To PlayerCount
- If Player(k).X = Magic(i).X + Magic(i).Pic - 3 And Player(k).Y = Magic(i).Y - Magic(i).Pic + 3 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- End If
- For k = 1 To MonCount
- If Mon(k).X = Magic(i).X + Magic(i).Pic - 3 And Mon(k).Y = Magic(i).Y - Magic(i).Pic + 3 Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- Next
- Case FaceInfo.RightFace
- If Hero.攻击模式 <> 和平攻击模式 Then
- For k = 1 To PlayerCount
- If Player(k).X = Magic(i).X + Magic(i).Pic - 3 And Player(k).Y = Magic(i).Y Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- End If
- For k = 1 To MonCount
- If Mon(k).X = Magic(i).X + Magic(i).Pic - 3 And Mon(k).Y = Magic(i).Y Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- Next
- Case FaceInfo.RightDownFace
- If Hero.攻击模式 <> 和平攻击模式 Then
- For k = 1 To PlayerCount
- If Player(k).X = Magic(i).X + Magic(i).Pic - 3 And Player(k).Y = Magic(i).Y + Magic(i).Pic - 3 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- End If
- For k = 1 To MonCount
- If Mon(k).X = Magic(i).X + Magic(i).Pic - 3 And Mon(k).Y = Magic(i).Y + Magic(i).Pic - 3 Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- Next
- Case FaceInfo.DownFace
- If Hero.攻击模式 <> 和平攻击模式 Then
- For k = 1 To PlayerCount
- If Player(k).X = Magic(i).X And Player(k).Y = Magic(i).Y + Magic(i).Pic - 3 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- End If
- For k = 1 To MonCount
- If Mon(k).X = Magic(i).X And Mon(k).Y = Magic(i).Y + Magic(i).Pic - 3 Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- Next
- Case FaceInfo.LeftDownFace
- If Hero.攻击模式 <> 和平攻击模式 Then
- For k = 1 To PlayerCount
- If Player(k).X = Magic(i).X - Magic(i).Pic + 3 And Player(k).Y = Magic(i).Y + Magic(i).Pic - 3 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- End If
- For k = 1 To MonCount
- If Mon(k).X = Magic(i).X - Magic(i).Pic + 3 And Mon(k).Y = Magic(i).Y + Magic(i).Pic - 3 Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- Next
- Case FaceInfo.Leftface
- If Hero.攻击模式 <> 和平攻击模式 Then
- For k = 1 To PlayerCount
- If Player(k).X = Magic(i).X - Magic(i).Pic + 3 And Player(k).Y = Magic(i).Y Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- End If
- For k = 1 To MonCount
- If Mon(k).X = Magic(i).X - Magic(i).Pic + 3 And Mon(k).Y = Magic(i).Y Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- Next
- Case FaceInfo.LeftUpFace
- If Hero.攻击模式 <> 和平攻击模式 Then
- For k = 1 To PlayerCount
- If Player(k).X = Magic(i).X - Magic(i).Pic + 3 And Player(k).Y = Magic(i).Y - Magic(i).Pic + 3 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- End If
- For k = 1 To MonCount
- If Mon(k).X = Magic(i).X - Magic(i).Pic + 3 And Mon(k).Y = Magic(i).Y - Magic(i).Pic + 3 Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- Next
- End Select
- End If
- End Select
- End If
- If Magic(i).MagicName = "火球术" Then
- If Magic(i).EndX > 1000 And Magic(i).EndY > 800 Then
- For j = i To MagicCount
- If j < MagicCount Then
- Magic(j) = Magic(j + 1)
- End If
- Next
- MagicCount = MagicCount - 1
- ReDim Preserve Magic(MagicCount)
- End If
- If Magic(i).Pic > Magic(i).MaxPicNum Then
- Magic(i).Pic = 0
- Magic(i).PicSpeed = 0
- End If
- Else
- If Magic(i).Pic > Magic(i).MaxPicNum Then
- For j = i To MagicCount
- If j < MagicCount Then
- Magic(j) = Magic(j + 1)
- End If
- Next
- MagicCount = MagicCount - 1
- ReDim Preserve Magic(MagicCount)
- End If
- End If
- End If
- Next
- End Sub
- '////////// 施放出去的魔法效果图片
- Public Sub ActMagic(PlayerNum As Integer, PlayerName As String, MagicName As String, X As Long, Y As Long)
- Dim i As Integer, mRot As Single
- Select Case MagicName
- Case "火球术"
- MagicCount = MagicCount + 1
- ReDim Preserve Magic(MagicCount)
- Magic(MagicCount).X = Player(PlayerNum).X
- Magic(MagicCount).Y = Player(PlayerNum).Y - 1
- Magic(MagicCount).EndX = Player(PlayerNum).X
- Magic(MagicCount).EndY = Player(PlayerNum).Y
- Magic(MagicCount).XOFFECT = (X * 48 - Player(PlayerNum).X * 48) / 20
- Magic(MagicCount).YOFFECT = (Y * 32 - Player(PlayerNum).Y * 32) / 20
- Magic(MagicCount).Pic = 0
- Magic(MagicCount).PicSpeed = 0
- mRot = GetRot(X * 48 - Player(PlayerNum).X * 48, Y * 32 - Player(PlayerNum).Y * 32)
- If mRot <= 6.4 And mRot > 6 Then Magic(MagicCount).StartPic = 10
- If mRot <= 6 And mRot > 5.6 Then Magic(MagicCount).StartPic = 20
- If mRot <= 5.6 And mRot > 5.2 Then Magic(MagicCount).StartPic = 30
- If mRot <= 5.2 And mRot > 4.8 Then Magic(MagicCount).StartPic = 40
- If mRot <= 4.8 And mRot > 4.4 Then Magic(MagicCount).StartPic = 50
- If mRot <= 4.4 And mRot > 4 Then Magic(MagicCount).StartPic = 60
- If mRot <= 4 And mRot > 3.6 Then Magic(MagicCount).StartPic = 70
- If mRot <= 3.6 And mRot > 3.2 Then Magic(MagicCount).StartPic = 90
- If mRot <= 3.2 And mRot > 2.8 Then Magic(MagicCount).StartPic = 90
- If mRot <= 2.8 And mRot > 2.4 Then Magic(MagicCount).StartPic = 100
- If mRot <= 2.4 And mRot > 2 Then Magic(MagicCount).StartPic = 110
- If mRot <= 2 And mRot > 1.6 Then Magic(MagicCount).StartPic = 120
- If mRot <= 1.6 Or mRot > 7.7 Then Magic(MagicCount).StartPic = 130
- If mRot <= 7.7 And mRot > 7.2 Then Magic(MagicCount).StartPic = 140
- If mRot <= 7.2 And mRot > 6.8 Then Magic(MagicCount).StartPic = 150
- If mRot >= 6.8 And mRot < 6.4 Then Magic(MagicCount).StartPic = 160
- Magic(MagicCount).MaxPicNum = 4
- Magic(MagicCount).MagicName = MagicName
- Magic(MagicCount).PlayerNum = PlayerNum
- Magic(MagicCount).PlayerName = PlayerName
- Magic(MagicCount).PicSuDu = 1
- For i = 1 To MagicDBCount
- If MagicDB(i).MagName_名称 = MagicName Then
- Magic(MagicCount).Effect = MagicDB(i).EffectType_动作效果
- Exit For
- End If
- Next
- Case "治愈术"
- Player(PlayerNum).PlayerMagic2Count = Player(PlayerNum).PlayerMagic2Count + 1
- ReDim Preserve Player(PlayerNum).PlayerMagic2(Player(PlayerNum).PlayerMagic2Count)
- Player(PlayerNum).PlayerMagic2(Player(PlayerNum).PlayerMagic2Count).Pic = 0
- Player(PlayerNum).PlayerMagic2(Player(PlayerNum).PlayerMagic2Count).PicSpeed = 0
- Player(PlayerNum).PlayerMagic2(Player(PlayerNum).PlayerMagic2Count).StartPic = 370
- Player(PlayerNum).PlayerMagic2(Player(PlayerNum).PlayerMagic2Count).MaxPicNum = 10
- Player(PlayerNum).PlayerMagic2(Player(PlayerNum).PlayerMagic2Count).MagicName = MagicName
- Player(PlayerNum).PlayerMagic2(Player(PlayerNum).PlayerMagic2Count).PlayerNum = PlayerNum
- Player(PlayerNum).PlayerMagic2(Player(PlayerNum).PlayerMagic2Count).PlayerName = PlayerName
- Player(PlayerNum).PlayerMagic2(Player(PlayerNum).PlayerMagic2Count).PicSuDu = 2
- For i = 1 To MagicDBCount
- If MagicDB(i).MagName_名称 = MagicName Then
- Player(PlayerNum).PlayerMagic2(Player(PlayerNum).PlayerMagic2Count).Effect = MagicDB(i).Effect_魔法效果
- Exit For
- End If
- Next
- Case "冰咆哮"
- MagicCount = MagicCount + 1
- ReDim Preserve Magic(MagicCount)
- Magic(MagicCount).X = X
- Magic(MagicCount).Y = Y
- Magic(MagicCount).Pic = 0
- Magic(MagicCount).PicSpeed = 0
- Magic(MagicCount).StartPic = 3850
- Magic(MagicCount).MaxPicNum = 19
- Magic(MagicCount).MagicName = MagicName
- Magic(MagicCount).PlayerNum = PlayerNum
- Magic(MagicCount).PlayerName = PlayerName
- Magic(MagicCount).PicSuDu = 1
- For i = 1 To MagicDBCount
- If MagicDB(i).MagName_名称 = MagicName Then
- Magic(MagicCount).Effect = MagicDB(i).EffectType_动作效果
- Exit For
- End If
- Next
- Case "雷电术"
- MagicCount = MagicCount + 1
- ReDim Preserve Magic(MagicCount)
- Magic(MagicCount).X = X
- Magic(MagicCount).Y = Y
- Magic(MagicCount).Pic = 0
- Magic(MagicCount).PicSpeed = 0
- Magic(MagicCount).StartPic = 10
- Magic(MagicCount).MaxPicNum = 4
- Magic(MagicCount).MagicName = MagicName
- Magic(MagicCount).PlayerNum = PlayerNum
- Magic(MagicCount).PlayerName = PlayerName
- Magic(MagicCount).PicSuDu = 3
- For i = 1 To MagicDBCount
- If MagicDB(i).MagName_名称 = MagicName Then
- Magic(MagicCount).Effect = MagicDB(i).EffectType_动作效果
- Exit For
- End If
- Next
- Set LoginGameMusic = DS.CreateSoundBufferFromFile(ResPath & "WavM11-2.wav", DSBDESC)
- LoginGameMusic.SetVolume mVolume
- LoginGameMusic.Play DSBPLAY_DEFAULT
- Case "魔法盾"
- If Player(PlayerNum).Magic盾 = False And Player(PlayerNum).Name_名字 = PlayerName Then
- Player(PlayerNum).Magic盾 = True
- Player(PlayerNum).Magic盾LTime = GetTickCount
- Player(PlayerNum).Magic盾PTime = 5000
- Player(PlayerNum).Magic盾StartPic = 3890
- Player(PlayerNum).Magic盾Pic = 0
- Player(PlayerNum).Magic盾MaxPic = 2
- End If
- End Select
- End Sub
- '////////// 自身魔法贴图动作
- Public Sub PlayerMagicTexAct()
- Dim i As Integer, j As Integer, l As Integer
- For i = 1 To PlayerCount
- If Player(i).PlayerMagicCount > 0 Then
- For j = 1 To Player(i).PlayerMagicCount
- If j <= Player(i).PlayerMagicCount Then
- Player(i).PlayerMagic(j).PicSpeed = Player(i).PlayerMagic(j).PicSpeed + 1
- If Player(i).PlayerMagic(j).PicSpeed > Player(i).PlayerMagic(j).PicSuDu Then
- Player(i).PlayerMagic(j).PicSpeed = 0
- Player(i).PlayerMagic(j).Pic = Player(i).PlayerMagic(j).Pic + 1
- ' PlayerMagicActInfo i, j, Player(i).PlayerMagic(j).Type
- If Player(i).PlayerMagic(j).Pic > Player(i).PlayerMagic(j).MaxPicNum Then
- For l = j To Player(i).PlayerMagicCount
- If l < Player(i).PlayerMagicCount Then
- Player(i).PlayerMagic(l) = Player(i).PlayerMagic(l + 1)
- End If
- Next
- Player(i).PlayerMagicCount = Player(i).PlayerMagicCount - 1
- ReDim Preserve Player(i).PlayerMagic(Player(i).PlayerMagicCount)
- End If
- End If
- End If
- Next
- End If
- If Player(i).PlayerMagic2Count > 0 Then
- For j = 1 To Player(i).PlayerMagic2Count
- If j <= Player(i).PlayerMagic2Count Then
- Player(i).PlayerMagic2(j).PicSpeed = Player(i).PlayerMagic2(j).PicSpeed + 1
- If Player(i).PlayerMagic2(j).PicSpeed > Player(i).PlayerMagic2(j).PicSuDu Then
- Player(i).PlayerMagic2(j).PicSpeed = 0
- Player(i).PlayerMagic2(j).Pic = Player(i).PlayerMagic2(j).Pic + 1
- If Player(i).PlayerMagic2(j).Pic > Player(i).PlayerMagic2(j).MaxPicNum Then
- For l = j To Player(i).PlayerMagic2Count
- If l < Player(i).PlayerMagic2Count Then
- Player(i).PlayerMagic2(l) = Player(i).PlayerMagic2(l + 1)
- End If
- Next
- Player(i).PlayerMagic2Count = Player(i).PlayerMagic2Count - 1
- ReDim Preserve Player(i).PlayerMagic2(Player(i).PlayerMagic2Count)
- End If
- End If
- End If
- Next
- End If
- If Player(i).Magic盾 = True Then
- Player(i).Magic盾PicSpeed = Player(i).Magic盾PicSpeed + 1
- If Player(i).Magic盾PicSpeed > 3 Then
- Player(i).Magic盾PicSpeed = 0
- Player(i).Magic盾Pic = Player(i).Magic盾Pic + 1
- If Player(i).Magic盾Pic > Player(i).Magic盾MaxPic Then
- Player(i).Magic盾Pic = 0
- End If
- End If
- If GetTickCount - Player(i).Magic盾LTime > Player(i).Magic盾PTime Then
- Player(i).Magic盾 = False
- End If
- End If
- Next
- End Sub
- '////////// 自身魔法动作属性
- Public Sub PlayerMagicActInfo1()
- Dim i As Integer, j As Integer
- For i = 1 To PlayerCount
- If Player(i).PlayerMagicCount > 0 Then
- For j = 1 To Player(i).PlayerMagicCount
- Select Case Player(i).PlayerMagic(j).MagicName
- Case "治愈术"
- If Player(i).PlayerMagic(j).Pic = 5 And Player(i).PlayerMagic(j).PicSpeed = 0 Then
- ActMagic i, Player(i).Name_名字, "治愈术", Player(i).PlayerMagic(j).X, Player(i).PlayerMagic(j).Y
- End If
- Case "冰咆哮"
- If Player(i).PlayerMagic(j).Pic = 5 And Player(i).PlayerMagic(j).PicSpeed = 0 Then
- ActMagic i, Player(i).Name_名字, "冰咆哮", Player(i).PlayerMagic(j).X, Player(i).PlayerMagic(j).Y
- End If
- Case "魔法盾"
- If Player(i).PlayerMagic(j).Pic = 9 And Player(i).PlayerMagic(j).PicSpeed = 0 Then
- ActMagic i, Player(i).Name_名字, "魔法盾", Player(i).PlayerMagic(j).X, Player(i).PlayerMagic(j).Y
- End If
- Case "雷电术"
- If Player(i).PlayerMagic(j).Pic = 5 And Player(i).PlayerMagic(j).PicSpeed = 0 Then
- ActMagic i, Player(i).Name_名字, "雷电术", Player(i).PlayerMagic(j).X, Player(i).PlayerMagic(j).Y
- End If
- Case "火球术"
- If Player(i).PlayerMagic(j).Pic = 4 And Player(i).PlayerMagic(j).PicSpeed = 0 Then
- ActMagic i, Player(i).Name_名字, "火球术", Player(i).PlayerMagic(j).X, Player(i).PlayerMagic(j).Y
- End If
- End Select
- Next
- End If
- Next
- End Sub
- '////////// 获取键盘鼠标输入
- Public Sub GetInput()
- Dim i As Integer
- If Mouse.SelFrm = MainFrom Then
- If Mouse.Button1Down = True Then
- If Mouse.Item.State = False Then
- If ShiftKey = True Then
- If Player(MainHeroNum).CanAct = True Then
- Player(MainHeroNum).Act = AttAck_攻击
- Player(MainHeroNum).Pic = 0
- Player(MainHeroNum).PicSpeed = 0
- Player(MainHeroNum).CanAct = False
- ' If Player(MainHeroNum).Face <> GetMouseFace Then
- Player(MainHeroNum).Face = GetMouseFace
- FrmMain.Client.SendData PLAYERFACEDATA & KONGDATA & MainHeroNum & KONGDATA & Player(MainHeroNum).Face & NETKONGDATA
- ' End If
- FrmMain.Client.SendData PLAYERATTACKDATA & KONGDATA & MainHeroNum & NETKONGDATA
- NetAttackData = True
- End If
- Else
- If Mouse.SelX <> Player(MainHeroNum).X Or Mouse.SelY <> Player(MainHeroNum).Y Then
- If GetMouseFace <> -1 Then
- If Player(MainHeroNum).CanAct = True Then
- If Player(MainHeroNum).Face <> GetMouseFace Then
- Player(MainHeroNum).Face = GetMouseFace
- FrmMain.Client.SendData PLAYERFACEDATA & KONGDATA & MainHeroNum & KONGDATA & Player(MainHeroNum).Face & NETKONGDATA
- End If
- Player(MainHeroNum).ActState = walk_走
- End If
- End If
- End If
- End If
- End If
- ElseIf Mouse.button2Down = True Then
- If Mouse.SelX <> Player(MainHeroNum).X Or Mouse.SelY <> Player(MainHeroNum).Y Then
- If GetMouseFace <> -1 Then
- If Player(MainHeroNum).CanAct = True Then
- If Player(MainHeroNum).Face <> GetMouseFace Then
- Player(MainHeroNum).Face = GetMouseFace
- FrmMain.Client.SendData PLAYERFACEDATA & KONGDATA & MainHeroNum & KONGDATA & Player(MainHeroNum).Face & NETKONGDATA
- End If
- Player(MainHeroNum).ActState = Run_跑
- End If
- End If
- End If
- End If
- End If
- End Sub
- '///////// 主角移动
- Public Sub MovePlayer()
- Dim XX As Integer, YY As Integer
- Dim XX1 As Integer, YY1 As Integer
- XX = Player(MainHeroNum).X: YY = Player(MainHeroNum).Y
- XX1 = Player(MainHeroNum).X: YY1 = Player(MainHeroNum).Y
- If Player(MainHeroNum).CanAct = False Then Exit Sub
- Player(MainHeroNum).Act = Player(MainHeroNum).ActState
- If Player(MainHeroNum).ActState = walk_走 Then
- Select Case Player(MainHeroNum).Face
- Case FaceInfo.UpFace
- YY = YY - 1
- Case FaceInfo.RightUpFace
- XX = XX + 1
- YY = YY - 1
- Case FaceInfo.RightFace
- XX = XX + 1
- Case FaceInfo.RightDownFace
- XX = XX + 1
- YY = YY + 1
- Case FaceInfo.DownFace
- YY = YY + 1
- Case FaceInfo.LeftDownFace
- XX = XX - 1
- YY = YY + 1
- Case FaceInfo.Leftface
- XX = XX - 1
- Case FaceInfo.LeftUpFace
- XX = XX - 1
- YY = YY - 1
- End Select
- If XX < 0 Or XX > Map.Width Then GoTo Walk
- If YY < 0 Or YY > Map.Height Then GoTo Walk
- If Map.Map3(XX, YY) > 0 Then GoTo Walk
- If Map.Map4(XX, YY) > 0 Then GoTo Walk
- If Map.Map5(XX, YY) > 0 Then GoTo Walk
- Map.Map3(Player(MainHeroNum).X, Player(MainHeroNum).Y) = 0
- Player(MainHeroNum).X = XX: Player(MainHeroNum).Y = YY
- Map.Map3(Player(MainHeroNum).X, Player(MainHeroNum).Y) = MainHeroNum
- FrmMain.Client.SendData WALKDATA & KONGDATA & MainHeroNum & KONGDATA & Player(MainHeroNum).X & KONGDATA & Player(MainHeroNum).Y & KONGDATA & Player(MainHeroNum).Face & NETKONGDATA
- NetWalkData = True
- Player(MainHeroNum).Act = walk_走
- Player(MainHeroNum).ActState = Stand_站立
- Player(MainHeroNum).CanAct = False
- Player(MainHeroNum).XOFFECT = 48
- Player(MainHeroNum).YOFFECT = 32
- Player(MainHeroNum).PicSpeed = 0
- Player(MainHeroNum).Pic = 0
- End If
- If Player(MainHeroNum).ActState = Run_跑 Then
- Select Case Player(MainHeroNum).Face
- Case FaceInfo.UpFace
- YY = YY - 2
- YY1 = YY1 - 1
- Case FaceInfo.RightUpFace
- XX = XX + 2
- YY = YY - 2
- XX1 = XX1 + 1
- YY1 = YY1 - 1
- Case FaceInfo.RightFace
- XX = XX + 2
- XX1 = XX1 + 1
- Case FaceInfo.RightDownFace
- XX = XX + 2
- YY = YY + 2
- XX1 = XX1 + 1
- YY1 = YY1 + 1
- Case FaceInfo.DownFace
- YY = YY + 2
- YY1 = YY1 + 1
- Case FaceInfo.LeftDownFace
- XX = XX - 2
- YY = YY + 2
- XX1 = XX1 - 1
- YY1 = YY1 + 1
- Case FaceInfo.Leftface
- XX = XX - 2
- XX1 = XX1 - 1
- Case FaceInfo.LeftUpFace
- XX = XX - 2
- YY = YY - 2
- XX1 = XX1 - 1
- YY1 = YY1 - 1
- End Select
- If XX < 0 Or XX > Map.Width Then GoTo Run
- If YY < 0 Or YY > Map.Height Then GoTo Run
- If Map.Map3(XX, YY) > 0 Then GoTo Run
- ' If Map.Map4(XX, YY) > 0 Then GoTo Run
- If Map.Map5(XX, YY) > 0 Then GoTo Run
- If XX1 < 0 Or XX1 > Map.Width Then GoTo Run
- If YY1 < 0 Or YY1 > Map.Height Then GoTo Run
- If Map.Map3(XX1, YY1) > 0 Then GoTo Run
- ' If Map.Map4(XX1, YY1) > 0 Then GoTo Run
- If Map.Map5(XX1, YY1) > 0 Then GoTo Run
- Map.Map3(Player(MainHeroNum).X, Player(MainHeroNum).Y) = 0
- Player(MainHeroNum).X = XX: Player(MainHeroNum).Y = YY
- Map.Map3(Player(MainHeroNum).X, Player(MainHeroNum).Y) = MainHeroNum
- FrmMain.Client.SendData RUNDATA & KONGDATA & MainHeroNum & KONGDATA & Player(MainHeroNum).X & KONGDATA & Player(MainHeroNum).Y & KONGDATA & Player(MainHeroNum).Face & NETKONGDATA
- NetRunData = True
- Player(MainHeroNum).Act = Run_跑
- Player(MainHeroNum).ActState = Stand_站立
- Player(MainHeroNum).CanAct = False
- Player(MainHeroNum).XOFFECT = 96
- Player(MainHeroNum).YOFFECT = 64
- Player(MainHeroNum).PicSpeed = 0
- Player(MainHeroNum).Pic = 0
- End If
- Exit Sub
- Walk:
- Player(MainHeroNum).Act = Stand_站立
- Player(MainHeroNum).ActState = Stand_站立
- Player(MainHeroNum).XOFFECT = 0
- Player(MainHeroNum).YOFFECT = 0
- Player(MainHeroNum).CanAct = True
- Exit Sub
- Run:
- Player(MainHeroNum).ActState = walk_走
- MovePlayer
- End Sub
- '//////// 获取鼠标对玩家的方向
- Public Function GetMouseFace() As FaceInfo
- Dim AA As Single
- ' If (Mouse.X + WorldX - 388) 48 > Player(MainHeroNum).X Then
- ' If (Mouse.Y + WorldY - 300) 32 < Player(MainHeroNum).Y Then GetMouseFace = RightUpFace
- ' If (Mouse.Y + WorldY - 300) 32 > Player(MainHeroNum).Y Then GetMouseFace = RightDownFace
- ' If (Mouse.Y + WorldY - 300) 32 = Player(MainHeroNum).Y Then GetMouseFace = RightFace
- ' ElseIf (Mouse.X + WorldX - 388) 48 < Player(MainHeroNum).X Then
- ' If (Mouse.Y + WorldY - 300) 32 < Player(MainHeroNum).Y Then GetMouseFace = LeftUpFace
- ' If (Mouse.Y + WorldY - 300) 32 > Player(MainHeroNum).Y Then GetMouseFace = LeftDownFace
- ' If (Mouse.Y + WorldY - 300) 32 = Player(MainHeroNum).Y Then GetMouseFace = Leftface
- ' ElseIf (Mouse.X + WorldX - 388) 48 = Player(MainHeroNum).X Then
- ' If (Mouse.Y + WorldY - 300) 32 < Player(MainHeroNum).Y Then GetMouseFace = UpFace
- ' If (Mouse.Y + WorldY - 300) 32 > Player(MainHeroNum).Y Then GetMouseFace = DownFace
- ' End If
- AA = GetRot(Mouse.X - Player(MainHeroNum).X * 48 + WorldX - 384, Mouse.Y - Player(MainHeroNum).Y * 32 + WorldY - 288)
- If AA < 6.5 And AA > 5.7 Then GetMouseFace = UpFace
- If AA < 5.7 And AA > 5.1 Then GetMouseFace = RightUpFace
- If AA < 5.1 And AA > 4.5 Then GetMouseFace = RightFace
- If AA < 4.5 And AA > 3.8 Then GetMouseFace = RightDownFace
- If AA < 3.8 And AA > 2.8 Then GetMouseFace = DownFace
- If AA < 2.8 And AA > 1.9 Then GetMouseFace = LeftDownFace
- If AA < 1.9 Or AA > 7.5 Then GetMouseFace = Leftface
- If AA < 7.5 And AA > 6.5 Then GetMouseFace = LeftUpFace
- End Function
- '/////// 玩家动作
- Public Sub PlayerAct()
- Dim i As Integer, j As Integer, k As Integer
- For i = 1 To PlayerCount
- Select Case Player(i).Act
- Case HeroActType.Stand_站立
- Player(i).CanAct = True
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed > 5 Then
- Player(i).PicSpeed = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 3 Then Player(i).Pic = 0
- End If
- Case HeroActType.walk_走
- If NetWalkData = True Then
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed > 100 Then NetWalkData = False
- If Player(i).Pic < 3 Then
- If Player(i).PicSpeed = 2 Then
- Player(i).XOFFECT = Player(i).XOFFECT - 48 / 12
- Player(i).YOFFECT = Player(i).YOFFECT - 32 / 12
- If Player(i).XOFFECT <= 0 Then Player(i).XOFFECT = 0
- If Player(i).YOFFECT <= 0 Then Player(i).YOFFECT = 0
- End If
- If Player(i).PicSpeed >= 4 Then
- Player(i).PicSpeed = 0
- Player(i).XOFFECT = Player(i).XOFFECT - 48 / 12
- Player(i).YOFFECT = Player(i).YOFFECT - 32 / 12
- If Player(i).XOFFECT <= 0 Then Player(i).XOFFECT = 0
- If Player(i).YOFFECT <= 0 Then Player(i).YOFFECT = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 5 Then
- Player(i).Pic = 0
- Player(i).ActState = Stand_站立
- Player(i).CanAct = True
- If i <> MainHeroNum Then Player(i).Act = Stand_站立
- End If
- End If
- End If
- Else
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed = 2 Then
- Player(i).XOFFECT = Player(i).XOFFECT - 48 / 12
- Player(i).YOFFECT = Player(i).YOFFECT - 32 / 12
- If Player(i).XOFFECT <= 0 Then Player(i).XOFFECT = 0
- If Player(i).YOFFECT <= 0 Then Player(i).YOFFECT = 0
- ElseIf Player(i).PicSpeed > 4 Then
- Player(i).PicSpeed = 0
- Player(i).XOFFECT = Player(i).XOFFECT - 48 / 12
- Player(i).YOFFECT = Player(i).YOFFECT - 32 / 12
- If Player(i).XOFFECT <= 0 Then Player(i).XOFFECT = 0
- If Player(i).YOFFECT <= 0 Then Player(i).YOFFECT = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 5 Then
- Player(i).Pic = 0
- Player(i).ActState = Stand_站立
- Player(i).CanAct = True
- If i <> MainHeroNum Then Player(i).Act = Stand_站立
- End If
- End If
- End If
- Case HeroActType.Run_跑
- If NetRunData = True Then
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed > 100 Then NetRunData = False
- If Player(i).Pic < 3 Then
- If Player(i).PicSpeed = 2 Then
- Player(i).XOFFECT = Player(i).XOFFECT - 96 / 12
- Player(i).YOFFECT = Player(i).YOFFECT - 64 / 12
- If Player(i).XOFFECT <= 0 Then Player(i).XOFFECT = 0
- If Player(i).YOFFECT <= 0 Then Player(i).YOFFECT = 0
- ElseIf Player(i).PicSpeed >= 4 Then
- Player(i).PicSpeed = 0
- Player(i).XOFFECT = Player(i).XOFFECT - 96 / 12
- Player(i).YOFFECT = Player(i).YOFFECT - 64 / 12
- If Player(i).XOFFECT <= 0 Then Player(i).XOFFECT = 0
- If Player(i).YOFFECT <= 0 Then Player(i).YOFFECT = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 5 Then
- Player(i).Pic = 0
- Player(i).ActState = Stand_站立
- Player(i).CanAct = True
- If i <> MainHeroNum Then Player(i).Act = Stand_站立
- End If
- End If
- End If
- Else
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed = 2 Then
- Player(i).XOFFECT = Player(i).XOFFECT - 96 / 12
- Player(i).YOFFECT = Player(i).YOFFECT - 64 / 12
- If Player(i).XOFFECT <= 0 Then Player(i).XOFFECT = 0
- If Player(i).YOFFECT <= 0 Then Player(i).YOFFECT = 0
- ElseIf Player(i).PicSpeed >= 4 Then
- Player(i).PicSpeed = 0
- Player(i).XOFFECT = Player(i).XOFFECT - 96 / 12
- Player(i).YOFFECT = Player(i).YOFFECT - 64 / 12
- If Player(i).XOFFECT <= 0 Then Player(i).XOFFECT = 0
- If Player(i).YOFFECT <= 0 Then Player(i).YOFFECT = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 5 Then
- Player(i).Pic = 0
- Player(i).ActState = Stand_站立
- Player(i).CanAct = True
- If i <> MainHeroNum Then Player(i).Act = Stand_站立
- End If
- End If
- End If
- Case HeroActType.AttAck_攻击
- If NetAttackData = True Then
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed > 100 Then NetAttackData = False
- If Player(i).Pic < 3 Then
- If Player(i).PicSpeed > 3 Then
- Player(i).PicSpeed = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 5 Then
- Player(i).Pic = 0
- Player(i).Act = Attack_等待
- Player(i).ActState = Attack_等待
- Player(i).CanAct = True
- End If
- End If
- End If
- Else
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed > 3 Then
- Player(i).PicSpeed = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 5 Then
- Player(i).Pic = 0
- Player(i).Act = Attack_等待
- Player(i).ActState = Attack_等待
- Player(i).CanAct = True
- End If
- End If
- End If
- If i = MainHeroNum And Player(i).Pic = 4 And Player(i).PicSpeed = 0 Then
- Dim GongVal As Long
- GongVal = Rnd * Abs(Player(MainHeroNum).DC1 - Player(MainHeroNum).DC2) + IIf(Player(MainHeroNum).DC1 < Player(MainHeroNum).DC2, Player(MainHeroNum).DC1, Player(MainHeroNum).DC2)
- Select Case Player(i).Face
- Case FaceInfo.UpFace
- For k = 1 To PlayerCount
- If Player(k).X = Player(i).X And Player(k).Y = Player(i).Y - 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- For k = 1 To MonCount
- If Mon(k).X = Player(i).X And Mon(k).Y = Player(i).Y - 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- Case FaceInfo.RightUpFace
- For k = 1 To PlayerCount
- If Player(k).X = Player(i).X + 1 And Player(k).Y = Player(i).Y - 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- For k = 1 To MonCount
- If Mon(k).X = Player(i).X + 1 And Mon(k).Y = Player(i).Y - 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- Case FaceInfo.RightFace
- For k = 1 To PlayerCount
- If Player(k).X = Player(i).X + 1 And Player(k).Y = Player(i).Y Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- For k = 1 To MonCount
- If Mon(k).X = Player(i).X + 1 And Mon(k).Y = Player(i).Y Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- Case FaceInfo.RightDownFace
- For k = 1 To PlayerCount
- If Player(k).X = Player(i).X + 1 And Player(k).Y = Player(i).Y + 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- For k = 1 To MonCount
- If Mon(k).X = Player(i).X + 1 And Mon(k).Y = Player(i).Y + 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- Case FaceInfo.DownFace
- For k = 1 To PlayerCount
- If Player(k).X = Player(i).X And Player(k).Y = Player(i).Y + 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- For k = 1 To MonCount
- If Mon(k).X = Player(i).X And Mon(k).Y = Player(i).Y + 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- Case FaceInfo.LeftDownFace
- For k = 1 To PlayerCount
- If Player(k).X = Player(i).X - 1 And Player(k).Y = Player(i).Y + 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- For k = 1 To MonCount
- If Mon(k).X = Player(i).X - 1 And Mon(k).Y = Player(i).Y + 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- Case FaceInfo.Leftface
- For k = 1 To PlayerCount
- If Player(k).X = Player(i).X - 1 And Player(k).Y = Player(i).Y Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- For k = 1 To MonCount
- If Mon(k).X = Player(i).X - 1 And Mon(k).Y = Player(i).Y Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- Case FaceInfo.LeftUpFace
- For k = 1 To PlayerCount
- If Player(k).X = Player(i).X - 1 And Player(k).Y = Player(i).Y - 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData SHANGHAIDATA & KONGDATA & k & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- For k = 1 To MonCount
- If Mon(k).X = Player(i).X - 1 And Mon(k).Y = Player(i).Y - 1 Then
- If k <> MainHeroNum Then
- FrmMain.Client.SendData MONSHANGHAI & KONGDATA & Mon(k).ID & KONGDATA & GongVal & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- End Select
- End If
- Case HeroActType.Attack_等待
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed > 50 Then
- Player(i).PicSpeed = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 0 Then
- Player(i).Pic = 0
- Player(i).Act = Stand_站立
- Player(i).ActState = Stand_站立
- Player(i).CanAct = True
- End If
- End If
- Case HeroActType.Bruise_受伤
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed > 5 Then
- Player(i).PicSpeed = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 2 Then
- Player(i).Pic = 0
- Player(i).Act = Stand_站立
- Player(i).ActState = Stand_站立
- Player(i).CanAct = True
- End If
- End If
- Case HeroActType.Dead_死亡
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed > 3 Then
- Player(i).PicSpeed = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 3 Then
- Player(i).Pic = 3
- Player(i).CanAct = False
- End If
- End If
- Case HeroActType.Magic_魔法
- If NetMagicData = True Then
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed > 100 Then NetMagicData = False
- If Player(i).Pic < 3 Then
- If Player(i).PicSpeed > 3 Then
- Player(i).PicSpeed = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 5 Then
- Player(i).Pic = 0
- Player(i).Act = Attack_等待
- Player(i).ActState = Attack_等待
- Player(i).CanAct = True
- End If
- End If
- End If
- Else
- Player(i).PicSpeed = Player(i).PicSpeed + 1
- If Player(i).PicSpeed > 3 Then
- Player(i).PicSpeed = 0
- Player(i).Pic = Player(i).Pic + 1
- If Player(i).Pic > 5 Then
- Player(i).Pic = 0
- Player(i).Act = Attack_等待
- Player(i).ActState = Attack_等待
- Player(i).CanAct = True
- End If
- End If
- End If
- End Select
- Next
- End Sub
- Public Sub MoveScreen()
- WorldX = Player(MainHeroNum).X * 48
- WorldY = Player(MainHeroNum).Y * 32 + 30
- If Player(MainHeroNum).Act = walk_走 Or Player(MainHeroNum).Act = Run_跑 Then
- Select Case Player(MainHeroNum).Face
- Case FaceInfo.UpFace
- WorldY = WorldY + Player(MainHeroNum).YOFFECT
- Case FaceInfo.RightUpFace
- WorldX = WorldX - Player(MainHeroNum).XOFFECT
- WorldY = WorldY + Player(MainHeroNum).YOFFECT
- Case FaceInfo.RightFace
- WorldX = WorldX - Player(MainHeroNum).XOFFECT
- Case FaceInfo.RightDownFace
- WorldX = WorldX - Player(MainHeroNum).XOFFECT
- WorldY = WorldY - Player(MainHeroNum).YOFFECT
- Case FaceInfo.DownFace
- WorldY = WorldY - Player(MainHeroNum).YOFFECT
- Case FaceInfo.LeftDownFace
- WorldX = WorldX + Player(MainHeroNum).XOFFECT
- WorldY = WorldY - Player(MainHeroNum).YOFFECT
- Case FaceInfo.Leftface
- WorldX = WorldX + Player(MainHeroNum).XOFFECT
- Case FaceInfo.LeftUpFace
- WorldX = WorldX + Player(MainHeroNum).XOFFECT
- WorldY = WorldY + Player(MainHeroNum).YOFFECT
- End Select
- End If
- ' If WorldX < 400 Then WorldX = 400
- ' If WorldX > Map.Width * 48 + 48 - 420 Then WorldX = Map.Width * 48 + 48 - 420
- ' If WorldY < 290 Then WorldY = 290
- ' If WorldY > Map.Height * 32 + 32 - 200 Then WorldY = Map.Height * 32 + 32 - 200
- End Sub
- '/////////////// 玩家排序
- Public Sub PaiXuPlayer()
- Dim i As Integer, N As Integer
- Dim Work As Boolean
- Work = False
- For i = 1 To PlayerCount
- PaiXuPlayerNum(i) = i
- Next
- Do While Work = True
- Work = False
- For i = 1 To PlayerCount
- If i < PlayerCount Then
- If Player(PaiXuPlayerNum(i)).Y > Player(PaiXuPlayerNum(i) + 1).Y Then
- N = PaiXuPlayerNum(i)
- PaiXuPlayerNum(i) = PaiXuPlayerNum(i + 1)
- PaiXuPlayerNum(i + 1) = N
- Work = True
- End If
- End If
- Next
- DoEvents
- Loop
- End Sub