Source: character.h


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

#ifndef _CHARACTER_H
#define _CHARACTER_H

#include "items.h"
#include "dice.h"
#include "status.h"
#include "dpoints.h"
#include "inventorylist.h"
#define FIGHTER 0
#define PALADIN 1
#define RANGER 2
#define MAGE 3
#define CLERIC 4
#define DRUID 5
#define THIEF 6
#define BARD 7
#define HUMAN 0
#define DWARF 1
#define ELF 2
#define HALFELF 3
#define HALFLING 4
#define GNOME 5

/**Represents a generic character.
   Extend to create a specific character.
  *@author Daniel Roberge
  */

class Character
{
 protected:
  int THACO;
  char *name;
  DepletablePoints HP;
  PWeapon weapon;
  PArmour armour;
  Status status;
  /**Carries out an attack roll against target*/
  virtual bool attackRoll(Character &target);
  /**Carries out a damage roll against target*/
  virtual void doDamage(Character &target);
  PInventoryList backpack;
 public:
  /**Creates a character with a weapon initialWeap, armour initialArm, and name myName*/
  Character(PWeapon initialWeap,PArmour initialArm,char *myName);
  /**Destroys the Character object. Deletes the weapon, armour, status, and HP members*/
  virtual ~Character();
  /**Returns the THACO of the character (THACO with the letter O, not the number 0)*/
  virtual int getTHACO() { return THACO + weapon->getPluses(); };
  /**Returns the AC of the character for damage type DamageType*/
  virtual int getAC(int DamageType);
  /**Returns the name of the character*/
  char *getName() { return name; };
  /**Returns the AC unmodified by damage type*/
  virtual int getAC() { return armour->getAC(); };
  /**Decreases the current value of the HP by amount. Returns the new HP value*/
  int loseHP(int amount);
  /**Combines an attack roll and a damage roll*/
  virtual void attack(Character &target);
  /**Returns whether or not the HP of the character has fallen below zero*/
  bool amAlive() { return (HP.IsPositive()); };
  /**Determines whether a character has a class.*/
  virtual bool haveClass() = 0;
};

typedef Character *PCharacter;
typedef Character &RCharacter;

#endif

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