Пример #1
0
Unit* GhostAgent::findLockdownTarget()
{
    int fCnt = friendlyUnitsWithinRange(224);
    if (fCnt < 2)
    {
        //If we dont have any attacking units nearby,
        //dont bother with lockdown.
        return NULL;
    }

    int maxRange = getGroundRange();

    Unit* target = NULL;
    int cTargetVal = 0;

    for(set<Unit*>::const_iterator i=Broodwar->enemy()->getUnits().begin(); i!=Broodwar->enemy()->getUnits().end(); i++)
    {
        if ((*i)->getType().isMechanical() && !(*i)->getLockdownTimer() == 0 && !(*i)->getType().isBuilding())
        {
            int targetVal = (*i)->getType().destroyScore();
            if (targetVal >= 200 && targetVal > cTargetVal)
            {
                target = (*i);
                cTargetVal = targetVal;
            }
        }
    }

    return target;
}
Пример #2
0
void ArbiterAgent::computeActions() {
	int cFrame = Broodwar->getFrameCount();
	if (cFrame - lastFrame < 20) {
		return;
	}
	lastFrame = cFrame;

	bool defensive = false;
	int eCnt = this->enemyAttackingUnitsWithinRange();
	if (eCnt > 0) {
		int fCnt = friendlyUnitsWithinRange();
		if (fCnt < 5) {
			defensive = true;
		}
	}
	
	//TODO: Add unitspecific code here

	PFManager::getInstance()->computeAttackingUnitActions(this, goal, defensive);
}
Пример #3
0
int UnitAgent::friendlyUnitsWithinRange()
{
	return friendlyUnitsWithinRange(192);
}