1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef AI_PROFILE_NPC_H
20 #define AI_PROFILE_NPC_H
23 #include "ai_bot_npc.h"
24 #include "ai_grp_npc.h"
25 #include "ai_generic_fight.h"
27 extern bool simulateBug(int bugId
);
29 // Forard declarations
32 //////////////////////////////////////////////////////////////////////////////
33 // Free variables and functions //
34 //////////////////////////////////////////////////////////////////////////////
36 extern bool ai_profile_npc_VerboseLog
;
38 //////////////////////////////////////////////////////////////////////////////
39 // CBotProfileMoveTo //
40 //////////////////////////////////////////////////////////////////////////////
42 class CBotProfileMoveTo
43 : public CAIBaseProfile
44 , public NLMISC::IDbgPtrData
47 CBotProfileMoveTo(AITYPES::TVerticalPos verticalPos
, RYAI_MAP_CRUNCH::CWorldPosition
const& dest
, CProfileOwner
* owner
);
49 /// @name IAIProfile implementation
51 virtual void beginProfile();
52 virtual void endProfile();
53 virtual void updateProfile(uint ticksSinceLastUpdate
);
54 virtual AITYPES::TProfiles
getAIProfileType () const { return AITYPES::BOT_MOVE_TO
; }
55 virtual std::string
getOneLineInfoString() const;
58 bool destinationReach() const;
60 CFollowPath::TFollowStatus _Status
;
61 AITYPES::TVerticalPos _VerticalPos
;
62 RYAI_MAP_CRUNCH::CWorldPosition _Dest
;
64 CPathPosition _PathPos
;
68 NLMISC::CDbgPtr
<CSpawnBotNpc
> _Bot
;
71 //////////////////////////////////////////////////////////////////////////////
72 // CBotProfileFollowPos //
73 //////////////////////////////////////////////////////////////////////////////
75 class CBotProfileFollowPos
76 : public CAIBaseProfile
77 , public NLMISC::IDbgPtrData
80 CBotProfileFollowPos(CPathCont
* pathCont
, CProfileOwner
* owner
);
81 CBotProfileFollowPos(CBotProfileFollowPos
const& other
);
83 /// @name IAIProfile implementation
85 virtual void beginProfile();
86 virtual void endProfile();
87 virtual void updateProfile(uint ticksSinceLastUpdate
);
88 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::BOT_FOLLOW_POS
; }
89 virtual std::string
getOneLineInfoString() const;
92 void setMaxSpeeds(float walkSpeed
, float runSpeed
);
93 void setStop(bool stop
);
95 CFollowPath::TFollowStatus _Status
;
96 CPathPosition _PathPos
;
99 NLMISC::CDbgPtr
<CSpawnBotNpc
> _Bot
;
102 NLMISC::CDbgPtr
<CPathCont
> _PathCont
;
104 // maximum speed to use (for group with different creatures)
108 // flag to stop temporary stop the movement
112 //////////////////////////////////////////////////////////////////////////////
113 // CBotProfileWanderBase //
114 //////////////////////////////////////////////////////////////////////////////
116 class CBotProfileWanderBase
117 : public CAIBaseProfile
120 CBotProfileWanderBase();
122 void setTimer(uint32 ticks
);
123 bool testTimer() const;
129 //////////////////////////////////////////////////////////////////////////////
130 // CBotProfileStandAtPos //
131 //////////////////////////////////////////////////////////////////////////////
133 class CBotProfileStandAtPos
134 : public CBotProfileWanderBase
135 , public NLMISC::IDbgPtrData
138 CBotProfileStandAtPos(CProfileOwner
* owner
);
140 /// @name IAIProfile implementation
142 virtual void beginProfile();
143 virtual void endProfile();
144 virtual void updateProfile(uint ticksSinceLastUpdate
);
145 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::BOT_STAND_AT_POS
; }
146 virtual std::string
getOneLineInfoString() const;
150 NLMISC::CDbgPtr
<CSpawnBotNpc
> _Bot
;
153 //////////////////////////////////////////////////////////////////////////////
154 // CBotProfileForage //
155 //////////////////////////////////////////////////////////////////////////////
157 class CBotProfileForage
158 : public CBotProfileWanderBase
159 , public NLMISC::IDbgPtrData
162 CBotProfileForage(CProfileOwner
* owner
);
163 virtual ~CBotProfileForage();
165 /// @name IAIProfile implementation
167 virtual void beginProfile();
168 virtual void endProfile();
169 virtual void updateProfile(uint ticksSinceLastUpdate
);
170 virtual AITYPES::TProfiles
getAIProfileType () const { return AITYPES::BOT_FORAGE
; }
171 virtual std::string
getOneLineInfoString() const;
177 NLMISC::CDbgPtr
<CSpawnBotNpc
> _Bot
;
179 CAITimer _ForageTimer
;
180 AISHEETS::ICreatureCPtr _OldSheet
;
181 bool _TemporarySheetUsed
;
184 //////////////////////////////////////////////////////////////////////////////
185 // CActivityProfile //
186 //////////////////////////////////////////////////////////////////////////////
188 class CActivityProfile
189 : public CAIBaseProfile
193 //////////////////////////////////////////////////////////////////////////////
194 // CGrpProfileNormal //
195 //////////////////////////////////////////////////////////////////////////////
197 class CGrpProfileNormal
198 : public CActivityProfile
201 CGrpProfileNormal(CProfileOwner
* owner
);
203 /// @name IAIProfile implementation
205 virtual void beginProfile();
206 virtual void endProfile();
207 virtual void updateProfile(uint ticksSinceLastUpdate
);
208 virtual AITYPES::TProfiles
getAIProfileType () const { return AITYPES::ACTIVITY_NORMAL
; }
209 virtual std::string
getOneLineInfoString() const;
212 bool isGroupFighting() const;
213 void setGroupFighting(bool groupFighting
);
216 NLMISC::CDbgPtr
<CSpawnGroupNpc
> _Grp
;
220 //////////////////////////////////////////////////////////////////////////////
222 //////////////////////////////////////////////////////////////////////////////
223 // :TODO: Understand following comment, and act accordingly
224 // every bot add or remove must be done from a spawn/despawn/die event (and not this way!)
227 : public CAIBaseProfile
230 CSlaveProfile(CProfileOwner
* owner
);
232 /// @name IAIProfile partial implementation
234 virtual void beginProfile();
235 virtual void updateProfile(uint ticksSinceLastUpdate
);
238 virtual void addBot(CBot
* bot
) = 0;
239 virtual void removeBot(CBot
* bot
) = 0;
242 NLMISC::CDbgPtr
<CSpawnGroup
> _Grp
;
245 //////////////////////////////////////////////////////////////////////////////
247 //////////////////////////////////////////////////////////////////////////////
250 : public CSlaveProfile
253 CMoveProfile(CProfileOwner
* owner
) ;
255 virtual CPathCont
* getPathCont(CBot
const* bot
) = 0;
257 virtual void resumeBot(CBot
const* bot
);
264 //////////////////////////////////////////////////////////////////////////////
266 //////////////////////////////////////////////////////////////////////////////
269 : public CSlaveProfile
272 CFightProfile(CProfileOwner
* owner
);
274 virtual std::vector
<CBot
*>& npcList() = 0;
275 virtual bool stillHaveEnnemy() const = 0;
278 //////////////////////////////////////////////////////////////////////////////
279 // CGrpProfileGoToPoint //
280 //////////////////////////////////////////////////////////////////////////////
282 class CGrpProfileGoToPoint
283 : public CMoveProfile
286 /// @name Constructors, destructor
288 CGrpProfileGoToPoint(CProfileOwner
* owner
, RYAI_MAP_CRUNCH::CWorldPosition
const& startPos
, RYAI_MAP_CRUNCH::CWorldPosition
const& endPos
, bool dontSendEvent
= false);
289 virtual ~CGrpProfileGoToPoint();
301 virtual ~CBotFollower();
302 void setBotAtDest(bool atDest
= true);
303 const bool& isBotAtDest() const;
309 /// @name CMoveProfile implementation
311 virtual CPathCont
* getPathCont(CBot
const* bot
);
314 /// @name CSlaveProfile implementation
316 virtual void addBot(CBot
* bot
);
317 virtual void removeBot(CBot
* bot
);
320 /// @name IAIProfile implementation
322 virtual void beginProfile();
323 virtual void updateProfile(uint ticksSinceLastUpdate
);
324 virtual void endProfile();
325 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::MOVE_GOTO_POINT
; }
326 virtual std::string
getOneLineInfoString() const;
327 virtual void stateChangeProfile();
328 virtual void resumeProfile();
331 bool profileTerminated() const;
334 void setDirection(bool forward
);
338 void setCurrentDestination(RYAI_MAP_CRUNCH::CWorldPosition
const& dest
);
342 void stopNpc(bool stop
);
345 void assignGeometryFromState();
347 typedef std::map
<CBot
*, CBotFollower
> TBotFollowerMap
;
348 TBotFollowerMap _NpcList
;
352 bool _ProfileTerminated
;
353 bool _MustCalcRatios
;
355 RYAI_MAP_CRUNCH::CWorldPosition _StartPos
;
356 RYAI_MAP_CRUNCH::CWorldPosition _EndPos
;
358 /// flag to temporary stop the bots
361 // rectangle shape related vars.
368 uint32 _NbBotInNormalShape
;
373 CAIVector _GlobalOrient
;
375 AITYPES::TVerticalPos _VerticalPos
;
379 //////////////////////////////////////////////////////////////////////////////
380 // CGrpProfileFollowRoute //
381 //////////////////////////////////////////////////////////////////////////////
383 class CGrpProfileFollowRoute
384 : public CMoveProfile
387 CGrpProfileFollowRoute(CProfileOwner
* owner
, std::vector
<CShape::TPosition
> const& geometry
, AITYPES::TVerticalPos
const& verticalPos
, bool dontSendEvent
= false);
388 CGrpProfileFollowRoute(CProfileOwner
* owner
);
390 virtual ~CGrpProfileFollowRoute();
402 virtual ~CBotFollower();
403 void setBotAtDest(bool atDest
= true);
404 const bool& isBotAtDest() const;
410 void setDirection(bool forward
);
413 void resumeProfile();
415 CPathCont
* getPathCont(CBot
const* bot
);
417 void addBot(CBot
* bot
);
418 void removeBot(CBot
* bot
);
420 /// @name IAIProfile implementation
422 virtual void beginProfile();
423 virtual void updateProfile(uint ticksSinceLastUpdate
);
424 virtual void endProfile();
425 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::MOVE_FOLLOW_ROUTE
; }
426 virtual std::string
getOneLineInfoString() const;
429 bool profileTerminated() const;
431 void setCurrentValidPos(AITYPES::TVerticalPos verticalPos
);
435 virtual void stateChangeProfile();
437 void stopNpc(bool stop
);
440 void assignGeometryFromState();
442 typedef std::map
<CBot
*, CBotFollower
> TBotFollowerMap
;
443 TBotFollowerMap _NpcList
;
447 bool _ProfileTerminated
;
448 bool _MustCalcRatios
;
451 /// flag to temporary stop the bots
454 // rectangle shape related vars.
461 uint32 _NbBotInNormalShape
;
466 CAIVector _GlobalOrient
;
468 bool _GeometryComeFromState
;
469 std::vector
<CShape::TPosition
> const* _Geometry
;
470 AITYPES::TVerticalPos _VerticalPos
;
474 //////////////////////////////////////////////////////////////////////////////
475 // CGrpProfileStandOnVertices //
476 //////////////////////////////////////////////////////////////////////////////
478 class CGrpProfileStandOnVertices
479 : public CMoveProfile
483 class CBotPositionner
: public NLMISC::CRefCount
486 CBotPositionner(RYAI_MAP_CRUNCH::TAStarFlag flags
);
487 CBotPositionner(uint32 geomIndex
, RYAI_MAP_CRUNCH::TAStarFlag flags
);
488 void setBotAtDest(bool atDest
= true);
489 bool isBotAtDest() const;
497 CGrpProfileStandOnVertices(CProfileOwner
* owner
);
498 ~CGrpProfileStandOnVertices();
500 CPathCont
*getPathCont (const CBot
*bot
);
502 /// @name IAIProfile implementation
504 virtual void beginProfile();
505 virtual void updateProfile(uint ticksSinceLastUpdate
);
506 virtual void endProfile();
507 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::MOVE_STAND_ON_VERTICES
; }
508 virtual std::string
getOneLineInfoString() const;
510 void resumeProfile();
512 void setCurrentValidPos (CAIStatePositional
*grpState
);
514 void addBot(CBot
* bot
);
515 void removeBot(CBot
* bot
);
518 typedef std::map
<const CBot
*,NLMISC::CSmartPtr
<CBotPositionner
> > TNpcBotPositionnerMap
;
519 TNpcBotPositionnerMap _NpcList
;
521 RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags
;
524 //////////////////////////////////////////////////////////////////////////////
525 // CGrpProfileWander //
526 //////////////////////////////////////////////////////////////////////////////
528 class CGrpProfileWander
529 : public CMoveProfile
532 CGrpProfileWander(CProfileOwner
* owner
);
533 CGrpProfileWander(CProfileOwner
* owner
, CNpcZone
const* const npcZone
);
534 virtual ~CGrpProfileWander();
536 void setBotStandProfile(AITYPES::TProfiles botStandProfileType
, IAIProfileFactory
* botStandProfileFactory
);
538 /// @name IAIProfile implementation
540 virtual void beginProfile();
541 virtual void updateProfile(uint ticksSinceLastUpdate
);
542 virtual void endProfile();
543 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::MOVE_WANDER
; }
544 virtual std::string
getOneLineInfoString() const;
547 void addBot (CBot
* bot
);
548 void removeBot (CBot
* bot
);
549 CPathCont
* getPathCont (CBot
const* bot
);
551 void stateChangeProfile();
553 void affectZoneFromStateMachine();
554 void resetDestinationReachedData();
556 void setTimer(uint32 ticks
) { _Timer
.set(ticks
); }
557 bool testTimer() const { return _Timer
.test(); }
559 CNpcZone
const* currentZone() const { return _NpcZone
; }
563 /// the profile type to apply to bot standing between two deplacement
564 AITYPES::TProfiles _BotStandProfileType
;
565 /// the profile factory to apply to bot standing between two deplacement
566 IAIProfileFactory
*_BotStandProfileFactory
;
567 /// a flag to force social interaction for the bots
570 NLMISC::CstCDbgPtr
<CPlaceRandomPos
> _RandomPos
;
571 NLMISC::CSmartPtr
<const CNpcZone
> _NpcZone
;
572 std::vector
<bool> _NpcDestinationReached
;
573 bool _DestinationReachedAll
;
574 bool _DestinationReachedFirst
;
579 //////////////////////////////////////////////////////////////////////////////
580 // CGrpProfileWanderNoPrim //
581 //////////////////////////////////////////////////////////////////////////////
583 /// This profile shouldn't require data primitive for wander zone
584 class CGrpProfileWanderNoPrim
585 : public CMoveProfile
588 // CGrpProfileWanderNoPrim(CProfileOwner* owner);
589 CGrpProfileWanderNoPrim(CProfileOwner
* owner
, NLMISC::CSmartPtr
<CNpcZonePlaceNoPrim
> const& npcZone
);
590 virtual ~CGrpProfileWanderNoPrim();
592 void setBotStandProfile(AITYPES::TProfiles botStandProfileType
, IAIProfileFactory
* botStandProfileFactory
);
594 /// @name IAIProfile implementation
596 virtual void beginProfile();
597 virtual void updateProfile(uint ticksSinceLastUpdate
);
598 virtual void endProfile();
599 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::MOVE_WANDER
; }
600 virtual std::string
getOneLineInfoString() const;
603 void addBot (CBot
* bot
);
604 void removeBot (CBot
* bot
);
605 CPathCont
* getPathCont (CBot
const* bot
);
607 void stateChangeProfile();
609 // void affectZoneFromStateMachine();
611 void setTimer(uint32 ticks
) { _Timer
.set(ticks
); }
612 bool testTimer() const { return _Timer
.test(); }
614 // CNpcZone const* currentZone() const { return _NpcZone; }
618 /// the profile type to apply to bot standing between two deplacement
619 AITYPES::TProfiles _BotStandProfileType
;
620 /// the profile factory to apply to bot standing between two deplacement
621 IAIProfileFactory
*_BotStandProfileFactory
;
622 /// a flag to force social interaction for the bots
625 // NLMISC::CstCDbgPtr<CPlaceRandomPos> _RandomPos;
626 NLMISC::CSmartPtr
<CNpcZonePlaceNoPrim
> _NpcZone
;
631 class CGrpProfileFollowPlayer
:
635 CGrpProfileFollowPlayer(CProfileOwner
* owner
, TDataSetRow
const& playerRow
, uint32 dispersionRadius
);
636 virtual ~CGrpProfileFollowPlayer() {}
638 void setBotStandProfile(AITYPES::TProfiles botStandProfileType
, IAIProfileFactory
* botStandProfileFactory
);
640 /// @name IAIProfile implementation
642 virtual void beginProfile();
643 virtual void updateProfile(uint ticksSinceLastUpdate
);
644 virtual void endProfile() {}
645 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::BOT_FOLLOW_POS
; }
646 virtual std::string
getOneLineInfoString() const { return std::string("follow_player group profile"); }
649 void stateChangeProfile() {}
650 bool destinationReach() const;
652 void addBot (CBot
* bot
) {}
653 void removeBot (CBot
* bot
) {}
654 CPathCont
* getPathCont (CBot
const* bot
) { return NULL
; };
659 /// the profile type to apply to bot standing between two deplacement
660 AITYPES::TProfiles _BotStandProfileType
;
661 /// the profile factory to apply to bot standing between two deplacement
662 IAIProfileFactory
*_BotStandProfileFactory
;
664 CFollowPath::TFollowStatus _Status
;
665 CPathPosition _PathPos
;
669 TDataSetRow _PlayerRow
;
670 uint32 _DispersionRadius
;
674 //////////////////////////////////////////////////////////////////////////////
675 // CGrpProfileIdle //
676 //////////////////////////////////////////////////////////////////////////////
678 class CGrpProfileIdle
679 : public CMoveProfile
682 CGrpProfileIdle(CProfileOwner
* owner
);
683 virtual ~CGrpProfileIdle();
685 class CBotPositionner
689 virtual ~CBotPositionner();
692 CPathCont
* getPathCont(CBot
const* bot
);
693 virtual void beginProfile();
694 void resumeProfile();
695 virtual void endProfile();
696 virtual void updateProfile(uint ticksSinceLastUpdate
);
698 void addBot(CBot
* bot
);
699 void removeBot(CBot
* bot
);
701 virtual std::string
getOneLineInfoString() const;
702 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::MOVE_IDLE
; }
705 typedef std::map
<CBot
*,CBotPositionner
> TNpcBotPositionnerMap
;
706 TNpcBotPositionnerMap _NpcList
;
709 //////////////////////////////////////////////////////////////////////////////
710 // CGrpProfileBandit //
711 //////////////////////////////////////////////////////////////////////////////
713 class CGrpProfileBandit
714 : public CGrpProfileNormal
717 CGrpProfileBandit(CProfileOwner
* owner
);
718 virtual ~CGrpProfileBandit();
720 /// @name IAIProfile implementation
722 virtual void beginProfile();
723 virtual void updateProfile(uint ticksSinceLastUpdate
);
724 virtual void endProfile();
725 virtual AITYPES::TProfiles
getAIProfileType () const { return AITYPES::ACTIVITY_BANDIT
; }
726 virtual std::string
getOneLineInfoString() const;
733 //////////////////////////////////////////////////////////////////////////////
734 // CGrpProfileEscorted //
735 //////////////////////////////////////////////////////////////////////////////
737 class CGrpProfileEscorted
738 : public CGrpProfileNormal
741 CGrpProfileEscorted(CProfileOwner
* owner
);
742 virtual ~CGrpProfileEscorted();
744 /// @name IAIProfile implementation
746 virtual void beginProfile();
747 virtual void updateProfile(uint ticksSinceLastUpdate
);
748 virtual void endProfile();
749 virtual AITYPES::TProfiles
getAIProfileType () const { return AITYPES::ACTIVITY_ESCORTED
; }
750 virtual std::string
getOneLineInfoString() const;
753 void stateChangeProfile();
756 bool _EscortTeamInRange
;
759 //////////////////////////////////////////////////////////////////////////////
760 // CGrpProfileGuard //
761 //////////////////////////////////////////////////////////////////////////////
763 class CGrpProfileGuard
764 : public CGrpProfileNormal
767 CGrpProfileGuard(CProfileOwner
* owner
);
768 virtual ~CGrpProfileGuard();
770 /// @name IAIProfile implementation
772 virtual void beginProfile();
773 virtual void updateProfile(uint ticksSinceLastUpdate
);
774 virtual void endProfile();
775 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::ACTIVITY_GUARD
; }
776 virtual std::string
getOneLineInfoString() const;
780 CAIVector _CenterPos
;
784 //////////////////////////////////////////////////////////////////////////////
785 // CGrpProfileGuardEscorted //
786 //////////////////////////////////////////////////////////////////////////////
788 class CGrpProfileGuardEscorted
789 : public CGrpProfileNormal
792 CGrpProfileGuardEscorted(CProfileOwner
* owner
);
793 virtual ~CGrpProfileGuardEscorted();
795 /// @name IAIProfile implementation
797 virtual void beginProfile();
798 virtual void updateProfile(uint ticksSinceLastUpdate
);
799 virtual void endProfile();
800 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::ACTIVITY_GUARD_ESCORTED
; }
801 virtual std::string
getOneLineInfoString() const;
804 void stateChangeProfile();
807 NLMISC::CSmartPtr
<CGrpProfileGuard
> _GuardProfile
;
808 NLMISC::CSmartPtr
<CGrpProfileEscorted
> _EscortedProfile
;
811 //////////////////////////////////////////////////////////////////////////////
812 // CGrpProfileFaction //
813 //////////////////////////////////////////////////////////////////////////////
815 class CGrpProfileFaction
816 : public CGrpProfileNormal
819 CGrpProfileFaction(CProfileOwner
* owner
);
820 virtual ~CGrpProfileFaction();
822 /// @name IAIProfile implementation
824 virtual void beginProfile();
825 virtual void updateProfile(uint ticksSinceLastUpdate
);
826 virtual void endProfile();
827 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::ACTIVITY_FACTION
; }
828 virtual std::string
getOneLineInfoString() const;
831 virtual void aggroEntity(CAIEntityPhysical
const* entity
);
832 void checkTargetsAround();
833 void noAssist() { bNoAssist
= true; }
835 static std::string
scriptFactionToFameFaction(std::string name
);
836 static std::string
fameFactionToScriptFaction(std::string name
);
838 static bool scriptFactionToFameFactionGreaterThan(std::string name
);
839 static sint32
scriptFactionToFameFactionValue(std::string name
);
843 CAITimer _checkTargetTimer
;
847 static AITYPES::CPropertySet _FameFactions
;
848 static void initFameFactions();
849 static bool entityHavePartOfFactions(CAIEntityPhysical
const* entity
, AITYPES::CPropertySetWithExtraList
<TAllianceId
> const& factions
);
852 //////////////////////////////////////////////////////////////////////////////
853 // CGrpProfileSquad //
854 // The Manager Parent of the Manager of this Grp class is COutpost //
855 //////////////////////////////////////////////////////////////////////////////
857 class CGrpProfileSquad
858 : public CGrpProfileFaction
861 CGrpProfileSquad(CProfileOwner
* owner
);
862 virtual ~CGrpProfileSquad();
864 /// @name IAIProfile implementation
866 virtual void beginProfile();
867 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::ACTIVITY_SQUAD
; }
868 virtual std::string
getOneLineInfoString() const;
871 virtual void aggroEntity(CAIEntityPhysical
const* entity
);
873 NLMISC::CSmartPtr
<CAIPlace
const> buildFirstHitPlace(TDataSetRow
const& aggroBot
);
877 /// Return the outpost to which the squad belongs, or NULL if not found
878 COutpost
* getDefendedOutpost() { return dynamic_cast<COutpost
*>(_Grp
->getPersistent().getOwner()->getOwner()); }
881 //////////////////////////////////////////////////////////////////////////////
882 // CGrpProfileFight //
883 //////////////////////////////////////////////////////////////////////////////
885 class CGrpProfileFight
886 : public CFightProfile
887 , public CFightOrganizer
889 // TODO : set this parameters thrue the group, no hardcode them
893 CHECK_AROUND_PERIOD
= 50, ///< Check every 5s
894 CHECK_AROUND_RADIUS
= 60, ///< Check 60 meters around
897 CGrpProfileFight(CProfileOwner
*owner
);
898 virtual ~CGrpProfileFight();
900 virtual void beginProfile();
903 void addBot (CBot
*bot
);
904 void removeBot (CBot
*bot
);
906 //////////////////////////////////////////////////////////////////////////
907 /// @name CFightOrganizer
909 virtual void setFight(CSpawnBot
* bot
, CAIEntityPhysical
* ennemy
);
910 virtual void setHeal(CSpawnBot
* bot
, CAIEntityPhysical
* target
);
911 virtual void setNoFight(CSpawnBot
* bot
);
912 virtual void setFlee(CSpawnBot
* bot
, CAIVector
& fleeVect
);
913 virtual void setReturnAfterFight(CSpawnBot
* bot
);
916 bool stillHaveEnnemy () const;
918 virtual void updateProfile(uint ticksSinceLastUpdate
);
920 virtual std::string
getOneLineInfoString() const;
922 virtual AITYPES::TProfiles
getAIProfileType() const { return AITYPES::FIGHT_NORMAL
; }
924 std::vector
<CBot
*> &npcList();
927 std::vector
<CBot
*> _NpcList
;
928 /// A timer to check the friend groups around and set their aggro list if they are not fighting
929 CAITimer _CheckAround
;
933 /****************************************************************************/
934 /* Profile factories */
935 /****************************************************************************/
937 //- Simple profile factories (based on generic factory) ----------------------
939 // CBotProfileStandAtPos
940 typedef CAIGenericProfileFactory
<CBotProfileStandAtPos
> CBotProfileStandAtPosFactory
;
943 typedef CAIGenericProfileFactory
<CBotProfileForage
> CBotProfileForageFactory
;
946 typedef CAIGenericProfileFactory
<CGrpProfileNormal
> CGrpProfileNormalFactory
;
948 // CGrpProfileFollowRoute
949 typedef CAIGenericProfileFactory
<CGrpProfileFollowRoute
> CGrpProfileFollowRouteFactory
;
952 typedef CAIGenericProfileFactory
<CGrpProfileWander
> CGrpProfileWanderFactory
;
954 // CGrpProfileGuardFactory
955 typedef CAIGenericProfileFactory
<CGrpProfileGuard
> CGrpProfileGuardFactory
;
957 // CGrpProfileEscortedFactory
958 typedef CAIGenericProfileFactory
<CGrpProfileEscorted
> CGrpProfileEscortedFactory
;
960 // CGrpProfileGuardEscortedFactory
961 typedef CAIGenericProfileFactory
<CGrpProfileGuardEscorted
> CGrpProfileGuardEscortedFactory
;
963 // CGrpProfileFactionFactory
964 typedef CAIGenericProfileFactory
<CGrpProfileFaction
> CGrpProfileFactionFactory
;
966 // CGrpProfileSquadFactory
967 typedef CAIGenericProfileFactory
<CGrpProfileSquad
> CGrpProfileSquadFactory
;
969 // CGrpProfileStandOnVerticesFactory
970 typedef CAIGenericProfileFactory
<CGrpProfileStandOnVertices
> CGrpProfileStandOnVerticesFactory
;
972 //////////////////////////////////////////////////////////////////////////////
973 // CGrpProfileNoChange //
974 //////////////////////////////////////////////////////////////////////////////
976 /// No change special profile
977 class CGrpProfileNoChangeFactory
978 : public IAIProfileFactory
981 NLMISC::CSmartPtr
<IAIProfile
> createAIProfile(CProfileOwner
* owner
)
986 RYAI_DECLARE_PROFILE_FACTORY(CGrpProfileNoChangeFactory
);
988 //////////////////////////////////////////////////////////////////////////////
989 // CGrpProfileBanditFactory //
990 //////////////////////////////////////////////////////////////////////////////
992 class CGrpProfileBanditFactory
993 : public IAIProfileFactory
996 NLMISC::CSmartPtr
<IAIProfile
> createAIProfile(CProfileOwner
* owner
);
997 static float getDefaultBanditAggroRange();
999 static float _DefaultAggroRange
;
1002 //- Singleton profiles (stateless ones) --------------------------------------
1004 extern CBotProfileStandAtPosFactory BotProfileStandAtPosFactory
;
1005 extern CBotProfileForageFactory BotProfileForageFactory
;