[ogs-changes] dist/c++/ogs/items Weapon.cpp,1.2,1.3 Weapon.h,1.2,1.3
Status: Alpha
Brought to you by:
elemings
|
From: <ele...@us...> - 2003-03-29 02:10:45
|
Update of /cvsroot/ogs/dist/c++/ogs/items
In directory sc8-pr-cvs1:/tmp/cvs-serv24985/items
Modified Files:
Weapon.cpp Weapon.h
Log Message:
See C++ ChangeLog (Mar 28) for details.
Index: Weapon.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/items/Weapon.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Weapon.cpp 25 Mar 2003 06:13:13 -0000 1.2
--- Weapon.cpp 29 Mar 2003 02:10:38 -0000 1.3
***************
*** 1,5 ****
/*
! * Weapon.cpp -- class implementation for Weapon item
! * Copyright (C) 2002 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
--- 1,5 ----
/*
! * Weapon.cpp -- class implementation for weapons
! * Copyright (C) 2003 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
***************
*** 21,26 ****
--- 21,40 ----
*/
+ #include "ogs/core/Die.h"
+ #include "ogs/core/Size.h"
#include "ogs/items/Weapon.h"
+ using ogs::core::Die;
+ using ogs::core::Size;
using ogs::items::Weapon;
+
+ /**
+ * Create a new weapon. The initial values of the weapon are
+ * unspecified.
+ */
+ Weapon::Weapon (): Item (7.0, Size::MEDIUM, 10), _proficiency (MARTIAL),
+ _type (1 << SLASHING), _damage (Die::d8, 1), _criticalMultiplier (3),
+ _threatRange (20) {
+ // empty constructor body
+ }
Index: Weapon.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/items/Weapon.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Weapon.h 18 Feb 2003 04:17:21 -0000 1.2
--- Weapon.h 29 Mar 2003 02:10:39 -0000 1.3
***************
*** 1,7 ****
/*
* Weapon.h -- class interface for weapons
! * Copyright (C) 2002 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
--- 1,6 ----
/*
* Weapon.h -- class interface for weapons
! * 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
***************
*** 26,29 ****
--- 25,30 ----
# define OGS_ITEMS_WEAPON_H
+ # include <bitset>
+
# include <ogs/core/Die.h>
# include <ogs/core/Item.h>
***************
*** 33,37 ****
/**
! * An item used in combat to defeat opponents
*/
class Weapon: public ogs::core::Item {
--- 34,40 ----
/**
! * An item used in combat to damage opponents. Since most weapons
! * differ only in attributes (data) rather than operation (behavior),
! * this class can be instantiated.
*/
class Weapon: public ogs::core::Item {
***************
*** 58,82 ****
* types.
*/
! enum DamageType {
! /** Inflicts bashing damage. */
! BASHING = 4,
! /** Inflicts piercing damage. */
! PIERCING = 8,
! /** Inflicts slashing damage. */
! SLASHING = 16
};
! virtual Proficiency getProficiency () = 0;
! virtual DamageType getDamageType () = 0;
! virtual ogs::core::Die getDamage () = 0;
! protected:
private:
!
};
OGS_END_ITEMS_NAMESPACE
--- 61,147 ----
* types.
*/
! typedef std::bitset<3> Type;
! enum {
! /** Indicates that this weapon inflicts bashing damage. */
! BASHING = 0,
! /** Indicates that this weapon Inflicts piercing damage. */
! PIERCING = 1,
! /** Indicates that this weapon inflicts slashing damage. */
! SLASHING = 2,
};
! Weapon ();
! Weapon (Entity::Weight weight, ogs::core::Size::Type size,
! Item::Worth worth, Proficiency proficiency, Type type,
! const ogs::core::Die& damage, unsigned criticalMultiplier,
! ogs::core::Die::Value threatRange);
! virtual ~Weapon () { }
! Proficiency getProficiency () const;
! Type getType () const;
! ogs::core::Die getDamage () const;
! unsigned getCriticalMultiplier () const;
! ogs::core::Die::Value getThreatRange () const;
private:
! Proficiency _proficiency;
! Type _type;
! ogs::core::Die _damage;
! unsigned _criticalMultiplier;
! ogs::core::Die::Value _threatRange;
};
+
+ /**
+ * Determine the proficiency of this weapon.
+ *
+ * @return Proficiency of this weapon: SIMPLE, MARTIAL, or EXOTIC.
+ */
+ inline Weapon::Proficiency
+ Weapon::getProficiency () const {
+ return (this->_proficiency);
+ }
+
+ /**
+ * Determine the type of this weapon.
+ *
+ * @return Type of this weapon.
+ */
+ inline Weapon::Type
+ Weapon::getType () const {
+ return (this->_type);
+ }
+
+ /**
+ * Determine the damage caused by this weapon.
+ *
+ * @return Damage from this weapon.
+ */
+ inline ogs::core::Die
+ Weapon::getDamage () const {
+ return (this->_damage);
+ }
+
+ /**
+ * Determine the critical multiplier of this weapon.
+ *
+ * @return Critical multiplier of this weapon.
+ */
+ inline unsigned
+ Weapon::getCriticalMultiplier () const {
+ return (this->_criticalMultiplier);
+ }
+
+ /**
+ * Determine the threat range of this weapon.
+ *
+ * @return Threat range of this weapon.
+ */
+ inline ogs::core::Die::Value
+ Weapon::getThreatRange () const {
+ return (this->_threatRange);
+ }
OGS_END_ITEMS_NAMESPACE
|