1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
-- 15.01.14 - ngc92: Use blobby volley api provided constants when possible
-- 11.04.15 - ngc92: updated math helpers
function OnOpponentServe()
moveto(120)
end
-- Flags und runners
wait = 0
aggro = true -- evtl Variablennamen wechseln
aggroservice = 50 -- versetzung zum Ball je gr�sser desto tiefer fliegt der Service 0-64( 64 ist ca CONST_BALLRADIUS + CONST_BLOBBY_BAUCH_RADIUS)
-- Konstanten
function OnServe(ballready)
moveto(ballx())
wait = wait + 1
aggro = true
if ballready then
if wait > 90 then
jump()
wait = 0
end
end
end
function OnGame()
aggro = aggroflagtesten() -- schaut ob der bot aggro werden soll oder nicht
local timetoblobhead = ball_time_to_y(CONST_BALL_BLOBBY_HEAD)
local target, hit = estimx(timetoblobhead)
if aggro then
sprungattacke(aggroservice)
return
end
-- Zielbestimmung --> optimierung weniger CPU power n�tig ;)
if (hit == CONST_BALL_LEFT_BORDER) then -- ball wird hinten apprallen
vonhinten(target)
return
end
-- nun k�mmern wir uns um die B�lle die ans netz prallen
if hit == CONST_BALL_LEFT_NET then
netzappraller(target)
end
-- it crosses the net - we are save
if target > CONST_BALL_RIGHT_NET then
target = 220
end
if (bspeedx() < 10 ) then
moveto(target - 20)
else
moveto(target)
end
end
function netzappraller(p_target)
--moveto(netzlinks - (netzlinks - estimate()))
moveto(p_target + bspeedx()*bspeedx()*1.4)
end
function vonhinten(p_target)
--das ist der fall wenn der Ball hinten abprallt
moveto(p_target - bspeedx()*2)
end
function sprungattacke(p_aggroservice)
moveto(ballx()-p_aggroservice)
if bally() < 580 then
jump()
end
end
function aggroflagtesten()
if (ballx() > CONST_FIELD_MIDDLE) then
return false
end
if (touches() == 2) then
return true
end
if (ballx() < (CONST_FIELD_MIDDLE - CONST_BALL_RADIUS)) and (bally() < 210) then -- der ball k�nnte nohc dr�ber fliegen ** noch optimieren
return true
end
-- leave unchanged
return aggro
end
|