Source: lycad_chargen/dice.h
|
|
|
|
/***************************************************************************
dice.h - description
-------------------
begin : Fri Jan 26 2001
copyright : (C) 2001 by Sheldon Lee-Wen
email : sheldonl@linuxmail.org
***************************************************************************/
/***************************************************************************
* *
* 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 DICE_H
#define DICE_H
#ifdef HAVE_CONFIG_H
#include
#endif
#include
#include
#include
/**This is a simple class to roll a die.
@author Sheldon Lee Wen
*/
class Dice {
public:
Dice();
~Dice();
/** All of these methods perform a certain type of roll and set the result.
You should then call success to determine if your action was successful.
Then you should call degreeOS to determine the amount by which you
were successful or unsuccessful.
*/
/** These two types of rolls set the result internally. You must use success and
degreeOS to find out whether you were successful or not and by how much. */
int rollProcedural();
int rollBoundless();
/** These methods do an attribute check against a target of ten. It adds the
value of an attribute and a modifier.
The first one returns whether the check succeeded or failed.
The second one also takes a shift value and returns the degree of success.
These rolls do not alter the internal state of the die.
*/
bool attributeCheck(int attribute, int mods);
int attributeCheck(int attribute, int mods, int shift);
/** roll performs a general roll of a d10 and returns the result. Internally it just
calls rollProcedural and returns the result. */
int roll();
/** This method does a percentile roll, 1>= X <=100, and returns the result as we
do not usually use percentile rolls for actions. Does not alter the internal state
of the die. */
int rollPercent();
/** This method determines whether or not your roll succeeded
tgt is the target number, and it defaults to 10.
mods is the modifier to the roll, a skill, etc. It will be added to the
result of the roll, but defaults to 0.
*/
bool success(int tgt=10, int mods=0);
/** This method returns the degree of success. This method should only
be called after success is called.
shift is the shift value in determining the degree of success, it defaults to 0.
*/
int degreeOS(int shift=0);
private:
void init();
int target;
int result;
int modifiedResult;
int dos;
};
#endif
Generated by: sheldonl on cr595811-a on Fri Nov 30 10:24:34 2001, using kdoc 2.0a53. |