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

CureWounds.h

00001 /*
00002  * CureWounds.h -- class interface for cure wounds spells
00003  * Copyright (C) 2003  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: CureWounds.h,v 1.3 2003/04/18 01:41:07 elemings Exp $
00021  */
00022 
00023 #ifdef __cplusplus
00024 
00025 #  ifndef OGS_SPELLS_CONJURATIONS_CURE_WOUNDS_H
00026 #    define OGS_SPELLS_CONJURATIONS_CURE_WOUNDS_H
00027 
00028 #    include <ogs/core/Die.h>
00029 #    include <ogs/core/Experience.h>
00030 #    include <ogs/magic/Subschool.h>
00031 #    include <ogs/spells/Conjuration.h>
00032 #    include <ogs/spells/conjurations/Namespace.h>
00033 
00034 OGS_BEGIN_SPELLS_CONJURATIONS_NAMESPACE
00035 
00036 class ogs::core::Entity;
00037 
00052 class CureWounds: public ogs::spells::Conjuration {
00053   public:
00055     typedef ogs::core::XP::Level CasterLevel;
00056 
00058     typedef ogs::core::Entity* Target;
00059 
00061     enum Degree {
00062 
00064       MINOR,
00065 
00069       LIGHT,
00070 
00074       MODERATE,
00075 
00079       SERIOUS,
00080 
00084       CRITICAL,
00085     };
00086 
00087     static CureWounds*
00088     createMinor                    (CasterLevel casterLevel,
00089                                     bool inflict = false);
00090     static CureWounds*
00091     createLight                    (CasterLevel casterLevel,
00092                                     bool inflict = false);
00093     static CureWounds*
00094     createModerate                 (CasterLevel casterLevel,
00095                                     bool inflict = false);
00096     static CureWounds*
00097     createSerious                  (CasterLevel casterLevel,
00098                                     bool inflict = false);
00099     static CureWounds*
00100     createCritical                 (CasterLevel casterLevel,
00101                                     bool inflict = false);
00102 
00103     const ogs::magic::School& getSchool () const;
00104     ogs::magic::Spell::Components getComponents () const;
00105     ogs::magic::Range getRange () const;
00106 
00107     Degree getDegree () const;
00108     Target getTarget () const;
00109     void setTarget (Target target);
00110     bool inflictsWounds () const;
00111 
00112     void castSpell ();
00113 
00114   protected:
00115     CureWounds (CasterLevel casterLevel,
00116                 Degree degree,
00117                 bool inflict = false);
00118 
00119   private:
00120     CasterLevel _casterLevel;
00121     Target _target;
00122     Degree _degree;
00123     bool _inflict;
00124 
00125     ogs::core::Die::Value rollHitPoints () const;
00126     bool checkTargetWillSave () const;
00127     bool checkTargetSpellResistance () const;
00128 };
00129 
00137 inline CureWounds*
00138 CureWounds::createMinor            (CasterLevel casterLevel,
00139                                     bool inflict) {
00140   return (new CureWounds (casterLevel, MINOR, inflict));
00141 }
00142 
00150 inline CureWounds*
00151 CureWounds::createLight            (CasterLevel casterLevel,
00152                                     bool inflict) {
00153   return (new CureWounds (casterLevel, LIGHT));
00154 }
00155 
00163 inline CureWounds*
00164 CureWounds::createModerate         (CasterLevel casterLevel,
00165                                     bool inflict) {
00166   return (new CureWounds (casterLevel, MODERATE));
00167 }
00168 
00176 inline CureWounds*
00177 CureWounds::createSerious          (CasterLevel casterLevel,
00178                                     bool inflict) {
00179   return (new CureWounds (casterLevel, SERIOUS, inflict));
00180 }
00181 
00189 inline CureWounds*
00190 CureWounds::createCritical         (CasterLevel casterLevel,
00191                                     bool inflict) {
00192   return (new CureWounds (casterLevel, CRITICAL, inflict));
00193 }
00194 
00201 inline const ogs::magic::School&
00202 CureWounds::getSchool () const {
00203   using ogs::magic::Subschool;
00204   static Subschool subschool (Subschool::HEALING);
00205   return (subschool);
00206 }
00207 
00214 inline ogs::magic::Range
00215 CureWounds::getRange () const {
00216   return (ogs::magic::Range::Touch ());
00217 }
00218 
00227 inline CureWounds::Target
00228 CureWounds::getTarget () const {
00229   return (this->_target);
00230 }
00231 
00238 inline void
00239 CureWounds::setTarget (Target target) {
00240   this->_target = target;
00241 }
00242 
00248 inline CureWounds::Degree
00249 CureWounds::getDegree () const {
00250   return (this->_degree);
00251 }
00252 
00258 inline bool
00259 CureWounds::inflictsWounds () const {
00260   return (this->_inflict);
00261 }
00262 
00263 OGS_END_SPELLS_CONJURATIONS_NAMESPACE
00264 
00265 #  endif /* !defined OGS_SPELLS_CONJURATIONS_CURE_WOUNDS_H */
00266 
00267 #endif /* defined __cplusplus */
00268 

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