BWAPI  4.1.2
An API for interacting with Starcraft: Broodwar (1.16.1)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules
Public Member Functions | List of all members
BWAPI::WeaponType Class Reference
Inheritance diagram for BWAPI::WeaponType:
Inheritance graph

Public Member Functions

 WeaponType (int id=WeaponTypes::Enum::None)
 
int damageAmount () const
 
int damageBonus () const
 
int damageCooldown () const
 
int damageFactor () const
 
DamageType damageType () const
 
ExplosionType explosionType () const
 
TechType getTech () const
 
int innerSplashRadius () const
 
int maxRange () const
 
int medianSplashRadius () const
 
int minRange () const
 
int outerSplashRadius () const
 
bool targetsAir () const
 
bool targetsGround () const
 
bool targetsMechanical () const
 
bool targetsNonBuilding () const
 
bool targetsNonRobotic () const
 
bool targetsOrganic () const
 
bool targetsOrgOrMech () const
 
bool targetsOwn () const
 
bool targetsTerrain () const
 
UpgradeType upgradeType () const
 
UnitType whatUses () const
 

Detailed Description

This object identifies a weapon type used by a unit to attack and deal damage.

Some weapon types can be upgraded while others are used for special abilities.

See also
WeaponTypes

Constructor & Destructor Documentation

BWAPI::WeaponType::WeaponType ( int  id = WeaponTypes::Enum::None)

Expected type constructor.

If the type is an invalid type, then it becomes Types::Unknown. A type is invalid if its value is less than 0 or greater than Types::Unknown.

Parameters
idThe id that corresponds to this type. It is typically an integer value that corresponds to an internal Broodwar type. If the given id is invalid, then it becomes Types::Unknown.

Member Function Documentation

TechType BWAPI::WeaponType::getTech ( ) const

Retrieves the technology type that must be researched before this weapon can be used.

Returns
TechType required by this weapon.
Return values
TechTypes::Noneif no tech type is required to use this weapon.
See also
TechType::getWeapon
UnitType BWAPI::WeaponType::whatUses ( ) const

Retrieves the unit type that is intended to use this weapon type.

Note
There is a rare case where some hero unit types use the same weapon.
Returns
The UnitType that uses this weapon.
See also
UnitType::groundWeapon, UnitType::airWeapon
int BWAPI::WeaponType::damageAmount ( ) const

Retrieves the base amount of damage that this weapon can deal per attack.

Note
That this damage amount must go through a DamageType and UnitSizeType filter before it is applied to a unit.
Returns
Amount of base damage that this weapon deals.
int BWAPI::WeaponType::damageBonus ( ) const

Determines the bonus amount of damage that this weapon type increases by for every upgrade to this type.

See also
upgradeType
Returns
Amount of damage added for every weapon upgrade.
int BWAPI::WeaponType::damageCooldown ( ) const

Retrieves the base amount of cooldown time between each attack, in frames.

Returns
The amount of base cooldown applied to the unit after an attack.
See also
UnitInterface::getGroundWeaponCooldown, UnitInterface::getAirWeaponCooldown
int BWAPI::WeaponType::damageFactor ( ) const

Obtains the intended number of missiles/attacks that are used.

This is used to multiply with the damage amount to obtain the full amount of damage for an attack.

Returns
The damage factor multiplied by the amount to obtain the total damage.
See also
damageAmount
UpgradeType BWAPI::WeaponType::upgradeType ( ) const

Retrieves the upgrade type that increases this weapon's damage output.

Returns
The UpgradeType used to upgrade this weapon's damage.
See also
damageBonus
DamageType BWAPI::WeaponType::damageType ( ) const

Retrieves the damage type that this weapon applies to a unit type.

Returns
DamageType used for damage calculation.
See also
DamageType, UnitSizeType
ExplosionType BWAPI::WeaponType::explosionType ( ) const

Retrieves the explosion type that indicates how the weapon deals damage.

Returns
ExplosionType identifying how damage is applied to a target location.
int BWAPI::WeaponType::minRange ( ) const

Retrieves the minimum attack range of the weapon, measured in pixels.

This value is 0 for almost all weapon types, except for WeaponTypes::Arclite_Shock_Cannon and WeaponTypes::Arclite_Shock_Cannon_Edmund_Duke.

Returns
Minimum attack range, in pixels.
int BWAPI::WeaponType::maxRange ( ) const

Retrieves the maximum attack range of the weapon, measured in pixels.

Returns
Maximum attack range, in pixels.
int BWAPI::WeaponType::innerSplashRadius ( ) const

Retrieves the inner radius used for splash damage calculations, in pixels.

Returns
Radius of the inner splash area, in pixels.
int BWAPI::WeaponType::medianSplashRadius ( ) const

Retrieves the middle radius used for splash damage calculations, in pixels.

Returns
Radius of the middle splash area, in pixels.
int BWAPI::WeaponType::outerSplashRadius ( ) const

Retrieves the outer radius used for splash damage calculations, in pixels.

Returns
Radius of the outer splash area, in pixels.
bool BWAPI::WeaponType::targetsAir ( ) const

Checks if this weapon type can target air units.

Returns
true if this weapon type can target air units, and false otherwise.
See also
UnitInterface::isFlying, UnitType::isFlyer
bool BWAPI::WeaponType::targetsGround ( ) const

Checks if this weapon type can target ground units.

Returns
true if this weapon type can target ground units, and false otherwise.
See also
UnitInterface::isFlying, UnitType::isFlyer
bool BWAPI::WeaponType::targetsMechanical ( ) const

Checks if this weapon type can only target mechanical units.

Returns
true if this weapon type can only target mechanical units, and false otherwise.
See also
targetsOrgOrMech, UnitType::isMechanical
bool BWAPI::WeaponType::targetsOrganic ( ) const

Checks if this weapon type can only target organic units.

Returns
true if this weapon type can only target organic units, and false otherwise.
See also
targetsOrgOrMech, UnitType::isOrganic
bool BWAPI::WeaponType::targetsNonBuilding ( ) const

Checks if this weapon type cannot target structures.

Returns
true if this weapon type cannot target buildings, and false if it can.
See also
UnitType::isBuilding
bool BWAPI::WeaponType::targetsNonRobotic ( ) const

Checks if this weapon type cannot target robotic units.

Returns
true if this weapon type cannot target robotic units, and false if it can.
See also
UnitType::isRobotic
bool BWAPI::WeaponType::targetsTerrain ( ) const

Checks if this weapon type can target the ground.

Note
This is more for attacks like Psionic Storm which can target a location, not to be confused with attack move.
Returns
true if this weapon type can target a location, and false otherwise.
bool BWAPI::WeaponType::targetsOrgOrMech ( ) const

Checks if this weapon type can only target organic or mechanical units.

Returns
true if this weapon type can only target organic or mechanical units, and false otherwise.
See also
targetsOrganic, targetsMechanical, UnitType::isOrganic, UnitType::isMechanical
bool BWAPI::WeaponType::targetsOwn ( ) const

Checks if this weapon type can only target units owned by the same player.

This is used for WeaponTypes::Consume.

Returns
true if this weapon type can only target your own units, and false otherwise.
See also
UnitInterface::getPlayer