|
BWAPI
|
#include <Squad.h>


Public Member Functions | |
| Squad () | |
| Squad (int mId, int mType, int mMoveType, string mName, int mPriority) | |
| int | getID () |
| void | addRequirement (UnitType type, int no) |
| string | getName () |
| bool | isRequired () |
| void | setRequired (bool mRequired) |
| int | getPriority () |
| void | setPriority (int mPriority) |
| void | setActivePriority (int mPriority) |
| void | addSetup (UnitType type, int no) |
| vector< UnitSetup > | getSetup () |
| virtual bool | isActive () |
| void | forceActive () |
| bool | isFull () |
| int | size () |
| int | getHealthPct () |
| virtual void | computeActions () |
| bool | isGathered () |
| bool | isAttacking () |
| bool | isUnderAttack () |
| bool | needUnit (UnitType type) |
| bool | addMember (BaseAgent *agent) |
| vector< BaseAgent * > | getMembers () |
| void | removeMember (BaseAgent *agent) |
| BaseAgent * | removeMember (UnitType type) |
| virtual void | setGoal (TilePosition mGoal) |
| virtual void | clearGoal () |
| virtual TilePosition | getGoal () |
| virtual bool | hasGoal () |
| bool | isThisGoal (TilePosition mGoal) |
| bool | isCloseTo (TilePosition mGoal) |
| TilePosition | getCenter () |
| BaseAgent * | getCenterAgent () |
| bool | isOffensive () |
| bool | isDefensive () |
| bool | isExplorer () |
| bool | isBunkerDefend () |
| bool | isShuttle () |
| bool | isKite () |
| bool | isRush () |
| bool | isSupport () |
| bool | isGround () |
| bool | isAir () |
| int | getSize () |
| int | getTotalUnits () |
| int | getStrength () |
| void | disband (TilePosition retreatPoint) |
| virtual void | printInfo () |
| void | printFullInfo () |
| bool | canMerge (Squad *squad) |
| bool | hasUnits (UnitType type, int no) |
| bool | contains (UnitType type) |
| TilePosition | getClosestStartLocation (TilePosition pos) |
Static Public Attributes | |
| static const int | OFFENSIVE = 0 |
| static const int | DEFENSIVE = 1 |
| static const int | EXPLORER = 2 |
| static const int | SUPPORT = 3 |
| static const int | BUNKER = 4 |
| static const int | SHUTTLE = 5 |
| static const int | KITE = 6 |
| static const int | RUSH = 7 |
| static const int | CHOKEHARASS = 8 |
| static const int | GROUND = 0 |
| static const int | AIR = 1 |
Protected Member Functions | |
| void | setMemberGoals () |
| void | setMemberState (BaseAgent *agent) |
| Unit * | findTarget () |
| void | checkAttack () |
| bool | isVisible (TilePosition pos) |
| TilePosition | getNextStartLocation () |
Protected Attributes | |
| vector< BaseAgent * > | agents |
| vector< UnitSetup > | setup |
| TilePosition | goal |
| int | id |
| bool | active |
| int | type |
| int | priority |
| int | activePriority |
| int | moveType |
| bool | required |
| string | name |
| int | goalSetFrame |
| vector< TilePosition > | hasVisited |
The Squad class represents a squad of units with a shared goal, for example attacking the enemy or defending the base. The Squad can be built up from different combinations and numbers of UnitTypes.
Author: Johan Hagelback (johan.hagelback@gmail.com)
| Squad::Squad | ( | ) |
Default constructor.
| Squad::Squad | ( | int | mId, |
| int | mType, | ||
| int | mMoveType, | ||
| string | mName, | ||
| int | mPriority | ||
| ) |
Creates a squad with a unique id, a type (Offensive, Defensive, Exploration, Support), a movement type (Ground, Air) and a name (for example AirAttackSquad, MainGroundSquad). Higher priority squads gets filled before lower prio squads. Lower prio value is considered higher priority. A squad with priority of 1000 or more will not be built. This can be used to create one-time squads that are only filled once.
| bool Squad::addMember | ( | BaseAgent * | agent | ) |
Adds an agent to this Squad.


