Source: weapon.h


Annotated List
Files
Globals
Hierarchy
Index
/***************************************************************************
                          weapon.h  -  description
                             -------------------
    begin                : Sat Jan 22 2000
    copyright            : (C) 2000 by Daniel Roberge
    email                : droberge@uvic.ca
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the Artistic License                            *
 *                                                                         *
 ***************************************************************************/

#ifndef _WEAPON_H
#define _WEAPON_H
#include "invitem.h"
#include "dice.h"

#define SLASHING 0
#define PIERCING 1
#define BLUDGEONING 2
#define MISSILE 3
/**Represents a weapon which has a certain amount of damage dice plus a damage type and speed
  *@author Daniel Roberge
  */

class Weapon : public InventoryItem
{
 private: // Private attributes
  /**Basic weapon data*/
  int numdice,dicesides,plusminus,damageType,speed;
 public:
  /**Creates a basic (wimpy) weapon named "Fists"*/
  Weapon();
  /**Creates a custom weapon with speed Speed, damage type DT, dice damage dice with sides sides, with a bonus of bonus,
      named AName and weight Weight*/
  Weapon(int Speed,int DT,int dice,int sides,int bonus,char *AName,int Weight);
  /**Creates a weapon which is a duplicate of model*/
  Weapon(const Weapon& model);
  /**Returns the weapon's speed*/
  int getSpeed() const { return speed; };
  /**Returns the integer constant representing the damage type*/
  int getDT() const { return damageType; };
  /**Rolls the damage dice and returns the value*/
  virtual int returnDamage() const;
  /**Returns the item's type*/
  InventoryType getType() { return WP_FLAG; };
  /** Returns the presence or absence of magic in the weapon */
  virtual bool isMagic() const;
  /** Returns the pluses on the weapon. */
  virtual int getPluses() const;
};

/** Returns the pluses on the weapon. */
inline int Weapon::getPluses() const{
 return 0;
}

/** Returns the presence or absence of magic in the weapon */
inline bool Weapon::isMagic() const{
 return false;
}

/**Reference to the Weapon class*/
typedef Weapon& RWeapon;
/**Pointer to the Weapon class*/
typedef Weapon* PWeapon;

#ifdef WP_LIB
/**Contains the standard weapon library*/
class WeaponLibrary {
	public:
		static const Weapon *Dagger;
		static const Weapon *Shortsword;
		static const Weapon *Longsword;
		/** Initializes the static members of the library*/
		static void setupLib();
		/**Deletes the static members of the library*/
		static void cleanupLib();
};
#endif
#endif

Generated by: droberge@magebook.localdomain on Mon Jul 3 13:20:08 200.