MCPcopy Create free account
hub / github.com/LARG/HFO / execute

Method execute

src/bhv_basic_move.cpp:58–125  ·  view source on GitHub ↗

-------------------------------------------------------------------*/ ! */

Source from the content-addressed store, hash-verified

56
57 */
58bool
59Bhv_BasicMove::execute( PlayerAgent * agent )
60{
61 dlog.addText( Logger::TEAM,
62 __FILE__": Bhv_BasicMove" );
63
64 //-----------------------------------------------
65 // tackle
66 if ( Bhv_BasicTackle( 0.8, 80.0 ).execute( agent ) )
67 {
68 return true;
69 }
70
71 const WorldModel & wm = agent->world();
72 /*--------------------------------------------------------*/
73 // chase ball
74 const int self_min = wm.interceptTable()->selfReachCycle();
75 const int mate_min = wm.interceptTable()->teammateReachCycle();
76 const int opp_min = wm.interceptTable()->opponentReachCycle();
77
78 if ( ! wm.existKickableTeammate()
79 && ( self_min <= 3
80 || ( self_min <= mate_min
81 && self_min < opp_min + 3 )
82 )
83 )
84 {
85 dlog.addText( Logger::TEAM,
86 __FILE__": intercept" );
87 Body_Intercept().execute( agent );
88 agent->setNeckAction( new Neck_OffensiveInterceptNeck() );
89
90 return true;
91 }
92
93 const Vector2D target_point = Strategy::i().getPosition( wm.self().unum() );
94 const double dash_power = Strategy::get_normal_dash_power( wm );
95
96 double dist_thr = wm.ball().distFromSelf() * 0.1;
97 if ( dist_thr < 1.0 ) dist_thr = 1.0;
98
99 dlog.addText( Logger::TEAM,
100 __FILE__": Bhv_BasicMove target=(%.1f %.1f) dist_thr=%.2f",
101 target_point.x, target_point.y,
102 dist_thr );
103
104 agent->debugClient().addMessage( "BasicMove%.0f", dash_power );
105 agent->debugClient().setTarget( target_point );
106 agent->debugClient().addCircle( target_point, dist_thr );
107
108 if ( ! Body_GoToPoint( target_point, dist_thr, dash_power
109 ).execute( agent ) )
110 {
111 Body_TurnToBall().execute( agent );
112 }
113
114 if ( wm.existKickableOpponent()
115 && wm.ball().distFromSelf() < 18.0 )

Callers

nothing calls this directly

Calls 2

Bhv_BasicTackleClass · 0.85
getPositionMethod · 0.80

Tested by

no test coverage detected