2013-09-25 16:01:36 +00:00
|
|
|
#ifndef GAME_MWMECHANICS_AICOMBAT_H
|
|
|
|
#define GAME_MWMECHANICS_AICOMBAT_H
|
|
|
|
|
|
|
|
#include "aipackage.hpp"
|
|
|
|
|
|
|
|
#include "pathfinding.hpp"
|
|
|
|
|
|
|
|
#include "movement.hpp"
|
2014-04-18 22:16:56 +00:00
|
|
|
#include "obstacle.hpp"
|
|
|
|
|
2014-06-08 16:59:26 +00:00
|
|
|
#include <OgreVector3.h>
|
|
|
|
|
2014-04-18 22:16:56 +00:00
|
|
|
#include "../mwworld/cellstore.hpp" // for Doors
|
2013-09-25 16:01:36 +00:00
|
|
|
|
2014-01-15 20:56:55 +00:00
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
|
2014-08-27 22:41:52 +00:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
2014-06-12 21:27:04 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
namespace AiSequence
|
|
|
|
{
|
|
|
|
struct AiCombat;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-25 16:01:36 +00:00
|
|
|
namespace MWMechanics
|
|
|
|
{
|
2014-08-27 22:41:52 +00:00
|
|
|
class Action;
|
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
/// \brief Causes the actor to fight another actor
|
2013-09-25 16:01:36 +00:00
|
|
|
class AiCombat : public AiPackage
|
|
|
|
{
|
|
|
|
public:
|
2014-04-30 03:40:59 +00:00
|
|
|
///Constructor
|
|
|
|
/** \param actor Actor to fight **/
|
2014-01-15 20:56:55 +00:00
|
|
|
AiCombat(const MWWorld::Ptr& actor);
|
2013-09-25 16:01:36 +00:00
|
|
|
|
2014-06-12 21:27:04 +00:00
|
|
|
AiCombat (const ESM::AiSequence::AiCombat* combat);
|
|
|
|
|
|
|
|
void init();
|
|
|
|
|
2013-09-25 16:01:36 +00:00
|
|
|
virtual AiCombat *clone() const;
|
|
|
|
|
2013-10-30 19:42:50 +00:00
|
|
|
virtual bool execute (const MWWorld::Ptr& actor,float duration);
|
2013-09-25 16:01:36 +00:00
|
|
|
|
|
|
|
virtual int getTypeId() const;
|
|
|
|
|
2013-11-18 11:33:09 +00:00
|
|
|
virtual unsigned int getPriority() const;
|
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
///Returns target ID
|
2014-05-17 15:20:57 +00:00
|
|
|
MWWorld::Ptr getTarget() const;
|
2014-01-07 00:12:37 +00:00
|
|
|
|
2014-06-12 21:27:04 +00:00
|
|
|
virtual void writeState(ESM::AiSequence::AiSequence &sequence) const;
|
|
|
|
|
2013-09-25 16:01:36 +00:00
|
|
|
private:
|
|
|
|
PathFinder mPathFinder;
|
2014-01-29 19:29:07 +00:00
|
|
|
// controls duration of the actual strike
|
2014-01-15 20:56:55 +00:00
|
|
|
float mTimerAttack;
|
|
|
|
float mTimerReact;
|
2014-01-29 19:29:07 +00:00
|
|
|
// controls duration of the sideway & forward moves
|
|
|
|
// when mCombatMove is true
|
2014-01-15 20:56:55 +00:00
|
|
|
float mTimerCombatMove;
|
|
|
|
|
2014-04-18 22:16:56 +00:00
|
|
|
// AiCombat states
|
2014-04-27 18:38:04 +00:00
|
|
|
bool mReadyToAttack, mAttack;
|
2014-01-19 20:09:51 +00:00
|
|
|
bool mFollowTarget;
|
2014-01-15 20:56:55 +00:00
|
|
|
bool mCombatMove;
|
|
|
|
|
2014-06-08 16:59:26 +00:00
|
|
|
float mStrength; // this is actually make sense only in ranged combat
|
|
|
|
float mMinMaxAttackDuration[3][2]; // slash, thrust, chop has different durations
|
2014-06-27 23:31:34 +00:00
|
|
|
bool mMinMaxAttackDurationInitialised;
|
2014-06-08 16:59:26 +00:00
|
|
|
|
2014-04-20 16:35:07 +00:00
|
|
|
bool mForceNoShortcut;
|
|
|
|
ESM::Position mShortcutFailPos;
|
|
|
|
|
2014-06-08 16:59:26 +00:00
|
|
|
Ogre::Vector3 mLastActorPos;
|
2014-01-15 20:56:55 +00:00
|
|
|
MWMechanics::Movement mMovement;
|
2014-06-08 16:59:26 +00:00
|
|
|
|
2014-05-15 01:01:48 +00:00
|
|
|
int mTargetActorId;
|
2014-06-08 16:59:26 +00:00
|
|
|
Ogre::Vector3 mLastTargetPos;
|
2014-01-15 20:56:55 +00:00
|
|
|
|
2014-04-19 22:31:02 +00:00
|
|
|
const MWWorld::CellStore* mCell;
|
2014-04-18 22:16:56 +00:00
|
|
|
ObstacleCheck mObstacleCheck;
|
|
|
|
|
2014-08-27 22:41:52 +00:00
|
|
|
boost::shared_ptr<Action> mCurrentAction;
|
|
|
|
float mActionCooldown;
|
|
|
|
|
2014-05-15 01:01:48 +00:00
|
|
|
void buildNewPath(const MWWorld::Ptr& actor, const MWWorld::Ptr& target);
|
2013-09-25 16:01:36 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2014-01-07 00:12:37 +00:00
|
|
|
#endif
|