OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MWMechanics::AiCombat Class Reference

Causes the actor to fight another actor. More...

#include <aicombat.hpp>

Inheritance diagram for MWMechanics::AiCombat:
Collaboration diagram for MWMechanics::AiCombat:

Public Member Functions

 AiCombat (const MWWorld::Ptr &actor)
 Constructor. More...
 
 AiCombat (const ESM::AiSequence::AiCombat *combat)
 
void init ()
 
virtual AiCombatclone () const
 Clones the package. More...
 
virtual bool execute (const MWWorld::Ptr &actor, CharacterController &characterController, AiState &state, float duration)
 
virtual int getTypeId () const
 
virtual unsigned int getPriority () const
 Higher number is higher priority (0 being the lowest) More...
 
MWWorld::Ptr getTarget () const
 Returns target ID. More...
 
virtual void writeState (ESM::AiSequence::AiSequence &sequence) const
 
virtual bool canCancel () const
 Can this Ai package be canceled? (default true) More...
 
virtual bool shouldCancelPreviousAi () const
 Upon adding this Ai package, should the Ai Sequence attempt to cancel previous Ai packages (default true)? More...
 
- Public Member Functions inherited from MWMechanics::AiPackage
 AiPackage ()
 Default constructor. More...
 
virtual ~AiPackage ()
 Default Deconstructor. More...
 
virtual void fastForward (const MWWorld::Ptr &actor, AiState &state)
 Simulates the passing of time. More...
 
virtual bool sideWithTarget () const
 Return true if having this AiPackage makes the actor side with the target in fights (default false) More...
 
virtual bool followTargetThroughDoors () const
 Return true if the actor should follow the target through teleport doors (default false) More...
 
virtual bool getRepeat () const
 Return true if this package should repeat. Currently only used for Wander packages. More...
 
void reset ()
 Reset pathfinding state. More...
 
bool isTargetMagicallyHidden (const MWWorld::Ptr &target)
 

Private Member Functions

bool attack (const MWWorld::Ptr &actor, const MWWorld::Ptr &target, AiCombatStorage &storage, CharacterController &characterController)
 Returns true if combat should end. More...
 
void updateLOS (const MWWorld::Ptr &actor, const MWWorld::Ptr &target, float duration, AiCombatStorage &storage)
 
void updateFleeing (const MWWorld::Ptr &actor, const MWWorld::Ptr &target, float duration, AiCombatStorage &storage)
 
void updateActorsMovement (const MWWorld::Ptr &actor, float duration, AiCombatStorage &storage)
 Transfer desired movement (from AiCombatStorage) to Actor. More...
 
void rotateActorOnAxis (const MWWorld::Ptr &actor, int axis, MWMechanics::Movement &actorMovementSettings, MWMechanics::Movement &desiredMovement)
 

Private Attributes

int mTargetActorId
 

Additional Inherited Members

- Public Types inherited from MWMechanics::AiPackage
enum  TypeId {
  TypeIdNone = -1, TypeIdWander = 0, TypeIdTravel = 1, TypeIdEscort = 2,
  TypeIdFollow = 3, TypeIdActivate = 4, TypeIdCombat = 5, TypeIdPursue = 6,
  TypeIdAvoidDoor = 7, TypeIdFace = 8
}
 Enumerates the various AITypes available. More...
 
- Static Public Member Functions inherited from MWMechanics::AiPackage
static bool isReachableRotatingOnTheRun (const MWWorld::Ptr &actor, const ESM::Pathgrid::Point &dest)
 Return if actor's rotation speed is sufficient to rotate to the destination pathpoint on the run. Otherwise actor should rotate while standing. More...
 
- Protected Member Functions inherited from MWMechanics::AiPackage
bool pathTo (const MWWorld::Ptr &actor, const ESM::Pathgrid::Point &dest, float duration, float destTolerance=0.0f)
 Handles path building and shortcutting with obstacles avoiding. More...
 
bool shortcutPath (const ESM::Pathgrid::Point &startPoint, const ESM::Pathgrid::Point &endPoint, const MWWorld::Ptr &actor, bool *destInLOS)
 
