2011年3月27日星期日

macro 巨集 之 不用flywing來迴避怪物腳本

automacro avoidmon0 {
aggressives > 3
#這裡我放 3 等於 迴避 2只或以上,如果你要迴避 4只請放 5 ...如吃類推
timeout 0.5
overrideAI 1
exclusive 1
run-once 1
call check
}

macro check {
[
$map = $.map
$mon = $.lastMonster
$monID = $.lastMonsterID
$monpos = $.lastMonsterPos
$dist = $.lastMonsterDist
$mypos = $.pos
$myx = @arg ("$mypos", 1)
$myy = @arg ("$mypos", 2)
$monx = @arg ("$monpos", 1)
$mony = @arg ("$monpos", 2)
$sign = @random ("+", "-")
do eval message T("Macro Avoid: $::Macro::Data::varStack{mon} \($::Macro::Data::varStack{monID}\)\n"), "teleport"; message T("魔物距離\= $::Macro::Data::varStack{dist} \, 魔物座標\: \($::Macro::Data::varStack{monx},$::Macro::Data::varStack{mony}\) 地圖名\= $::Macro::Data::varStack{map}\n"), "teleport";
# do eval warning "[怪物迴避] $.lastMonster at ($monx,$mony) 在附近, 迴避中...\n";
do as
if ($monx <= $myx) goto east
if ($monx >= $myx) goto west
]

:east
[
if ($mony >= $myy) goto southeast
if ($mony <= $myy) goto northeast
]
[
$direction = 東→→→→→
$x = @eval ($myx + 50)
$y = $myy
]
goto greatEscape
:southeast
[
$direction = 東南↘↘↘↘↘
$x = @eval ($myx + 50)
$y = @eval ($myy - 50)
]
goto greatEscape

:northeast
[
$direction = 東北↗↗↗↗↗
$x = @eval ($myx + 50)
$y = @eval ($myy + 50)
]
goto greatEscape
stop

:west
[
if ($mony >= $myy) goto southwest
if ($mony <= $myy) goto northwest
]
[
$direction = 西←←←←←
$x = @eval ($myx - 50)
$y = $myy
]
do goto greatEscape
stop

:southwest
[
$direction = 西南↙↙↙↙↙
$x = @eval ($myx - 50)
$y = @eval ($myy - 50)
]
goto greatEscape
stop
:northwest
[
$direction = 西北↖↖↖↖↖
$x = @eval ($myx - 50)
$y = @eval ($myy + 50)
]
goto greatEscape
stop

:greatEscape
do move $x $y
do eval warning "[怪物迴避] 從 ($myx, $myy) 移往 $direction ($x, $y) 閃避 $.lastMonster ($monx, $mony)\n";
[
$mypos1 = $.pos
$myx1 = @arg ("$mypos1", 1)
$myy2 = @arg ("$mypos1", 2)
]
if ($myx1 != $x) goto sign
if ($myy2 != $y) goto sign
do a yes
release all
stop
:sign
[
$direction = 隨機
$x1 = @eval ($myx $sign 50)
$y2 = @eval ($myy $sign 50)
]
do move $x1 $y2
do eval warning "[怪物迴避] 從 ($myx1, $myy2) 移往 $direction ($x1, $y2) 閃避 $.lastMonster ($monx, $mony)\n";
do a yes
release all
stop
}

没有评论:

发表评论