示例#1
0
bool MoveTurretOrShoot( Tank * pEnemy, Tank & self, World & world, model::Move& move, double offset )
{
	double angle_to_enemy = self.GetTurretAngleTo(*pEnemy);

    if (angle_to_enemy + offset > ( MIN_ANGLE) ) 
	{	
		move.set_turret_turn(1.0);  
    } 
	else if (angle_to_enemy + offset < ( -MIN_ANGLE ) ) 
	{
		move.set_turret_turn(-1.0);
	} 
	else 
	{
		//vector<Tank> t = world.tanks();

		//if ( ! EnemyBlocked(pEnemy, self, t) ) /* decide to shoot here, path may block */
		//{
			/* burst if we almoust alone */

			if ( EnemyIsWalkingDead( pEnemy ) || self.premium_shell_count() > 3 )
			{
				move.set_fire_type(PREMIUM_PREFERRED);
			}
			else
			{
				move.set_fire_type(REGULAR_FIRE);
			}

			return true;
		//}
	}

	return false;
}
示例#2
0
BonusType what_i_need(Tank & me)
{
	if ( ( (double)me.crew_health()/(double)me.crew_max_health() ) < 0.9)
	{
		return MEDIKIT;
	}

	if ( ( (double)me.hull_durability()/(double)me.hull_max_durability() ) < 0.9 )
	{
		return REPAIR_KIT;
	}

	if (!me.premium_shell_count())
	{
		return AMMO_CRATE;
	}

	return UNKNOWN_BONUS;
}