LGP Character Related Classes BackUp

From NexusCrossing

Jump to: navigation, search

Here I will discuss the construction of class lgpCharacterClass;

What I have here will part design doc, part pseudocode, and part implementation description.


Contents

[edit] pseudocode

[edit] class CharacterClass

 class CharacterClass
   {
     public:
       virtual on_level_up(lgpCreature &creature);     //Run this when the level is gained.
       virtual on_level_loss(lgpCreature &creature);  //Run this if the level is lost.
     protected:
       string ClassName;                              //The name of the class.
   };

[edit] clas SkillItem

 class SkillItem
   {
     public:
       SkillItem();   //Default constructor.  Set everything to "", NOVALUE, 0
       ~SkillItem();
       SkillItem(string skillname, LGPVALUE attribute);   //Preffered constructor.  Set values to skillname, attribute, 0
       SkillItem(string skillname, LGPVALUE attribute, int starting_rank);  //Usefull for generating NPC's or templated
                                                                            //characters.  Sets values to 
                                                                            //skillname, attribute, starting_rank
            
       string skill;
       LGPVALUE modifying_attribute;
       int rank;
   }


[edit] Modifications to Existing classes

add to lgpCreature:
std::map<string, int> ClassList;  //A list of the character's classes, and their current level.
std::map<string, SkillItem> SkillList;  //A list of the character's skills, and their current rank (unmodified).
int skill(sting skillname, LGPVALUE state);
int set_skill(string skillname, int value);

add to LGPVALUE:
STRENGTH, DEXTERITY, CONSTITUTION,  //Physucal Attributes
INTELLIGENCE, WISDOM, CHARISMA      //Mental Attributes


[edit] int skill(sting skillname, LGPVALUE state);

This member function will return a value for a skill. The value returned will depend on the state given.

skillname is the name of the skill. It must be written in the same way as it is entered into the skill list for the class. It will be used as the key when this member function accesses the skill list.

'state' is an LGPVALUE that tells the member function which number to return.

BASE
This is the default. It returns the base, unmodified skill value.
CURRENT
This returns the modified skill value.
ROLL
This returns a skill roll. This is the Modified skill value, plus 1d20.


[edit] int set_skill(string skillname, int value);

This member function is used to set the base value of a skill.




Personal tools