[ogs-changes] dist/c++/ogs/cclasses Paladin.cpp,1.1,1.2
Status: Alpha
Brought to you by:
elemings
From: <ele...@us...> - 2003-03-24 07:45:20
|
Update of /cvsroot/ogs/dist/c++/ogs/cclasses In directory sc8-pr-cvs1:/tmp/cvs-serv1156 Modified Files: Paladin.cpp Log Message: Implemented getSpellsPerDay function. Index: Paladin.cpp =================================================================== RCS file: /cvsroot/ogs/dist/c++/ogs/cclasses/Paladin.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Paladin.cpp 23 Mar 2003 22:14:36 -0000 1.1 --- Paladin.cpp 24 Mar 2003 07:45:11 -0000 1.2 *************** *** 1,4 **** /* ! * Paladin.cpp -- class implementation for templates * Copyright (C) 2003 Eric Lemings <ele...@us...> * --- 1,4 ---- /* ! * Paladin.cpp -- class implementation for paladins * Copyright (C) 2003 Eric Lemings <ele...@us...> * *************** *** 21,24 **** --- 21,26 ---- */ + #include <climits> + #include "ogs/core/Abilities.h" #include "ogs/core/Ability.h" *************** *** 162,164 **** --- 164,210 ---- // TODO: Remove weapon proficiency feats. } + + /** + * Determine the number of spells that this paladin can cast per day. + * The vector index of the return value is the spell level. If the + * number of spells for a given spell level is zero (0), the number of + * spells that can be cast for that level is the same as the bonus + * spells from the Charisma score of the paladin (if any). + * + * @return Number of spells that can be cast per spell level per day. + */ + Paladin::SpellCounts Paladin::getSpellsPerDay () const { + static unsigned spellTable [17][4] = { + { 0, UINT_MAX, UINT_MAX, UINT_MAX }, + { 0, UINT_MAX, UINT_MAX, UINT_MAX }, + { 1, UINT_MAX, UINT_MAX, UINT_MAX }, + { 1, UINT_MAX, UINT_MAX, UINT_MAX }, + { 1, 0, UINT_MAX, UINT_MAX }, + { 1, 0, UINT_MAX, UINT_MAX }, + { 1, 1, UINT_MAX, UINT_MAX }, + { 1, 1, 0, UINT_MAX }, + { 1, 1, 1, UINT_MAX }, + { 1, 1, 1, UINT_MAX }, + { 2, 1, 1, 0 }, + { 2, 1, 1, 1 }, + { 2, 2, 1, 1 }, + { 2, 2, 2, 1 }, + { 3, 2, 2, 1 }, + { 3, 3, 3, 2 }, + { 3, 3, 3, 3 }, + }; + + Experience::Level xpLevel = getLevel (); + SpellCounts spellCounts; + if (xpLevel >= 4) { + SpellCounts::size_type i = 0; + while (spellTable [xpLevel][i] != UINT_MAX) { + spellCounts [i] = spellTable [xpLevel][i]; + ++i; + } + } + + return (spellCounts); + } + |