Ares
Classes | Public Types | Static Public Member Functions | Static Public Attributes

WarheadTypeExt Class Reference

#include <src/Ext/WarheadType/Body.h>

List of all members.

Classes

class  ExtData
struct  VersesData

Public Types

typedef WarheadTypeClass TT

Static Public Member Functions

static void applyRipples (WarheadTypeClass *pWH, CoordStruct *coords)
static void applyIronCurtain (WarheadTypeClass *pWH, CoordStruct *coords, HouseClass *House, int damage)
static void applyEMP (WarheadTypeClass *pWH, CoordStruct *coords, TechnoClass *source)
static bool applyPermaMC (WarheadTypeClass *pWH, CoordStruct *coords, HouseClass *House, ObjectClass *Source)
static void applyOccupantDamage (BulletClass *)
static bool canWarheadAffectTarget (TechnoClass *, HouseClass *, WarheadTypeClass *)
 Gets whether a Techno can be affected by a warhead fired by a house.

Static Public Attributes

static Container< WarheadTypeExtExtMap
static WarheadTypeClass * Temporal_WH = NULL
static WarheadTypeClass * EMP_WH = NULL
static hash_map< IonBlastClass
*, WarheadTypeExt::ExtData * > 
IonExt

Member Typedef Documentation

typedef WarheadTypeClass WarheadTypeExt::TT

Member Function Documentation

static void WarheadTypeExt::applyEMP ( WarheadTypeClass *  pWH,
CoordStruct *  coords,
TechnoClass *  source 
) [inline, static]
                                                                                               {
                if(auto pWHExt = WarheadTypeExt::ExtMap.Find(pWH)) {
                        pWHExt->applyEMP(coords, source);
                }
        }
static void WarheadTypeExt::applyIronCurtain ( WarheadTypeClass *  pWH,
CoordStruct *  coords,
HouseClass *  House,
int  damage 
) [inline, static]
                                                                                                                  {
                if(auto pWHExt = WarheadTypeExt::ExtMap.Find(pWH)) {
                        pWHExt->applyIronCurtain(coords, House, damage);
                }
        }
void WarheadTypeExt::applyOccupantDamage ( BulletClass *  Bullet) [static]

This function checks if the projectile transporting the warhead should pass through the building's walls and deliver the warhead to the occupants instead. If so, it performs that effect.

Note:
Moved here from hook BulletClass_Fire.
This cannot logically be triggered in situations where the warhead is not delivered by a projectile, such as the GenericWarhead super weapon.
Parameters:
BulletThe projectile
Todo:
This should probably be moved to /Ext/Bullet/ instead, I just maintained the previous structure to ease transition. Since UC.DaMO (#778) in 0.5 will require a reimplementation of this logic anyway, we can probably just leave it here until then.
                                                            {
        if (Bullet->Target) {
                BulletExt::ExtData* TheBulletExt = BulletExt::ExtMap.Find(Bullet);
                if (TheBulletExt->DamageOccupants()) {
                        // the occupants have been damaged, do not damage the building (the original target)
                        Bullet->Health = 0;
                        Bullet->DamageMultiplier = 0;
                        Bullet->Remove();
                }
        }
}
static bool WarheadTypeExt::applyPermaMC ( WarheadTypeClass *  pWH,
CoordStruct *  coords,
HouseClass *  House,
ObjectClass *  Source 
) [inline, static]
                                                                                                                        {
                if(auto pWHExt = WarheadTypeExt::ExtMap.Find(pWH)) {
                        pWHExt->applyPermaMC(coords, House, Source);
                }
        }
static void WarheadTypeExt::applyRipples ( WarheadTypeClass *  pWH,
CoordStruct *  coords 
) [inline, static]
                                                                              {
                if(auto pWHExt = WarheadTypeExt::ExtMap.Find(pWH)) {
                        pWHExt->applyRipples(coords);
                }
        }
bool WarheadTypeExt::canWarheadAffectTarget ( TechnoClass *  Target,
HouseClass *  SourceHouse,
WarheadTypeClass *  WH 
) [static]

Gets whether a Techno can be affected by a warhead fired by a house.

A warhead will not affect allies if AffectsAllies is not set and will not affect enemies if AffectsEnemies is not set.

Parameters:
TargetThe Techno WH is fired at.
SourceHouseThe house that fired WH.
Returns:
True if WH can affect Target, false otherwise.
Author:
AlexB
Date:
2010-04-27
                                                                                                                {
        if (SourceHouse && Target && WH) {
                // owner and target house are allied and this warhead
                // is set to not hurt any allies.
                bool alliedWithTarget = SourceHouse->IsAlliedWith(Target->Owner);
                if (alliedWithTarget && !WH->AffectsAllies) {
                        return false;
                }

                // this warhead's pulse is designed to fly around
                // enemy units. useful for healing.
                WarheadTypeExt::ExtData *pWHdata = WarheadTypeExt::ExtMap.Find(WH);
                if (!alliedWithTarget && !pWHdata->AffectsEnemies) {
                        return false;
                }
        }

        return true;
}

Member Data Documentation

WarheadTypeClass * WarheadTypeExt::EMP_WH = NULL [static]
WarheadTypeClass * WarheadTypeExt::Temporal_WH = NULL [static]

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