Definition at line 30 of file b1-army-person.hpp.
Public Member Functions | |
b1ArmyPerson () | |
void | enlist () |
void | skillTables (int n) |
b1ArmyPerson::b1ArmyPerson | ( | ) |
Generic constructor
Definition at line 30 of file b1-army-person.cpp.
References enlist(), and personObj::setService().
00030 : book1Person() { 00031 this->setService("Army"); 00032 this->enlist(); 00033 }
Here is the call graph for this function:
void b1ArmyPerson::enlist | ( | ) |
Enlist this character, and run them through the paces.
Definition at line 35 of file b1-army-person.cpp.
References personObj::addSkill(), personObj::getEducation(), personObj::getEndurance(), personObj::setAccepted(), personObj::setAge(), personObj::setAlive(), personObj::setCommissioned(), personObj::setRank(), personObj::setTerms(), and skillTables().
Referenced by b1ArmyPerson().
00035 { 00036 int dm=0; 00037 int skill_rolls=0; 00038 00039 if ( this->getDexterity() > 5) 00040 dm = 1; 00041 if ( this->getEndurance() > 4 ) 00042 dm = dm + 2; 00043 if ( (d2d6()+dm) > 4 ) { 00044 this->setAccepted(1); 00045 this->addSkill(RIFLE,1); 00046 } else { 00047 this->setAccepted(0); 00048 return ; 00049 } 00050 this->setTerms(1); 00051 while(1){ // while 00052 if ( this->getTerms() == 1 ) { // if 00053 skill_rolls=2; 00054 } else { 00055 skill_rolls=1; 00056 } //end-if 00057 00058 // Determine Survival 00059 // 00060 dm=0; 00061 if ( this->getEducation() > 5) 00062 dm = 2; 00063 if ( (d2d6()+dm) > 4 ) { 00064 // this->setTerms(this->getTerms()+1); 00065 this->setAge( this->getAge()+4); 00066 } else { 00067 this->setAlive(0); 00068 return; 00069 } 00070 00071 // Check to see if commissioned either already or now. 00072 // if already commissioned check for promotion. 00073 00074 if ( this->getCommissioned() == 1 ) { 00075 dm = ( this->getEducation() > 6 ? 1:0); 00076 if ( (d2d6()+dm) > 5 ) { 00077 this->setRank(this->getRank()+1); // promotion of an officer. 00078 skill_rolls++; 00079 } 00080 } else { 00081 dm = ( this->getEndurance() > 6 ? 1 : 0 ) ; 00082 // Roll to see if they get commissioned. 00083 if ( (d2d6()+dm)>5 ){ 00084 this->setCommissioned(1); 00085 this->setRank(1); 00086 this->addSkill(SUBMACHINEGUN,1); 00087 00088 dm = ( this->getEducation() > 6 ? 1:0); 00089 skill_rolls++; 00090 00091 if ( (d2d6()+dm) > 7 ) { 00092 this->setRank(this->getRank()+1); // promotion of an officer. 00093 skill_rolls++; 00094 } 00095 } 00096 } 00097 00098 this->skillTables(skill_rolls); 00099 00100 // I've imposed my own DMS for sanity sake since I don't want people 00101 // managing to be in for 60 terms like some trial runs had. 00102 dm=0; 00103 if ( this->getTerms() > 5 ) { 00104 dm = this->getTerms() - 5; 00105 } 00106 if ( this->getAge() > 50 ) { 00107 dm = dm + (this->getAge()/10); 00108 } 00109 int re_enlisted=0; 00110 00111 if ( (d2d6() - dm) > 5 ) { 00112 this->setTerms(this->getTerms()+1); 00113 re_enlisted=1; 00114 } 00115 00116 // A couple of sanity checks: 00117 if ( this->getRank() > 6) this->setRank(6); 00118 if ( re_enlisted != 1 ) { 00119 00120 this->musterOut(); 00121 return; 00122 } 00123 00124 } 00125 }
Here is the call graph for this function:
Here is the caller graph for this function:
void b1ArmyPerson::skillTables | ( | int | n | ) |
Invoke one several skill tables.
n | number of rolls to run against the skill tables for a given term. |
Definition at line 127 of file b1-army-person.cpp.
Referenced by enlist().
00127 { 00128 // There are 4 different skill tables to deal with here... 00129 // 3 of which are in play when education < 8 and all 4 are 00130 // in play for education >= 8 00131 00132 00133 int roll; 00134 for(roll=1;roll<=nrolls;roll++){ 00135 if ( this->getEducation() < 8 ) { 00136 switch(d1d6()){ 00137 case 1: 00138 case 2: 00139 this->skillTable1(); 00140 break; 00141 case 3: 00142 case 4: 00143 this->skillTable2(); 00144 break; 00145 case 5: 00146 case 6: 00147 this->skillTable3(); 00148 break; 00149 }; 00150 } else { 00151 switch(d2d6()){ 00152 case 1: 00153 this->skillTable1(); 00154 break; 00155 case 2: 00156 case 3: 00157 this->skillTable2(); 00158 break; 00159 case 4: 00160 case 5: 00161 this->skillTable3(); 00162 break; 00163 case 6: 00164 this->skillTable4(); 00165 break; 00166 }; 00167 00168 } 00169 00170 } 00171 }
Here is the caller graph for this function: