00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef __cplusplus
00024
00025 # ifndef OGS_CORE_CHARACTER_H
00026 # define OGS_CORE_CHARACTER_H
00027
00028 # include <vector>
00029 # include <map>
00030
00031 # include <ogs/Support.h>
00032 # include <ogs/core/Creature.h>
00033 # include <ogs/core/Die.h>
00034 # include <ogs/core/Experience.h>
00035 # include <ogs/core/Skill.h>
00036 # include <ogs/core/Namespace.h>
00037
00038 OGS_BEGIN_CORE_NAMESPACE
00039
00040 class CClass;
00041 class Feat;
00042 class Ability;
00043
00050 class Character: public ogs::support::Object,
00051 public ogs::support::Observer {
00052 public:
00053 class Advance;
00054
00055 Character (Creature& creature, CClass& cclass);
00056
00057 Creature& getCreature () const;
00058 XP::Points getPoints () const;
00059 void setPoints (XP::Points xpPoints);
00060 XP::Level getLevel () const;
00061
00062 const Advance& getAdvance (XP::Level xpLevel) const;
00063 bool canAdvance () const;
00064 void advanceCClass (CClass& cclass);
00065 Skill::Points getSkillPoints () const;
00066 bool canIncreaseAbility () const;
00067
00068 private:
00069 typedef std::vector<Advance> AdvanceOrder;
00070
00071 Creature* _creature;
00072 XP::Points _xpPoints;
00073 AdvanceOrder _advanceOrder;
00074 };
00075
00084 class Character::Advance {
00085 public:
00086 Advance ();
00087 Advance (CClass& cclass);
00088
00089 CClass& getCClass () const;
00090 Die::Value getHitPoints () const;
00091 Skill::Points getSkillPoints () const;
00092 void addSkill (Skill* skill, Skill::Points skillPoints);
00093 Ability* getAbilityIncrease () const;
00094 void increaseAbility (Ability* ability);
00095
00096 private:
00097 typedef std::map<Skill*, Skill::Points> Skills;
00098 typedef std::vector<Feat*> Feats;
00099
00100 CClass* _cclass;
00101 Die::Value _hitPoints;
00102 Ability* _ability;
00103 Skills _skills;
00104 Feats _feats;
00105 };
00106
00112 inline Creature&
00113 Character::getCreature () const {
00114 return (*(this->_creature));
00115 }
00116
00122 inline XP::Points
00123 Character::getPoints () const {
00124 return (this->_xpPoints);
00125 }
00126
00133 inline XP::Level
00134 Character::getLevel () const {
00135 return (XP::getLevel (this->_xpPoints));
00136 }
00137
00143 inline bool
00144 Character::canAdvance () const {
00145 return (getLevel () > this->_advanceOrder.size ());
00146 }
00147
00153 inline CClass&
00154 Character::Advance::getCClass () const {
00155 return (*(this->_cclass));
00156 }
00157
00163 inline Ability*
00164 Character::Advance::getAbilityIncrease () const {
00165 return (this->_ability);
00166 }
00167
00168 OGS_END_CORE_NAMESPACE
00169
00170 # endif
00171
00172 #endif
00173