1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 03:35:27 +00:00
OpenMW/apps/openmw/mwmechanics/aicombat.hpp

77 lines
2.0 KiB
C++
Raw Normal View History

2013-09-25 18:01:36 +02:00
#ifndef GAME_MWMECHANICS_AICOMBAT_H
#define GAME_MWMECHANICS_AICOMBAT_H
#include "aipackage.hpp"
#include "pathfinding.hpp"
#include "movement.hpp"
#include "obstacle.hpp"
#include "../mwworld/cellstore.hpp" // for Doors
2013-09-25 18:01:36 +02:00
2014-01-15 22:56:55 +02:00
#include "../mwbase/world.hpp"
#include <boost/shared_ptr.hpp>
2014-06-12 23:27:04 +02:00
namespace ESM
{
namespace AiSequence
{
struct AiCombat;
}
}
2013-09-25 18:01:36 +02:00
namespace MWMechanics
{
class Action;
struct AiCombatStorage;
/// \brief Causes the actor to fight another actor
2013-09-25 18:01:36 +02:00
class AiCombat : public AiPackage
{
public:
///Constructor
/** \param actor Actor to fight **/
2014-01-15 22:56:55 +02:00
AiCombat(const MWWorld::Ptr& actor);
2013-09-25 18:01:36 +02:00
2014-06-12 23:27:04 +02:00
AiCombat (const ESM::AiSequence::AiCombat* combat);
void init();
2013-09-25 18:01:36 +02:00
virtual AiCombat *clone() const;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration);
2013-09-25 18:01:36 +02:00
virtual int getTypeId() const;
virtual unsigned int getPriority() const;
///Returns target ID
2014-05-17 19:20:57 +04:00
MWWorld::Ptr getTarget() const;
2014-06-12 23:27:04 +02:00
virtual void writeState(ESM::AiSequence::AiSequence &sequence) const;
protected:
virtual bool doesPathNeedRecalc(ESM::Pathgrid::Point dest, const ESM::Cell *cell);
2013-09-25 18:01:36 +02:00
private:
int mTargetActorId;
2014-01-15 22:56:55 +02:00
void buildNewPath(const MWWorld::Ptr& actor, const MWWorld::Ptr& target);
bool reactionTimeActions(const MWWorld::Ptr& actor, CharacterController& characterController,
AiCombatStorage& storage, MWWorld::Ptr target);
/// Transfer desired movement (from AiCombatStorage) to Actor
void updateActorsMovement(const MWWorld::Ptr& actor, float duration, MWMechanics::Movement& movement);
void rotateActorOnAxis(const MWWorld::Ptr& actor, int axis,
MWMechanics::Movement& actorMovementSettings, MWMechanics::Movement& desiredMovement);
2013-09-25 18:01:36 +02:00
};
2013-09-25 18:01:36 +02:00
}
#endif