//MonDir = 1
Else
KeyDown 37, 1
//MonDir = -1
EndIf
Return JudgeMoveBallDir
//攻击怪物
Sub AttackMon
If (GameState > 0)
//玩家和怪物背向则调整面象
If MonX > PlayerX and PlayerDir = 0
KeyPress 39, 1
Delay 30
ElseIf MonX < PlayerX and PlayerDir = 1
KeyPress 37, 1
Delay 30
EndIf
//相隔不同层时的延时处理
JumpDelay = 0
If MonFloor - PlayerFloor > 0
KeyDown 32, 1
Delay 200
If MonFloor - PlayerFloor = 2 or MonFloor - PlayerFloor = 3
JumpDelay = 250
ElseIf MonFloor - PlayerFloor = 2.5
JumpDelay = 260
EndIf
Delay JumpDelay
KeyUp 32, 1
EndIf
If GameState = 1
//判断平时是否使用技能 限制在相隔一层的范围内效果比较好
VBSCall FindColorEx( UseSkillMpX, UseSkillMpY, UseSkillMpX, UseSkillMpY, MpColor, 0, 0.9, UseSkillX, UseSkillY)
If MonFloor - PlayerFloor < 1.5 and UseSkillX > 0
KeyPress 83, 1
Else
KeyPress 65, 1
EndIf
Else
KeyPress 83, 1
Delay 150
EndIf
Delay JumpDelay + 200
EndIf
Return AttackMon
//加血
Sub AddHp
IfColor HpX, HpY, HpColor, 1
KeyPress 49, 1
Delay 50
EndIf
Return AddHp
//防止有按键没有弹起
Sub OnScriptExit
KeyUp 32, 1
KeyUp 37, 1
KeyUp 39, 1
Return OnScriptExit