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

CClass.h

00001 /*
00002  * CClass.h -- class interface for character classes
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: CClass.h,v 1.6 2003/04/13 05:25:51 elemings Exp $
00021  */
00022 
00023 #ifdef __cplusplus
00024 
00025 #  ifndef OGS_CORE_CCLASS_H
00026 #    define OGS_CORE_CCLASS_H
00027 
00028 #    include <ogs/support/Attachable.h>
00029 #    include <ogs/support/Object.h>
00030 #    include <ogs/core/Character.h>
00031 #    include <ogs/core/Die.h>
00032 #    include <ogs/core/Experience.h>
00033 #    include <ogs/core/Modifier.h>
00034 #    include <ogs/core/Namespace.h>
00035 #    include <ogs/core/Saves.h>
00036 #    include <ogs/core/Skill.h>
00037 
00038 OGS_BEGIN_CORE_NAMESPACE
00039 
00054 class CClass: public ogs::support::Object,
00055               public ogs::support::Attachable {
00056   public:
00057     virtual ~CClass () = 0;
00058 
00059     virtual bool attachObject (ogs::support::Object& object);
00060     virtual bool detachObject ();
00061     ogs::support::Object* getObject () const;
00062 
00063     Die::Sides getHitDie () const;
00064     Skill::Points getSkillRate () const;
00065     XP::Level getLevel () const;
00066     void setLevel (XP::Level xpLevel);
00067 
00068   protected:
00069     CClass (Die::Sides hitDie, Skill::Points skillRate,
00070             XP::Level xpLevel, Modifier::Value baseAttack,
00071             Modifier::Value baseFort, Modifier::Value baseRef,
00072             Modifier::Value baseWill);
00073 
00074     virtual bool canAttach (const Object& object) const;
00075     virtual bool canDetach () const;
00076 
00077     virtual void updateCClass ();
00078 
00079   private:
00080     Die::Sides _hitDie;
00081     Skill::Points _skillRate;
00082     XP::Level _xpLevel;
00083     Modifier _baseAttack;
00084     Modifier _baseFortSave;
00085     Modifier _baseRefSave;
00086     Modifier _baseWillSave;
00087     Character* _character;
00088 };
00089 
00096 inline ogs::support::Object*
00097 CClass::getObject () const {
00098   return (this->_character);
00099 }
00100 
00106 inline Die::Sides
00107 CClass::getHitDie () const {
00108   return (this->_hitDie);
00109 }
00110 
00118 inline Skill::Points
00119 CClass::getSkillRate () const {
00120   return (this->_skillRate);
00121 }
00122 
00128 inline XP::Level
00129 CClass::getLevel () const {
00130   return (this->_xpLevel);
00131 }
00132 
00141 inline bool
00142 CClass::canAttach (const Object& object) const {
00143   return (&object != this && _character == NULL &&
00144           dynamic_cast<const Character*> (&object) != NULL);
00145 }
00146 
00153 inline bool
00154 CClass::canDetach () const {
00155   return (false);
00156 }
00157 
00158 inline CClass::~CClass () { }
00159 
00160 OGS_END_CORE_NAMESPACE
00161 
00162 #  endif /* !defined OGS_CORE_CCLASS_H */
00163 
00164 #endif /* defined __cplusplus */
00165 

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