Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

Creature.h

00001 /*
00002  * Creature.h -- class interface for creatures
00003  * Copyright (C) 2002  Eric Lemings <elemings@users.sourceforge.net>
00004  *
00005  * This software is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This software is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this software; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00018  * 02111-1307, USA
00019  *
00020  * RCS: $Id: Creature.h,v 1.11 2003/04/18 01:41:02 elemings Exp $
00021  */
00022 
00023 #ifdef __cplusplus
00024 
00025 #  ifndef OGS_CORE_CREATURE_H
00026 #    define OGS_CORE_CREATURE_H
00027 
00028 #    include <list>
00029 #    include <vector>
00030 
00031 #    include <ogs/core/Abilities.h>
00032 #    include <ogs/core/BodyPart.h>
00033 #    include <ogs/core/Die.h>
00034 #    include <ogs/core/Entity.h>
00035 #    include <ogs/core/Modifiers.h>
00036 #    include <ogs/core/Namespace.h>
00037 #    include <ogs/core/Saves.h>
00038 #    include <ogs/core/Types.h>
00039 
00040 OGS_BEGIN_CORE_NAMESPACE
00041 
00042 class Character;
00043 class Feat;
00044 class Item;
00045 class Skill;
00046 
00056 class Creature: public Entity {
00057   public:
00059     typedef std::list<BodyPart> Body;
00060 
00061     const Die& getHitDice () const;
00062     Die& getHitDice ();
00063 
00064     const Modifiers& getInitiative () const;
00065     Modifiers& getInitiative ();
00066     Die::Value rollInitiative () const;
00067 
00068     const Saves& getSaves () const;
00069     Saves& getSaves ();
00070 
00071     const Abilities& getAbilities () const;
00072     Abilities& getAbilities ();
00073 
00074     Skills getSkills () const;
00075     bool addSkill (Skill& skill);
00076     bool removeSkill (Skill& skill);
00077 
00078     Feats getFeats () const;
00079     bool addFeat (Feat& feat);
00080     bool removeFeat (Feat& feat);
00081 
00082     Body getBody () const;
00083     bool equipItem (Item& item);
00084     bool equipItem (Item& item, BodyPart& part);
00085     bool unequipItem (Item& item);
00086 
00087     Character* getCharacter () const;
00088 
00089     virtual ~Creature () = 0;
00090 
00091   protected:
00100     typedef std::vector<BodyPart::Type> Parts;
00101 
00102     Creature (Die hitDice, Abilities abilities,
00103               Size::Type size = Size::MEDIUM,
00104               Parts parts = Parts ());
00105 
00106   private:
00107     Die _hitDice;
00108     Modifiers _initiative;
00109     //TODO: Add moves;
00110     Saves _saves;
00111     Abilities _abilities;
00112     Skills _skills;
00113     Feats _feats;
00114     Body _body;
00115     Character* _character;
00116 
00117     Modifier _fortModifier;
00118     Modifier _refModifier;
00119     Modifier _willModifier;
00120 };
00121 
00127 inline const Die&
00128 Creature::getHitDice () const {
00129   return (this->_hitDice);
00130 }
00131 
00138 inline Die&
00139 Creature::getHitDice () {
00140   return (this->_hitDice);
00141 }
00142 
00148 inline const Modifiers&
00149 Creature::getInitiative () const {
00150   return (this->_initiative);
00151 }
00152 
00160 inline Modifiers&
00161 Creature::getInitiative () {
00162   return (this->_initiative);
00163 }
00164 
00172 inline Die::Value
00173 Creature::rollInitiative () const {
00174   return (Die::roll () + _initiative.getValue ());
00175 }
00176 
00182 inline const Abilities&
00183 Creature::getAbilities () const {
00184   return (this->_abilities);
00185 }
00186 
00194 inline Abilities&
00195 Creature::getAbilities () {
00196   return (this->_abilities);
00197 }
00198 
00204 inline const Saves&
00205 Creature::getSaves () const {
00206   return (this->_saves);
00207 }
00208 
00216 inline Saves&
00217 Creature::getSaves () {
00218   return (this->_saves);
00219 }
00220 
00226 inline Skills
00227 Creature::getSkills () const {
00228   return (this->_skills);
00229 }
00230 
00236 inline Feats
00237 Creature::getFeats () const {
00238   return (this->_feats);
00239 }
00240 
00246 inline Creature::Body
00247 Creature::getBody () const {
00248   return (this->_body);
00249 }
00250 
00258 inline Character*
00259 Creature::getCharacter () const {
00260   return (this->_character);
00261 }
00262 
00263 inline Creature::~Creature () { }
00264 
00265 OGS_END_CORE_NAMESPACE
00266 
00267 #  endif /* !defined OGS_CORE_CREATURE_H */
00268 
00269 #endif /* defined __cplusplus */
00270 

Generated on Sun Apr 20 03:36:16 2003 for Open Gaming System (OGS) by doxygen1.3