Source: lycad_chargen/modifiable.h


Annotated List
Files
Globals
Hierarchy
Index
/***************************************************************************
                          modifiable.h  -  description
                             -------------------
    begin                : Thu Nov 8 2001
    copyright            : (C) 2001 by Sheldon Lee Wen
    email                : tormak@home.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program 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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef MODIFIABLE_H
#define MODIFIABLE_H
#include "Modifier.h"
#include "Vector.h"

/**This class implements the base functionality
	required for a class to accept modifiers.
  *@author Sheldon Lee Wen
  */

class Modifiable {
public: 
	Modifiable();
	virtual ~Modifiable();
  	/** This method returns the number of modifiers our object has. */
  	int numModifiers();
  	/** This method removes a modifier */
  	virtual void removeModifier(Modifier *source);
  	/** This method adds a modifier */
  	virtual void addModifier(Modifier *source);
  	/** Returns the magnitude with all of it's in scope modifiers added. */
  	virtual int getModifiedMagnitude();
	/** Returns the base magnitude of the modifiable object */
  	virtual int getMagnitude() const;
  	/** Returns the magnitude with all of it's in scope modifiers added, plus
		a modifier passed in the variable modified. This one time modifier will
		not be added to the modifiable object. */
  	virtual int getModifiedMagnitude(Modifier& modified);
  	/** This method returns the magnitude plus the values of any in scope modifiers, plus a one time constant value modified */
  	virtual int getModifiedMagnitude(int modified);
  /** Sums all of the existing modifiers and assigns the value to magnitude */
  virtual int setMagnitude();
  /** Set the magnitude to newMagnitude. This should be overridden in
		inherited classes to check that newMagnitude is valid. */
  virtual int setMagnitude( const int newMagnitude);

protected:
  	/** This method totals the magnitudes of all modifiers and returns it. */
  	virtual int sumOfAllModifiers();
  	/** This variable contains our modifiers */
  	Vector modifiers;
	/** This holds the numeric value of the modifiable object. We assume that
		 any game statistic that is modifiable is a numeric value */
	int magnitude;
};

#endif

Generated by: sheldonl on cr595811-a on Fri Nov 30 10:24:34 2001, using kdoc 2.0a53.