bool checkWayIsClearForActor (const ESM::Pathgrid::Point &startPoint, const ESM::Pathgrid::Point &endPoint, const MWWorld::Ptr &actor)
 Check if the way to the destination is clear, taking into account actor speed. More...
 
virtual bool doesPathNeedRecalc (const ESM::Pathgrid::Point &newDest, const MWWorld::CellStore *currentCell)
 
void evadeObstacles (const MWWorld::Ptr &actor, float duration, const ESM::Position &pos)
 
- Protected Attributes inherited from MWMechanics::AiPackage
PathFinder mPathFinder
 
ObstacleCheck mObstacleCheck
 
float mTimer
 
osg::Vec3f mLastActorPos
 
short mRotateOnTheRunChecks
 
bool mIsShortcutting
 
bool mShortcutProhibited
 
ESM::Pathgrid::Point mShortcutFailPos
 

Detailed Description

Causes the actor to fight another actor.

Constructor & Destructor Documentation

MWMechanics::AiCombat::AiCombat ( const MWWorld::Ptr actor)

Constructor.

Parameters
actorActor to fight
MWMechanics::AiCombat::AiCombat ( const ESM::AiSequence::AiCombat combat)

Member Function Documentation

bool MWMechanics::AiCombat::attack ( const MWWorld::Ptr actor,
const MWWorld::Ptr target,
AiCombatStorage storage,
CharacterController characterController 
)
private

Returns true if combat should end.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool MWMechanics::AiCombat::canCancel ( ) const
inlinevirtual

Can this Ai package be canceled? (default true)

Reimplemented from MWMechanics::AiPackage.

AiCombat * MWMechanics::AiCombat::clone ( ) const
virtual

Clones the package.

Implements MWMechanics::AiPackage.

bool MWMechanics::AiCombat::execute ( const MWWorld::Ptr actor,
CharacterController characterController,
AiState state,
float  duration 
)
virtual

Updates and runs the package (Should run every frame)

Returns
Package completed?

Implements MWMechanics::AiPackage.

Here is the call graph for this function:

unsigned int MWMechanics::AiCombat::getPriority ( ) const
virtual

Higher number is higher priority (0 being the lowest)

Reimplemented from MWMechanics::AiPackage.

MWWorld::Ptr MWMechanics::AiCombat::getTarget ( ) const
virtual

Returns target ID.

Reimplemented from MWMechanics::AiPackage.

Here is the call graph for this function:

Here is the caller graph for this function:

int MWMechanics::AiCombat::getTypeId ( ) const
virtual

Returns the TypeID of the AiPackage

See Also
enum TypeId

Implements MWMechanics::AiPackage.

void MWMechanics::AiCombat::init ( )
void MWMechanics::AiCombat::rotateActorOnAxis ( const MWWorld::Ptr actor,
int  axis,
MWMechanics::Movement actorMovementSettings,
MWMechanics::Movement desiredMovement 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool MWMechanics::AiCombat::shouldCancelPreviousAi ( ) const
inlinevirtual

Upon adding this Ai package, should the Ai Sequence attempt to cancel previous Ai packages (default true)?

Reimplemented from MWMechanics::AiPackage.

void MWMechanics::AiCombat::updateActorsMovement ( const MWWorld::Ptr actor,
float  duration,
AiCombatStorage storage 
)
private

Transfer desired movement (from AiCombatStorage) to Actor.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::AiCombat::updateFleeing ( const MWWorld::Ptr actor,
const MWWorld::Ptr target,
float  duration,
MWMechanics::AiCombatStorage storage 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::AiCombat::updateLOS ( const MWWorld::Ptr actor,
const MWWorld::Ptr target,
float  duration,
MWMechanics::AiCombatStorage storage 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::AiCombat::writeState ( ESM::AiSequence::AiSequence sequence) const
virtual

Reimplemented from MWMechanics::AiPackage.

Member Data Documentation

int MWMechanics::AiCombat::mTargetActorId
private

The documentation for this class was generated from the following files: