[ogs-changes] dist/c++/ogs/feats AllWeapons.cpp,NONE,1.1 AllWeapons.h,NONE,1.1 SingleWeapon.cpp,NONE
Status: Alpha
Brought to you by:
elemings
Update of /cvsroot/ogs/dist/c++/ogs/feats
In directory sc8-pr-cvs1:/tmp/cvs-serv24985/feats
Modified Files:
Alertness.cpp Alertness.h ArmorProficiency.cpp
ArmorProficiency.h ImprovedInitiative.cpp ImprovedInitiative.h
ImprovedSave.cpp ImprovedSave.h Makefile.am
ShieldProficiency.h Toughness.h WeaponProficiency.h
Added Files:
AllWeapons.cpp AllWeapons.h SingleWeapon.cpp SingleWeapon.h
Removed Files:
ExoticWeapon.cpp ExoticWeapon.h MartialWeapon.cpp
MartialWeapon.h
Log Message:
See C++ ChangeLog (Mar 28) for details.
--- NEW FILE: AllWeapons.cpp ---
/*
* AllWeapons.cpp -- class implementation for all weapon proficiency feats
* Copyright (C) 2003 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA
*
* RCS: $Id: AllWeapons.cpp,v 1.1 2003/03/29 02:10:36 elemings Exp $
*/
#include "ogs/core/Creature.h"
#include "ogs/feats/AllWeapons.h"
#include "ogs/items/Weapon.h"
using ogs::core::Creature;
using ogs::feats::AllWeapons;
using ogs::items::Weapon;
/**
* Create a new Simple Weapons Proficiency feat.
*
* @return A new Simple Weapons Proficiency feat.
*/
AllWeapons* AllWeapons::createSimple () {
return (new AllWeapons (Weapon::SIMPLE));
}
/**
* Create a new Martial Weapons Proficiency feat.
*
* @return A new Martial Weapons Proficiency feat.
*/
AllWeapons* AllWeapons::createMartial () {
return (new AllWeapons (Weapon::MARTIAL));
}
/**
* Create a new weapon proficiency feat for all wapons of a specified
* group.
*
* @param proficiency Group of weapons that this feat applies to.
*/
AllWeapons::AllWeapons (Weapon::Proficiency proficiency):
_proficiency (proficiency) {
// empty constructor body
}
/**
* Determine if this feat can be attached to an object. An all weapons
* proficiency feat can be attached to a creature if the creature does
* not already have this feat.
*
* @param object Object to attach this feat to.
* @return True if this feat is attached to object.
*/
bool AllWeapons::canAttach (const Object& object) const {
if (!Feat::canAttach (object)) {
return (false);
}
const Creature& creature = dynamic_cast<const Creature&> (object);
Creature::Feats feats = creature.getFeats ();
Creature::Feats::iterator itor = feats.begin ();
while (itor != feats.end ()) {
using ogs::core::Feat;
Feat* feat = *itor++;
AllWeapons* allWeapons = dynamic_cast <AllWeapons*> (feat);
if (allWeapons != NULL) {
if (allWeapons->getProficiency () == _proficiency) {
return (false);
}
}
}
return (true);
}
--- NEW FILE: AllWeapons.h ---
/*
* AllWeapons.h -- class interface for all weapons proficiency feats
* Copyright (C) 2003 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA
*
* RCS: $Id: AllWeapons.h,v 1.1 2003/03/29 02:10:36 elemings Exp $
*/
#ifdef __cplusplus
# ifndef OGS_FEATS_SINGLE_WEAPON_H
# define OGS_FEATS_SINGLE_WEAPON_H
# include <ogs/feats/Namespace.h>
# include <ogs/feats/WeaponProficiency.h>
OGS_BEGIN_FEATS_NAMESPACE
/**
* A weapon proficiency for all weapons of one group. Simple Weapon
* Proficiency is a general feat that indicates that a creature is
* proficient with all simple weapons. Some cclasses are also
* proficient with all martial weapons. Exotic weapons can only be
* selected as single weapons. This class can be used instead of the
* @c SingleWeapon class to indicate that a creature is proficient with
* all weapons in one of these groups.
*
* @see SingleWeapon
*/
class AllWeapons: public WeaponProficiency {
public:
static AllWeapons* createSimple ();
static AllWeapons* createMartial ();
Feat::Compatibility getCompatibility () const;
ogs::items::Weapon::Proficiency getProficiency () const;
bool isProficient (const ogs::items::Weapon& weapon) const;
private:
ogs::items::Weapon::Proficiency _proficiency;
AllWeapons (ogs::items::Weapon::Proficiency proficiency);
bool canAttach (const Object& object) const;
};
/**
* Determine the compatability of this feat. Weapon proficiency feats
* for all weapons are exclusive feats.
*
* @return Feat::EXCLUSIVE
*/
inline ogs::core::Feat::Compatibility
AllWeapons::getCompatibility () const {
return (Feat::EXCLUSIVE);
}
/**
* Determine weapon proficiency that this feat applies to.
*
* @return Proficiency of weapon: SIMPLE or MARTIAL.
*/
inline ogs::items::Weapon::Proficiency
AllWeapons::getProficiency () const {
return (this->_proficiency);
}
/**
* Determine if a weapon is a proficient weapon. A proficient weapon is
* a weapon that a creature with this feat is proficient with. If this
* feat is not attached to a creature, the weapon is not a proficient
* weapon.
*
* @return True if weapon is a proficient weapon.
*/
inline bool
AllWeapons::isProficient (const ogs::items::Weapon& weapon) const {
return (weapon.getProficiency () == this->_proficiency);
}
OGS_END_FEATS_NAMESPACE
# endif /* !defined OGS_FEATS_SINGLE_WEAPON_H */
#endif /* defined __cplusplus */
--- NEW FILE: SingleWeapon.cpp ---
/*
* SingleWeapon.cpp -- class implementation for single weapon proficiency feats
* Copyright (C) 2003 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA
*
* RCS: $Id: SingleWeapon.cpp,v 1.1 2003/03/29 02:10:38 elemings Exp $
*/
#include <typeinfo>
#include "ogs/support/Class.h"
#include "ogs/feats/SingleWeapon.h"
using ogs::feats::SingleWeapon;
using ogs::items::Weapon;
/**
* Create a new single weapon proficiency. This constructor will throw
* an exception if the template parameter is not a class derived from
* the @c Weapon class.
*
* @throws std::bad_cast If WeaponType is not a type of weapon.
*/
template <class _WeaponType>
SingleWeapon<_WeaponType>::SingleWeapon () {
WeaponType object;
Weapon& weapon = dynamic_cast<Weapon&> (object);
}
/**
* Determine if this feat can be attached to an object. Single weapon
* proficiency feats can be attached to a creature if the creature does
* not already have a weapon proficiency feat for this type of weapon.
*
* @param object Object to attach this feat to.
* @return True if this feat is attached to object.
*/
template <class _WeaponType> bool
SingleWeapon<_WeaponType>::canAttach (const Object& object) const {
}
/**
* Determine if a weapon is a proficient weapon. A proficient weapon is
* a weapon that a creature with this feat is proficient with. If this
* feat is not attached to a creature, the weapon is not a proficient
* weapon.
*
* @return True if weapon is a proficient weapon.
*/
template <class _WeaponType> bool
SingleWeapon<_WeaponType>::isProficient (const Weapon& weapon) const {
using ogs::support::Class;
Class thisWeaponClass = Class::getClass<WeaponType> ();
Class weaponClass = weapon.getClass ();
return (thisWeaponClass == weaponClass);
}
--- NEW FILE: SingleWeapon.h ---
/*
* SingleWeapon.h -- class interface for single weapon proficiency feats
* Copyright (C) 2003 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA
*
* RCS: $Id: SingleWeapon.h,v 1.1 2003/03/29 02:10:38 elemings Exp $
*/
#ifdef __cplusplus
# ifndef OGS_FEATS_SINGLE_WEAPON_H
# define OGS_FEATS_SINGLE_WEAPON_H
# include <ogs/feats/Namespace.h>
# include <ogs/feats/WeaponProficiency.h>
# include <ogs/items/Weapon.h>
OGS_BEGIN_FEATS_NAMESPACE
/**
* A weapon proficiency for a single weapon. Some classes are
* automatically proficient only with specific types of weapons, some of
* which are simple weapons. Single weapon proficiency feats for
* martial weapons and exotic weapons can also be taken optionally.
*/
template <class _WeaponType>
class SingleWeapon: public WeaponProficiency {
public:
/** Type of weapon that this proficiency applies to. */
typedef _WeaponType WeaponType;
SingleWeapon ();
Feat::Compatibility getCompatibility () const;
ogs::items::Weapon::Proficiency getProficiency () const;
bool isProficient (const ogs::items::Weapon& weapon) const;
private:
bool canAttach (const Object& object) const;
};
/**
* Determine the compatability of this feat. Single weapon proficiency
* feats are repeatable feats. Each time a single weapon feat is taken,
* it applies to a new weapon.
*
* @return Feat::EXCLUSIVE
*/
template <class _WeaponType>
inline ogs::core::Feat::Compatibility
SingleWeapon<_WeaponType>::getCompatibility () const {
return (Feat::REPEATABLE);
}
/**
* Determine proficiency of weapon that this feat applies to.
*
* @return Proficiency of weapon: SIMPLE, MARTIAL, or EXOTIC.
*/
template <class _WeaponType>
inline ogs::items::Weapon::Proficiency
SingleWeapon<_WeaponType>::getProficiency () const {
WeaponType weapon;
return (weapon.getProficiency ());
}
OGS_END_FEATS_NAMESPACE
# endif /* !defined OGS_FEATS_SINGLE_WEAPON_H */
#endif /* defined __cplusplus */
Index: Alertness.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/Alertness.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Alertness.cpp 25 Mar 2003 06:13:13 -0000 1.2
--- Alertness.cpp 29 Mar 2003 02:10:35 -0000 1.3
***************
*** 44,48 ****
* @return True if the feature is attached to the object.
*/
! bool Alertness::canAttach (Object& object) const {
return (Feat::canAttach (object) &&
!Feat::findFeat<Alertness> (object));
--- 44,48 ----
* @return True if the feature is attached to the object.
*/
! bool Alertness::canAttach (const Object& object) const {
return (Feat::canAttach (object) &&
!Feat::findFeat<Alertness> (object));
***************
*** 79,95 ****
while (itor != skills.end ()) {
using ogs::skills::Listen;
! Listen* listenSkill = dynamic_cast<Listen*> (*itor);
if (listenSkill != NULL) {
! listenSkill->addModifier (this->_modifier);
} else {
using ogs::skills::Spot;
Spot* spotSkill = dynamic_cast<Spot*> (*itor);
if (spotSkill != NULL) {
! spotSkill->addModifier (this->_modifier);
}
}
-
- ++itor;
}
}
--- 79,96 ----
while (itor != skills.end ()) {
+ using ogs::core::Modifiers;
using ogs::skills::Listen;
! Listen* listenSkill = dynamic_cast<Listen*> (*itor++);
if (listenSkill != NULL) {
! Modifiers& modifiers = listenSkill->getModifiers ();
! modifiers.addModifier (this->_modifier);
} else {
using ogs::skills::Spot;
Spot* spotSkill = dynamic_cast<Spot*> (*itor);
if (spotSkill != NULL) {
! Modifiers& modifiers = spotSkill->getModifiers ();
! modifiers.addModifier (this->_modifier);
}
}
}
}
Index: Alertness.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/Alertness.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Alertness.h 25 Mar 2003 06:13:13 -0000 1.2
--- Alertness.h 29 Mar 2003 02:10:36 -0000 1.3
***************
*** 26,30 ****
# define OGS_FEATS_ALERTNESS_H
- # include <ogs/support/Object.h>
# include <ogs/core/Feat.h>
# include <ogs/core/Modifier.h>
--- 26,29 ----
***************
*** 42,54 ****
bool attachObject (Object& object);
bool dettachObject ();
! Object* getObject () const;
! ogs::core::Feat::Compatibility getCompatibility () const;
! ogs::core::Feat::Group getGroup () const;
private:
ogs::core::Modifier _modifier;
! bool canAttach (Object& object) const;
! void addSkillModifier (ogs::support::Object& object);
};
--- 41,52 ----
bool attachObject (Object& object);
bool dettachObject ();
! Feat::Compatibility getCompatibility () const;
! Feat::Group getGroup () const;
private:
ogs::core::Modifier _modifier;
! bool canAttach (const Object& object) const;
! void addSkillModifier (Object& object);
};
***************
*** 61,65 ****
inline ogs::core::Feat::Compatibility
Alertness::getCompatibility () const {
! return (ogs::core::Feat::EXCLUSIVE);
}
--- 59,63 ----
inline ogs::core::Feat::Compatibility
Alertness::getCompatibility () const {
! return (Feat::EXCLUSIVE);
}
***************
*** 72,76 ****
inline ogs::core::Feat::Group
Alertness::getGroup () const {
! return (ogs::core::Feat::GENERAL);
}
--- 70,74 ----
inline ogs::core::Feat::Group
Alertness::getGroup () const {
! return (Feat::GENERAL);
}
Index: ArmorProficiency.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/ArmorProficiency.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ArmorProficiency.cpp 25 Mar 2003 06:13:13 -0000 1.4
--- ArmorProficiency.cpp 29 Mar 2003 02:10:36 -0000 1.5
***************
*** 21,25 ****
*/
- #include "ogs/support/Object.h"
#include "ogs/core/Creature.h"
#include "ogs/core/Feat.h"
--- 21,24 ----
***************
*** 27,31 ****
#include "ogs/feats/ArmorProficiency.h"
- using ogs::support::Object;
using ogs::core::Creature;
using ogs::items::Armor;
--- 26,29 ----
***************
*** 33,37 ****
static bool
! findArmorProficiency (Creature& creature,
Armor::Proficiency proficiency);
--- 31,35 ----
static bool
! findArmorProficiency (const Creature& creature,
Armor::Proficiency proficiency);
***************
*** 74,83 ****
/**
! * Determine if this feat can be attached to an object.
*
* @param object Object to attach this feat to.
* @return True if this feat is attached to object.
*/
! bool ArmorProficiency::canAttach (Object& object) const {
if (!Feat::canAttach (object)) {
return (false);
--- 72,84 ----
/**
! * Determine if this feat can be attached to an object. An armor
! * proficiency feat can be attached to a creature if the creature does
! * not already have this type of armor proficiency feat and already
! * has the prerequisite feats (if any).
*
* @param object Object to attach this feat to.
* @return True if this feat is attached to object.
*/
! bool ArmorProficiency::canAttach (const Object& object) const {
if (!Feat::canAttach (object)) {
return (false);
***************
*** 85,89 ****
bool success = false;
! Creature& creature = dynamic_cast<Creature&> (object);
if (this->_proficiency == Armor::LIGHT) {
if (! findArmorProficiency (creature, Armor::LIGHT)) {
--- 86,90 ----
bool success = false;
! const Creature& creature = dynamic_cast<const Creature&> (object);
if (this->_proficiency == Armor::LIGHT) {
if (! findArmorProficiency (creature, Armor::LIGHT)) {
***************
*** 113,117 ****
*/
static bool
! findArmorProficiency (Creature& creature,
Armor::Proficiency proficiency) {
Creature::Feats feats = creature.getFeats ();
--- 114,118 ----
*/
static bool
! findArmorProficiency (const Creature& creature,
Armor::Proficiency proficiency) {
Creature::Feats feats = creature.getFeats ();
***************
*** 121,125 ****
while (itor != feats.end ()) {
using ogs::core::Feat;
! Feat* feat = *itor;
ArmorProficiency* armorProficiency =
dynamic_cast <ArmorProficiency*> (feat);
--- 122,126 ----
while (itor != feats.end ()) {
using ogs::core::Feat;
! Feat* feat = *itor++;
ArmorProficiency* armorProficiency =
dynamic_cast <ArmorProficiency*> (feat);
***************
*** 129,134 ****
}
}
-
- ++itor;
}
--- 130,133 ----
Index: ArmorProficiency.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/ArmorProficiency.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ArmorProficiency.h 25 Mar 2003 06:13:13 -0000 1.3
--- ArmorProficiency.h 29 Mar 2003 02:10:36 -0000 1.4
***************
*** 1,5 ****
/*
* ArmorProficiency.h -- class interface for armor proficiency feats
! * Copyright (C) 2002 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
--- 1,5 ----
/*
* ArmorProficiency.h -- class interface for armor proficiency feats
! * Copyright (C) 2003 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
***************
*** 26,30 ****
# define OGS_FEATS_ARMOR_PROFICIENCY_H
- # include <ogs/support/Object.h>
# include <ogs/core/Feat.h>
# include <ogs/feats/Namespace.h>
--- 26,29 ----
***************
*** 35,45 ****
/**
* A feat that allows the effective use of armor. A creature that uses
! * armor without begin proficient with it suffers a -4 penalty to attack
! * rolls, ability checks, and skill checks. A creature must be
! * proficient with light armor before the creature can be proficient
! * with medium armor. (The Light Armor Proficiency feat is a
! * prerequisite for the Medium Armor Proficiency feat.) A creature must
! * be proficient with medium armor before the creature can be proficient
! * with heavy armor.
*/
class ArmorProficiency: public ogs::core::Feat {
--- 34,44 ----
/**
* A feat that allows the effective use of armor. A creature that uses
! * armor without begin proficient with it suffers the armor check
! * penalty to attack rolls and skill checks that involve moving
! * including Ride. A creature must be proficient with light armor
! * before the creature can be proficient with medium armor. (The Light
! * Armor Proficiency feat is a prerequisite for the Medium Armor
! * Proficiency feat.) A creature must be proficient with medium armor
! * before the creature can be proficient with heavy armor.
*/
class ArmorProficiency: public ogs::core::Feat {
***************
*** 53,57 ****
ogs::items::Armor::Proficiency getProficiency () const;
! virtual bool isProficient (const ogs::items::Armor& armor) const;
private:
--- 52,56 ----
ogs::items::Armor::Proficiency getProficiency () const;
! bool isProficient (const ogs::items::Armor& armor) const;
private:
***************
*** 60,64 ****
ArmorProficiency (ogs::items::Armor::Proficiency proficiency);
! bool canAttach (Object& object) const;
};
--- 59,63 ----
ArmorProficiency (ogs::items::Armor::Proficiency proficiency);
! bool canAttach (const Object& object) const;
};
Index: ImprovedInitiative.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/ImprovedInitiative.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ImprovedInitiative.cpp 25 Mar 2003 06:13:13 -0000 1.3
--- ImprovedInitiative.cpp 29 Mar 2003 02:10:36 -0000 1.4
***************
*** 47,51 ****
* @return True if the feature is attached to the object.
*/
! bool ImprovedInitiative::canAttach (Object& object) const {
return (Feat::canAttach (object) &&
!Feat::findFeat<ImprovedInitiative> (object));
--- 47,51 ----
* @return True if the feature is attached to the object.
*/
! bool ImprovedInitiative::canAttach (const Object& object) const {
return (Feat::canAttach (object) &&
!Feat::findFeat<ImprovedInitiative> (object));
Index: ImprovedInitiative.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/ImprovedInitiative.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ImprovedInitiative.h 25 Mar 2003 06:13:13 -0000 1.2
--- ImprovedInitiative.h 29 Mar 2003 02:10:36 -0000 1.3
***************
*** 47,51 ****
static ogs::core::Modifier _modifier;
! bool canAttach (Object& object) const;
};
--- 47,51 ----
static ogs::core::Modifier _modifier;
! bool canAttach (const Object& object) const;
};
Index: ImprovedSave.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/ImprovedSave.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ImprovedSave.cpp 25 Mar 2003 06:13:13 -0000 1.1
--- ImprovedSave.cpp 29 Mar 2003 02:10:37 -0000 1.2
***************
*** 63,76 ****
/**
! * Determine if this feat can be attached to an object. Since Great
! * Fortitude feats are exclusive feats, they can only be attached to
! * objects that do not already have this feat.
*
* @param object Object to attach this feature to.
* @return True if the feature is attached to the object.
*/
! bool ImprovedSave::canAttach (Object& object) const {
! return (Feat::canAttach (object) &&
! !Feat::findFeat<ImprovedSave> (object));
}
--- 63,94 ----
/**
! * Determine if this feat can be attached to an object. An improved
! * save feat can only be attached to a creature if the creature does not
! * already have this feat.
*
* @param object Object to attach this feature to.
* @return True if the feature is attached to the object.
*/
! bool ImprovedSave::canAttach (const Object& object) const {
! if (! Feat::canAttach (object)) {
! return (false);
! }
!
! const Creature& creature = dynamic_cast<const Creature&> (object);
! Creature::Feats feats = creature.getFeats ();
! Creature::Feats::iterator itor = feats.begin ();
!
! while (itor != feats.end ()) {
! using ogs::core::Feat;
! Feat* feat = *itor++;
! ImprovedSave* improvedSave = dynamic_cast <ImprovedSave*> (feat);
! if (improvedSave != NULL) {
! if (improvedSave->getType () == _type) {
! return (false);
! }
! }
! }
!
! return (true);
}
Index: ImprovedSave.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/ImprovedSave.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ImprovedSave.h 25 Mar 2003 06:13:13 -0000 1.1
--- ImprovedSave.h 29 Mar 2003 02:10:37 -0000 1.2
***************
*** 69,73 ****
ImprovedSave (Type type);
! bool canAttach (Object& object) const;
};
--- 69,73 ----
ImprovedSave (Type type);
! bool canAttach (const Object& object) const;
};
Index: Makefile.am
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Makefile.am 25 Mar 2003 06:13:13 -0000 1.5
--- Makefile.am 29 Mar 2003 02:10:37 -0000 1.6
***************
*** 25,37 ****
pkginclude_HEADERS = \
Alertness.h \
ArmorProficiency.h \
BonusFeat.h \
- ExoticWeapon.h \
ImprovedInitiative.h \
ImprovedSave.h \
- MartialWeapon.h \
Namespace.h \
ShieldProficiency.h \
! SimpleWeapon.h \
Toughness.h \
WeaponProficiency.h
--- 25,36 ----
pkginclude_HEADERS = \
Alertness.h \
+ AllWeapons.h \
ArmorProficiency.h \
BonusFeat.h \
ImprovedInitiative.h \
ImprovedSave.h \
Namespace.h \
ShieldProficiency.h \
! SingleWeapon.h \
Toughness.h \
WeaponProficiency.h
***************
*** 47,55 ****
libogs_feats_la_SOURCES = \
Alertness.cpp \
ArmorProficiency.cpp \
BonusFeat.cpp \
- ExoticWeapon.cpp \
ImprovedInitiative.cpp \
ImprovedSave.cpp \
! MartialWeapon.cpp
--- 46,54 ----
libogs_feats_la_SOURCES = \
Alertness.cpp \
+ AllWeapons.cpp \
ArmorProficiency.cpp \
BonusFeat.cpp \
ImprovedInitiative.cpp \
ImprovedSave.cpp \
! SingleWeapon.cpp
Index: ShieldProficiency.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/ShieldProficiency.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ShieldProficiency.h 7 Jan 2003 07:41:33 -0000 1.1
--- ShieldProficiency.h 29 Mar 2003 02:10:38 -0000 1.2
***************
*** 32,46 ****
/**
! * A shield proficiency feat allows the use of shields without
! * additional penalties.
*/
class ShieldProficiency: public ogs::core::Feat {
public:
! protected:
private:
!
};
OGS_END_FEATS_NAMESPACE
--- 32,79 ----
/**
! * A feat that allows the effective use of shields. A creature that
! * uses a shield without being proficient with it suffers the armor
! * check penalty of the shield on attack rolls and skill checks that
! * involve moving including the Ride skill.
*/
class ShieldProficiency: public ogs::core::Feat {
public:
+ ShieldProficiency ();
! Feat::Compatibility getCompatibility () const;
! Feat::Group getGroup () const;
private:
! bool canAttach (const Object& object) const;
};
+
+ /**
+ * Create a new Shield Proficiency feat.
+ */
+ inline ShieldProficiency::ShieldProficiency () {
+ // empty constructor body
+ }
+
+ /**
+ * Determine the compatability of this feat. Shield proficiency feats
+ * are exclusive feats.
+ *
+ * @return Feat::EXCLUSIVE
+ */
+ inline ogs::core::Feat::Compatibility
+ ShieldProficiency::getCompatibility () const {
+ return (Feat::EXCLUSIVE);
+ }
+
+ /**
+ * Determine the group that this feat belongs to. Shield proficiency
+ * feats are general feats.
+ *
+ * @return Feat::GENERAL
+ */
+ inline ogs::core::Feat::Group
+ ShieldProficiency::getGroup () const {
+ return (Feat::GENERAL);
+ }
OGS_END_FEATS_NAMESPACE
Index: Toughness.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/Toughness.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Toughness.h 7 Jan 2003 07:41:33 -0000 1.1
--- Toughness.h 29 Mar 2003 02:10:38 -0000 1.2
***************
*** 1,5 ****
/*
! * Toughness.h -- class interface for Toughness feat
! * Copyright (C) 2002 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
--- 1,5 ----
/*
! * Toughness.h -- class interface for Toughness feats
! * Copyright (C) 2003 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
***************
*** 27,30 ****
--- 27,31 ----
# include <ogs/core/Feat.h>
+ # include <ogs/core/Modifier.h>
# include <ogs/feats/Namespace.h>
***************
*** 32,45 ****
/**
! * A general feat that adds bonus hit points each time it is taken.
*/
class Toughness: public ogs::core::Feat {
public:
! protected:
private:
};
OGS_END_FEATS_NAMESPACE
--- 33,75 ----
/**
! * A feat that adds +3 health points each time it is taken.
*/
class Toughness: public ogs::core::Feat {
public:
+ Toughness ();
! bool attachObject (Object& object);
! bool dettachObject ();
! Feat::Compatibility getCompatibility () const;
! Feat::Group getGroup () const;
private:
+ ogs::core::Modifier _modifier;
+ bool canAttach (const Object& object) const;
+ void addHealthModifier (Object& object);
};
+
+ /**
+ * Determine the compatability of this feat. Toughness feats are
+ * cumulative feats.
+ *
+ * @return Feat::CUMULATIVE
+ */
+ inline ogs::core::Feat::Compatibility
+ Toughness::getCompatibility () const {
+ return (Feat::CUMULATIVE);
+ }
+
+ /**
+ * Determine the group that this feat belongs to. Toughness feats are
+ * general feats.
+ *
+ * @return Feat::GENERAL
+ */
+ inline ogs::core::Feat::Group
+ Toughness::getGroup () const {
+ return (Feat::GENERAL);
+ }
OGS_END_FEATS_NAMESPACE
Index: WeaponProficiency.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/feats/WeaponProficiency.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** WeaponProficiency.h 7 Jan 2003 07:41:33 -0000 1.1
--- WeaponProficiency.h 29 Mar 2003 02:10:38 -0000 1.2
***************
*** 1,5 ****
/*
! * WeaponProficiency.h -- class interface for weapon proficiencies
! * Copyright (C) 2002 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
--- 1,5 ----
/*
! * WeaponProficiency.h -- class interface for weapon proficiency feats
! * Copyright (C) 2003 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
***************
*** 28,46 ****
# include <ogs/core/Feat.h>
# include <ogs/feats/Namespace.h>
OGS_BEGIN_FEATS_NAMESPACE
/**
! * A weapon proficiency allows the use of certain weapons without a
! * penalty to attack rolls.
*/
class WeaponProficiency: public ogs::core::Feat {
public:
! protected:
! private:
};
OGS_END_FEATS_NAMESPACE
--- 28,78 ----
# include <ogs/core/Feat.h>
# include <ogs/feats/Namespace.h>
+ # include <ogs/items/Weapon.h>
OGS_BEGIN_FEATS_NAMESPACE
/**
! * A feat that allows the effective use of a weapon. A creature that
! * uses a weapon without being proficient with it suffers a -4 penatly
! * to attack rolls. This class is the base class for derived classes
! * that identify specific types of weapons for this proficiency feat.
*/
class WeaponProficiency: public ogs::core::Feat {
public:
! ogs::core::Feat::Group getGroup () const;
! /**
! * Determine weapon proficiency that this feat applies to.
! *
! * @return Proficiency of weapon: SIMPLE, MARTIAL, or EXOTIC.
! */
! virtual ogs::items::Weapon::Proficiency getProficiency () const = 0;
!
! /**
! * Determine if a weapon is a proficient weapon. A proficient
! * weapon is a weapon that a creature with this feat is proficient
! * with. If this feat is not attached to a creature, the weapon is
! * not a proficient weapon.
! *
! * @return True if weapon is a proficient weapon.
! */
! virtual bool isProficient (const ogs::items::Weapon& weapon) const = 0;
+ virtual ~WeaponProficiency ();
};
+
+ /**
+ * Determine the group that this feat belongs to. Weapon proficiency
+ * feats are general feats.
+ *
+ * @return Feat::GENERAL
+ */
+ inline ogs::core::Feat::Group
+ WeaponProficiency::getGroup () const {
+ return (ogs::core::Feat::GENERAL);
+ }
+
+ inline WeaponProficiency::~WeaponProficiency () { }
OGS_END_FEATS_NAMESPACE
--- ExoticWeapon.cpp DELETED ---
--- ExoticWeapon.h DELETED ---
--- MartialWeapon.cpp DELETED ---
--- MartialWeapon.h DELETED ---
|