recycle striker strategy from last year code
bad translation, goalie is actually a strikerpull/1/head
parent
0f913d8ad1
commit
304610e2e2
|
@ -7,7 +7,7 @@
|
|||
#define TILT_MULT 1.8
|
||||
#define TILT_DIST 180
|
||||
#define CATCH_DIST 150
|
||||
#define GOALIE_ATKSPD_LAT 255
|
||||
#define GOALIE_ATKSPD_LAT 320 //255
|
||||
#define GOALIE_ATKSPD_BAK 350
|
||||
#define GOALIE_ATKSPD_FRT 345
|
||||
#define GOALIE_ATKSPD_STRK 355
|
||||
|
@ -28,7 +28,7 @@ class Goalie : public Game, public PositionSysZone{
|
|||
private:
|
||||
void realPlay() override;
|
||||
void init() override;
|
||||
void goalie(int);
|
||||
void goalie();
|
||||
void ballBack();
|
||||
void storcimentoPorta();
|
||||
|
||||
|
|
|
@ -22,37 +22,75 @@ void Goalie::init(){
|
|||
}
|
||||
|
||||
void Goalie::realPlay(){
|
||||
if(ball->ballSeen) this->goalie(50);
|
||||
if(ball->ballSeen) this->goalie();
|
||||
else ((PositionSysCamera*)ps)->goCenter();
|
||||
}
|
||||
|
||||
int dir, degrees2;
|
||||
void Goalie::goalie(int plusang) {
|
||||
if(ball->distance < CATCH_DIST) drive->prepareDrive(ball->angle, 350, 0);
|
||||
else{
|
||||
/* if(ball->angle > 345 || ball->angle < 15) plusang *= 0.15;
|
||||
FRONT */
|
||||
if (ball->angle > 345 && ball->angle < 15) plusang *= 0.15;
|
||||
if(ball->angle > 180) degrees2 = ball->angle - 360;
|
||||
else degrees2 = ball->angle;
|
||||
|
||||
if(degrees2 > 0) dir = ball->angle + plusang; //45 con 8 ruote
|
||||
else dir = ball->angle - plusang; //45 con 8 ruote
|
||||
|
||||
if(dir < 0) dir = dir + 360;
|
||||
else dir = dir;
|
||||
|
||||
storcimentoPorta();
|
||||
if(ball->distance > TILT_DIST && (ball->angle > 340 || ball->angle < 20)){
|
||||
plusang -= 20;
|
||||
drive->prepareDrive(dir, 350, cstorc);
|
||||
} else {
|
||||
drive->prepareDrive(dir, 350, 0);
|
||||
cstorc = 0;
|
||||
}
|
||||
void Goalie::goalie() {
|
||||
if(ball->angle>= 350 || ball->angle<= 20) {
|
||||
if(ball->distance > 190) atk_direction = 0;
|
||||
else atk_direction = ball->angle;
|
||||
atk_speed = GOALIE_ATKSPD_FRT;
|
||||
}
|
||||
|
||||
if(ball->angle>= 90 && ball->angle<= 270) {
|
||||
ballBack();
|
||||
atk_speed = GOALIE_ATKSPD_BAK;
|
||||
}
|
||||
|
||||
if(ball->angle> 10 && ball->angle< 30) {
|
||||
atk_direction = ball->angle+ GOALIE_ATKDIR_PLUSANG1;
|
||||
atk_speed = GOALIE_ATKSPD_LAT;
|
||||
}
|
||||
if(ball->angle>= 30 && ball->angle< 45) {
|
||||
atk_direction = ball->angle+ GOALIE_ATKDIR_PLUSANG2;
|
||||
atk_speed = GOALIE_ATKSPD_LAT;
|
||||
}
|
||||
if(ball->angle>= 45 && ball->angle< 90) {
|
||||
atk_direction = ball->angle+ GOALIE_ATKDIR_PLUSANG3;
|
||||
atk_speed = GOALIE_ATKSPD_LAT;
|
||||
}
|
||||
if(ball->angle> 270 && ball->angle<= 315) {
|
||||
atk_direction = ball->angle- GOALIE_ATKDIR_PLUSANG3_COR;
|
||||
atk_speed = GOALIE_ATKSPD_LAT;
|
||||
}
|
||||
if(ball->angle> 315 && ball->angle<= 330) {
|
||||
atk_direction = ball->angle- GOALIE_ATKDIR_PLUSANG2_COR;
|
||||
atk_speed = GOALIE_ATKSPD_LAT;
|
||||
}
|
||||
if(ball->angle> 330 && ball->angle< 350) {
|
||||
atk_direction = ball->angle- GOALIE_ATKDIR_PLUSANG1_COR;
|
||||
atk_speed = GOALIE_ATKSPD_LAT;
|
||||
}
|
||||
|
||||
// if((ball->angle>= 330 || ball->angle<= 30) && ball->distance > 190) { //storcimento
|
||||
// atk_speed = GOALIE_ATKSPD_STRK; //dove i gigahertz hanno fallito
|
||||
// drive->prepareDrive(atk_direction, atk_speed, cstorc);
|
||||
// }
|
||||
// else
|
||||
drive->prepareDrive(atk_direction, 100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Goalie::ballBack() {
|
||||
int ball_degrees2;
|
||||
int dir;
|
||||
|
||||
int plusang;
|
||||
if(ball->distance > 130) plusang = GOALIE_ATKDIR_PLUSANGBAK;
|
||||
else plusang = 0;
|
||||
|
||||
if(ball->angle> 180) ball_degrees2 = ball->angle- 360;
|
||||
else ball_degrees2 = ball->angle;
|
||||
if(ball_degrees2 > 0) dir = ball->angle+ plusang; //45 con 8 ruote
|
||||
else dir = ball->angle- plusang; //45 con 8 ruote
|
||||
if(dir < 0) dir = dir + 360;
|
||||
else dir = dir;
|
||||
atk_direction = dir;
|
||||
}
|
||||
|
||||
|
||||
void Goalie::storcimentoPorta() {
|
||||
if (CURRENT_DATA_READ.angleAtkFix >= 5 && CURRENT_DATA_READ.angleAtkFix <= 60) cstorc+=9;
|
||||
else if (CURRENT_DATA_READ.angleAtkFix <= 355 && CURRENT_DATA_READ.angleAtkFix >= 210) cstorc-=9;
|
||||
|
|
Loading…
Reference in New Issue