| void Squad::addRequirement | ( | UnitType | type, |
| int | no | ||
| ) |
| void Squad::addSetup | ( | UnitType | type, |
| int | no | ||
| ) |
| bool Squad::canMerge | ( | Squad * | squad | ) |
| void Squad::checkAttack | ( | ) | [protected] |


| void Squad::clearGoal | ( | ) | [virtual] |
Clears the goal for this Squad, i.e. sets the goal to TilePosition(-1,-1).
Reimplemented in ShuttleSquad, KiteSquad, HarassSquad, ChokeHarassSquad, ExplorationSquad, and RushSquad.

| void Squad::computeActions | ( | ) | [virtual] |
Called each update to issue orders.
Reimplemented in ShuttleSquad, KiteSquad, HarassSquad, ChokeHarassSquad, ExplorationSquad, and RushSquad.

| bool Squad::contains | ( | UnitType | type | ) |
Checks if the squad has at least one unit of the specified type.

| void Squad::disband | ( | TilePosition | retreatPoint | ) |
Disbands this Squad and send its remaining members to a retreat point.
| Unit * Squad::findTarget | ( | ) | [protected] |


| void Squad::forceActive | ( | ) |
Forces an offensive squad to be active, even if it's not full.
Returns the center position of this Squad, i.e. the average x and y position of its members.

Returns the unit closest to the center position of the Squad.

Returns the closest start location to the specified position.


| TilePosition Squad::getGoal | ( | ) | [virtual] |
Returns the current goal of this Squad.
Reimplemented in ShuttleSquad, KiteSquad, HarassSquad, ChokeHarassSquad, ExplorationSquad, and RushSquad.

| int Squad::getHealthPct | ( | ) |
| int Squad::getID | ( | ) |
| vector< BaseAgent * > Squad::getMembers | ( | ) |
Returns the members of this Squad.
| string Squad::getName | ( | ) |
| TilePosition Squad::getNextStartLocation | ( | ) | [protected] |


| int Squad::getPriority | ( | ) |
Returns the priority for this Squad. Prio 1 is the highest.

| vector< UnitSetup > Squad::getSetup | ( | ) |
| int Squad::getSize | ( | ) |
Returns the size of the Squad, i.e. the number if agents currently in it.

| int Squad::getStrength | ( | ) |
| int Squad::getTotalUnits | ( | ) |
Returns the total number of units in the squad when it is full.

| bool Squad::hasGoal | ( | ) | [virtual] |
Returns true if this squad has an assigned goal.
Reimplemented in ShuttleSquad, KiteSquad, HarassSquad, ChokeHarassSquad, ExplorationSquad, and RushSquad.

| bool Squad::hasUnits | ( | UnitType | type, |
| int | no | ||
| ) |
Returns true if this Squad has the number of the specified unit types in it.

| bool Squad::isActive | ( | ) | [virtual] |
Returns true if this Squad is active, or false if not. A Squad is active when it first has been filled with agents. A Squad with destroyed units are still considered Active.
Reimplemented in ShuttleSquad, KiteSquad, HarassSquad, ChokeHarassSquad, ExplorationSquad, and RushSquad.

| bool Squad::isAir | ( | ) |
Returns true if this squad travels by air.

| bool Squad::isAttacking | ( | ) |
Checks if the squad is attacking, i.e. if any member of the squad has targets within range.


| bool Squad::isBunkerDefend | ( | ) |
Returns true if this is a Bunker Defense Squad.
| bool Squad::isCloseTo | ( | TilePosition | mGoal | ) |
Returns true if the goal of this squad is close to the specified goal.

| bool Squad::isDefensive | ( | ) |
| bool Squad::isExplorer | ( | ) |
| bool Squad::isFull | ( | ) |
Returns true if this Squad is full, i.e. it has all the units it shall have.


| bool Squad::isGathered | ( | ) |
Returns true if this Squad is gathered, i.e. if 90% of its units are within a certain range of each other.

| bool Squad::isGround | ( | ) |
Returns true if this squad travels by ground.

| bool Squad::isKite | ( | ) |
| bool Squad::isOffensive | ( | ) |
| bool Squad::isRequired | ( | ) |
Checks if this Squad is required to be active before an attack is launched.

| bool Squad::isRush | ( | ) |
| bool Squad::isShuttle | ( | ) |
Returns true if this is a Shuttle Squad.
| bool Squad::isSupport | ( | ) |
Returns true if this is a Support Squad (for example Transports).

| bool Squad::isThisGoal | ( | TilePosition | mGoal | ) |
Returns true if the goal of this squad is the same as the specified goal, false if not.

| bool Squad::isUnderAttack | ( | ) |
Returns true if this Squad is under attack.
| bool Squad::isVisible | ( | TilePosition | pos | ) | [protected] |


| bool Squad::needUnit | ( | UnitType | type | ) |
| void Squad::printFullInfo | ( | ) |
Used to print some info to the screen. Shows printInfo() plus all members of the Squad.


| void Squad::printInfo | ( | ) | [virtual] |
Used to print some info to the screen.
Reimplemented in ShuttleSquad, KiteSquad, HarassSquad, ChokeHarassSquad, ExplorationSquad, and RushSquad.


| void Squad::removeMember | ( | BaseAgent * | agent | ) |
Removes an agent from this Squad.


| BaseAgent * Squad::removeMember | ( | UnitType | type | ) |
Removes an agent of the specified type from this Squad, and returns the reference to the removed agent.

| void Squad::setActivePriority | ( | int | mPriority | ) |
Sets the priority this Squad has once it has been active. Prio 1 is the highest.
| void Squad::setGoal | ( | TilePosition | mGoal | ) | [virtual] |
Sets the goal for this Squad.
Reimplemented in ShuttleSquad, KiteSquad, HarassSquad, ChokeHarassSquad, ExplorationSquad, and RushSquad.


| void Squad::setMemberGoals | ( | ) | [protected] |

| void Squad::setMemberState | ( | BaseAgent * | agent | ) | [protected] |


| void Squad::setPriority | ( | int | mPriority | ) |
Sets the priority for this Squad. Prio 1 is the highest.
| void Squad::setRequired | ( | bool | mRequired | ) |
Sets if this Squad is required or not.
| int Squad::size | ( | ) |
Returns the current size (i.e. number of alive agents in the squad).

bool Squad::active [protected] |
int Squad::activePriority [protected] |
vector<BaseAgent*> Squad::agents [protected] |
const int Squad::AIR = 1 [static] |
Air Squad
const int Squad::BUNKER = 4 [static] |
Bunker Defense Squad
const int Squad::CHOKEHARASS = 8 [static] |
ChokeHarass Squad
const int Squad::DEFENSIVE = 1 [static] |
Defensive Squad
const int Squad::EXPLORER = 2 [static] |
Explorer Squad
TilePosition Squad::goal [protected] |
int Squad::goalSetFrame [protected] |
const int Squad::GROUND = 0 [static] |
Ground Squad
vector<TilePosition> Squad::hasVisited [protected] |
int Squad::id [protected] |
const int Squad::KITE = 6 [static] |
Kite Squad
int Squad::moveType [protected] |
string Squad::name [protected] |
const int Squad::OFFENSIVE = 0 [static] |
Offensive Squad
int Squad::priority [protected] |
bool Squad::required [protected] |
const int Squad::RUSH = 7 [static] |
Rush Squad
vector<UnitSetup> Squad::setup [protected] |
const int Squad::SHUTTLE = 5 [static] |
Shuttle Squad
const int Squad::SUPPORT = 3 [static] |
Support Squad
int Squad::type [protected] |
1.7.6.1