📄 directive.h
字号:
////////////////////////////////////////////////////////////////////////// Filename : Directive.h// Written By : 辫己刮// Description : // MonsterAI俊辑 青悼阑 搬沥窍绰 Directive客 DirectiveSet阑 // 备泅秦初篮 颇老捞促.////////////////////////////////////////////////////////////////////////#ifndef __DIRECTIVE_H__#define __DIRECTIVE_H__#include "Types.h"#include "Exception.h"#include <algorithm>////////////////////////////////////////////////////////////////////////// 炼扒 惑荐////////////////////////////////////////////////////////////////////////enum{ DIRECTIVE_COND_ENEMY_RANGE_MELEE = 0, // 0 DIRECTIVE_COND_ENEMY_RANGE_MISSILE, // 1 DIRECTIVE_COND_ENEMY_RANGE_CLOSE, // 2 DIRECTIVE_COND_ENEMY_RANGE_OUT_OF_SIGHT, // 3 DIRECTIVE_COND_ENEMY_DYING, // 4 DIRECTIVE_COND_ENEMY_NOT_BLOOD_DRAINED, // 5 DIRECTIVE_COND_ENEMY_NOT_GREEN_POISONED, // 6 DIRECTIVE_COND_ENEMY_NOT_YELLOW_POISONED, // 7 DIRECTIVE_COND_ENEMY_NOT_DARKBLUE_POISONED, // 8 DIRECTIVE_COND_ENEMY_NOT_GREEN_STALKERED, // 9 DIRECTIVE_COND_ENEMY_NOT_PARALYZED, // 10 DIRECTIVE_COND_ENEMY_NOT_DOOMED, // 11 DIRECTIVE_COND_ENEMY_NOT_BLINDED, // 12 DIRECTIVE_COND_ENEMY_NOT_IN_DARKNESS, // 13 DIRECTIVE_COND_ENEMY_NOT_SEDUCTION, // 14 DIRECTIVE_COND_IM_OK, // 15 DIRECTIVE_COND_IM_DYING, // 16 DIRECTIVE_COND_IM_DAMAGED, // 17 DIRECTIVE_COND_IM_HIDING, // 18 DIRECTIVE_COND_IM_WOLF, // 19 DIRECTIVE_COND_IM_BAT, // 20 DIRECTIVE_COND_IM_INVISIBLE, // 21 DIRECTIVE_COND_IM_WALKING_WALL, // 22 DIRECTIVE_COND_TIMING_BLOOD_DRAIN, // 23 // 2002.9.4 DIRECTIVE_COND_MASTER_SUMMON_TIMING, // 24 DIRECTIVE_COND_MASTER_NOT_READY, // 25 DIRECTIVE_COND_IM_IN_BAD_POSITION, // 26 DIRECTIVE_COND_FIND_WEAK_ENEMY, // 27 DIRECTIVE_COND_ENEMY_NOT_DEATH, // 28 DIRECTIVE_COND_ENEMY_NOT_HALLUCINATION, // 29 // 2002.9.16 DIRECTIVE_COND_TIMING_MASTER_BLOOD_DRAIN, // 30 // 2002.9.23 DIRECTIVE_COND_TIMING_DUPLICATE_SELF, // 31 // 2002.9.24 DIRECTIVE_COND_ENEMY_RANGE_IN_MISSILE, // 32 // 2002.10.1 DIRECTIVE_COND_POSSIBLE_SUMMON_MONSTERS, // 33 // 2003.4.14 DIRECTIVE_COND_ENEMY_TILE_NOT_ACID_SWAMP, // 34 DIRECTIVE_COND_ENEMY_ON_AIR, // 35 DIRECTIVE_COND_ENEMY_ON_SAFE_ZONE, // 36 DIRECTIVE_COND_MAX};const string DirectiveCondition2String[] = { "EnemyRangeMelee", "EnemyRangeMissile", "EnemyRangeClose", "EnemyRangeOutOfSight", "EnemyDying", "EnemyNotBloodDrained", "EnemyNotGreenPoisoned", "EnemyNotYellowPoisoned", "EnemyNotDarkbluePoisoned", "EnemyNotGreenStalkered", "EnemyNotParalyzed", "EnemyNotDoomed", "EnemyNotBlinded", "EnemyNotInDarkness", "EnemyNotSeduction", "ImOK", "ImDying", "ImDamaged", "ImHiding", "ImWolf", "ImBat", "ImInvisible", "ImWalkingWall", "TimingBloodDrain", // 2002.9.4 "MasterSummonTiming", "MasterNotReady", "ImInBadPosition", "FindWeakEnemy", "EnemyNotDeath", "EnemyNotHallucination", // 2002.9.16 "TimingMasterBloodDrain", // 2002.9.23 "TimingDuplicateSelf", // 2002.9.24 "EnemyRangeInMissile", // 2002.10.1 "PossibleSummonMonsters", // 31 // 2003.4.14 "EnemyTileNotAcidSwamp", // 32 "EnemyOnAir", // 33 "EnemyOnSafeZone", // 34 "ConditionMAX"};////////////////////////////////////////////////////////////////////////// 青悼 惑荐////////////////////////////////////////////////////////////////////////enum{ DIRECTIVE_ACTION_APPROACH = 0, // 0 DIRECTIVE_ACTION_FLEE, // 1 DIRECTIVE_ACTION_USE_SKILL, // 2 DIRECTIVE_ACTION_FORGET, // 3 DIRECTIVE_ACTION_CHANGE_ENEMY, // 4 DIRECTIVE_ACTION_MOVE_RANDOM, // 5 DIRECTIVE_ACTION_WAIT, // 6 DIRECTIVE_ACTION_FAST_FLEE, // 7 DIRECTIVE_ACTION_MAX};const string DirectiveAction2String[] = { "Approach", // 0 "Flee", // 1 "UseSkill", // 2 "Forget", // 3 "ChangeEnemy", // 4 "MoveRandom", // 5 "Wait", // 6 "FastFlee", // 7 "ActionMAX"};////////////////////////////////////////////////////////////////////////// class Directive//// 窍唱狼 咀记俊 措茄 烙狼狼 炼扒甸阑 笼绢持篮 努贰胶捞促.// 溜 炼扒苞, 弊 咀记俊 鞘夸茄 颇扼固磐, 弊府绊 犬伏, 吝夸己 殿阑// 苟媚初篮 努贰胶...////////////////////////////////////////////////////////////////////////class Directive{///// Member methods ///// public: Directive() throw(); ~Directive() throw();public: list<int>& getConditions(void) throw() { return m_Conditions; } void addCondition(int condition) throw(); int getAction(void) const throw() { return m_Action; } void setAction(int action) throw() { m_Action = action; } int getParameter(void) const throw() { return m_Parameter; } void setParameter(int parameter) throw() { m_Parameter = parameter; } int getRatio(void) const throw() { return m_Ratio; } void setRatio(int ratio) throw() { m_Ratio = ratio; } int getWeight(void) const throw() { return m_Weight; } void setWeight(int weight) throw() { m_Weight = weight; } string toString(void) throw(); bool hasCondition( int condition ) const { return find(m_Conditions.begin(), m_Conditions.end(), condition)!=m_Conditions.end(); }///// Member data ///// protected: list<int> m_Conditions; int m_Action; int m_Parameter; int m_Ratio; int m_Weight;};////////////////////////////////////////////////////////////////////////// class DirectiveSet//// Directive 努贰胶狼 笼钦捞促. 盔贰 Directive狼 Weight 函荐甫 // 捞侩窍咯 家泼阑 啊瓷窍霸 父甸妨绊 沁绰单, 积阿焊促 府胶飘甫// 家泼窍绰 霸 蓖满酒辑 弊成 笼绢持绰 鉴辑措肺 快急鉴困啊 臭篮 巴栏肺// 牢侥窍档废 沁促.(MonsterAI 曼炼)////////////////////////////////////////////////////////////////////////class DirectiveSet{///// Member methods ///// public: DirectiveSet() throw(); ~DirectiveSet() throw();public: const list<Directive*>& getDirectives(void) const throw() { return m_Directives; } const list<Directive*>& getDeadDirectives(void) const throw() { return m_DeadDirectives; } void addDirective(Directive* pDirective) throw(); void addDeadDirective(Directive* pDirective) throw(); void clear() throw(); string getName(void) const throw() { return m_Name; } void setName(const string& name) throw() { m_Name = name; } bool hasCondition( int condition ) const; bool canAttackAir() const { return m_bAttackAir; } void setAttackAir(bool bAA) { m_bAttackAir = bAA; } bool canSeeSafeZone() const { return m_bSeeSafeZone; } void setSeeSafeZone( bool bSS ) { m_bSeeSafeZone = bSS; }///// Member data /////protected: list<Directive*> m_Directives; list<Directive*> m_DeadDirectives; string m_Name; bool m_bAttackAir; bool m_bSeeSafeZone;};////////////////////////////////////////////////////////////////////////// class DirectiveSetManager////////////////////////////////////////////////////////////////////////class DirectiveSetManager{///// Member methods /////public: DirectiveSetManager() throw(); ~DirectiveSetManager() throw();public: // 按眉甫 檬扁拳茄促. void init() throw(); // DB肺何磐 directive set阑 肺靛茄促. void load() throw(); // 瘤沥等 鸥涝狼 directive set 器牢磐甫 馆券茄促. DirectiveSet* getDirectiveSet(uint index) throw();protected: // 巩磊凯阑 颇教秦辑 瘤沥等 牢郸胶俊 directive set阑 积己茄促. void createDirectiveSet(uint index, const string& name, const string& text, const string& deadtext) throw(); // directive俊 叠妨坷绰 颇扼固磐甸阑 颇教茄促. void parseDirectiveParameter(Directive* pDirective, const string& text, int mode) throw(); // 巩磊凯肺何磐 condition 蔼阑 府畔茄促. int getCondition(const string& token) throw(); // 巩磊凯肺何磐 action 蔼阑 府畔茄促. int getAction(const string& token) throw(); // 巩磊凯肺何磐 颇扼固磐 蔼阑 府畔茄促. int getParameter(const string& token) throw(); // 巩磊凯肺何磐 犬伏阑 府畔茄促. int getRatio(const string& token) throw();///// Member data /////protected: uint m_nSetCount; DirectiveSet** m_ppSet;};extern DirectiveSetManager* g_pDirectiveSetManager;#endif // __DIRECTIVESETMANAGER_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -