📄 tackle.cpp
字号:
/* |No|Copyright (C) 2005 Ferdowsi University*/#include "tackle.h"#include "global.h"bool Tackle::IsTackleNeeded() { float TRadious = 0.5;// Treatening Radious if (TheirPlayer[FieldInfo.NearestOpponent2(ball.pos)].dist2ball < TRadious) return false; return true;}bool Tackle::TryTackle(){ float RiskRadious = 0.7; float agentAngle = NormalizeAngle(Rad2Deg(atan2((ball.pos[1]-self.pos[1]),(ball.pos[0]-self.pos[0]))),-180.0); if(ball.pos[0] < -30 || self.dist2ball > RiskRadious || self.dist2ball > MyPlayer[FieldInfo.NearestTeammate2(ball.pos)].dist2ball || !IsTackleNeeded() || agentAngle > 75 || agentAngle < -75) return false; action_info.x = ball.pos[0] ; action_info.y = ball.pos[1] ; action_info.do_drive = true ; action_info.kick_angle = 45; action_info.kick_direction = agentAngle; action_info.kick_power = 100; action_info.do_kick = true; return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -