_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
#include <action_attack.h>
|
virtual bool | IsValid () const |
|
virtual void | Save (CFile &file, const CUnit &unit) const |
|
virtual bool | ParseSpecificData (lua_State *l, int &j, const char *value, const CUnit &unit) |
|
virtual void | Execute (CUnit &unit) |
|
virtual void | OnAnimationAttack (CUnit &unit) |
|
virtual PixelPos | Show (const CViewport &vp, const PixelPos &lastScreenPos) const |
|
virtual void | UpdatePathFinderData (PathFinderInput &input) |
|
virtual bool | OnAiHitUnit (CUnit &unit, CUnit *attacker, int) |
|
bool | IsWeakTargetSelected () const |
|
bool | IsAutoTargeting () const |
|
bool | IsMovingToAttackPos () const |
|
bool | IsAttackGroundOrWall () const |
|
bool | IsTargetTooClose (const CUnit &unit) const |
|
CUnit *const | BestTarget (const CUnit &unit, CUnit *const target1, CUnit *const target2) const |
|
void | OfferNewTarget (const CUnit &unit, CUnit *const target) |
|
|
static COrder * | NewActionAttack (const CUnit &attacker, CUnit &target) |
|
static COrder * | NewActionAttack (const CUnit &attacker, const Vec2i &dest) |
|
static COrder * | NewActionAttackGround (const CUnit &attacker, const Vec2i &dest) |
|
static COrder * | NewActionBoard (CUnit &unit) |
|
static COrder * | NewActionBuild (const CUnit &builder, const Vec2i &pos, CUnitType &building) |
|
static COrder * | NewActionBuilt (CUnit &builder, CUnit &unit) |
|
static COrder * | NewActionDefend (CUnit &dest) |
|
static COrder * | NewActionDie () |
|
static COrder * | NewActionExplore (const CUnit &unit) |
|
static COrder * | NewActionFollow (CUnit &dest) |
|
static COrder * | NewActionMove (const Vec2i &pos) |
|
static COrder * | NewActionPatrol (const Vec2i ¤tPos, const Vec2i &dest) |
|
static COrder * | NewActionRepair (CUnit &unit, CUnit &target) |
|
static COrder * | NewActionRepair (const Vec2i &pos) |
|
static COrder * | NewActionResearch (CUnit &unit, CUpgrade &upgrade) |
|
static COrder * | NewActionResource (CUnit &harvester, const Vec2i &pos) |
|
static COrder * | NewActionResource (CUnit &harvester, CUnit &mine) |
|
static COrder * | NewActionReturnGoods (CUnit &harvester, CUnit *depot) |
|
static COrder * | NewActionSpellCast (const SpellType &spell, const Vec2i &pos, CUnit *target, bool isAutocast=false) |
|
static COrder * | NewActionStandGround () |
|
static COrder * | NewActionStill () |
|
static COrder * | NewActionTrain (CUnit &trainer, CUnitType &type) |
|
static COrder * | NewActionTransformInto (CUnitType &type) |
|
static COrder * | NewActionUpgradeTo (CUnit &unit, CUnitType &type, bool instant=false) |
|
static COrder * | NewActionUnload (const Vec2i &pos, CUnit *what) |
|
const unsigned char | Action |
|
bool | Finished |
| global action More...
|
|
bool | Instant |
| true when order is finish More...
|
|
void | UpdatePathFinderData_NotCalled (PathFinderInput &input) |
|
◆ COrder_Attack()
COrder_Attack::COrder_Attack |
( |
bool |
ground | ) |
|
|
inlineexplicit |
◆ BestTarget()
CUnit *const COrder_Attack::BestTarget |
( |
const CUnit & |
unit, |
|
|
CUnit *const |
target1, |
|
|
CUnit *const |
target2 |
|
) |
| const |
◆ Clone()
◆ Execute()
Unit attacks!
if (SubAction & AUTO_TARGETING) is true the goal is a weak goal. This means the unit AI (little AI) could choose a new better goal.
- Todo:
- Lets do some tries to reach the target. If target place is not reachable, choose better goal to reduce the pathfinder load.
- Parameters
-
unit | Unit, for that the attack is handled. |
Implements COrder.
◆ GetGoalPos()
virtual const Vec2i COrder_Attack::GetGoalPos |
( |
| ) |
const |
|
inlinevirtual |
Get goal position
Reimplemented from COrder.
◆ IsAttackGroundOrWall()
bool COrder_Attack::IsAttackGroundOrWall |
( |
| ) |
const |
FIXME: Check if need to add this: (goal && goal->Type && goal->Type->BoolFlag[WALL_INDEX].value)
◆ IsAutoTargeting()
bool COrder_Attack::IsAutoTargeting |
( |
| ) |
const |
◆ IsMovingToAttackPos()
bool COrder_Attack::IsMovingToAttackPos |
( |
| ) |
const |
◆ IsTargetTooClose()
bool COrder_Attack::IsTargetTooClose |
( |
const CUnit & |
unit | ) |
const |
Check if current target is closer to unit more than MinAttackRange
- Parameters
-
unit | Unit that is attacking and moving |
Calculate distance to goal or map tile if attack ground/wall
◆ IsValid()
bool COrder_Attack::IsValid |
( |
| ) |
const |
|
virtual |
◆ IsWeakTargetSelected()
bool COrder_Attack::IsWeakTargetSelected |
( |
| ) |
const |
◆ OfferNewTarget()
void COrder_Attack::OfferNewTarget |
( |
const CUnit & |
unit, |
|
|
CUnit *const |
target |
|
) |
| |
Try to change goal from outside, when in the auto attack mode
@param unit
- Parameters
-
target | Target that offered as the new current goal |
if attacker cant't move (stand_ground, building, in a bunker or transport)
◆ OnAiHitUnit()
bool COrder_Attack::OnAiHitUnit |
( |
CUnit & |
unit, |
|
|
CUnit * |
attacker, |
|
|
int |
|
|
) |
| |
|
virtual |
◆ OnAnimationAttack()
void COrder_Attack::OnAnimationAttack |
( |
CUnit & |
unit | ) |
|
|
virtual |
Call when animation step is "attack"
Reimplemented from COrder.
◆ ParseSpecificData()
bool COrder_Attack::ParseSpecificData |
( |
lua_State * |
l, |
|
|
int & |
j, |
|
|
const char * |
value, |
|
|
const CUnit & |
unit |
|
) |
| |
|
virtual |
◆ Save()
◆ Show()
◆ UpdatePathFinderData()
◆ COrder::NewActionAttack [1/2]
◆ COrder::NewActionAttack [2/2]
◆ COrder::NewActionAttackGround
The documentation for this class was generated from the following files:
(C) Copyright 1998-2012 by The