Advanced Strategic Command
Classes | Functions
attack.h File Reference

Interface for all the fighting routines of ASC. More...

#include "typen.h"
#include "vehicletype.h"
#include "vehicle.h"
#include "buildings.h"
#include "objects.h"
#include "explosivemines.h"
#include "actions/context.h"
Include dependency graph for attack.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  AttackFormula
 the core formula, which weighs the different factory that go into the calculation More...
 
class  FightVisitor
 
class  tfight
 
struct  tfight::tavalues
 
class  UnitAttacksSomething
 
class  tunitattacksunit
 
class  tunitattacksbuilding
 
class  tmineattacksunit
 
class  tunitattacksobject
 
class  AttackWeap
 Structure to store the weapons which a unit can use to perform an attack. More...
 
class  WeapDist
 Some very old system to calculate the weapon efficiency over a given distance. More...
 

Functions

AttackWeapattackpossible (const Vehicle *attacker, int x, int y)
 Is attacker able to attack anything in field x/y ? More...
 
bool attackpossible2u (const Vehicle *attacker, const Vehicle *target, AttackWeap *attackweap=NULL, int targetheight=-1)
 Is attacker able to attack target ? Distance is not evaluated. More...
 
bool attackpossible28 (const Vehicle *attacker, const Vehicle *target, AttackWeap *attackweap=NULL, int targetHeight=-1)
 Is attacker able to attack target ? Distance is assumed one field. More...
 
bool attackpossible2n (const Vehicle *attacker, const Vehicle *target, AttackWeap *attackweap=NULL)
 Is attacker able to attack target ? Actual distance used. More...
 
bool vehicleplattfahrbar (const Vehicle *vehicle, const MapField *field)
 Can the vehicle drive across the field and destroy any unit there by moving over them? More...
 

Detailed Description

Interface for all the fighting routines of ASC.

Definition in file attack.h.

Function Documentation

AttackWeap* attackpossible ( const Vehicle attacker,
int  x,
int  y 
)
bool attackpossible28 ( const Vehicle attacker,
const Vehicle target,
AttackWeap attackweap = NULL,
int  targetHeight = -1 
)

Is attacker able to attack target ? Distance is assumed one field.

The distance is assumed to be 1 field. The routine is used for the movement routines for example, because units moving next to enemies get a movement malus. Does not evaluate any diplomatic states

Parameters
attackerthe attacking unit
targetthe unit that is being attacked
attackweapif != NULL, detailed information about the weapons which can perform the attack are written to attackweap
targetHeightif != -1 , assume the target unit was on this height (bitmapped!)

Definition at line 983 of file attack.cpp.

References Vehicle::ammo, UnitWeapon::count, AttackWeap::count, SingleWeapon::efficiency, getFirstBit(), getheightdelta(), SingleWeapon::getScalarWeaponType(), Vehicle::height, SingleWeapon::mindistance, minmalq, VehicleType::movemalustyp, AttackWeap::num, SingleWeapon::offensive(), SingleWeapon::shootable(), SingleWeapon::sourceheight, AttackWeap::strength, SingleWeapon::targ, AttackWeap::target, SingleWeapon::targetingAccuracy, Vehicle::typ, AttackWeap::typ, AttackWeap::vehicle, UnitWeapon::weapon, VehicleType::weapons, and Vehicle::weapstrength.

Referenced by calcMoveMalus(), and fieldAccessible().

bool attackpossible2n ( const Vehicle attacker,
const Vehicle target,
AttackWeap attackweap = NULL 
)
bool attackpossible2u ( const Vehicle attacker,
const Vehicle target,
AttackWeap attackweap = NULL,
int  targetheight = -1 
)

Is attacker able to attack target ? Distance is not evaluated.

The distance is not evaluated. The routine is used for the movement routines for example, because the current distance of units A and B is not relevant for the check whether unit A can move across the field where B is standing.

Parameters
attackerthe attacking unit
targetthe unit that is being attacked
attackweapif != NULL, detailed information about the weapons which can perform the attack are written to attackweap
targetHeightif != -1 , assume the target unit was on this height (bitmapped!)

Definition at line 939 of file attack.cpp.

References Vehicle::ammo, UnitWeapon::count, AttackWeap::count, Player::diplomacy, SingleWeapon::efficiency, getFirstBit(), getheightdelta(), ContainerBase::getMap(), ContainerBase::getOwner(), SingleWeapon::getScalarWeaponType(), Vehicle::height, DiplomaticStateVector::isHostile(), VehicleType::movemalustyp, AttackWeap::num, SingleWeapon::offensive(), GameMap::player, SingleWeapon::shootable(), SingleWeapon::sourceheight, AttackWeap::strength, SingleWeapon::targ, AttackWeap::target, SingleWeapon::targetingAccuracy, Vehicle::typ, AttackWeap::typ, AttackWeap::vehicle, UnitWeapon::weapon, VehicleType::weapons, and Vehicle::weapstrength.

bool vehicleplattfahrbar ( const Vehicle vehicle,
const MapField field 
)

Can the vehicle drive across the field and destroy any unit there by moving over them?

Definition at line 1069 of file attack.cpp.

Referenced by fieldAccessible().