Skip to content

Commit

Permalink
update defenderV2
Browse files Browse the repository at this point in the history
  • Loading branch information
Umbrella167 committed May 15, 2024
1 parent eaf4879 commit 3269627
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
35 changes: 17 additions & 18 deletions Core/HuRocos-2024/play/NORMALPLAY.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ local UpdataTickMessage = function (our_goalie_num,defend_num1,defend_num2)
KickerRUNPos = Utils.GetAttackPos(vision, player.num("Kicker"),KickerShootPos,CGeoPoint(-500,2400),CGeoPoint(2200,0),300);
SpecialRUNPos = Utils.GetAttackPos(vision, player.num("Special"),SpecialShootPos,CGeoPoint(-1900,0),CGeoPoint(1000,-2800),300);
end

-- 6000 * 4000

runCount = 0

end
Expand Down Expand Up @@ -185,7 +183,7 @@ local getState = function ()
end
end
-- 如果球权是敌方的 [一抢球、二盯防]
elseif ball_rights == -1 or (ball.pos():x() < param.markingThreshold and ball_rights ~= 1) then
elseif ball_rights == -1 or (ball.pos():x() < param.markingThreshold and ball_rights ~= 1 and ball_rights ~= 0) then
resultState = "defendNormalState"
-- 如果是顶牛状态 [一带球、二跑位]
elseif ball_rights == 2 then
Expand Down Expand Up @@ -225,7 +223,7 @@ firstState = "Init",
if not subScript then
gSubPlay.new("ShootPoint", "Nor_Shoot",{pos = function() return shoot_pos end})
gSubPlay.new("ShowDribbling", "Nor_Dribbling",{pos = function() return shoot_pos end})
gSubPlay.new("Defender", "Nor_Defend")
gSubPlay.new("Defender", "Nor_DefendV2")
gSubPlay.new("Goalie", "Nor_Goalie")
end
return "GetGlobalMessage"
Expand All @@ -250,8 +248,8 @@ firstState = "Init",
Assister = task.getball(function() return shoot_pos end,playerVel,getballMode),
Kicker = task.goCmuRush(function() return KickerRUNPos end,closures_dir_ball("Kicker"),_,DSS_FLAG),
Special = task.goCmuRush(function() return SpecialRUNPos end ,closures_dir_ball("Special"),_,DSS_FLAG),
Tier = gSubPlay.roleTask("Defender", "Tier"),
Defender = gSubPlay.roleTask("Defender", "Defender"),
Tier = gSubPlay.roleTask("Defender", "Breaker"),
Defender = gSubPlay.roleTask("Defender", "Fronter"),
Goalie = gSubPlay.roleTask("Goalie", "Goalie"),
match = "{AKSTDG}"
},
Expand All @@ -271,8 +269,8 @@ firstState = "Init",
Assister = gSubPlay.roleTask("ShootPoint", "Assister"),
Kicker = task.goCmuRush(function() return KickerRUNPos end,closures_dir_ball("Kicker"),_,DSS_FLAG),
Special = task.goCmuRush(function() return SpecialRUNPos end,closures_dir_ball("Special"),_,DSS_FLAG),
Tier = gSubPlay.roleTask("Defender", "Tier"),
Defender = gSubPlay.roleTask("Defender", "Defender"),
Tier = gSubPlay.roleTask("Defender", "Breaker"),
Defender = gSubPlay.roleTask("Defender", "Fronter"),
Goalie = gSubPlay.roleTask("Goalie", "Goalie"),
match = "{AKSTDG}"
},
Expand All @@ -288,8 +286,8 @@ firstState = "Init",
Assister = task.touchKick(function() return shoot_pos end, false, kick.flat),
Kicker = task.goCmuRush(function() return KickerRUNPos end,closures_dir_ball("Kicker"),_,DSS_FLAG),
Special = task.goCmuRush(function() return SpecialRUNPos end,closures_dir_ball("Special"),_,DSS_FLAG),
Tier = gSubPlay.roleTask("Defender", "Tier"),
Defender = gSubPlay.roleTask("Defender", "Defender"),
Tier = gSubPlay.roleTask("Defender", "Breaker"),
Defender = gSubPlay.roleTask("Defender", "Fronter"),
Goalie = gSubPlay.roleTask("Goalie", "Goalie"),
match = "[A][KS]{TDG}"
},
Expand All @@ -313,8 +311,8 @@ firstState = "Init",
Assister = task.getball(function() return shoot_pos end,playerVel,getballMode),
Kicker = task.goCmuRush(function() return KickerRUNPos end,closures_dir_ball("Kicker"),_,DSS_FLAG),
Special = task.goCmuRush(function() return SpecialRUNPos end,closures_dir_ball("Special"),_,DSS_FLAG),
Tier = gSubPlay.roleTask("Defender", "Tier"),
Defender = gSubPlay.roleTask("Defender", "Defender"),
Tier = gSubPlay.roleTask("Defender", "Breaker"),
Defender = gSubPlay.roleTask("Defender", "Fronter"),
Goalie = gSubPlay.roleTask("Goalie", "Goalie"),
match = "[A][KS]{TDG}"

