📄 trigger.h
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : Trigger.h// Written By : // Description ://////////////////////////////////////////////////////////////////////////////#ifndef __TRIGGER_H__#define __TRIGGER_H__#include "Types.h"#include "Exception.h"#include <vector>#include "Condition.h"const string TriggerType2String [] = { "NPC_TRIGGER" , "QUEST_TRIGGER", "MONSTER_TRIGGER"};//////////////////////////////////////////////////////////////////////////////// class Trigger;//////////////////////////////////////////////////////////////////////////////class Action;class Creature;class Trigger {public: enum TriggerType { NPC_TRIGGER, QUEST_TRIGGER, MONSTER_TRIGGER }; enum TriggerMode { ACTIVE_TRIGGER, PASSIVE_TRIGGER, NEUTRAL_TRIGGER }; const static char Comment; const static char Separator; const static char EOL; const static char* WhiteSpaces; const static char* SpaceTab;public: Trigger() throw(Error); ~Trigger() throw(Error);public: void addCondition(Condition* pCondition) throw(Error); void addAction(Action* pAction) throw(Error); void addCounterAction(Action* pAction) throw(Error); bool hasCondition(ConditionType_t conditionType) const throw(Error) { return m_ConditionSet.test(conditionType); } bool isAllSatisfied(TriggerMode triggerMode, Creature* pCreature1, Creature* pCreature2 = NULL, void* pParam = NULL) const throw(Error); bool activate(Creature* pCreature1, Creature* pCreature2 = NULL) const throw(Error); bool activateCounter(Creature* pCreature1, Creature* pCreature2 = NULL) const throw(Error); string toString() const throw();public: TriggerType getTriggerType() const throw() { return m_TriggerType; } void setTriggerType(TriggerType triggerType) throw() { m_TriggerType = triggerType; } void setTriggerType(const string & triggerType) throw(Error) { if(triggerType == "NPC") m_TriggerType = NPC_TRIGGER; else if(triggerType == "QUEST") m_TriggerType = QUEST_TRIGGER; else if(triggerType == "MONSTER") m_TriggerType = MONSTER_TRIGGER; else throw Error("invalid triggerType"); } TriggerID_t getTriggerID() const throw() { return m_TriggerID; } void setTriggerID(TriggerID_t triggerID) throw() { m_TriggerID = triggerID; } QuestID_t getQuestID() const throw() { return m_QuestID; } void setQuestID(QuestID_t questID) throw() { m_QuestID = questID; } string getComment() const throw() { return m_Comment; } void setComment(string comment) throw() { m_Comment = comment; } ConditionSet & getConditionSet() throw() { return m_ConditionSet; } const ConditionSet & getConditionSet() const throw() { return m_ConditionSet; } void setConditions(const string & str) throw(Error); void setActions(const string & str) throw(Error); void setCounterActions(const string & str) throw(Error);private: // 飘府芭 鸥涝 TriggerType m_TriggerType; // 飘府芭 酒捞叼 TriggerID_t m_TriggerID; // 楷包登绰 涅胶飘 酒捞叼 // m_TriggerType == QUEST_TRIGGER 老 版快俊父 狼固啊 乐促. QuestID_t m_QuestID; // bitset of conditions for fastest reference ConditionSet m_ConditionSet; // comment string m_Comment; // vector of conditions vector<Condition*> m_Conditions; // vector of actions vector<Action*> m_Actions; // vector of counter actions vector<Action*> m_CounterActions;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -