interception.h

来自「2002年」· C头文件 代码 · 共 68 行

H
68
字号
#ifndef __INTERCEPTION_H__
#define __INTERCEPTION_H__

#include "bpn.h"
#include "types.h"
#include "command.h"
#include "goingthroughspeed.h"
#include "intercept_util.h"

const int IT_simulate_cycles = 20;
const float IT_smartstay_angle = -360.0f;
class Player;

class Interception : public Intercept_util{	
private:
	bool Is_smartit_needed;
	void Do_Intercept(InterceptionInfo& IT_info);
	bool smart_intercept(int bestcycle, InterceptionInfo& inf);

	InterceptionInfo self_closest_it_info;
	InterceptionInfo self_smart_it_info;
	int best_IT_cycle;

	Vector ball_pos[IT_simulate_cycles+1], ball_vel[IT_simulate_cycles+1];
	Vector player_pos[3], player_vel[3];
	float ball_speed[IT_simulate_cycles+1];
	Ray ballcourse, playercourse;
	float ballangle, dist_2_bounder, max_ballmove;
	float bodyfacing;

	void prepare_intercept_info(const Vector& ballpos, const Vector& ballvel, const Vector& startpoint, const Vector& selfvel, float bdfacing);
	bool Is_smart_intercept(Vector* it_infs, unsigned char it_state);
public:
	Interception();	
/********************	BPN	**********************/
	BPN ControlBallNet;

/*****    interception info of others ******************/
	float my_min_cycles, their_min_cycles, self_cycles;
	void SetInterceptionInfo(bool reset);

	/*  sorted by control of the ball   */
	UNum MyPlayers_Interception[2 * SP_team_size];
	UNum TheirPlayers_Interception[2 * SP_team_size];
	Player& MyPlayer_CtrlOfBall(int idx);
	Player& TheirPlayer_CtrlOfBall(int idx);

	float calculatecontrol(float my_cycles, float their_cycles);
	float calculatecontrol(InterceptionInfo& myinf, InterceptionInfo& theirinf, bool is_teammate = false);

	bool WouldIntercept(char side, UNum No);
	bool Is_IT_Priored(UNum player1, UNum player2);

/******************	getinterceptioninfo	************************/
	void SetITPlayer(Player* p);
	void SetSelfIT();
	void smart_self_intercept(const Vector& ballpos, const Vector& ballvel, const Vector& startpoint, const Vector& selfvel, float bodyfacing, InterceptionInfo& inf);
	inline void setsmartit(bool v){Is_smartit_needed = v;}
	
	IT_mode intercept(InterceptionInfo& inf, Command& command);
	IT_mode intercept(InterceptionInfo& inf);
	
/**********	Strategy	***********************/
	bool SmartInterception();
};

#endif //__INTERCEPTION_H__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?