1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00
OpenMW/apps/openmw/mwmechanics/aicombat.hpp

69 lines
1.9 KiB
C++
Raw Normal View History

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"
#include "obstacle.hpp"
#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"
2013-09-25 16:01:36 +00:00
namespace MWMechanics
{
class AiCombat : public AiPackage
{
public:
2014-01-15 20:56:55 +00:00
AiCombat(const MWWorld::Ptr& actor);
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
///< \return Package completed?
virtual int getTypeId() const;
virtual unsigned int getPriority() const;
const std::string &getTargetId() 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-01-29 19:29:07 +00:00
// the z rotation angle (degrees) we want to reach
// used every frame when mRotate is true
float mTargetAngle;
// AiCombat states
2014-01-15 20:56:55 +00:00
bool mReadyToAttack, mStrike;
2014-01-19 20:09:51 +00:00
bool mFollowTarget;
2014-01-15 20:56:55 +00:00
bool mCombatMove;
bool mBackOffDoor;
2014-01-29 19:29:07 +00:00
bool mRotate;
2014-01-15 20:56:55 +00:00
MWMechanics::Movement mMovement;
MWWorld::Ptr mTarget;
2014-04-19 22:31:02 +00:00
const MWWorld::CellStore* mCell;
ObstacleCheck mObstacleCheck;
float mDoorCheckDuration;
2014-04-19 22:31:02 +00:00
// TODO: for some reason mDoors.searchViaHandle() returns
// null pointers, workaround by keeping an iterator
MWWorld::CellRefList<ESM::Door>::List::iterator mDoorIter;
2014-04-19 22:31:02 +00:00
MWWorld::CellRefList<ESM::Door>& mDoors;
2014-01-15 20:56:55 +00:00
void buildNewPath(const MWWorld::Ptr& actor);
2013-09-25 16:01:36 +00:00
};
}
#endif