diff --git a/Core/HuRocos-2024/play/NORMALPLAY.lua b/Core/HuRocos-2024/play/NORMALPLAY.lua index 7bbf00a..e1a0bfd 100644 --- a/Core/HuRocos-2024/play/NORMALPLAY.lua +++ b/Core/HuRocos-2024/play/NORMALPLAY.lua @@ -288,13 +288,9 @@ firstState = "Init", switch = function() UpdataTickMessage(our_goalie_num,defend_num1,defend_num2) -- 更新帧信息 local State = getState() - if param.shootPos:x() == param.pitchLength / 2 then - shoot_kp = 10000 - else - shoot_kp = param.shootKp - end - - return State + if(GlobalMessage.Tick().ball.rights == -1 or not player.canTouch(player.pos("Assister"),shoot_pos,param.canTouchAngle)) then + return State + end end, Assister = task.touchKick(function() return shoot_pos end, false, function() return shoot_kp end, kick.flat), Kicker = task.goCmuRush(function() return KickerRUNPos end,closures_dir_ball("Kicker"),_,DSS_FLAG), @@ -302,7 +298,7 @@ firstState = "Init", Tier = gSubPlay.roleTask("Defender", "Tier"), Defender = gSubPlay.roleTask("Defender", "Defender"), Goalie = gSubPlay.roleTask("Goalie", "Goalie"), - match = "{AKSTDG}" + match = "[AKS]{TDG}" }, -- 接球 ["Getball"] = { @@ -313,13 +309,13 @@ firstState = "Init", if State ~= "Getball" then return State end - -- local AssisterPos = CGeoPoint(player.posX("Assister"),player.posY("Assister")) - -- local ballLine = CGeoSegment(ball.pos(),ball.pos() + Utils.Polar2Vector(9999,ball.velDir())) - -- local playerPrjPos = ballLine:projection(player.pos("Assister")) - -- local onBallLine = ballLine:IsPointOnLineOnSegment(playerPrjPos) - -- if Utils.isValidPass(vision,AssisterPos,shoot_pos,param.enemy_buffer) and player.canTouch(AssisterPos,shoot_pos,param.canTouchAngle) and Utils.isValidPass(vision,AssisterPos,CGeoPoint(ball.posX(),ball.posY()),param.enemy_buffer) and ball.velMod() > 500 and onBallLine then - -- return "Touch" - -- end + local AssisterPos = CGeoPoint(player.posX("Assister"),player.posY("Assister")) + local ballLine = CGeoSegment(ball.pos(),ball.pos() + Utils.Polar2Vector(9999,ball.velDir())) + local playerPrjPos = ballLine:projection(player.pos("Assister")) + local onBallLine = ballLine:IsPointOnLineOnSegment(playerPrjPos) + if Utils.isValidPass(vision,AssisterPos,shoot_pos,param.enemy_buffer) and player.canTouch(AssisterPos,shoot_pos,param.canTouchAngle) and Utils.isValidPass(vision,AssisterPos,CGeoPoint(ball.posX(),ball.posY()),param.enemy_buffer)then + return "Touch" + end end, Assister = task.getball(function() return shoot_pos end,playerVel,getballMode), Kicker = task.goCmuRush(function() return KickerRUNPos end,closures_dir_ball("Kicker"),_,DSS_FLAG), diff --git a/Core/tactics/skill/Getball.lua b/Core/tactics/skill/Getball.lua index caea9da..bc2e776 100644 --- a/Core/tactics/skill/Getball.lua +++ b/Core/tactics/skill/Getball.lua @@ -16,11 +16,11 @@ function Getball(task) local qflag = inter_flag or 0 local playerPos = CGeoPoint:new_local(player.pos(runner):x(),player.pos(runner):y()) local inter_pos = Utils.GetBestInterPos(vision,playerPos,param.playerVel,minter_flag,0,param.V_DECAY_RATE,param.distRate) - debugEngine:gui_debug_msg(CGeoPoint(0,0),minter_flag) - local ballLine = CGeoSegment(ball.pos(),ball.pos() + Utils.Polar2Vector(-param.INF,ball.velDir())) - local playerPrj = ballLine:projection(player.pos(runner)) - local canGetBall = ballLine:IsPointOnLineOnSegment(playerPrj) - local toballdist = player.toBallDist(runner) + -- debugEngine:gui_debug_msg(CGeoPoint(0,0),minter_flag) + -- local ballLine = CGeoSegment(ball.pos(),ball.pos() + Utils.Polar2Vector(-param.INF,ball.velDir())) + -- local playerPrj = ballLine:projection(player.pos(runner)) + -- local canGetBall = ballLine:IsPointOnLineOnSegment(playerPrj) + -- local toballdist = player.toBallDist(runner) -- -- 敌方球权的情况 -- if GlobalMessage.Tick().ball.rights == -1 or GlobalMessage.Tick().ball.rights == 2 then @@ -145,11 +145,11 @@ function Getball(task) debugError = debugError .. " INF " end -- 解决敌人过近的问题 - if GlobalMessage.Tick().ball.rights == -1 or GlobalMessage.Tick().ball.rights == 2 then + -- if GlobalMessage.Tick().ball.rights == -1 or GlobalMessage.Tick().ball.rights == 2 then local minEnemyDistNum = {} for i = 0 ,param.maxPlayer -1 do if enemy.valid(i) then - if enemy.pos(i):dist(ball.pos()) < 300 then + if enemy.pos(i):dist(ball.pos()) < 200 then table.insert(minEnemyDistNum,i) end end @@ -158,12 +158,12 @@ function Getball(task) local toballDir = (ball.pos() - enemy.pos(GlobalMessage.Tick().their.dribbling_num)):dir() local playerDir = player.dir(runner) local Subdir =Utils.angleDiff(toballDir,playerDir) * 180/math.pi - local dist_ = param.playerFrontToCenter + 150 + local dist_ = param.playerFrontToCenter + 100 local theirDribblingPlayerPos = enemy.pos(GlobalMessage.Tick().their.dribbling_num) - inter_pos = ball.pos() + Utils.Polar2Vector(dist_,(player.pos(runner) - theirDribblingPlayerPos):dir()) + inter_pos = ball.pos() + Utils.Polar2Vector(dist_,(ball.pos() - theirDribblingPlayerPos):dir()) debugError = debugError .. Subdir .."Enemy " end - end + -- end endVel = Utils.Polar2Vector(endVelMod,idir) param.lastInterPos = inter_pos diff --git a/Core/tactics/skill/Touch.lua b/Core/tactics/skill/Touch.lua index e4b1704..872fd56 100644 --- a/Core/tactics/skill/Touch.lua +++ b/Core/tactics/skill/Touch.lua @@ -1,10 +1,10 @@ function Touch(task) local mpos local useInter = task.useInter or false - matchPos = function() - return ball.pos() + matchPos = function(runner) + local inter_pos = Utils.GetBestInterPos(vision,player.pos(runner),param.playerVel,param.getballMode,0,param.V_DECAY_RATE,param.distRate) + return _c(inter_pos) end - execute = function(runner) mpos = _c(task.pos,runner) task_param = TaskT:new_local() diff --git a/ZBin/lua_scripts/RoleMatch.lua b/ZBin/lua_scripts/RoleMatch.lua index 655910c..99fc4ea 100644 --- a/ZBin/lua_scripts/RoleMatch.lua +++ b/ZBin/lua_scripts/RoleMatch.lua @@ -49,8 +49,7 @@ gRolePos = { } -gRolePriority = { "Goalie","Defender","Tier"} - +gRolePriority = { "Goalie","Defender","Tier","Leader"} gOurExistNum = {} --为了使车号统一从0开始,强行给gOurExistNum[0]赋值,但table自身接口全都无法使用了 diff --git a/ZBin/lua_scripts/worldmodel/param.lua b/ZBin/lua_scripts/worldmodel/param.lua index 153ee11..22c0354 100644 --- a/ZBin/lua_scripts/worldmodel/param.lua +++ b/ZBin/lua_scripts/worldmodel/param.lua @@ -40,13 +40,13 @@ ourButtomGoalPos = CGeoPoint:new_local(-pitchLength / 2, -goalRadius) -- 是否为真实场地 -isReality = true +isReality = false Team = "ONE" -- Team = "TWO" -----------------------------------------------| -- Getball参数 --| -----------------------------------------------| -playerVel = 2.5 -- 机器人速度 +playerVel = 1.5 -- 机器人速度 getballMode = 1 -- [0[激进模式], 1[保守模式], 2[middle]] -- local V_DECAY_RATE_Reality = 700 -- 场地摩擦 local V_DECAY_RATE_Reality = 800 -- 场地摩擦 diff --git a/ZBin/lua_scripts/worldmodel/player.lua b/ZBin/lua_scripts/worldmodel/player.lua index 9119399..a4243fe 100644 --- a/ZBin/lua_scripts/worldmodel/player.lua +++ b/ZBin/lua_scripts/worldmodel/player.lua @@ -80,7 +80,8 @@ end function pos(role) - return instance(role):Pos() + local p = instance(role):Pos() + return CGeoPoint(p:x(),p:y()) end function posX(role) diff --git a/ZBin/lua_scripts/worldmodel/task.lua b/ZBin/lua_scripts/worldmodel/task.lua index a864ab5..bbe8b30 100644 --- a/ZBin/lua_scripts/worldmodel/task.lua +++ b/ZBin/lua_scripts/worldmodel/task.lua @@ -148,11 +148,11 @@ end function getball(shootPos_,playerVel, inter_flag, permissions) return function() -- 解决敌人过近的问题 - if GlobalMessage.Tick().ball.rights == -1 or GlobalMessage.Tick().ball.rights == 2 then + -- if GlobalMessage.Tick().ball.rights == -1 or GlobalMessage.Tick().ball.rights == 2 then local minEnemyDistNum1 = {} for i = 0 ,param.maxPlayer -1 do if enemy.valid(i) then - if enemy.pos(i):dist(ball.pos()) < 300 then + if enemy.pos(i):dist(ball.pos()) < 200 then table.insert(minEnemyDistNum1,i) end if #minEnemyDistNum1 == 2 then @@ -167,14 +167,16 @@ function getball(shootPos_,playerVel, inter_flag, permissions) local Subdir = Utils.angleDiff(toballDir,playerDir) * 180/math.pi local dist_ = param.playerFrontToCenter - 10 local theirDribblingPlayerPos = enemy.pos(GlobalMessage.Tick().their.dribbling_num) + if math.abs(Subdir) > 165 then - local inter_pos = ball.pos() + Utils.Polar2Vector(dist_,(ball.pos() - theirDribblingPlayerPos):dir()) - local idir = 0 + local inter_pos = ball.pos() + Utils.Polar2Vector(dist_,(theirDribblingPlayerPos - ball.pos()):dir()) + local idir = (theirDribblingPlayerPos - ball.pos()):dir() + local iflag = flag.dribbling local mexe, mpos = SimpleGoto { pos = inter_pos, dir = idir, flag = iflag } return { mexe, mpos } end end - end + -- end