Skip to content

Commit

Permalink
干扰敌方开球
Browse files Browse the repository at this point in the history
  • Loading branch information
dinzhen12 committed May 16, 2024
1 parent 88a610a commit cd1a4c6
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
45 changes: 39 additions & 6 deletions Core/HuRocos-2024/play/indirectDefend_New.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ function Tdebug()
end
end
--获取球位置
local ballpos = ball.pos()
KeepDis = 100
local KeepDis = 270



--获取敌人车号
-- local LockdefendNum = function()
Expand All @@ -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

Expand All @@ -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 {

Expand All @@ -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 ()
Expand Down
2 changes: 1 addition & 1 deletion ZBin/lua_scripts/worldmodel/param.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions ZBin/lua_scripts/worldmodel/task.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,6 @@ end
markingTable = {}
markingTableLen = 0


function defender_marking(role,pos)
local enemyDribblingNum = GlobalMessage.Tick().their.dribbling_num
local p
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit cd1a4c6

Please sign in to comment.