Expand All @@ -336,8 +334,8 @@ firstState = "Init",
Assister = gSubPlay.roleTask("ShowDribbling", "Assister"),
Kicker = task.goCmuRush(function() return KickerRUNPos end,closures_dir_ball("Kicker"),_,DSS_FLAG),
Special = task.goCmuRush(function() return SpecialRUNPos end,closures_dir_ball("Special"),_,DSS_FLAG),
Tier = gSubPlay.roleTask("Defender", "Tier"),
Defender = gSubPlay.roleTask("Defender", "Defender"),
Tier = gSubPlay.roleTask("Defender", "Breaker"),
Defender = gSubPlay.roleTask("Defender", "Fronter"),
Goalie = gSubPlay.roleTask("Goalie", "Goalie"),
match = "{AKSTDG}"
},
Expand All @@ -346,14 +344,15 @@ firstState = "Init",
switch = function()
UpdataTickMessage(our_goalie_num,defend_num1,defend_num2) -- 更新帧信息
local State = getState()
-- getState()
return State
if bufcnt(true,30) then
return State
end
end,
Assister = task.getball(function() return shoot_pos end,playerVel,getballMode),
Kicker = function() return task.defender_marking("Kicker",function() return KickerRUNPos end) end,--task.goCmuRush(function() return KickerRUNPos end,closures_dir_ball("Kicker"),_,DSS_FLAG),--
Special = function() return task.defender_marking("Special",function() return SpecialRUNPos end) end ,--task.goCmuRush(function() return SpecialRUNPos end,closures_dir_ball("Special"),_,DSS_FLAG),--
Tier = gSubPlay.roleTask("Defender", "Tier"),
Defender = gSubPlay.roleTask("Defender", "Defender"),
Tier = gSubPlay.roleTask("Defender", "Breaker"),
Defender = gSubPlay.roleTask("Defender", "Fronter"),
Goalie = gSubPlay.roleTask("Goalie", "Goalie"),
match = "[A][KS]{TDG}"
},
Expand Down
2 changes: 1 addition & 1 deletion Core/HuRocos-2024/play/Nor_Goalie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ return {
if ball.velMod() < 1000 and Utils.InExclusionZone(getBallPos, param.goalieBuf, "our") then
return "goalie_getBall"
end
if rolePos:dist(getBallPos)<param.goalieCatchBuf then
if rolePos:dist(getBallPos)<param.goalieCatchBuf and Utils.InExclusionZone(getBallPos, param.goalieBuf, "our") then
return "goalie_getBall"
end
end,
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 @@ -43,7 +43,7 @@ penaltyMiddleLine = CGeoSegment(ourGoalPos, ourGoalPos + Utils.Polar2Vec
-- 是否为真实场地
isReality = false
Team = "ONE" -- Team = "TWO"
allowTouch = false -- 是否开启touch
allowTouch = true -- 是否开启touch
canTouchAngle = 45 -- 可以touch的角度
dribblingExclusionDist = 135 -- 距离禁区多少距离开启带球
debugSize = 100
Expand Down
7 changes: 5 additions & 2 deletions ZBin/lua_scripts/worldmodel/task.lua
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ function power(p, num,shootFlag)
if not param.isReality then
local SimulationRate = 15
res = res * SimulationRate
if iflag == kick.chip() then
res = 3500
end
end
return res
end
Expand Down Expand Up @@ -721,7 +724,7 @@ function getDefenderCount()
defenderCount = 0
for i=0, param.maxPlayer-1 do
playerName = player.name(i)
if player.valid(i) and (playerName == "Breaker" or playerName == "Fronter") then
if player.valid(i) and (playerName == "Tier" or playerName == "Defender") then
defenderNums[defenderCount] = i
defenderCount = defenderCount + 1
end
Expand Down Expand Up @@ -1118,7 +1121,7 @@ function goalie_kick(role)
local mexe, mpos = GoCmuRush { pos = goaliePoint, dir = idir, acc = a, flag = iflag, rec = r, vel = v }
-- return { mexe, mpos, kick.chip, idir, pre.low, power(param.goalieTargetPos, kp), power(param.goalieTargetPos, kp), 0x00000000 }
-- return { mexe, mpos, param.goalieShootMode, idir, pre.low, power(fungoalieTargetPos(), kp, player.num(role)), power(fungoalieTargetPos(), kp, player.num(role)), 0x00000000 }
return { mexe, mpos, param.goalieShootMode, idir, pre.low, cp.specified(8000), cp.specified(8000), 0x00000000 }
return { mexe, mpos, param.goalieShootMode, idir, pre.low, power(fungoalieTargetPos(),player.num(role),param.goalieShootMode), power(fungoalieTargetPos(),player.num(role),param.goalieShootMode), 0x00000000 }
end


Expand Down

0 comments on commit 3269627

Please sign in to comment.