b1MerchantPerson Class Reference

Inheritance diagram for b1MerchantPerson:

Inheritance graph
[legend]
Collaboration diagram for b1MerchantPerson:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 44 of file b1-merchant-person.hpp.

Public Member Functions

 b1MerchantPerson ()
void enlist ()
void skillTables (int n)


Constructor & Destructor Documentation

b1MerchantPerson::b1MerchantPerson (  ) 

Generic constructor

Definition at line 51 of file b1-merchant-person.cpp.

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

00051                                    : book1Person() {
00052 #ifdef DEBUG_ON
00053         fprintf(stderr,"Entering b1MerchantPerson::b1MerchantPerson()\n");
00054 #endif
00055         this->setService("Merchant");
00056         this->enlist();
00057 #ifdef DEBUG_ON
00058         fprintf(stderr,"Exiting b1MerchantPeson::b1MerchantPerson()\n");
00059 #endif
00060 
00061 }

Here is the call graph for this function:


Member Function Documentation

void b1MerchantPerson::enlist (  ) 

Enlist this character, and run them through the paces.

Definition at line 64 of file b1-merchant-person.cpp.

References personObj::getIntelligence(), personObj::setAccepted(), personObj::setAge(), personObj::setAlive(), personObj::setCommissioned(), personObj::setRank(), personObj::setTerms(), and skillTables().

Referenced by b1MerchantPerson().

00064                              {
00065         int dm=0;
00066         int skill_rolls=0;
00067         
00068         if ( this->getStrength() > 6 ) 
00069                 dm = 1; 
00070         if ( this->getIntelligence() > 5 ) 
00071                 dm = dm + 2;
00072         if ( (d2d6()+dm) > 6 ) {
00073                 this->setAccepted(1);
00074         } else {
00075                 this->setAccepted(0);
00076                 return ;
00077         }
00078         this->setTerms(1);
00079         while(1){ // while 
00080                 if ( this->getTerms() == 1 ) { // if
00081                         skill_rolls=2;
00082                 } else {
00083                         skill_rolls=1;
00084                 } //end-if
00085                 
00086                 // Determine Survival
00087                 //
00088                 dm=0;
00089                 if ( this->getIntelligence() > 6) 
00090                         dm = 2;
00091                 if ( (d2d6()+dm) > 4 ) {
00092                         // this->setTerms(this->getTerms()+1);
00093                         this->setAge( this->getAge()+4);
00094                 } else {
00095                         this->setAlive(0);
00096                         return;
00097                 }
00098                 
00099                 // Check to see if commissioned either already or now.
00100                 // if already commissioned check for promotion.
00101                 
00102                 if ( this->getCommissioned() == 1 ) {
00103                         dm = ( this->getIntelligence() > 8 ? 1:0);
00104                         if ( (d2d6()+dm) > 9 ) {
00105                                 this->setRank(this->getRank()+1);  // promotion of an officer.
00106                                 if ( this->getRank() == 4)  {
00107                                                 this->addSkill(PILOT,1);
00108                                         }
00109                                 
00110                                         
00111                                 skill_rolls++;
00112                         }
00113                 } else {
00114                         dm = ( this->getIntelligence() > 6 ? 1 : 0 ) ;
00115                         // Roll to see if they get commissioned. 
00116                         if ( (d2d6()+dm)>3 ){
00117                                 this->setCommissioned(1);
00118                                 this->setRank(1);
00119                                 dm = ( this->getIntelligence() > 8 ? 1:0);
00120                                 skill_rolls++;
00121                         
00122                                 if ( (d2d6()+dm) > 9 ) {
00123                                         this->setRank(this->getRank()+1);  // promotion of an officer. 
00124                                         skill_rolls++;
00125                                 }
00126                         }
00127                         
00128                 }
00129                 
00130                 this->skillTables(skill_rolls);
00131                 
00132                 // I've imposed my own DMS for sanity sake since I don't want people
00133                 // managing to be in for 60 terms like some trial runs had. 
00134                 dm=0;
00135                 if ( this->getTerms() > 5 ) {
00136                         dm = this->getTerms() - 5; 
00137                 }
00138                 if ( this->getAge() > 50 ) {
00139                         dm = dm + (this->getAge()/10);
00140                 }
00141                 int re_enlisted=0;
00142                 
00143                 if ( (d2d6() - dm) > 3 ) {
00144                         this->setTerms(this->getTerms()+1);
00145                         re_enlisted=1;
00146                 }
00147                         
00148                 // A couple of sanity checks:
00149                 if ( this->getRank() > 5) this->setRank(5);
00150                 if ( re_enlisted != 1 ) return;
00151                         
00152         }
00153         
00154 }

Here is the call graph for this function:

Here is the caller graph for this function:

void b1MerchantPerson::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 157 of file b1-merchant-person.cpp.

Referenced by enlist().

00157                                             {
00158         // There are 4 different skill tables to deal with here...
00159         // 3 of which are in play when education < 8 and all 4 are 
00160         // in play for education >= 8 
00161         
00162 
00163         int roll;
00164         for(roll=1;roll<=nrolls;roll++){
00165                 if ( this->getEducation() < 8 ) {
00166                         switch(d1d6()){
00167                                 case 1:
00168                                 case 2:
00169                                         this->skillTable1();
00170                                         break;
00171                                 case 3:
00172                                 case 4:
00173                                         this->skillTable2();
00174                                         break;
00175                                 case 5:
00176                                 case 6:
00177                                         this->skillTable3();
00178                                         break;
00179                         };
00180                 } else {
00181                         switch(d2d6()){
00182                                 case 1:
00183                                         this->skillTable1();
00184                                         break;
00185                                 case 2:
00186                                 case 3:
00187                                         this->skillTable2();
00188                                         break;
00189                                 case 4: 
00190                                 case 5:
00191                                         this->skillTable3();
00192                                         break;
00193                                 case 6:
00194                                         this->skillTable4();
00195                                         break;
00196                         };
00197                         
00198                 }
00199                 
00200         }
00201         
00202         
00203 }

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:41:03 2008 for frpuniverse by  doxygen 1.4.7