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

Experience.h

00001 /*
00002  * Experience.h -- class interface for experiences
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: Experience.h,v 1.5 2003/04/18 01:41:02 elemings Exp $
00021  */
00022 
00023 #ifdef __cplusplus
00024 
00025 #  ifndef OGS_CORE_EXPERIENCE_H
00026 #    define OGS_CORE_EXPERIENCE_H
00027 
00028 #    include <string>
00029 
00030 #    include <ogs/core/Modifier.h>
00031 #    include <ogs/core/Namespace.h>
00032 
00033 OGS_BEGIN_CORE_NAMESPACE
00034 
00035 class Experience;
00036 
00038 typedef Experience XP;
00039 
00046 class Experience {
00047   public:
00049     typedef unsigned int Points;
00051     typedef unsigned short Level;
00052 
00053     static Level getLevel (Points points);
00054     static Points getPoints (Level level);
00055 
00056     static Modifier::Value getStrongAttack (Level level);
00057     static Modifier::Value getAverageAttack (Level level);
00058     static Modifier::Value getWeakAttack (Level level);
00059 
00060     static std::string formatLevel (Level level);
00061 };
00062 
00069 inline Modifier::Value
00070 Experience::getStrongAttack (Level level) {
00071   return (level);
00072 }
00073 
00080 inline Modifier::Value
00081 Experience::getAverageAttack (Level level) {
00082   return ((3 * level) / 4);
00083 }
00084 
00090 inline Modifier::Value
00091 Experience::getWeakAttack (Level level) {
00092   return (level / 2);
00093 }
00094 
00095 OGS_END_CORE_NAMESPACE
00096 
00097 #  endif /* !defined OGS_CORE_EXPERIENCE_H */
00098 
00099 #endif /* defined __cplusplus */
00100 

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