00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "b1-marine-person.hpp"
00026 #include "skill-obj.hpp"
00027 #include "dice.hpp"
00028
00029 b1MarinePerson::b1MarinePerson() : book1Person() {
00030 this->setService("Marines");
00031 this->enlist();
00032
00033 }
00034
00035 void b1MarinePerson::enlist(){
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){
00054 if ( this->getTerms() == 1 ) {
00055 skill_rolls=2;
00056 } else {
00057 skill_rolls=1;
00058 }
00059
00060
00061
00062 dm=0;
00063 if ( this->getEndurance() > 7)
00064 dm = 2;
00065 if ( (d2d6()+dm) > 5 ) {
00066
00067 this->setAge( this->getAge()+4);
00068 } else {
00069 this->setAlive(0);
00070 return;
00071 }
00072
00073
00074
00075
00076 if ( this->getCommissioned() == 1 ) {
00077 dm = ( this->getSocialStanding() > 7 ? 1:0);
00078 if ( (d2d6()+dm) > 8 ) {
00079 this->setRank(this->getRank()+1);
00080
00081 skill_rolls++;
00082 }
00083 } else {
00084 dm = ( this->getEducation() > 6 ? 1 : 0 ) ;
00085
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);
00095 skill_rolls++;
00096 }
00097 }
00098
00099 }
00100
00101 this->skillTables(skill_rolls);
00102
00103
00104
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
00120 if ( this->getRank() > 6) this->setRank(6);
00121 if ( re_enlisted != 1 ) {
00122 this->musterOut();
00123 return;
00124 }
00125
00126 }
00127 }
00128
00129 void b1MarinePerson::skillTables(int nrolls){
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 }
00169
00170
00171 void b1MarinePerson::skillTable1(){
00172 switch(d1d6()){
00173 case 1:
00174 this->incrementStrength(1);
00175 break;
00176 case 2:
00177 this->incrementDexterity(1);
00178 break;
00179 case 3:
00180 this->incrementEndurance(1);
00181 break;
00182 case 4:
00183 this->addSkill(GAMBLING,1);
00184 break;
00185 case 5:
00186 this->addSkill(BRAWLING,1);
00187 break;
00188 case 6:
00189 this->addSkill(BLADE_COMBAT,1);
00190 break;
00191 }
00192
00193 }
00194 void b1MarinePerson::skillTable2(){
00195 switch(d1d6()){
00196 case 1:
00197 this->addSkill(VEHICLE,1);
00198 break;
00199 case 2:
00200 this->addSkill(VACC_SUIT,1);
00201 break;
00202 case 3:
00203 case 5:
00204 this->addSkill(BLADE_COMBAT,1);
00205 break;
00206 default:
00207 this->addSkill(GUN_COMBAT,1);
00208 break;
00209 };
00210
00211 }
00212 void b1MarinePerson::skillTable3(){
00213 switch(d1d6()){
00214 case 1:
00215 this->addSkill(VEHICLE,1);
00216 break;
00217 case 2:
00218 this->addSkill(MECHANICAL,1);
00219 break;
00220 case 3:
00221 this->addSkill(ELECTRONICS,1);
00222 break;
00223 case 4:
00224 this->addSkill(TACTICS,1);
00225 break;
00226 case 5:
00227 this->addSkill(BLADE_COMBAT,1);
00228 break;
00229 case 6:
00230 this->addSkill(GUN_COMBAT,1);
00231 break;
00232 }
00233
00234 }
00235 void b1MarinePerson::skillTable4(){
00236 switch(d1d6()){
00237 case 1:
00238 this->addSkill(MEDICAL,1);
00239 break;
00240 case 2:
00241 case 3:
00242 this->addSkill(TACTICS,1);
00243 break;
00244 case 4:
00245 this->addSkill(COMPUTER,1);
00246 break;
00247 case 5:
00248 this->addSkill(LEADER,1);
00249 break;
00250 case 6:
00251 this->addSkill(ADMIN,1);
00252 break;
00253 };
00254
00255 }
00256
00257 static int cashRolls=0;
00258 static int materialRolls=0;
00259
00260 void b1MarinePerson::musterOut(){
00261 int ix;
00262
00263 if ( this->getTerms() > 3 ) {
00264 cashRolls=3;
00265 } else {
00266 cashRolls = randxInRange(1,this->getTerms());
00267 }
00268
00269 materialRolls=this->getTerms() - cashRolls;
00270
00271 for(ix=1;ix<=cashRolls;ix++)
00272 this->cashTable();
00273
00274 for(ix=1;ix<=materialRolls;ix++)
00275 this->materialTable();
00276
00277
00278 }
00279
00280 void b1MarinePerson::cashTable(){
00281 int dm = ( this->getRank() > 4 ? 1 : 0 );
00282 double amount;
00283
00284 switch(d1d6()+dm){
00285 case 1:
00286 amount=2000;
00287 break;
00288 case 2:
00289 case 3:
00290 amount=5000;
00291 break;
00292
00293 case 4:
00294 amount=10000;
00295 break;
00296
00297 case 5:
00298 amount=20000;
00299 break;
00300
00301 case 6:
00302 amount=30000;
00303 break;
00304 default:
00305 amount=40000;
00306 break;
00307 }
00308
00309 this->setCash(this->getCash()+amount);
00310 }
00311
00312 void b1MarinePerson::materialTable(){
00313 int dm = ( this->getRank() > 4 ? 1 : 0 ) + d1d6();
00314
00315
00316 switch(dm){
00317 case 1:
00318 this->addMaterialBenefit(new mbLowPassage());
00319 break;
00320 case 2:
00321 this->incrementIntelligence(2);
00322 break;
00323 case 3:
00324 this->incrementEducation(1);
00325 break;
00326 case 4:
00327 this->addMaterialBenefit(new mbBlade());
00328 break;
00329 case 5:
00330 this->addMaterialBenefit(new mbTAS());
00331 break;
00332 case 6:
00333 this->addMaterialBenefit(new mbHighPassage());
00334 break;
00335 default:
00336 this->incrementSocialStanding(2);
00337 break;
00338 };
00339 }
00340
00341
00342