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"
|
2014-04-19 08:16:56 +10:00
|
|
|
#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"
|
|
|
|
|
2014-08-28 00:41:52 +02:00
|
|
|
#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
|
|
|
|
{
|
2014-08-28 00:41:52 +02:00
|
|
|
class Action;
|
|
|
|
|
2015-07-26 17:32:29 +12:00
|
|
|
struct AiCombatStorage;
|
|
|
|
|
2014-04-29 23:40:59 -04:00
|
|
|
/// \brief Causes the actor to fight another actor
|
2013-09-25 18:01:36 +02:00
|
|
|
class AiCombat : public AiPackage
|
|
|
|
{
|
|
|
|
public:
|
2014-04-29 23:40:59 -04:00
|
|
|
///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;
|
|
|
|
|
2015-06-26 17:47:04 +02:00
|
|
|
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;
|
|
|
|
|
2013-11-18 12:33:09 +01:00
|
|
|
virtual unsigned int getPriority() const;
|
|
|
|
|
2014-04-29 23:40:59 -04:00
|
|
|
///Returns target ID
|
2014-05-17 19:20:57 +04:00
|
|
|
MWWorld::Ptr getTarget() const;
|
2014-01-07 04:12:37 +04:00
|
|
|
|
2014-06-12 23:27:04 +02:00
|
|
|
virtual void writeState(ESM::AiSequence::AiSequence &sequence) const;
|
|
|
|
|
2015-06-11 18:31:35 +12:00
|
|
|
protected:
|
|
|
|
virtual bool doesPathNeedRecalc(ESM::Pathgrid::Point dest, const ESM::Cell *cell);
|
|
|
|
|
2013-09-25 18:01:36 +02:00
|
|
|
private:
|
2014-06-08 20:59:26 +04:00
|
|
|
|
2014-05-15 03:01:48 +02:00
|
|
|
int mTargetActorId;
|
2014-01-15 22:56:55 +02:00
|
|
|
|
2014-05-15 03:01:48 +02:00
|
|
|
void buildNewPath(const MWWorld::Ptr& actor, const MWWorld::Ptr& target);
|
2015-07-26 17:32:29 +12:00
|
|
|
bool reactionTimeActions(const MWWorld::Ptr& actor, CharacterController& characterController,
|
|
|
|
AiCombatStorage& storage, MWWorld::Ptr target);
|
2015-07-26 17:23:45 +12:00
|
|
|
|
|
|
|
/// Transfer desired movement (from AiCombatStorage) to Actor
|
2015-09-14 19:57:22 +12:00
|
|
|
void updateActorsMovement(const MWWorld::Ptr& actor, float duration, MWMechanics::Movement& movement);
|
2015-08-09 14:18:55 +12:00
|
|
|
void rotateActorOnAxis(const MWWorld::Ptr& actor, int axis,
|
2015-07-26 17:23:45 +12:00
|
|
|
MWMechanics::Movement& actorMovementSettings, MWMechanics::Movement& desiredMovement);
|
2013-09-25 18:01:36 +02:00
|
|
|
};
|
2014-10-08 23:00:36 +02:00
|
|
|
|
2014-10-09 23:11:10 +02:00
|
|
|
|
2013-09-25 18:01:36 +02:00
|
|
|
}
|
|
|
|
|
2014-01-07 04:12:37 +04:00
|
|
|
#endif
|