From cd1a4c6628a54c5d0f3ab236bcd598259e573889 Mon Sep 17 00:00:00 2001 From: Rick5 <1770224907@qq.com> Date: Fri, 17 May 2024 02:12:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B2=E6=89=B0=E6=95=8C=E6=96=B9=E5=BC=80?= =?UTF-8?q?=E7=90=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/HuRocos-2024/play/indirectDefend_New.lua | 45 ++++++++++++++++--- ZBin/lua_scripts/worldmodel/param.lua | 2 +- ZBin/lua_scripts/worldmodel/task.lua | 4 +- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/Core/HuRocos-2024/play/indirectDefend_New.lua b/Core/HuRocos-2024/play/indirectDefend_New.lua index 5c61dd6..6a10187 100644 --- a/Core/HuRocos-2024/play/indirectDefend_New.lua +++ b/Core/HuRocos-2024/play/indirectDefend_New.lua @@ -16,8 +16,9 @@ function Tdebug() end end --获取球位置 -local ballpos = ball.pos() -KeepDis = 100 +local KeepDis = 270 + + --获取敌人车号 -- local LockdefendNum = function() @@ -37,7 +38,7 @@ local DenfendPosFront = function (role) -- end ballpos = ball.pos() - local denfendPosfront = enemy.pos(Match[player.num(role)]) + Utils.Polar2Vector(KeepDis, (enemy.pos(Match[player.num(role)]) - ballpos):dir() + math.pi / 3) + local denfendPosfront = enemy.pos(Match[player.num(role)]) + Utils.Polar2Vector(KeepDis, (enemy.pos(Match[player.num(role)]) - ballpos):dir() + math.pi *2/3) return denfendPosfront end @@ -48,10 +49,11 @@ local DenfendPosCenter = function (role) -- end ballpos = ball.pos() - local denfendPoscenter = enemy.pos(Match[player.num(role)]) + Utils.Polar2Vector(KeepDis, (enemy.pos(Match[player.num(role)]) - ballpos):dir() + math.pi / 3) + local denfendPoscenter = enemy.pos(Match[player.num(role)]) + Utils.Polar2Vector(KeepDis, (enemy.pos(Match[player.num(role)]) - ballpos):dir() + math.pi *2/3) return denfendPoscenter -end +end +local DenfendPos = CGeoPoint(0,0) ------------------------------------------------------------------------------------------------- return { @@ -60,7 +62,38 @@ return { end, -firstState = "Init", +firstState = "Init1111", + + + +["Init1111"] = { + switch = function () + + local ballpos = ball.pos() + local StartEnemyPos = enemy.pos(enemy.closestBall()) + DenfendPos = ballpos + Utils.Polar2Vector(KeepDis,(ball.pos() - StartEnemyPos ):dir()) + debugEngine:gui_debug_msg(CGeoPoint(0,0),DenfendPos:x(),4) + debugEngine:gui_debug_msg(CGeoPoint(0,150),DenfendPos:y(),4) + + if ball.velMod() > 500 then + return "exit" + end + end, + + Assister =task.goCmuRush( function()return DenfendPos end ,0,a,0), + Kicker = function() return task.defender_marking("Kicker",CGeoPoint(param.INF,param.INF)) end, + Special = function() return task.defender_marking("Special",CGeoPoint(param.INF,param.INF)) end, + + -- Assister = task.stop(), + -- Kicker = task.stop(), + -- Special = task.stop(), + + match = "[AKS]" +}, + + + + ["Init"] = { switch = function () diff --git a/ZBin/lua_scripts/worldmodel/param.lua b/ZBin/lua_scripts/worldmodel/param.lua index e5bbd74..e35bc76 100644 --- a/ZBin/lua_scripts/worldmodel/param.lua +++ b/ZBin/lua_scripts/worldmodel/param.lua @@ -112,7 +112,7 @@ markingPosRate2 = 1 / 10 -- defend参数 --| -----------------------------------------------| -- defender 模式, 0-盯球,1-盯人 -defenderMode = 0 +defenderMode = 1 defenderShootMode = function() return 1 end -- 1 flat 2 chip defenderBuf = playerRadius * 1.5 diff --git a/ZBin/lua_scripts/worldmodel/task.lua b/ZBin/lua_scripts/worldmodel/task.lua index a5176cf..c5f1336 100644 --- a/ZBin/lua_scripts/worldmodel/task.lua +++ b/ZBin/lua_scripts/worldmodel/task.lua @@ -1370,7 +1370,6 @@ end markingTable = {} markingTableLen = 0 - function defender_marking(role,pos) local enemyDribblingNum = GlobalMessage.Tick().their.dribbling_num local p @@ -1395,7 +1394,7 @@ function defender_marking(role,pos) end -- end -- 如果 敌人在前场 ,我方正常跑位 - if markingTableLen == 0 or (markingTableLen == 1 and role == "Special" ) then + if markingTableLen == 0 or (markingTableLen == 1 and role == "Special" ) and pos:x() ~= param.INF then local mexe, mpos = GoCmuRush { pos = p, dir = idir, acc = a, flag = flag.allow_dss + flag.dodge_ball, rec = r, vel = v } return { mexe, mpos } else @@ -1417,7 +1416,6 @@ function defender_marking(role,pos) if(not Utils.InField(markingPos)) then markingPos = CGeoPoint (player.posX(role),player.posY(role)) end - local mexe, mpos = GoCmuRush { pos = markingPos, dir = idir, acc = a, flag = flag.allow_dss, rec = r, vel = v } return { mexe, mpos } end