BWAPI
Public Member Functions | Private Attributes
AOEThreatClass Class Reference

#include <AOEThreat.h>

Collaboration diagram for AOEThreatClass:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AOEThreatClass (Unit unit)
 AOEThreatClass (BWAPI::Bullet *bullet)
bool hasGone () const
Position getPosition () const
int getRadius () const
Unit getTarget () const
bool isAirThreat () const
bool isGroundThreat () const
bool isEnergyThreat () const
void draw () const

Private Attributes

Unit mUnit
BWAPI::BulletmBullet

Detailed Description

Definition at line 5 of file AOEThreat.h.


Constructor & Destructor Documentation

Definition at line 3 of file AOEThreat.cpp.

        : mUnit(unit)
        , mBullet(NULL)
{
}

Definition at line 9 of file AOEThreat.cpp.

        : mUnit()
        , mBullet(bullet)
{
}

Member Function Documentation

void AOEThreatClass::draw ( ) const

Definition at line 81 of file AOEThreat.cpp.

References BWAPI::Broodwar, BWAPI::Game::drawCircleMap(), getPosition(), getRadius(), BWAPI::Colors::Red, BWAPI::Position::x(), and BWAPI::Position::y().

Here is the call graph for this function:

Definition at line 20 of file AOEThreat.cpp.

References BWAPI::BulletTypes::EMP_Missile, BWAPI::Bullet::exists(), BWAPI::Bullet::getPosition(), BWAPI::Bullet::getTargetPosition(), BWAPI::Bullet::getType(), BWAPI::Positions::Invalid, mBullet, mUnit, BWAPI::UnitTypes::Protoss_Scarab, BWAPI::BulletTypes::Psionic_Storm, and BWAPI::UnitTypes::Terran_Vulture_Spider_Mine.

Referenced by draw(), and hasGone().

{
        if(mUnit && mUnit->exists())
        {
                const BWAPI::UnitType &type = mUnit->getType();
                if(type == BWAPI::UnitTypes::Terran_Vulture_Spider_Mine)
                {
                        if(mUnit->getTarget())
                                return mUnit->getTarget()->getPosition();
                        else
                                return mUnit->getPosition();
                }
                else if(type == BWAPI::UnitTypes::Protoss_Scarab)
                {
                        if(mUnit->getTarget())
                                return mUnit->getTarget()->getPosition();
                        else
                                return BWAPI::Positions::Invalid;
                }
                else
                        return mUnit->getPosition();
        }
        else if(mBullet && mBullet->exists())
        {
                const BWAPI::BulletType &type = mBullet->getType();
                if(type == BWAPI::BulletTypes::Psionic_Storm)
                        return mBullet->getPosition();
                else if(type == BWAPI::BulletTypes::EMP_Missile)
                        return mBullet->getTargetPosition();
        }

        return BWAPI::Positions::Invalid;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 54 of file AOEThreat.cpp.

References BWAPI::BulletTypes::EMP_Missile, BWAPI::Bullet::exists(), BWAPI::Bullet::getType(), isAirThreat(), isGroundThreat(), mBullet, mUnit, and BWAPI::BulletTypes::Psionic_Storm.

Referenced by draw().

{
        if(mUnit && mUnit->exists())
        {
                int radius = 0;
                if(isAirThreat())
                        radius = mUnit->getType().airWeapon().medianSplashRadius();
                if(isGroundThreat())
                        radius = std::max(mUnit->getType().groundWeapon().medianSplashRadius(), radius);
                
                if(!mUnit->getTarget())
                        return radius / 2;
                else
                        return radius;
        }
        else if(mBullet && mBullet->exists())
        {
                const BWAPI::BulletType &type = mBullet->getType();
                if(type == BWAPI::BulletTypes::Psionic_Storm)
                        return 64;
                else if(type == BWAPI::BulletTypes::EMP_Missile)
                        return 96;
        }

        return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 87 of file AOEThreat.cpp.

References mUnit, and StaticUnits::nullunit.

{
        if(mUnit && mUnit->exists())
                return mUnit->getTarget();

        return StaticUnits::nullunit;
}
bool AOEThreatClass::hasGone ( ) const

Definition at line 15 of file AOEThreat.cpp.

References getPosition(), and BWAPI::Positions::Invalid.

Here is the call graph for this function:

Definition at line 95 of file AOEThreat.cpp.

References BWAPI::Bullet::exists(), BWAPI::Bullet::getType(), mBullet, and BWAPI::BulletTypes::Psionic_Storm.

Referenced by getRadius().

{
        if(mBullet && mBullet->exists())
        {
                if(mBullet->getType() == BWAPI::BulletTypes::Psionic_Storm)
                        return true;
        }

        return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 123 of file AOEThreat.cpp.

References BWAPI::BulletTypes::EMP_Missile, BWAPI::Bullet::exists(), BWAPI::Bullet::getType(), and mBullet.

{
        if(mBullet && mBullet->exists())
        {
                if(mBullet->getType() == BWAPI::BulletTypes::EMP_Missile)
                        return true;
        }

        return false;
}

Here is the call graph for this function:

Definition at line 106 of file AOEThreat.cpp.

References BWAPI::Bullet::exists(), BWAPI::Bullet::getType(), mBullet, mUnit, BWAPI::UnitTypes::Protoss_Scarab, BWAPI::BulletTypes::Psionic_Storm, and BWAPI::UnitTypes::Terran_Vulture_Spider_Mine.

Referenced by getRadius().

{
        if(mUnit && mUnit->exists())
        {
                const BWAPI::UnitType &type = mUnit->getType();
                if(type == BWAPI::UnitTypes::Protoss_Scarab || type == BWAPI::UnitTypes::Terran_Vulture_Spider_Mine)
                        return true;
        }
        else if(mBullet && mBullet->exists())
        {
                if(mBullet->getType() == BWAPI::BulletTypes::Psionic_Storm)
                        return true;
        }

        return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 25 of file AOEThreat.h.

Referenced by getPosition(), getRadius(), isAirThreat(), isEnergyThreat(), and isGroundThreat().

Definition at line 24 of file AOEThreat.h.

Referenced by getPosition(), getRadius(), getTarget(), and isGroundThreat().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines