예제 #1
0
int BrigadeClass::CheckTactic (int tid)
	{
	Objective	o;

	if (tid < 1)
		return 0;
	if (haveWeaps < 0)
		{
		FalconEntity	*e;
		GridIndex		x,y,dx,dy;

		e = GetTarget();
		if (Engaged() && !e)
			SetEngaged(0);
		if (GetUnitSupply() > 20)
			haveWeaps = 1;
		else
			haveWeaps = 0;
		GetLocation(&x,&y);
		o = GetUnitObjective();
		ourObjOwner = 0;
		if (o && o->GetTeam() == GetTeam())
			ourObjOwner = 1;
		if (o)
			o->GetLocation(&dx,&dy);
		else
			GetUnitDestination(&dx,&dy);
		ourObjDist = FloatToInt32(Distance(x,y,dx,dy));
		}
	if (!CheckUnitType(tid, GetDomain(), GetType()))
		return 0;
	if (!CheckTeam(tid,GetTeam()))
		return 0;
	if (!CheckEngaged(tid,Engaged()))
		return 0;
	if (!CheckCombat(tid,Combat()))
		return 0;
	if (!CheckLosses(tid,Losses()))
		return 0;
	if (!CheckRetreating(tid,Retreating()))
		return 0;
	if (!CheckAction(tid,GetUnitOrders()))
		return 0;
	if (!CheckOwned(tid,ourObjOwner))
		return 0;
	if (TeamInfo[GetTeam()]->GetGroundAction()->actionType != GACTION_OFFENSIVE && !CheckRole(tid,0))
		return 0;
	if (!CheckRange(tid,ourObjDist))
		return 0;
//	if (!CheckDistToFront(tid,ourFrontDist))
//		return 0;
	if (!CheckStatus(tid,Broken()))
		return 0;
//	if (!CheckOdds(tid,odds))
//		return 0;
	return GetTacticPriority(tid);
	}
예제 #2
0
///////////////////////////////////////////////////////////////
///////////////////   LIEUTENANT LOOP     ////////////////////
/////////////////////////////////////////////////////////////
////////////////////   LOW LEVEL STRATEGY  /////////////////
void Lieutenant::Loop(Movement::Context& MC,Vector<Unit> enemies)
{
	mc = &MC;
	CheckCasualties();
	//Dead lieutenant check
	if (tanks.empty() && marines.empty())
	{
		hasOrder = false;
		goal = vec2(0,0);
		engaged = false;
		requestsAid = false;
		return;
	}
	CheckEngaged();
	CheckObjective();
	CheckFormation();

	//If the lieutenant doesn't have an order
	if (!hasOrder)
	{
		//PullBackWounded(); //has mixed results, recommended testing before implementation
		FireAtWill(enemies);
		//If the lieutenant is in combat
		if (engaged)
		{
				AquireTargets(enemies);
		}
		else
		{
			//If the lieutenant is safe and healthy (maybe after reforming?)
			if (GetHealth() >= HEALTHY_VALUE)
			{
				//Sets the lieutenants aidRequest to false
				SetAid(false);
			}
		}
	}
}