b1MarinePerson Class Reference

Inheritance diagram for b1MarinePerson:

Inheritance graph
[legend]
Collaboration diagram for b1MarinePerson:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 30 of file b1-marine-person.hpp.

Public Member Functions

 b1MarinePerson ()
void enlist ()
void skillTables (int n)


Constructor & Destructor Documentation

b1MarinePerson::b1MarinePerson (  ) 

Generic constructor

Definition at line 29 of file b1-marine-person.cpp.

References enlist(), and personObj::setService().

00029                                : book1Person() {
00030         this->setService("Marines");
00031         this->enlist();
00032         
00033 }

Here is the call graph for this function:


Member Function Documentation

void b1MarinePerson::enlist (  ) 

Enlist this character, and run them through the paces.

Definition at line 35 of file b1-marine-person.cpp.

References personObj::addSkill(), personObj::getEducation(), personObj::getSocialStanding(), personObj::setAccepted(), personObj::setAge(), personObj::setAlive(), personObj::setCommissioned(), personObj::setRank(), personObj::setTerms(), and skillTables().

Referenced by b1MarinePerson().

00035                            {
00036                 int dm=0;
00037         int skill_rolls=0;
00038         
00039         
00040         if ( this->getIntelligence() > 7 ) 
00041                 dm = 1; 
00042         if ( this->getStrength() > 7 ) 
00043                 dm = dm + 2;
00044         if ( (d2d6()+dm) > 5 ) {
00045                 this->setAccepted(1);
00046                 this->addSkill(CUTLASS,1);
00047                 
00048         } else {
00049                 this->setAccepted(0);
00050                 return ;
00051         }
00052         this->setTerms(1);
00053         while(1){ // while 
00054                 if ( this->getTerms() == 1 ) { // if
00055                         skill_rolls=2;
00056                 } else {
00057                         skill_rolls=1;
00058                 } //end-if
00059                 
00060                 // Determine Survival
00061                 //
00062                 dm=0;
00063                 if ( this->getEndurance() > 7) 
00064                         dm = 2;
00065                 if ( (d2d6()+dm) > 5 ) {
00066                         // this->setTerms(this->getTerms()+1);
00067                         this->setAge( this->getAge()+4);
00068                 } else {
00069                         this->setAlive(0);
00070                         return;
00071                 }
00072                 
00073                 // Check to see if commissioned either already or now.
00074                 // if already commissioned check for promotion.
00075                 
00076                 if ( this->getCommissioned() == 1 ) {
00077                         dm = ( this->getSocialStanding() > 7 ? 1:0);
00078                         if ( (d2d6()+dm) > 8 ) {
00079                                 this->setRank(this->getRank()+1);  // promotion of an officer.
00080 
00081                                 skill_rolls++;
00082                         }
00083                 } else {
00084                         dm = ( this->getEducation() > 6 ? 1 : 0 ) ;
00085                         // Roll to see if they get commissioned. 
00086                         if ( (d2d6()+dm)>8 ){
00087                                 this->setCommissioned(1);
00088                                 this->addSkill(REVOLVER,1);
00089                                 this->setRank(1);
00090                                 dm = ( this->getSocialStanding() > 7 ? 1:0);
00091                                 skill_rolls++;
00092                         
00093                                 if ( (d2d6()+dm) > 8 ) {
00094                                         this->setRank(this->getRank()+1);  // promotion of an officer. 
00095                                         skill_rolls++;
00096                                 }
00097                         }
00098                         
00099                 }
00100                 
00101                 this->skillTables(skill_rolls);
00102                 
00103                 // I've imposed my own DMS for sanity sake since I don't want people
00104                 // managing to be in for 60 terms like some trial runs had. 
00105                 dm=0;
00106                 if ( this->getTerms() > 5 ) {
00107                         dm = this->getTerms() - 5; 
00108                 }
00109                 if ( this->getAge() > 50 ) {
00110                         dm = dm + (this->getAge()/10);
00111                 }
00112                 int re_enlisted=0;
00113                 
00114                 if ( (d2d6() - dm) > 5 ) {
00115                         this->setTerms(this->getTerms()+1);
00116                         re_enlisted=1;
00117                 }
00118                         
00119                 // A couple of sanity checks:
00120                 if ( this->getRank() > 6) this->setRank(6);
00121                 if ( re_enlisted != 1 ) {
00122                         this->musterOut();
00123                         return;
00124                 }
00125                         
00126         }
00127 }

Here is the call graph for this function:

Here is the caller graph for this function:

void b1MarinePerson::skillTables ( int  n  ) 

Invoke one several skill tables.

Parameters:
n number of rolls to run against the skill tables for a given term.

Definition at line 129 of file b1-marine-person.cpp.

Referenced by enlist().

00129                                           {
00130         int roll;
00131         for(roll=1;roll<=nrolls;roll++){
00132                 if ( this->getEducation() < 8 ) {
00133                         switch(d1d6()){
00134                                 case 1:
00135                                 case 2:
00136                                         this->skillTable1();
00137                                         break;
00138                                 case 3:
00139                                 case 4:
00140                                         this->skillTable2();
00141                                         break;
00142                                 case 5:
00143                                 case 6:
00144                                         this->skillTable3();
00145                                         break;
00146                         };
00147                 } else {
00148                         switch(d2d6()){
00149                                 case 1:
00150                                         this->skillTable1();
00151                                         break;
00152                                 case 2:
00153                                 case 3:
00154                                         this->skillTable2();
00155                                         break;
00156                                 case 4: 
00157                                 case 5:
00158                                         this->skillTable3();
00159                                         break;
00160                                 case 6:
00161                                         this->skillTable4();
00162                                         break;
00163                         };
00164                         
00165                 }
00166                 
00167         }
00168 }

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Fri Mar 7 16:40:59 2008 for frpuniverse by  doxygen 1.4.7