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_SKILL_H
00026 # define OGS_CORE_SKILL_H
00027
00028 # include <ogs/Support.h>
00029 # include <ogs/core/Ability.h>
00030 # include <ogs/core/Experience.h>
00031 # include <ogs/core/Modifier.h>
00032 # include <ogs/core/Modifiers.h>
00033 # include <ogs/core/Namespace.h>
00034
00035 OGS_BEGIN_CORE_NAMESPACE
00036
00057 class Skill: public ogs::support::Object {
00058 public:
00062 typedef int Type;
00063
00068 typedef unsigned short int Points;
00069
00074 typedef unsigned short int Ranks;
00075
00076 static Points getMaximumPoints (XP::Level xpLevel);
00077 static XP::Level getMaximumPointsLevel (Points points);
00078
00079 Skill (Type type, Ability::Type keyAbility,
00080 bool useUntrained, bool useArmorPenalty,
00081 Points cclassPoints = 0);
00082 virtual ~Skill () { }
00083
00084 Type getType () const;
00085 Ability::Type getKeyAbility () const;
00086 bool useUntrained () const;
00087 bool useArmorPenalty () const;
00088
00089 Points getMaximumPoints () const;
00090 void setMaximumPoints (Points points);
00091 Ranks getMaximumRanks () const;
00092 Points getCurrentPoints (bool cclassSkill = true) const;
00093 void setCurrentPoints (Points points, bool cclassSkill = true);
00094 Ranks getCurrentRanks () const;
00095 Modifiers& getModifiers ();
00096
00097 protected:
00098 static Ranks getRanks (Points cclassPoints, Points xclassPoints);
00099 bool checkMaximumRanks (Points points, bool cclassSkill);
00100
00101 private:
00102 Type _type;
00103 Ability::Type _keyAbility;
00104 bool _useUntrained;
00105 bool _useArmorPenalty;
00106 Points _cclassPoints;
00107 Points _xclassPoints;
00108 Points _maxPoints;
00109 Modifier _rankModifier;
00110 Modifiers _modifiers;
00111 };
00112
00118 inline Skill::Type
00119 Skill::getType () const {
00120 return (this->_type);
00121 }
00122
00129 inline Ability::Type
00130 Skill::getKeyAbility () const {
00131 return (this->_keyAbility);
00132 }
00133
00140 inline bool
00141 Skill::useUntrained () const {
00142 return (this->_useUntrained);
00143 }
00144
00150 inline bool
00151 Skill::useArmorPenalty () const {
00152 return (this->_useArmorPenalty);
00153 }
00154
00165 inline Skill::Points
00166 Skill::getMaximumPoints (XP::Level xpLevel) {
00167 return (xpLevel < 1? 0: xpLevel + 3);
00168 }
00169
00177 inline XP::Level
00178 Skill::getMaximumPointsLevel (Points points) {
00179 return (points < 4? 0: points - 3);
00180 }
00181
00193 inline Skill::Points
00194 Skill::getMaximumPoints () const {
00195 return (this->_maxPoints);
00196 }
00197
00206 inline Skill::Ranks
00207 Skill::getMaximumRanks () const {
00208 return (this->_cclassPoints > 0? this->_maxPoints:
00209 this->_maxPoints / 2);
00210 }
00211
00222 inline Skill::Points
00223 Skill::getCurrentPoints (bool cclassSkill) const {
00224 return (cclassSkill? this->_cclassPoints: this->_xclassPoints);
00225 }
00226
00234 inline Skill::Ranks
00235 Skill::getCurrentRanks () const {
00236 return (getRanks (this->_cclassPoints, this->_xclassPoints));
00237 }
00238
00244 inline Modifiers&
00245 Skill::getModifiers () {
00246 return (this->_modifiers);
00247 }
00248
00255 inline Skill::Ranks
00256 Skill::getRanks (Points cclassPoints, Points xclassPoints) {
00257 return (cclassPoints + (xclassPoints / 2));
00258 }
00259
00260 OGS_END_CORE_NAMESPACE
00261
00262 # endif
00263
00264 #endif
00265