bool Shop::ShopItem::valid_item() const { int i=-1; switch (itemclass_) { case WEAPON: i = getweapontype(itemtypename_); break; case CLIP: i = getcliptype(itemtypename_); break; case ARMOR: i = getarmortype(itemtypename_); break; case LOOT: i = getloottype(itemtypename_); break; } return (i != -1); }
void Shop::ShopItem::choose(squadst& customers, int& buyer) const { if (is_available()) { ledger.subtract_funds(adjusted_price(), EXPENSE_SHOPPING); switch (itemclass_) { case WEAPON: { Weapon* i = new Weapon(*weapontype[getweapontype(itemtypename_)]); customers.squad[buyer]->give_weapon(*i, &location[customers.squad[0]->base]->loot); if (i->empty()) delete i; else location[customers.squad[0]->base]->loot.push_back(i); break; } case CLIP: { Clip* i = new Clip(*cliptype[getcliptype(itemtypename_)]); customers.squad[buyer]->take_clips(*i, 1); if (i->empty()) delete i; else location[customers.squad[0]->base]->loot.push_back(i); break; } case ARMOR: { Armor* i = new Armor(*armortype[getarmortype(itemtypename_)]); customers.squad[buyer]->give_armor(*i, &location[customers.squad[0]->base]->loot); if (i->empty()) delete i; else location[customers.squad[0]->base]->loot.push_back(i); break; } case LOOT: { Loot* i = new Loot(*loottype[getloottype(itemtypename_)]); location[customers.squad[0]->base]->loot.push_back(i); break; } } } }
const std::string& Shop::ShopItem::get_description() const { if (description_defined_) { return description_; } else { switch (itemclass_) { default: return description_; // Will be "UNDEFINED" case WEAPON: return weapontype[getweapontype(itemtypename_)]->get_name(); case CLIP : return cliptype [getcliptype (itemtypename_)]->get_name(); case ARMOR : return armortype [getarmortype (itemtypename_)]->get_name(); case LOOT : return loottype [getloottype (itemtypename_)]->get_name(); } } }
bool populate_masks_from_xml(vector<ArmorType*>& masks,string file,Log& log) { CMarkup xml; if(!xml.Load(string(artdir)+file)) { //File is missing or not valid XML. addstr("Failed to load "+file+"!",log); getkey(); return false; //Abort. } xml.FindElem(); xml.IntoElem(); int defaultindex; if(xml.FindElem("default")) defaultindex=getarmortype(xml.GetData()); else { addstr("Default missing for masks!",log); getkey(); return false; //Abort. } if(defaultindex==-1) { addstr("Default for masks is not a known armor type!",log); getkey(); return false; //Abort. } xml.ResetMainPos(); while(xml.FindElem("masktype")) armortype.push_back(new ArmorType(*armortype[defaultindex],xml.GetSubDoc())); return true; }
CreatureType::CreatureType(const std::string& xmlstring) : age_(18,57), alignment_public_mood_(true), attribute_points_(40), gender_liberal_(GENDER_RANDOM), gender_conservative_(GENDER_RANDOM), infiltration_(0), juice_(0), money_(20,40) { for(int i=0; i<ATTNUM; i++) attributes_[i].set_interval(1,10); id_=number_of_creaturetypes++; CMarkup xml; xml.SetDoc(xmlstring); xml.FindElem(); idname_=xml.GetAttrib("idname"); if(!len(idname_)) { idname_ = "LACKS IDNAME "+tostring(id_); xmllog.log("Creature type "+tostring(id_)+" lacks idname."); } type_=creaturetype_string_to_enum(idname_); xml.IntoElem(); // Loop over all the elements inside the creaturetype element. while(xml.FindElem()) { std::string element = xml.GetTagName(); if (element == "alignment") { std::string alignment = xml.GetData(); if (alignment == "PUBLIC MOOD") alignment_public_mood_ = true; else if (alignment == "LIBERAL") { alignment_ = ALIGN_LIBERAL; alignment_public_mood_ = false; } else if (alignment == "MODERATE") { alignment_ = ALIGN_MODERATE; alignment_public_mood_ = false; } else if (alignment == "CONSERVATIVE") { alignment_ = ALIGN_CONSERVATIVE; alignment_public_mood_ = false; } else xmllog.log("Invalid alignment for " + idname_ + ": " + alignment); } else if (element == "age") { std::string age = xml.GetData(); if (age == "DOGYEARS") age_.set_interval(2,6); else if (age == "CHILD") age_.set_interval(7,10); else if (age == "TEENAGER") age_.set_interval(14,17); else if (age == "YOUNGADULT") age_.set_interval(18,35); else if (age == "MATURE") age_.set_interval(20,59); else if (age == "GRADUATE") age_.set_interval(26,59); else if (age == "MIDDLEAGED") age_.set_interval(35,59); else if (age == "SENIOR") age_.set_interval(65,94); else assign_interval(age_, age, idname_, element); } else if (element == "attribute_points") assign_interval(attribute_points_, xml.GetData(), idname_, element); else if (element == "attributes") { while(xml.FindChildElem()) { int attribute = attribute_string_to_enum(xml.GetChildTagName()); if (attribute != -1) assign_interval(attributes_[attribute], xml.GetChildData(), idname_, element); else xmllog.log("Unknown attribute in " + idname_ + ": " + xml.GetTagName()); } } else if (element == "juice") assign_interval(juice_, xml.GetData(), idname_, element); else if (element == "gender") { int gender = gender_string_to_enum(xml.GetData()); if (gender != -1 && gender != GENDER_WHITEMALEPATRIARCH) gender_liberal_ = gender_conservative_ = gender; else xmllog.log("Invalid gender for " + idname_ + ": " + xml.GetData()); } else if (element == "infiltration") assign_interval(infiltration_, xml.GetData(), idname_, element); else if (element == "money") assign_interval(money_, xml.GetData(), idname_, element); else if (element == "skills") { while(xml.FindChildElem()) { int skill = skill_string_to_enum(xml.GetChildTagName()); if (skill != -1) assign_interval(skills_[skill], xml.GetChildData(), idname_, element); else xmllog.log("Unknown skill for " + idname_ + ": " + xml.GetChildTagName()); } } else if (element == "armor") { if (getarmortype(xml.GetData()) != -1) armortypes_.push_back(xml.GetData()); else xmllog.log("Invalid armor type for " + idname_ + ": " + xml.GetData());; } else if (element == "weapon") { //xml.SavePos("creature"); weapons_and_clips_.push_back(WeaponsAndClips(xml, idname_)); //xml.RestorePos("creature"); } else if (element == "encounter_name") encounter_name_ = xml.GetData(); else if (element == "type_name") type_name_ = xml.GetData(); else xmllog.log("Unknown element for " + idname_ + ": " + element); } if (!len(type_name_)) { xmllog.log("type_name not defined for " + idname_ + "."); type_name_ = "UNDEFINED"; } // If no weapon type has been given then use WEAPON_NONE. if (!len(weapons_and_clips_)) weapons_and_clips_.push_back(WeaponsAndClips("WEAPON_NONE", 1, "NONE", 0)); // If no armor type has been given then use ARMOR_NONE. if (!len(armortypes_)) armortypes_.push_back("ARMOR_NONE"); }
void CreatureType::give_armor(Creature& cr) const { const std::string str = pickrandom(armortypes_); if (str != "ARMOR_NONE") cr.give_armor(*armortype[getarmortype(str)], NULL); }
/* does end of month actions */ void passmonth(char &clearformess,char canseethings) { short oldlaw[LAWNUM]; memmove(oldlaw,law,sizeof(short)*LAWNUM); int l, v, p; //TIME ADVANCE day=1; month++; if(month==13) { month=1; year++; } switch(endgamestate) { case ENDGAME_NONE: if(publicmood(-1)>60) { endgamestate=ENDGAME_CCS_APPEARANCE; attitude[VIEW_CONSERVATIVECRIMESQUAD]=0; } break; case ENDGAME_CCS_APPEARANCE: if(publicmood(-1)>80) endgamestate=ENDGAME_CCS_ATTACKS; break; case ENDGAME_CCS_ATTACKS: if(publicmood(-1)>90) endgamestate=ENDGAME_CCS_SIEGES; break; case ENDGAME_CCS_SIEGES: case ENDGAME_CCS_DEFEATED: //if(publicmood(-1)>85&&presparty!=LIBERAL_PARTY) // endgamestate=ENDGAME_MARTIALLAW; break; } //CLEAR RENT EXEMPTIONS for(l=0;l<len(location);l++) location[l]->newrental=0; //YOUR PAPER AND PUBLIC OPINION AND STUFF vector<int> nploc; for(l=0;l<len(location);l++) { if((location[l]->compound_walls & COMPOUND_PRINTINGPRESS)&& !location[l]->siege.siege&& location[l]->renting!=RENTING_CCS) nploc.push_back(l); } // Check for game over endcheck(END_DEAD); dispersalcheck(clearformess); int guardianpower=0; if(len(nploc)&&!disbanding) { //DO SPECIAL EDITIONS int loottypeindex=choosespecialedition(clearformess); if(loottypeindex!=-1) { guardianpower+=10*len(nploc); printnews(loottypeindex,len(nploc)); if(loottype[loottypeindex]->get_idname()=="LOOT_INTHQDISK"|| //For special edition xml file? -XML loottype[loottypeindex]->get_idname()=="LOOT_SECRETDOCUMENTS") { for(int l=0;l<len(nploc);l++) criminalizepool(LAWFLAG_TREASON,-1,nploc[l]); } } } int libpower[VIEWNUM]={0}; //STORIES STALE EVEN IF NOT PRINTED for(v=0;v<VIEWNUM;v++)public_interest[v]/=2; int conspower=200-attitude[VIEW_AMRADIO]-attitude[VIEW_CABLENEWS]; //HAVING SLEEPERS for(int pl=len(pool)-1;pl>0;pl--) if(pool[pl]->alive&&(pool[pl]->flag & CREATUREFLAG_SLEEPER)) sleepereffect(*pool[pl],clearformess,canseethings,libpower); //Manage graffiti for(int l=0;l<len(location);l++) // Check each location { for(int c=len(location[l]->changes)-1;c>=0;c--) // Each change to the map { if(location[l]->changes[c].flag==SITEBLOCK_GRAFFITI|| location[l]->changes[c].flag==SITEBLOCK_GRAFFITI_CCS|| location[l]->changes[c].flag==SITEBLOCK_GRAFFITI_OTHER) // Find changes that refer specifically to graffiti { int power=0,align=0; if(location[l]->changes[c].flag==SITEBLOCK_GRAFFITI) align=1; if(location[l]->changes[c].flag==SITEBLOCK_GRAFFITI_CCS) align=-1; //Purge graffiti from more secure sites (or from non-secure //sites about once every five years), but these will //influence people more for the current month if(securityable(location[l]->type)) { location[l]->changes.erase(location[l]->changes.begin()+c); power=5; } else { if(location[l]->renting==RENTING_CCS) location[l]->changes[c].flag=SITEBLOCK_GRAFFITI_CCS; // Convert to CCS tags else if(location[l]->renting==RENTING_PERMANENT) location[l]->changes[c].flag=SITEBLOCK_GRAFFITI; // Convert to LCS tags else { power=1; if(!LCSrandom(10)) location[l]->changes[c].flag=SITEBLOCK_GRAFFITI_OTHER; // Convert to other tags if(!LCSrandom(10)&&endgamestate<ENDGAME_CCS_DEFEATED&&endgamestate>0) location[l]->changes[c].flag=SITEBLOCK_GRAFFITI_CCS; // Convert to CCS tags if(!LCSrandom(30)) location[l]->changes.erase(location[l]->changes.begin()+c); // Clean up } } if(align==1) { background_liberal_influence[VIEW_LIBERALCRIMESQUAD]+=power; background_liberal_influence[VIEW_CONSERVATIVECRIMESQUAD]+=power; } else if(align==-1) { background_liberal_influence[VIEW_LIBERALCRIMESQUAD]-=power; background_liberal_influence[VIEW_CONSERVATIVECRIMESQUAD]-=power; } } } } int mediabalance=0; int issuebalance[VIEWNUM-5]; //int stimulus=0; //double cost=0; //double tax=0; //PUBLIC OPINION NATURAL MOVES for(v=0;v<VIEWNUM;v++) { // Liberal essays add their power to the effect of sleepers libpower[v]+=background_liberal_influence[v]; background_liberal_influence[v]=static_cast<short>(background_liberal_influence[v]*0.66); if(v==VIEW_LIBERALCRIMESQUADPOS) continue; if(v==VIEW_LIBERALCRIMESQUAD) continue; //if(v==VIEW_POLITICALVIOLENCE) //{ // change_public_opinion(VIEW_POLITICALVIOLENCE,-1,0); // continue; //} if(v==VIEW_CONSERVATIVECRIMESQUAD) continue; if(v!=VIEW_AMRADIO&&v!=VIEW_CABLENEWS) { issuebalance[v] = libpower[v] - conspower; mediabalance += issuebalance[v]; // Heavy randomization -- balance of power just biases the roll int roll = issuebalance[v] + LCSrandom(400)-200; // If +/-50 to either side, that side wins the tug-of-war if(roll < -50) change_public_opinion(v,-1,0); else if(roll > 50) change_public_opinion(v,1,0); else // Else random movement change_public_opinion(v,LCSrandom(2)*2-1,0); } // AM Radio and Cable News popularity slowly shift to reflect public // opinion over time -- if left unchecked, their subtle influence // on society will become a self-perpetuating Conservative nightmare! else if(v==VIEW_AMRADIO||v==VIEW_CABLENEWS) { if(publicmood(-1)<attitude[v])change_public_opinion(v,-1); else change_public_opinion(v,1); } } // Temporary Stalinizing Code (TODO: Implement the Stalinist Comrade Squad for changing public opinion, then remove this) if(stalinmode) for(int v=0;v<VIEWNUM-3;v++) { if(stalinview(v,false)) { if((attitude[v]+=3)>100) attitude[v]=100; } else { if(--attitude[v]<0) attitude[v]=0; } } // End Temporary Stalinizing Code (TODO: Implement the Stalinist Comrade Squad for changing public opinion, then remove this) // Seduction monthly experience stipends for those liberals // who have been getting it on with their love slaves/masters // in the background for(int s=0;s<len(pool);s++) { pool[s]->train(SKILL_SEDUCTION,loveslaves(*pool[s])*5); if(pool[s]->flag & CREATUREFLAG_LOVESLAVE) pool[s]->train(SKILL_SEDUCTION,5); } /******************************************************* * INTELLIGENCE REPORT * * ONLY IF SHOWMECHANICS OR SHOWWAIT IS DEFINED * * EYES ONLY - LCS PROPERTY - TOP SECRET * *******************************************************/ #if defined(SHOWMECHANICS) || defined(SHOWWAIT) if(canseethings) { music.play(MUSIC_ELECTIONS); erase(); set_color(COLOR_WHITE,COLOR_BLACK,1); mvaddstr(0,23,"LCS MONTHLY INTELLIGENCE REPORT"); mvaddstr(2,27,"CURRENT POLITICAL TRENDS"); int numviews=(endgamestate>=ENDGAME_CCS_DEFEATED||newscherrybusted<2)?VIEWNUM-1:VIEWNUM; for(int v=-1-stalinmode,y=4,x=0,pip;v<numviews;v++) { if((y-4)*2>=numviews+1+stalinmode) y=4,x=40; for(pip=2;pip>=-2;pip--) { set_alignment_color(pip,true); if(pip==2) mvaddchar(y,x+22,'\x11'); addstr("ÄÄÄ"); if(pip==-2) addchar('\x10'); } if(v>=0) pip=14-(attitude[v]*14)/100; else pip=14-(publicmood(v)*14)/100; set_alignment_color((14-pip)/3-2,true); mvaddstr(y,x,getview(v,false)); mvaddchar(y++,x+23+pip,'O'); } set_color(COLOR_GREEN,COLOR_BLACK,1); mvaddstr(23,0,"Elite Liberal "); set_color(COLOR_WHITE,COLOR_BLACK,0); addstr("- "); set_color(COLOR_CYAN,COLOR_BLACK,1); addstr("Liberal "); set_color(COLOR_WHITE,COLOR_BLACK,0); addstr("- "); set_color(COLOR_YELLOW,COLOR_BLACK,1); addstr("moderate "); set_color(COLOR_WHITE,COLOR_BLACK,0); addstr("- "); set_color(COLOR_MAGENTA,COLOR_BLACK,1); addstr("Conservative "); set_color(COLOR_WHITE,COLOR_BLACK,0); addstr("- "); set_color(COLOR_RED,COLOR_BLACK,1); addstr("Arch-Conservative"); set_color(COLOR_WHITE,COLOR_BLACK,0); mvaddstr(24,0,"Press any key to reflect on these poll numbers."); clearformess=1; getkey(); } #endif /******************************************************* * * * END INTELLIGENCE REPORT * * * *******************************************************/ //ELECTIONS if(month==11){elections(clearformess,canseethings);clearformess=1;} //SUPREME COURT if(month==6){supremecourt(clearformess,canseethings);clearformess=1;} //CONGRESS congress(clearformess,canseethings);clearformess=1; //DID YOU WIN? if(wincheck()) { liberalagenda(1); savehighscore(END_WON); reset(savefile_name); viewhighscores(); end_game(); } //CONTROL LONG DISBANDS if(disbanding&&year-disbandtime>=50) { music.play(MUSIC_DEFEAT); set_color(COLOR_WHITE,COLOR_BLACK,1); erase(); move(12,10); addstr("The Liberal Crime Squad is now just a memory.", gamelog); gamelog.newline(); getkey(); set_color(COLOR_WHITE,COLOR_BLACK,0); erase(); move(12,12); addstr("The last LCS members have all been hunted down.", gamelog); gamelog.newline(); getkey(); set_color(COLOR_BLACK,COLOR_BLACK,1); erase(); move(12,14); addstr("They will never see the utopia they dreamed of...", gamelog); gamelog.newline(); gamelog.nextMessage(); getkey(); savehighscore(END_DISBANDLOSS); reset(savefile_name); viewhighscores(); end_game(); } //UPDATE THE WORLD IN CASE THE LAWS HAVE CHANGED updateworld_laws(law,oldlaw); //THE SYSTEM! for(p=len(pool)-1;p>=0;p--) { if(disbanding) break; if(!pool[p]->alive) continue; if(pool[p]->flag & CREATUREFLAG_SLEEPER) continue; if(pool[p]->location==-1) continue; if(location[pool[p]->location]->type==SITE_GOVERNMENT_POLICESTATION) { if(clearformess) erase(); else makedelimiter(); if(pool[p]->flag & CREATUREFLAG_MISSING) { set_color(COLOR_MAGENTA,COLOR_BLACK,1); move(8,1); addstr("Cops re-polluted ", gamelog); addstr(pool[p]->name, gamelog); addstr("'s mind with Conservatism!", gamelog); gamelog.nextMessage(); getkey(); removesquadinfo(*pool[p]); delete_and_remove(pool,p); continue; } else if(pool[p]->flag & CREATUREFLAG_ILLEGALALIEN && law[LAW_IMMIGRATION]!=2) { set_color(COLOR_MAGENTA,COLOR_BLACK,1); move(8,1); addstr(pool[p]->name, gamelog); addstr(" has been shipped out to the INS to face ", gamelog); if(law[LAW_IMMIGRATION]==-2 && law[LAW_DEATHPENALTY]==-2) addstr("execution.", gamelog); else addstr("deportation.", gamelog); gamelog.newline(); getkey(); removesquadinfo(*pool[p]); delete_and_remove(pool,p); continue; } else { //TRY TO GET RACKETEERING CHARGE int copstrength=100; if(law[LAW_POLICEBEHAVIOR]==-2) copstrength=200; if(law[LAW_POLICEBEHAVIOR]==-1) copstrength=150; if(law[LAW_POLICEBEHAVIOR]==1) copstrength=75; if(law[LAW_POLICEBEHAVIOR]==2) copstrength=50; copstrength=(copstrength*pool[p]->heat)/4; if(copstrength>200)copstrength=200; //Confession check if(LCSrandom(copstrength)>pool[p]->juice + pool[p]->get_attribute(ATTRIBUTE_HEART,true)*5 - pool[p]->get_attribute(ATTRIBUTE_WISDOM,true)*5 + pool[p]->get_skill(SKILL_PSYCHOLOGY)*5 /*+ pool[p]->get_skill(SKILL_SURVIVAL)*5*/ && pool[p]->hireid!=-1) { int nullify=0; int p2=getpoolcreature(pool[p]->hireid); if(pool[p2]->alive && (pool[p2]->location==-1 || location[pool[p2]->location]->type!=SITE_GOVERNMENT_PRISON)) { //Charge the boss with racketeering! criminalize(*pool[p2],LAWFLAG_RACKETEERING); //Rack up testimonies against the boss in court! pool[p2]->confessions++; } if(!nullify) { //Issue a raid on this guy's base! if(pool[p]->base>=0)location[pool[p]->base]->heat+=300; set_color(COLOR_WHITE,COLOR_BLACK,1); move(8,1); addstr(pool[p]->name, gamelog); addstr(" has broken under the pressure and ratted you out!", gamelog); gamelog.newline(); getkey(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(9,1); addstr("The traitor will testify in court, and safehouses may be compromised.", gamelog); gamelog.nextMessage(); getkey(); removesquadinfo(*pool[p]); delete_and_remove(pool,p); continue; //no trial for this person; skip to next person } //else continue to trial } set_color(COLOR_WHITE,COLOR_BLACK,1); move(8,1); addstr(pool[p]->name, gamelog); addstr(" is moved to the courthouse for trial.", gamelog); gamelog.nextMessage(); getkey(); pool[p]->location=find_courthouse(*pool[p]); Armor prisoner(*armortype[getarmortype("ARMOR_PRISONER")]); pool[p]->give_armor(prisoner,NULL); } } else if(location[pool[p]->location]->type==SITE_GOVERNMENT_COURTHOUSE) { trial(*pool[p]); clearformess=1; } else if(location[pool[p]->location]->type==SITE_GOVERNMENT_PRISON) if(prison(*pool[p])) clearformess=1; } //NUKE EXECUTION VICTIMS for(p=len(pool)-1;p>=0;p--) { if(pool[p]->location==-1) continue; if(location[pool[p]->location]->type==SITE_GOVERNMENT_PRISON&&!pool[p]->alive) { removesquadinfo(*pool[p]); pool[p]->die(); pool[p]->location=-1; } } //MUST DO AN END OF GAME CHECK HERE BECAUSE OF EXECUTIONS endcheck(END_EXECUTED); //DISPERSAL CHECK dispersalcheck(clearformess); //FUND REPORTS if(canseethings)fundreport(clearformess); ledger.resetMonthlyAmounts(); if(clearformess) erase(); //HEAL CLINIC PEOPLE for(p=0;p<len(pool);p++) { if(disbanding) break; if(!(pool[p]->alive)) continue; if(pool[p]->clinic>0) { pool[p]->clinic--; for(int w=0;w<BODYPARTNUM;w++) { if((pool[p]->wound[w]&WOUND_NASTYOFF)||(pool[p]->wound[w]&WOUND_CLEANOFF)) pool[p]->wound[w]=(char)WOUND_CLEANOFF; else pool[p]->wound[w]=0; } int healthdamage = 0; if(pool[p]->special[SPECIALWOUND_RIGHTLUNG]!=1) { pool[p]->special[SPECIALWOUND_RIGHTLUNG]=1; if(LCSrandom(2)) healthdamage++; } if(pool[p]->special[SPECIALWOUND_LEFTLUNG]!=1) { pool[p]->special[SPECIALWOUND_LEFTLUNG]=1; if(LCSrandom(2)) healthdamage++; } if(pool[p]->special[SPECIALWOUND_HEART]!=1) { pool[p]->special[SPECIALWOUND_HEART]=1; if(LCSrandom(3)) healthdamage++; } pool[p]->special[SPECIALWOUND_LIVER]=1; pool[p]->special[SPECIALWOUND_STOMACH]=1; pool[p]->special[SPECIALWOUND_RIGHTKIDNEY]=1; pool[p]->special[SPECIALWOUND_LEFTKIDNEY]=1; pool[p]->special[SPECIALWOUND_SPLEEN]=1; pool[p]->special[SPECIALWOUND_RIBS]=RIBNUM; if(!pool[p]->special[SPECIALWOUND_NECK]) pool[p]->special[SPECIALWOUND_NECK]=2; if(!pool[p]->special[SPECIALWOUND_UPPERSPINE]) pool[p]->special[SPECIALWOUND_UPPERSPINE]=2; if(!pool[p]->special[SPECIALWOUND_LOWERSPINE]) pool[p]->special[SPECIALWOUND_LOWERSPINE]=2; // Inflict permanent health damage pool[p]->set_attribute(ATTRIBUTE_HEALTH,pool[p]->get_attribute(ATTRIBUTE_HEALTH,0)-healthdamage); if(pool[p]->get_attribute(ATTRIBUTE_HEALTH,0)<=0) pool[p]->set_attribute(ATTRIBUTE_HEALTH,1); if(pool[p]->blood<=20&&pool[p]->clinic<=2)pool[p]->blood=50; if(pool[p]->blood<=50&&pool[p]->clinic<=1)pool[p]->blood=75; // If at clinic and in critical condition, transfer to university hospital if(pool[p]->clinic > 2 && pool[p]->location > -1 && location[pool[p]->location]->type==SITE_HOSPITAL_CLINIC) { int hospital=find_hospital(*pool[p]); if(hospital!=-1) { pool[p]->location=hospital; set_color(COLOR_WHITE,COLOR_BLACK,1); move(8,1); addstr(pool[p]->name, gamelog); addstr(" has been transferred to ", gamelog); addstr(location[hospital]->name, gamelog); addstr(".", gamelog); gamelog.nextMessage(); getkey(); } } // End treatment if(pool[p]->clinic==0) { pool[p]->blood=100; if(clearformess) erase(); else makedelimiter(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(8,1); addstr(pool[p]->name, gamelog); addstr(" has left ", gamelog); addstr(location[pool[p]->location]->name, gamelog); addstr(".", gamelog); gamelog.nextMessage(); int hs=find_homeless_shelter(*pool[p]); if(hs==-1) hs=0; //TODO: Error unable to find location if(location[pool[p]->base]->siege.siege|| location[pool[p]->base]->renting==RENTING_NOCONTROL) pool[p]->base=hs; pool[p]->location=pool[p]->base; getkey(); } } } }
/* loads the game from save.dat */ char load(const string& filename) { //LOAD FILE int loadversion; int l; bool dummy_b; int dummy; long dummy_l; FILE *h; h=LCSOpenFile(filename.c_str(), "rb", LCSIO_PRE_HOME); if(h!=NULL) { fread(&loadversion,sizeof(int),1,h); //NUKE INVALID SAVE GAMES if(loadversion<lowestloadversion) { LCSCloseFile(h); reset(); return 0; } fread(seed,sizeof(unsigned long),RNG_SIZE,h); fread(&mode,sizeof(short),1,h); fread(&wincondition,sizeof(short),1,h); fread(&fieldskillrate,sizeof(short),1,h); fread(&day,sizeof(int),1,h); fread(&month,sizeof(int),1,h); fread(&year,sizeof(int),1,h); fread(&execterm,sizeof(short),1,h); fread(&presparty,sizeof(short),1,h); fread(&amendnum,sizeof(int),1,h); fread(&multipleCityMode,sizeof(bool),1,h); fread(&termlimits,sizeof(bool),1,h); fread(&deagle,sizeof(bool),1,h); fread(&m249,sizeof(bool),1,h); fread(¬ermlimit,sizeof(bool),1,h); fread(&nocourtpurge,sizeof(bool),1,h); fread(&stalinmode,sizeof(bool),1,h); fread(&stat_recruits,sizeof(int),1,h); fread(&stat_dead,sizeof(int),1,h); fread(&stat_kills,sizeof(int),1,h); fread(&stat_kidnappings,sizeof(int),1,h); fread(&stat_buys,sizeof(int),1,h); fread(&stat_burns,sizeof(int),1,h); fread(&endgamestate,sizeof(char),1,h); fread(&ccsexposure,sizeof(char),1,h); fread(&ccs_kills,sizeof(char),1,h); fread(&Vehicle::curcarid,sizeof(long),1,h); fread(&curcreatureid,sizeof(long),1,h); fread(&cursquadid,sizeof(long),1,h); fread(&police_heat,sizeof(int),1,h); fread(&offended_corps,sizeof(short),1,h); fread(&offended_cia,sizeof(short),1,h); fread(&offended_amradio,sizeof(short),1,h); fread(&offended_cablenews,sizeof(short),1,h); fread(&offended_firemen,sizeof(short),1,h); fread(attorneyseed,sizeof(unsigned long),RNG_SIZE,h); //fread(&selectedsiege,sizeof(long),1,h); fread(lcityname,sizeof(char),CITY_NAMELEN,h); fread(&newscherrybusted,sizeof(char),1,h); fread(slogan,sizeof(char),SLOGAN_LEN,h); fread(&ledger,sizeof(class Ledger),1,h); fread(&party_status,sizeof(short),1,h); fread(attitude,sizeof(short),VIEWNUM,h); fread(law,sizeof(short),LAWNUM,h); fread(house,sizeof(short),HOUSENUM,h); fread(senate,sizeof(short),SENATENUM,h); fread(court,sizeof(short),COURTNUM,h); fread(courtname,sizeof(char)*POLITICIAN_NAMELEN,COURTNUM,h); fread(exec,sizeof(char),EXECNUM,h); fread(execname,sizeof(char)*POLITICIAN_NAMELEN,EXECNUM,h); fread(oldPresidentName,sizeof(char),POLITICIAN_NAMELEN,h); //LOCATIONS fread(&dummy,sizeof(int),1,h); location.resize(dummy); for(l=0;l<len(location);l++) { location[l]=new Location; fread(&dummy,sizeof(int),1,h); location[l]->loot.resize(dummy); for(int l2=0;l2<len(location[l]->loot);l2++) { int itemLen; fread(&itemLen, sizeof(int), 1, h); vector<char> vec = vector<char>(itemLen + 1); fread(&vec[0], itemLen, 1, h); vec[itemLen] = '\0'; Item* it = create_item(&vec[0]); if(it!=NULL) location[l]->loot[l2] = it; } //Remove items of unknown type. for(int l2=len(location[l]->loot)-1; l2>=0; l2--) { bool del = false; if(location[l]->loot[l2]->is_loot()) del = (getloottype(location[l]->loot[l2]->get_itemtypename()) == -1); else if(location[l]->loot[l2]->is_clip()) del = (getcliptype(location[l]->loot[l2]->get_itemtypename()) == -1); else if(location[l]->loot[l2]->is_weapon()) del = (getweapontype(location[l]->loot[l2]->get_itemtypename()) == -1); else if(location[l]->loot[l2]->is_armor()) del = (getarmortype(location[l]->loot[l2]->get_itemtypename()) == -1); if(del) { addstr("Item type "); addstr(location[l]->loot[l2]->get_itemtypename()); addstr(" does not exist. Deleting item."); delete_and_remove(location[l]->loot,l2); } } consolidateloot(location[l]->loot); // consolidate loot after loading fread(&dummy,sizeof(int),1,h); location[l]->changes.resize(dummy); for(int l2=0;l2<len(location[l]->changes);l2++) fread(&location[l]->changes[l2],sizeof(sitechangest),1,h); fread(location[l]->name,sizeof(char),LOCATION_NAMELEN,h); fread(location[l]->shortname,sizeof(char),LOCATION_SHORTNAMELEN,h); fread(&location[l]->type,sizeof(char),1,h); fread(&location[l]->city,sizeof(int),1,h); fread(&location[l]->area,sizeof(int),1,h); fread(&location[l]->parent,sizeof(int),1,h); fread(&location[l]->id,sizeof(int),1,h); fread(&location[l]->renting,sizeof(int),1,h); fread(&location[l]->newrental,sizeof(char),1,h); fread(&location[l]->needcar,sizeof(char),1,h); fread(&location[l]->closed,sizeof(int),1,h); fread(&location[l]->hidden,sizeof(bool),1,h); fread(&location[l]->mapped,sizeof(bool),1,h); fread(&location[l]->upgradable,sizeof(bool),1,h); fread(&location[l]->highsecurity,sizeof(int),1,h); fread(&location[l]->siege,sizeof(siegest),1,h); fread(&location[l]->heat,sizeof(int),1,h); fread(&location[l]->heat_protection,sizeof(int),1,h); fread(&location[l]->compound_walls,sizeof(int),1,h); fread(&location[l]->compound_stores,sizeof(int),1,h); fread(&location[l]->front_business,sizeof(char),1,h); fread(location[l]->front_name,sizeof(char),LOCATION_NAMELEN,h); fread(location[l]->front_shortname,sizeof(char),LOCATION_SHORTNAMELEN,h); fread(&location[l]->haveflag,sizeof(bool),1,h); fread(location[l]->mapseed,sizeof(unsigned long),RNG_SIZE,h); } //VEHICLES fread(&dummy,sizeof(int),1,h); vehicle.resize(dummy); for(l=0;l<len(vehicle);l++) { int vehicleLen; fread (&vehicleLen, sizeof(int), 1, h); vector<char> vec = vector<char> (vehicleLen + 1); fread (&vec[0], vehicleLen, 1, h); vec[vehicleLen] = '\0'; vehicle[l] = new Vehicle (&vec[0]); } //POOL fread(&dummy,sizeof(int),1,h); pool.resize(dummy); for(int pl=0;pl<len(pool);pl++) { int creatureLen; fread (&creatureLen, sizeof(int), 1, h); vector<char> vec = vector<char> (creatureLen + 1); fread (&vec[0], creatureLen, 1, h); vec[creatureLen] = '\0'; pool[pl] = new Creature(&vec[0]); //pool[pl]=new Creature; //fread(pool[pl],sizeof(Creature),1,h); //read extra interrogation data if applicable if(pool[pl]->align==-1 && pool[pl]->alive) { interrogation* &intr = pool[pl]->activity.intr(); intr = new interrogation; fread(intr->techniques,sizeof(bool[6]),1,h); fread(&intr->druguse,sizeof(int),1,h); intr->rapport.clear(); int size; fread(&size,sizeof(int),1,h); for(int i=0;i<size;i++) { long id; float_zero value; fread(&id,sizeof(long),1,h); fread(&value,sizeof(float_zero),1,h); intr->rapport[id]=value; } } /* //read equipment vector<Item*> dump; //Used to catch invalid pointers from creature so they aren't deleted. pool[pl]->drop_weapon(&dump); pool[pl]->strip(&dump); pool[pl]->clips = deque<Clip*>(); pool[pl]->extra_throwing_weapons = deque<Weapon*>(); int itemLen; fread(&itemLen, sizeof(int), 1, h); if(itemLen != 0) { vector<char> vec = vector<char>(itemLen + 1); fread(&vec[0], itemLen, 1, h); vec[itemLen] = '\0'; Weapon w(&vec[0]); if(getweapontype(w.get_itemtypename())!=-1) //Check it is a valid weapon type. pool[pl]->give_weapon(w,&dump); } //pool[pl]->clips.clear(); fread(&dummy,sizeof(int),1,h); for(int nc=0; nc<dummy; nc++) { fread(&itemLen, sizeof(itemLen), 1, h); vector<char> vec = vector<char>(itemLen + 1); fread(&vec[0], itemLen, 1, h); vec[itemLen] = '\0'; Clip c(&vec[0]); if(getcliptype(c.get_itemtypename())!=-1) //Check it is a valid clip type. pool[pl]->take_clips(c,len(c)); } //pool[pl]->extra_throwing_weapons.clear(); fread(&dummy,sizeof(int),1,h); for(int ne=0; ne<dummy; ne++) { fread(&itemLen, sizeof(itemLen), 1, h); vector<char> vec = vector<char>(itemLen + 1); fread(&vec[0], itemLen, 1, h); vec[itemLen] = '\0'; Weapon w(&vec[0]); if(getweapontype(w.get_itemtypename())!=-1) //Check it is a valid weapon type. pool[pl]->give_weapon(w,NULL); } fread(&itemLen, sizeof(itemLen), 1, h); if(itemLen != 0) { vector<char> vec = vector<char>(itemLen + 1); fread(&vec[0], itemLen, 1, h); vec[itemLen] = '\0'; Armor a(&vec[0]); if(getarmortype(a.get_itemtypename())!=-1) //Check it is a valid armor type. pool[pl]->give_armor(a,&dump); }*/ } //Unique Creatures { int uniquecreaturesLen; fread (&uniquecreaturesLen, sizeof(int), 1, h); vector<char> vec = vector<char> (uniquecreaturesLen + 1); fread (&vec[0], uniquecreaturesLen, 1, h); vec[uniquecreaturesLen] = '\0'; uniqueCreatures = UniqueCreatures(&vec[0]); //fread(&uniqueCreatures,sizeof(UniqueCreatures),1,h); } //SQUADS fread(&dummy,sizeof(int),1,h); squad.resize(dummy); for(int sq=0;sq<len(squad);sq++) { squad[sq]=new squadst; fread(squad[sq]->name,sizeof(char),SQUAD_NAMELEN,h); fread(&squad[sq]->activity,sizeof(activityst),1,h); fread(&squad[sq]->id,sizeof(int),1,h); for(int pos=0;pos<6;pos++) { //REBUILD SQUAD FROM POOL squad[sq]->squad[pos]=NULL; fread(&dummy_b,sizeof(bool),1,h); if(dummy_b) { int dummy_i; fread(&dummy_i,sizeof(int),1,h); for(int pl=0;pl<len(pool);pl++) if(pool[pl]->id==dummy_i) squad[sq]->squad[pos]=pool[pl]; } } fread(&dummy,sizeof(int),1,h); squad[sq]->loot.resize(dummy); for(int l2=0;l2<len(squad[sq]->loot);l2++) { int itemLen; fread(&itemLen, sizeof(int), 1, h); vector<char> vec = vector<char>(itemLen + 1); fread(&vec[0], itemLen, 1, h); vec[itemLen] = '\0'; Item* it = create_item(&vec[0]); //if(it!=NULL) //Assume save file is correct? -XML squad[sq]->loot[l2] = it; /*else squad[sq]->loot.erase(loot.begin()+l2--);*/ } //Remove items of unknown type. for(int l2=len(squad[sq]->loot)-1; l2>=0; l2--) { bool del = false; if(squad[sq]->loot[l2]->is_loot()) del = (getloottype(squad[sq]->loot[l2]->get_itemtypename()) == -1); else if(squad[sq]->loot[l2]->is_clip()) del = (getcliptype(squad[sq]->loot[l2]->get_itemtypename()) == -1); else if(squad[sq]->loot[l2]->is_weapon()) del = (getweapontype(squad[sq]->loot[l2]->get_itemtypename()) == -1); else if(squad[sq]->loot[l2]->is_armor()) del = (getarmortype(squad[sq]->loot[l2]->get_itemtypename()) == -1); if(del) { addstr("Item type "); addstr(squad[sq]->loot[l2]->get_itemtypename()); addstr(" does not exist. Deleting item."); delete_and_remove(squad[sq]->loot,l2); } } consolidateloot(squad[sq]->loot); // consolidate loot after loading } activesquad=NULL; fread(&dummy_b,sizeof(bool),1,h); if(dummy_b) { int dummy_i; fread(&dummy_i,sizeof(int),1,h); for(int sq=0;sq<len(squad);sq++) if(squad[sq]->id==dummy_i) { activesquad=squad[sq]; break; } } //DATES fread(&dummy,sizeof(int),1,h); date.resize(dummy); for(int dt=0;dt<len(date);dt++) { date[dt]=new datest; fread(&date[dt]->mac_id,sizeof(long),1,h); fread(&date[dt]->timeleft,sizeof(short),1,h); fread(&date[dt]->city,sizeof(int),1,h); fread(&dummy,sizeof(int),1,h); date[dt]->date.resize(dummy); for(int dt2=0;dt2<len(date[dt]->date);dt2++) { int creatureLen; fread (&creatureLen, sizeof(int), 1, h); vector<char> vec = vector<char> (creatureLen + 1); fread (&vec[0], creatureLen, 1, h); vec[creatureLen] = '\0'; date[dt]->date[dt2] = new Creature(&vec[0]); //date[dt]->date[dt2]=new Creature; //fread(date[dt]->date[dt2],sizeof(Creature),1,h); } } //RECRUITS fread(&dummy,sizeof(int),1,h); recruit.resize(dummy); for(int rt=0;rt<len(recruit);rt++) { recruit[rt]=new recruitst; fread(&recruit[rt]->recruiter_id,sizeof(long),1,h); fread(&recruit[rt]->timeleft,sizeof(short),1,h); fread(&recruit[rt]->level,sizeof(char),1,h); fread(&recruit[rt]->eagerness1,sizeof(char),1,h); fread(&recruit[rt]->task,sizeof(char),1,h); int creatureLen; fread (&creatureLen, sizeof(int), 1, h); vector<char> vec = vector<char> (creatureLen + 1); fread (&vec[0], creatureLen, 1, h); vec[creatureLen] = '\0'; recruit[rt]->recruit = new Creature(&vec[0]); //recruit[rt]->recruit = new Creature; //fread(recruit[rt]->recruit,sizeof(Creature),1,h); } //NEWS STORIES fread(&dummy,sizeof(int),1,h); newsstory.resize(dummy); for(int ns=0;ns<len(newsstory);ns++) { newsstory[ns]=new newsstoryst; fread(&newsstory[ns]->type,sizeof(short),1,h); fread(&newsstory[ns]->view,sizeof(short),1,h); fread(&newsstory[ns]->loc,sizeof(long),1,h); fread(&newsstory[ns]->priority,sizeof(long),1,h); fread(&newsstory[ns]->page,sizeof(long),1,h); fread(&newsstory[ns]->positive,sizeof(char),1,h); fread(&newsstory[ns]->siegetype,sizeof(short),1,h); newsstory[ns]->cr=NULL; fread(&dummy_b,sizeof(bool),1,h); if(dummy_b) { fread(&dummy_l,sizeof(long),1,h); for(int pl=0;pl<len(pool);pl++) if(pool[pl]->id==dummy_l) { newsstory[ns]->cr=pool[pl]; break; } } fread(&dummy,sizeof(int),1,h); newsstory[ns]->crime.resize(dummy); for(int dt2=0;dt2<len(newsstory[ns]->crime);dt2++) fread(&newsstory[ns]->crime[dt2],sizeof(int),1,h); } // Liberal Media fread(public_interest,sizeof(public_interest),1,h); fread(background_liberal_influence,sizeof(background_liberal_influence),1,h); // Site mode options fread(&encounterwarnings,sizeof(bool),1,h); bool musicenabled; fread(&musicenabled,sizeof(bool),1,h); music.enableIf(musicenabled); LCSCloseFile(h); // Check that vehicles are of existing types. for(int v=0;v<len(vehicle);v++) { if(getvehicletype(vehicle[v]->vtypeidname())==-1) { //Remove vehicle of non-existing type. addstr("Vehicle type "+vehicle[v]->vtypeidname()+" does not exist. Deleting vehicle."); delete_and_remove(vehicle,v--); } } return 1; } gamelog.log("Could not load"); return 0; }
/* creates your founder */ void makecharacter() { Creature *newcr=new Creature; newcr->align=1; #ifdef BLIND newcr->special[SPECIALWOUND_RIGHTEYE]=1; newcr->special[SPECIALWOUND_LEFTEYE]=1; #endif #ifdef SPINE newcr->special[SPECIALWOUND_UPPERSPINE]=1; newcr->special[SPECIALWOUND_LOWERSPINE]=1; #endif #ifdef NOFACE newcr->special[SPECIALWOUND_TONGUE]=1; newcr->special[SPECIALWOUND_RIGHTEYE]=1; newcr->special[SPECIALWOUND_LEFTEYE]=1; newcr->special[SPECIALWOUND_NOSE]=1; #endif #ifdef NOWALK newcr->special[SPECIALWOUND_UPPERSPINE]=1; newcr->special[SPECIALWOUND_LOWERSPINE]=1; newcr->special[SPECIALWOUND_NECK]=1; newcr->wound[BODYPART_LEG_RIGHT]=1; newcr->wound[BODYPART_LEG_LEFT]=1; #endif #ifdef INTERNAL newcr->special[SPECIALWOUND_RIGHTLUNG]=1; newcr->special[SPECIALWOUND_LEFTLUNG]=1; newcr->special[SPECIALWOUND_HEART]=1; newcr->special[SPECIALWOUND_LIVER]=1; newcr->special[SPECIALWOUND_STOMACH]=1; newcr->special[SPECIALWOUND_LEFTKIDNEY]=1; newcr->special[SPECIALWOUND_RIGHTKIDNEY]=1; newcr->special[SPECIALWOUND_SPLEEN]=1; #endif newcr->set_attribute(ATTRIBUTE_HEART,8); newcr->set_attribute(ATTRIBUTE_WISDOM,1); newcr->set_attribute(ATTRIBUTE_INTELLIGENCE,3); newcr->set_attribute(ATTRIBUTE_AGILITY,5); newcr->set_attribute(ATTRIBUTE_STRENGTH,4); newcr->set_attribute(ATTRIBUTE_HEALTH,6); newcr->set_attribute(ATTRIBUTE_CHARISMA,4); for(int sk=0;sk<SKILLNUM;sk++)newcr->set_skill(sk,0); char first[3][80]; char last[80]; bool male = LCSrandom(2); // whether or not starting gender is male char gender = newcr->gender_liberal = newcr->gender_conservative = (male ? GENDER_MALE : GENDER_FEMALE); do { firstname(first[0], GENDER_NEUTRAL); firstname(first[1], GENDER_MALE); firstname(first[2], GENDER_FEMALE); lastname(last); } while(strcmp(first[0],last) == 0 && strcmp(first[1],last) == 0 && strcmp(first[2],last) == 0); { Armor a(*armortype[getarmortype("ARMOR_CLOTHES")]); newcr->give_armor(a,NULL); } bool choices=true; while(true) { erase(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(4,6); addstr("The Founder of the Liberal Crime Squad"); move(7,2); addstr("FIRST NAME: "); addstr(first[(int)gender]); move(7,30); set_color(COLOR_BLACK,COLOR_BLACK,1); addstr(" (Press A to have your parents reconsider)"); move(9,2); set_color(COLOR_WHITE,COLOR_BLACK,1); addstr("LAST NAME: "); addstr(last); move(9,30); set_color(COLOR_BLACK,COLOR_BLACK,1); addstr(" (Press B to be born to a different family)"); move(11,2); set_color(COLOR_WHITE,COLOR_BLACK,1); addstr("SEX: "); if(newcr->gender_conservative == GENDER_MALE) { set_color(COLOR_CYAN,COLOR_BLACK,1); addstr("Male"); } else if(newcr->gender_conservative == GENDER_FEMALE) { set_color(COLOR_MAGENTA,COLOR_BLACK,1); addstr("Female"); } else { set_color(COLOR_YELLOW,COLOR_BLACK,1); addstr("It's Complicated"); } move(11,30); set_color(COLOR_BLACK,COLOR_BLACK,1); addstr(" (Press C to change your sex at birth)"); move(13,2); set_color(COLOR_WHITE,COLOR_BLACK,1); addstr("HISTORY: "); if(choices) { set_color(COLOR_GREEN,COLOR_BLACK,1); addstr("Let Me Choose"); } else { set_color(COLOR_RED,COLOR_BLACK,1); addstr("Let Fate Decide"); } move(13,30); set_color(COLOR_BLACK,COLOR_BLACK,1); addstr(" (Press D to toggle childhood)"); if(!multipleCityMode) { move(15,2); set_color(COLOR_WHITE,COLOR_BLACK,1); addstr("CITY: "); addstr(lcityname); move(15,30); set_color(COLOR_BLACK,COLOR_BLACK,1); addstr(" (Press E to relocate)"); } move(19-multipleCityMode*2,4); set_color(COLOR_WHITE,COLOR_BLACK,0); addstr("Press any other key when ready to begin..."); int c=getkey(); if(c=='a') { do { firstname(first[(int)gender],newcr->gender_conservative); } while(strcmp(first[(int)gender],last) == 0); continue; } if(c=='b') { do { lastname(last); } while(strcmp(first[0],last) == 0 && strcmp(first[1],last) == 0 && strcmp(first[2],last) == 0); continue; } if(c=='c') { if((newcr->gender_conservative == GENDER_FEMALE && !male) || (newcr->gender_conservative == GENDER_NEUTRAL && male)) newcr->gender_conservative = GENDER_MALE; else if((newcr->gender_conservative == GENDER_MALE && !male) || (newcr->gender_conservative == GENDER_FEMALE && male)) newcr->gender_conservative = GENDER_NEUTRAL; else newcr->gender_conservative = GENDER_FEMALE; gender = newcr->gender_liberal = newcr->gender_conservative; continue; } if(c=='d') { choices = !choices; continue; } if(c=='e' && !multipleCityMode) { strcpy(lcityname,cityname()); continue; } break; } strcpy(newcr->propername,first[(int)gender]); strcat(newcr->propername," "); strcat(newcr->propername,last); int c; bool hasmaps=false; bool makelawyer=false; bool gaylawyer=false; Vehicle * startcar = NULL; char recruits = RECRUITS_NONE; char base = SITE_RESIDENTIAL_SHELTER; for(int q=0;q<10;q++) { erase(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(0,0); addstr("Insight into a Revolution: My Traumatic Childhood"); set_color(COLOR_WHITE,COLOR_BLACK,0); //A - Thief //B - Fighter //C - Student //D - Generalist/Sleepers //E - Recruiter char selection = LCSrandom(5); switch(q) { /* - The anniversary of Hitler's suicide. - SKILL_PISTOL 1 (lol) - Indira Gandhi Killed */ case 0: move(2,0);addstr("The day I was born in 1984..."); move(5,0); if(choices || selection == 0) addstr("A - the Polish priest Popieluszko was kidnapped by government agents."); //ATTRIBUTE_AGILITY 2 // Oct. 19, 1984 move(7,0); if(choices || selection == 1) addstr("B - was the 3rd anniversary of the assassination attempt on Ronald Reagan."); //ATTRIBUTE_STRENGTH 2 // Mar. 3, 1984 move(9,0); if(choices || selection == 2) addstr("C - the Macintosh was introduced."); //ATTRIBUTE_INTELLIGENCE 2 // Jan. 24, 1984 move(11,0); if(choices || selection == 3) addstr("D - the Nobel Peace Prize went to Desmond Tutu for opposition to apartheid."); //ATTRIBUTE_HEART 2 // Oct. 16, 1984 move(13,0); if(choices || selection == 4) addstr("E - the Sandanista Front won the elections in Nicaragua."); //ATTRIBUTE_CHARISMA 2 // Sept. 4, 1984 //move(14,0); //if(choices || selection == 5) //addstr("F - the United Nations condemned Iraq's use of chemical weapons."); //ATTRIBUTE_HEALTH 2 //March 30, 1984 move(17,0); addstr("The doctor said I was "); set_color(COLOR_WHITE,COLOR_BLACK,1); if(newcr->gender_conservative == GENDER_MALE) addstr("a boy"); else if(newcr->gender_conservative == GENDER_FEMALE) addstr("a girl"); else addstr("an intersex baby"); set_color(COLOR_WHITE,COLOR_BLACK,0); addstr("."); move(19,0); addstr("My parents "); if(newcr->gender_conservative == GENDER_NEUTRAL) { addstr("insisted otherwise."); move(20,0); addstr("They "); } addstr("named me "); set_color(COLOR_WHITE,COLOR_BLACK,1); addstr(newcr->propername); set_color(COLOR_WHITE,COLOR_BLACK,0); addstr("."); break; // My first memory was... // my father burning my back with a cigarette // When he was really into the sauce... // // XXX: Needs an option to have the founder have been in the Army -- LK // XXX: Something I forgot. case 1: move(2,0);addstr("When I was bad..."); move(5,0); if(choices || selection == 0) addstr("A - my parents grounded me and hid my toys, but I knew where they put them."); // Toy box //SKILL_SECURITY 1 //ATTRIBUTE_AGILITY 1 move(7,0); if(choices || selection == 1) addstr("B - my father beat me. I learned to take a punch earlier than most."); //SKILL_HANDTOHAND 1 //ATTRIBUTE_HEALTH 1 move(9,0); if(choices || selection == 2) addstr("C - I was sent to my room, where I studied quietly by myself, alone."); //SKILL_WRITING 1 //ATTRIBUTE_INTELLIGENCE 1 move(11,0); if(choices || selection == 3) addstr("D - my parents argued with each other about me, but I was never punished."); //SKILL_PERSUASION 1 //ATTRIBUTE_HEART 1 move(13,0); if(choices || selection == 4) addstr("E - my father lectured me endlessly, trying to make me think like him."); //SKILL_PSYCHOLOGY 1 //ATTRIBUTE_CHARISMA 1 /*switch(c) { case 'e': move(17,4); addstr("\"The worst has happened. Someone wanted to kill and killed"); move(18,4); addstr("not only the a man, not only a Pole, not only a priest."); move(19,4); addstr("Someone wanted to kill the hope that it is possible to avoid"); move(20,4); addstr("violence in Polish political life.\""); move(21,8); addstr("- Solidarity Leader Lech Walesa"); break; default: break; }*/ break; case 2: move(2,0);addstr("In elementary school..."); move(5,0); if(choices || selection == 0) addstr("A - I was mischievous, and always up to something."); //SKILL_DISGUISE 1 //ATTRIBUTE_AGILITY 1 move(7,0); if(choices || selection == 1) addstr("B - I had a lot of repressed anger. I hurt animals."); //SKILL_PSYCHOLOGY 1 //ATTRIBUTE_STRENGTH 1 //ATTRIBUTE_AGILITY 1 //ATTRIBUTE_HEART -1 <--- ! move(9,0); if(choices || selection == 2) addstr("C - I was at the head of the class, and I worked very hard."); //ATTRIBUTE_INTELLIGENCE 1 //SKILL_WRITING 1 move(11,0); if(choices || selection == 3) addstr("D - I was unruly and often fought with the other children."); //SKILL_HANDTOHAND 1 //ATTRIBUTE_STRENGTH 1 move(13,0); if(choices || selection == 4) addstr("E - I was the class clown. I even had some friends."); //SKILL_PERSUASION 1 //ATTRIBUTE_CHARISMA 1 break; case 3: move(2,0);addstr("When I turned 10..."); move(5,0); if(choices || selection == 0) addstr("A - my parents divorced. Whenever I talked, they argued, so I stayed quiet."); //SKILL_STEALTH 1 move(7,0); if(choices || selection == 1) addstr("B - my parents divorced. Violently."); //SKILL_HANDTOHAND 1 move(9,0); if(choices || selection == 2) addstr("C - my parents divorced. Acrimoniously. I once tripped over the paperwork!"); //SKILL_LAW 1 move(11,0); if(choices || selection == 3) addstr("D - my parents divorced. Mom slept with the divorce lawyer."); //SKILL_SEDUCTION 1 move(13,0); if(choices || selection == 4) addstr("E - my parents divorced. It still hurts to read my old diary."); //SKILL_WRITING 1 break; case 4: move(2,0);addstr("In junior high school..."); move(5,0); if(choices || selection == 0) addstr("A - I was into chemistry. I wanted to know what made the world tick."); //SKILL_SCIENCE 2 //ATTRIBUTE_INTELLIGENCE 2 move(7,0); if(choices || selection == 1) addstr("B - I played guitar in a grunge band. We sucked, but so did life."); //SKILL_MUSIC 2 //ATTRIBUTE_CHARISMA 2 move(9,0); if(choices || selection == 2) addstr("C - I drew things, a lot. I was drawing a world better than this."); //SKILL_ART 2 //ATTRIBUTE_HEART 2 move(11,0); if(choices || selection == 3) addstr("D - I played violent video games at home. I was a total outcast."); //SKILL_COMPUTERS 2 //ATTRIBUTE_AGILITY 2 move(13,0); if(choices || selection == 4) addstr("E - I was obsessed with swords, and started lifting weights."); //SKILL_SWORD 2 //ATTRIBUTE_STRENGTH 2 break; case 5: move(2,0);addstr("Things were getting really bad..."); move(5,0); if(choices || selection == 0) addstr("A - when I stole my first car. I got a few blocks before I totaled it."); //SKILL_DRIVING 1 //SKILL_SECURITY 1 move(7,0); if(choices || selection == 1) addstr("B - and I went to live with my dad. He had been in Nam and he still drank."); //SKILL_SHOTGUN 1 //SKILL_RIFLE 1 //SKILL_PSYCHOLOGY 1 move(9,0); if(choices || selection == 2) addstr("C - and I went completely goth. I had no friends and made costumes by myself."); //SKILL_TAILORING 2 move(11,0); if(choices || selection == 3) addstr("D - when I was sent to religious counseling, just stressing me out more."); //SKILL_RELIGION 1 //SKILL_PSYCHOLOGY 1 move(13,0); if(choices || selection == 4) addstr("E - and I tried being a teacher's assistant. It just made me a target."); //SKILL_TEACHING 2 break; case 6: move(2,0);addstr("Well, I knew it had reached a crescendo when..."); move(5,0); if(choices || selection == 0) addstr("A - I stole a cop car when I was only 14. I went to juvie for 6 months."); //SKILL_DRIVING 1 //SKILL_SECURITY 1 //ATTRIBUTE_INTELLIGENCE 1 move(7,0); if(choices || selection == 1) addstr("B - my step mom shot her ex-husband, my dad, with a shotgun. She got off.");//XXX: Sounds... Sexual... //SKILL_SHOTGUN 2 //ATTRIBUTE_AGILITY 1 move(9,0); if(choices || selection == 2) addstr("C - I tried wrestling for a quarter, desperate to fit in."); //ATTRIBUTE_STRENGTH 1 //SKILL_HANDTOHAND 2 move(11,0); if(choices || selection == 3) addstr("D - I got caught making out, and now I needed to be 'cured' of homosexuality."); //SKILL_SEDUCTION 1 //SKILL_RELIGION 1 //ATTRIBUTE_HEART 1 move(13,0); if(choices || selection == 4) addstr("E - I resorted to controlling people. Had my own clique of outcasts."); //SKILL_PERSUASION 2 //ATTRIBUTE_CHARISMA 1 break; case 7: move(2,0);addstr("I was only 15 when I ran away, and..."); move(5,0); if(choices || selection == 0) addstr("A - I started robbing houses: rich people only. I was fed up with their crap."); //SKILL_SECURITY 1 //SKILL_STEALTH 1 //ATTRIBUTE_AGILITY 1 move(7,0); if(choices || selection == 1) addstr("B - I hung out with thugs and beat the shit out of people."); //ATTRIBUTE_STRENGTH 1 //SKILL_HANDTOHAND 2 move(9,0); if(choices || selection == 2) addstr("C - I got a horrible job working fast food, smiling as people fed the man."); //ATTRIBUTE_CHARISMA 1 //SKILL_BUSINESS 2 move(11,0); if(choices || selection == 3) addstr("D - I let people pay me for sex. I needed the money to survive."); //ATTRIBUTE_HEART -1 //ATTRIBUTE_CHARISMA 2 //SKILL_SEDUCTION 2 move(13,0); if(choices || selection == 4) addstr("E - I volunteered for a left-wing candidate. It wasn't *real*, though, you know?"); //ATTRIBUTE_INTELLIGENCE 1 //SKILL_LAW 1 //SKILL_PERSUASION 1 break; case 8: move(2,0);addstr("Life went on. On my 18th birthday..."); move(5,0); if(choices || selection == 0) addstr("A - I got my hands on a sports car. The owner must have been pissed."); move(7,0); if(choices || selection == 1) addstr("B - I bought myself an assault rifle."); move(9,0); if(choices || selection == 2) addstr("C - I celebrated. I'd saved a thousand bucks!"); move(11,0); if(choices || selection == 3) addstr("D - I went to a party and met a cool law student. We've been dating since.");//XXX: No Seduction? move(13,0); if(choices || selection == 4) addstr("E - I managed to acquire secret maps of several major buildings downtown."); break; case 9: move(2,0);addstr("For the past few years, I've been..."); move(5,0); if(choices || selection == 0) addstr("A - stealing from Corporations. I know they're still keeping more secrets."); //ATTRIBUTE_INTELLIGENCE 2 //ATTRIBUTE_AGILITY 2 //SKILL_SECURITY 2 //SKILL_STEALTH 2 // +Downtown apartment // +$500 (one month rent) move(7,0); if(choices || selection == 1) addstr("B - a violent criminal. Nothing can change me, or stand in my way."); //SKILL_RIFLE 2 //SKILL_PISTOL 2 //SKILL_STREETSENSE 2 //ATTRIBUTE_AGILITY 2 //ATTRIBUTE_HEALTH 2 //ATTRIBUTE_STRENGTH 2 // +Crack house (with stockpiled rations) // +A crew (four gang members with knives and pistols) move(9,0); if(choices || selection == 2) addstr("C - taking college courses. I can see how much the country needs help."); //SKILL_SCIENCE 2 //SKILL_COMPUTERS 2 //SKILL_WRITING 2 //SKILL_TEACHING 2 //SKILL_BUSINESS 1 //SKILL_LAW 1 //ATTRIBUTE_INTELLIGENCE 4 // +University apartment // +$200 (one month rent) move(11,0); if(choices || selection == 3) addstr("D - surviving alone, just like anyone. But we can't go on like this."); //SKILL_FIRSTAID 2 //SKILL_STREETSENSE 2 //ATTRIBUTE_INTELLIGENCE 1 //ATTRIBUTE_AGILITY 1 //ATTRIBUTE_HEALTH 2 // +Homeless shelter // +1 all stats (except Wisdom) move(13,0); if(choices || selection == 4) addstr("E - writing my manifesto and refining my image. I'm ready to lead."); //ATTRIBUTE_CHARISMA 2 //ATTRIBUTE_INTELLIGENCE 2 //SKILL_LAW 1 //SKILL_PERSUASION 2 //SKILL_WRITING 1 // +Industrial apartment // +$100 (one month rent) // +50 juice move(17,0); addstr("I live in "); if(!multipleCityMode) addstr(lcityname); else addstr("Seattle, WA"); addstr(", and it's about to experience real change."); break; } do { c=getkey(); if(!choices) c='a'+selection; } while(c<'a'||c>'e'); switch(q) { case 0: // Oct. 19, 1984 if(c=='a') { newcr->adjust_attribute(ATTRIBUTE_AGILITY,+2); newcr->birthday_month = 10; newcr->birthday_day = 19; } // Mar. 3, 1984 if(c=='b') { newcr->adjust_attribute(ATTRIBUTE_STRENGTH,+2); newcr->birthday_month = 3; newcr->birthday_day = 3; } // Jan. 24, 1984 if(c=='c') { newcr->adjust_attribute(ATTRIBUTE_INTELLIGENCE,+2); newcr->birthday_month = 1; newcr->birthday_day = 24; } // Oct. 16, 1984 if(c=='d') { newcr->adjust_attribute(ATTRIBUTE_HEART,+2); newcr->birthday_month = 10; newcr->birthday_day = 16; } // Sep. 4, 1984 if(c=='e') { newcr->adjust_attribute(ATTRIBUTE_CHARISMA,+2); newcr->birthday_month = 9; newcr->birthday_day = 4; } newcr->age = year - 1984; // Don't count this year in founder's age if starting before birthday if(month < newcr->birthday_month || (month==newcr->birthday_month && day<newcr->birthday_day)) { newcr->age--; } break; case 1: if(c=='a') { newcr->set_skill(SKILL_SECURITY,newcr->get_skill(SKILL_SECURITY)+(1)); newcr->adjust_attribute(ATTRIBUTE_AGILITY,+1); } if(c=='b') { newcr->set_skill(SKILL_HANDTOHAND,newcr->get_skill(SKILL_HANDTOHAND)+(1)); newcr->adjust_attribute(ATTRIBUTE_HEALTH,+1); } if(c=='c') { newcr->adjust_attribute(ATTRIBUTE_INTELLIGENCE,+1); newcr->set_skill(SKILL_WRITING,newcr->get_skill(SKILL_WRITING)+(1)); } if(c=='d') { newcr->set_skill(SKILL_PERSUASION,newcr->get_skill(SKILL_PERSUASION)+(1)); newcr->adjust_attribute(ATTRIBUTE_HEART,+1); } if(c=='e') { newcr->set_skill(SKILL_PSYCHOLOGY,newcr->get_skill(SKILL_PSYCHOLOGY)+(1)); newcr->adjust_attribute(ATTRIBUTE_CHARISMA,+1); } break; case 2: if(c=='a') { newcr->set_skill(SKILL_DISGUISE,newcr->get_skill(SKILL_DISGUISE)+(1)); newcr->adjust_attribute(ATTRIBUTE_AGILITY,+1); } if(c=='b') { newcr->set_skill(SKILL_PSYCHOLOGY,newcr->get_skill(SKILL_PSYCHOLOGY)+(1)); newcr->adjust_attribute(ATTRIBUTE_AGILITY,+1); newcr->adjust_attribute(ATTRIBUTE_HEART,-1); newcr->adjust_attribute(ATTRIBUTE_STRENGTH,+1); } if(c=='c') { newcr->adjust_attribute(ATTRIBUTE_INTELLIGENCE,+1); newcr->set_skill(SKILL_WRITING,newcr->get_skill(SKILL_WRITING)+(1)); } if(c=='d') { newcr->adjust_attribute(ATTRIBUTE_STRENGTH,+1); newcr->set_skill(SKILL_HANDTOHAND,newcr->get_skill(SKILL_HANDTOHAND)+(1)); } if(c=='e') { newcr->set_skill(SKILL_PERSUASION,newcr->get_skill(SKILL_PERSUASION)+(1)); newcr->adjust_attribute(ATTRIBUTE_CHARISMA,+1); } break; case 3: if(c=='a') { newcr->set_skill(SKILL_STEALTH,newcr->get_skill(SKILL_STEALTH)+(1)); } if(c=='b') { newcr->set_skill(SKILL_HANDTOHAND,newcr->get_skill(SKILL_HANDTOHAND)+(1)); } if(c=='c') { newcr->set_skill(SKILL_LAW,newcr->get_skill(SKILL_LAW)+(1)); } if(c=='d') { newcr->set_skill(SKILL_SEDUCTION,newcr->get_skill(SKILL_SEDUCTION)+(1)); } if(c=='e') { newcr->set_skill(SKILL_WRITING,newcr->get_skill(SKILL_WRITING)+1); } break; case 4: if(c=='a') { newcr->set_skill(SKILL_SCIENCE,newcr->get_skill(SKILL_SCIENCE)+(2)); newcr->adjust_attribute(ATTRIBUTE_INTELLIGENCE,+2); } if(c=='b') { newcr->set_skill(SKILL_MUSIC,newcr->get_skill(SKILL_MUSIC)+(2)); newcr->adjust_attribute(ATTRIBUTE_CHARISMA,+2); } if(c=='c') { newcr->set_skill(SKILL_ART,newcr->get_skill(SKILL_ART)+(2)); newcr->adjust_attribute(ATTRIBUTE_HEART,+2); } if(c=='d') { newcr->set_skill(SKILL_COMPUTERS,newcr->get_skill(SKILL_COMPUTERS)+(2)); newcr->adjust_attribute(ATTRIBUTE_AGILITY,+2); } if(c=='e') { newcr->adjust_attribute(ATTRIBUTE_STRENGTH,+2); newcr->set_skill(SKILL_SWORD,newcr->get_skill(SKILL_SWORD)+(2)); } break; case 5: if(c=='a') { newcr->set_skill(SKILL_DRIVING,newcr->get_skill(SKILL_DRIVING)+(1)); newcr->set_skill(SKILL_SECURITY,newcr->get_skill(SKILL_SECURITY)+(1)); } if(c=='b') { newcr->set_skill(SKILL_SHOTGUN,newcr->get_skill(SKILL_SHOTGUN)+(1)); newcr->set_skill(SKILL_RIFLE,newcr->get_skill(SKILL_RIFLE)+(1)); newcr->set_skill(SKILL_PSYCHOLOGY,newcr->get_skill(SKILL_PSYCHOLOGY)+(1)); } if(c=='c') { newcr->set_skill(SKILL_TAILORING,newcr->get_skill(SKILL_TAILORING)+(2)); } if(c=='d') { newcr->set_skill(SKILL_RELIGION,newcr->get_skill(SKILL_RELIGION)+(1)); newcr->set_skill(SKILL_PSYCHOLOGY,newcr->get_skill(SKILL_PSYCHOLOGY)+(1)); } if(c=='e') { newcr->set_skill(SKILL_TEACHING,newcr->get_skill(SKILL_TEACHING)+(2)); } break; case 6: if(c=='a') { newcr->set_skill(SKILL_DRIVING,newcr->get_skill(SKILL_DRIVING)+(1)); newcr->set_skill(SKILL_SECURITY,newcr->get_skill(SKILL_SECURITY)+(1)); newcr->adjust_attribute(ATTRIBUTE_INTELLIGENCE,+1); } if(c=='b') { newcr->set_skill(SKILL_SHOTGUN,newcr->get_skill(SKILL_SHOTGUN)+(2)); newcr->adjust_attribute(ATTRIBUTE_AGILITY,+1); } if(c=='c') { newcr->adjust_attribute(ATTRIBUTE_STRENGTH,+1); newcr->set_skill(SKILL_HANDTOHAND,newcr->get_skill(SKILL_HANDTOHAND)+(2)); } if(c=='d') { newcr->set_skill(SKILL_SEDUCTION,newcr->get_skill(SKILL_SEDUCTION)+(1)); newcr->set_skill(SKILL_RELIGION,newcr->get_skill(SKILL_RELIGION)+(1)); newcr->adjust_attribute(ATTRIBUTE_HEART,+1); gaylawyer=true; } if(c=='e') { newcr->set_skill(SKILL_PERSUASION,newcr->get_skill(SKILL_PERSUASION)+(2)); newcr->adjust_attribute(ATTRIBUTE_CHARISMA,+1); } break; case 7: if(c=='a') { newcr->set_skill(SKILL_SECURITY,newcr->get_skill(SKILL_SECURITY)+(1)); newcr->set_skill(SKILL_STEALTH,newcr->get_skill(SKILL_STEALTH)+(1)); newcr->adjust_attribute(ATTRIBUTE_AGILITY,+1); } if(c=='b') { newcr->adjust_attribute(ATTRIBUTE_STRENGTH,+1); newcr->set_skill(SKILL_HANDTOHAND,newcr->get_skill(SKILL_HANDTOHAND)+(2)); } if(c=='c') { newcr->adjust_attribute(ATTRIBUTE_CHARISMA,+1); newcr->set_skill(SKILL_BUSINESS,newcr->get_skill(SKILL_BUSINESS)+(2)); } if(c=='d') { newcr->adjust_attribute(ATTRIBUTE_HEART,-1); newcr->adjust_attribute(ATTRIBUTE_CHARISMA,+2); newcr->set_skill(SKILL_SEDUCTION,newcr->get_skill(SKILL_SEDUCTION)+(2)); } if(c=='e') { newcr->adjust_attribute(ATTRIBUTE_INTELLIGENCE,+1); newcr->set_skill(SKILL_LAW,newcr->get_skill(SKILL_LAW)+(1)); newcr->set_skill(SKILL_PERSUASION,newcr->get_skill(SKILL_PERSUASION)+(1)); } break; case 8: if(c=='a') { startcar = new Vehicle(*vehicletype[getvehicletype("SPORTSCAR")]); // Add heat to the starting vehicle because it is stolen. // This is so that you can't immediately sell it at full price. startcar->add_heat(10); vehicle.push_back(startcar); newcr->pref_carid = startcar->id(); } if(c=='b') { Weapon neww(*weapontype[getweapontype("WEAPON_AUTORIFLE_AK47")]); Clip newc(*cliptype[getcliptype("CLIP_ASSAULT")],9); newcr->give_weapon(neww,NULL); newcr->take_clips(newc,9); } if(c=='c') { ledger.force_funds(1000); } if(c=='d') { makelawyer=true; } if(c=='e') { hasmaps=true; } break; case 9: if(c=='a') { newcr->adjust_attribute(ATTRIBUTE_INTELLIGENCE,+2); newcr->adjust_attribute(ATTRIBUTE_AGILITY,+2); newcr->set_skill(SKILL_SECURITY,newcr->get_skill(SKILL_SECURITY)+(2)); newcr->set_skill(SKILL_STEALTH,newcr->get_skill(SKILL_STEALTH)+(2)); newcr->type = CREATURE_THIEF; newcr->type_idname = "CREATURE_THIEF"; base = SITE_RESIDENTIAL_APARTMENT_UPSCALE; ledger.force_funds(ledger.get_funds()+500); Armor newa(*armortype[getarmortype("ARMOR_BLACKCLOTHES")]); newcr->give_armor(newa,NULL); } if(c=='b') { newcr->set_skill(SKILL_RIFLE,newcr->get_skill(SKILL_RIFLE)+(2)); newcr->set_skill(SKILL_PISTOL,newcr->get_skill(SKILL_PISTOL)+(2)); newcr->set_skill(SKILL_STREETSENSE,newcr->get_skill(SKILL_STREETSENSE)+(2)); newcr->adjust_attribute(ATTRIBUTE_AGILITY,+2); newcr->adjust_attribute(ATTRIBUTE_HEALTH,+2); newcr->adjust_attribute(ATTRIBUTE_STRENGTH,+2); newcr->type = CREATURE_GANGMEMBER; newcr->type_idname = "CREATURE_GANGMEMBER"; base = SITE_BUSINESS_CRACKHOUSE; recruits = RECRUITS_GANG; } if(c=='c') { newcr->adjust_attribute(ATTRIBUTE_INTELLIGENCE,+4); newcr->set_skill(SKILL_SCIENCE,newcr->get_skill(SKILL_SCIENCE)+(2)); newcr->set_skill(SKILL_COMPUTERS,newcr->get_skill(SKILL_COMPUTERS)+(2)); newcr->set_skill(SKILL_WRITING,newcr->get_skill(SKILL_WRITING)+(2)); newcr->set_skill(SKILL_TEACHING,newcr->get_skill(SKILL_TEACHING)+(2)); newcr->set_skill(SKILL_BUSINESS,newcr->get_skill(SKILL_BUSINESS)+(1)); newcr->set_skill(SKILL_LAW,newcr->get_skill(SKILL_LAW)+(1)); newcr->type = CREATURE_COLLEGESTUDENT; newcr->type_idname = "CREATURE_COLLEGESTUDENT"; base = SITE_RESIDENTIAL_APARTMENT; ledger.force_funds(ledger.get_funds()+200); } if(c=='d') { newcr->adjust_attribute(ATTRIBUTE_INTELLIGENCE,+1); newcr->adjust_attribute(ATTRIBUTE_AGILITY,+1); newcr->adjust_attribute(ATTRIBUTE_HEALTH,+2); newcr->set_skill(SKILL_FIRSTAID,newcr->get_skill(SKILL_FIRSTAID)+(2)); newcr->set_skill(SKILL_STREETSENSE,newcr->get_skill(SKILL_STREETSENSE)+(2)); newcr->type = CREATURE_HSDROPOUT; newcr->type_idname = "CREATURE_HSDROPOUT"; base = SITE_RESIDENTIAL_SHELTER; newcr->adjust_attribute(ATTRIBUTE_HEART,+1); newcr->adjust_attribute(ATTRIBUTE_INTELLIGENCE,+1); newcr->adjust_attribute(ATTRIBUTE_AGILITY,+1); newcr->adjust_attribute(ATTRIBUTE_STRENGTH,+1); newcr->adjust_attribute(ATTRIBUTE_HEALTH,+1); newcr->adjust_attribute(ATTRIBUTE_CHARISMA,+1); } if(c=='e') { newcr->adjust_attribute(ATTRIBUTE_CHARISMA,+2); newcr->adjust_attribute(ATTRIBUTE_INTELLIGENCE,+2); newcr->set_skill(SKILL_LAW,newcr->get_skill(SKILL_LAW)+(1)); newcr->set_skill(SKILL_WRITING,newcr->get_skill(SKILL_WRITING)+(1)); newcr->set_skill(SKILL_PERSUASION,newcr->get_skill(SKILL_PERSUASION)+(2)); newcr->type = CREATURE_POLITICALACTIVIST; newcr->type_idname = "CREATURE_POLITICALACTIVIST"; base = SITE_RESIDENTIAL_TENEMENT; ledger.force_funds(ledger.get_funds()+50); newcr->juice+=50; } break; } } erase(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(2,2); addstr("A NEW CONSERVATIVE ERA", gamelog); gamelog.newline(); set_color(COLOR_WHITE,COLOR_BLACK,0); move(4,2); addstr("The Year is ", gamelog); addstr(year, gamelog); addstr(".", gamelog); move(6,2); gamelog.newline(); addstr("Conservative President ", gamelog); char president[80]; generate_name(president,GENDER_WHITEMALEPATRIARCH); addstr(president, gamelog); addstr(" ends his second term with approval", gamelog); move(7,2); gamelog.newline(); addstr("ratings in the high 70s, and is succeeded by hardcore Arch-Conservative", gamelog); move(8,2); gamelog.newline(); addstr(execname[EXEC_PRESIDENT], gamelog); addstr(".", gamelog); gamelog.nextMessage(); move(10,2); addstr("With Conservatives sweeping into power in the House of Representatives", gamelog); move(11,2); gamelog.newline(); addstr("and Senate, and a Conservative majority in the Supreme Court of the", gamelog); move(12,2); gamelog.newline(); addstr("United States, commentators are hailing it as the beginning of a new", gamelog); move(13,2); gamelog.newline(); addstr("Conservative era.", gamelog); gamelog.nextMessage(); move(15,2); set_color(COLOR_RED,COLOR_BLACK,1); addstr("President ", gamelog); addstr(execname[EXEC_PRESIDENT], gamelog); addstr(" has asked the new Congress to move quickly", gamelog); move(16,2); gamelog.newline(); addstr("to rubber stamp his radical Arch-Conservative agenda. ", gamelog); set_color(COLOR_WHITE,COLOR_BLACK,0); addstr("The left seems", gamelog); gamelog.newline(); move(17,2); addstr("powerless to stop this imminent trampling of Liberal Sanity and Justice.", gamelog); gamelog.nextMessage(); move(19,2); addstr("In this dark time, the Liberal Crime Squad is born...", gamelog); gamelog.nextMessage(); getkey(); erase(); set_color(COLOR_WHITE,COLOR_BLACK,1); move(0,0); addstr("What is your name to the People?"); set_color(COLOR_WHITE,COLOR_BLACK,0); move(1,0); addstr("Press enter to be known by your real name instead."); enter_name(2,0,newcr->name,CREATURE_NAMELEN,newcr->propername); pool.push_back(newcr); make_world(hasmaps); squadst *newsq=new squadst; newsq->id=0;cursquadid++; newsq->squad[0]=newcr; newcr->squadid=0; strcpy(newsq->name,"The Liberal Crime Squad"); for(int l=0;l<len(location);l++) { if(location[l]->type==base) { newcr->base=l; newcr->location=l; if(startcar) startcar->set_location(l); switch(base) { case SITE_RESIDENTIAL_APARTMENT_UPSCALE:location[l]->renting=500;break; case SITE_RESIDENTIAL_APARTMENT:location[l]->renting=200;break; case SITE_RESIDENTIAL_TENEMENT:location[l]->renting=100;break; case SITE_BUSINESS_CRACKHOUSE: location[l]->renting=RENTING_PERMANENT; location[l]->compound_stores+=100; break; } location[l]->newrental=1; switch(recruits) { case RECRUITS_GANG: for(int i=0;i<4;i++) { Creature* recruit = new Creature; makecreature(*recruit,CREATURE_GANGMEMBER); if(recruit->get_weapon().get_itemtypename() == "WEAPON_AUTORIFLE_AK47" || recruit->get_weapon().get_itemtypename() == "WEAPON_SMG_MP5" || !recruit->is_armed()) { Weapon w(*weapontype[getweapontype("WEAPON_SEMIPISTOL_9MM")]); recruit->give_weapon(w,NULL); Clip c(*cliptype[getcliptype("CLIP_9")],4); recruit->take_clips(c,4); recruit->reload(false); } recruit->align=ALIGN_LIBERAL; recruit->set_attribute(ATTRIBUTE_HEART, recruit->get_attribute(ATTRIBUTE_HEART,false)+ recruit->get_attribute(ATTRIBUTE_WISDOM,false)/2); recruit->set_attribute(ATTRIBUTE_WISDOM, recruit->get_attribute(ATTRIBUTE_WISDOM,false)/2); recruit->namecreature(); strcpy(recruit->name,recruit->propername); recruit->location=l; recruit->base=l; recruit->hireid=newcr->id; newsq->squad[i+1]=recruit; recruit->squadid=newsq->id; pool.push_back(recruit); } break; } #ifdef GIVEBLOODYARMOR Armor *newa= new Armor(*armortype[getarmortype("ARMOR_CLOTHES")]); newa->set_bloody(true); location[l]->loot.push_back(newi); #endif #ifdef HIGHFUNDS ledger.force_funds(100000); #endif break; } } //newcr->juice=0; squad.push_back(newsq); activesquad=newsq; if(makelawyer) { Creature* lawyer=new Creature; makecreature(*lawyer,CREATURE_LAWYER); // Make sure lawyer is of the appropriate gender for dating the main character; // opposite sex by default, same sex if the option was chosen that mentions // homosexuality if(gaylawyer) { lawyer->gender_conservative=lawyer->gender_liberal=newcr->gender_conservative; // neutral founder gets neutral partner } else { if(newcr->gender_conservative==GENDER_MALE) lawyer->gender_liberal=lawyer->gender_conservative=GENDER_FEMALE; if(newcr->gender_conservative==GENDER_FEMALE) lawyer->gender_liberal=lawyer->gender_conservative=GENDER_MALE; // neutral founder gets random partner } // Ensure the lawyer has good heart/wisdom stats if(lawyer->get_attribute(ATTRIBUTE_HEART,false)<newcr->get_attribute(ATTRIBUTE_HEART,false)-2) lawyer->adjust_attribute(ATTRIBUTE_HEART,-2); lawyer->set_attribute(ATTRIBUTE_WISDOM,1); lawyer->namecreature(); lawyer->flag|=CREATUREFLAG_SLEEPER; lawyer->flag|=CREATUREFLAG_LOVESLAVE; lawyer->align=ALIGN_LIBERAL; lawyer->infiltration=0.3f; lawyer->age=28; location[lawyer->worklocation]->mapped=1; lawyer->hireid=newcr->id; pool.push_back(lawyer); lawyer->location=lawyer->base=lawyer->worklocation; } uniqueCreatures.initialize(); }
/********************************* ** ** SLEEPERS STEALING THINGS ** **********************************/ void sleeper_steal(Creature &cr,char &clearformess,char canseethings,int (&libpower)[VIEWNUM]) { if(LCSrandom(100) > 100*cr.infiltration) { cr.juice-=1; if(cr.juice<-2) { erase(); move(6,1); addstr("Sleeper ", gamelog); addstr(cr.name, gamelog); addstr(" has been arrested while stealing things.", gamelog); gamelog.nextMessage(); getkey(); cr.crimes_suspected[LAWFLAG_THEFT]++; removesquadinfo(cr); cr.location=find_police_station(cr); cr.drop_weapons_and_clips(NULL); cr.activity.type=ACTIVITY_NONE; cr.flag&=~CREATUREFLAG_SLEEPER; } return; } // Improves juice, as confidence improves if(cr.juice<100) { cr.juice += 10; if(cr.juice>100)cr.juice=100; } cr.infiltration-=LCSrandom(10)*0.01f-0.02f; //No effectiveness drop before? -Niel //Item *item; string item; Location *shelter=location[find_homeless_shelter(cr)]; int number_of_items = LCSrandom(10)+1; int itemindex = -1; // have to check case item not found to avoid brave modders segfaults. int numberofxmlfails = 0; // Tell them how many fails while(number_of_items--) { switch(location[cr.location]->type) //Temporary (transitionally) solution until sites are done. -XML { case SITE_RESIDENTIAL_TENEMENT: if(!LCSrandom(3))item="LOOT_KIDART"; else if(!LCSrandom(2))item="LOOT_DIRTYSOCK"; else item="LOOT_FAMILYPHOTO"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_RESIDENTIAL_APARTMENT: if(!LCSrandom(5))item="LOOT_CELLPHONE"; else if(!LCSrandom(4))item="LOOT_SILVERWARE"; else if(!LCSrandom(3))item="LOOT_TRINKET"; else if(!LCSrandom(2))item="LOOT_CHEAPJEWELERY"; else item="LOOT_COMPUTER"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_RESIDENTIAL_APARTMENT_UPSCALE: if(!LCSrandom(10))item="LOOT_EXPENSIVEJEWELERY"; else if(!LCSrandom(5))item="LOOT_CELLPHONE"; else if(!LCSrandom(4))item="LOOT_SILVERWARE"; else if(!LCSrandom(3))item="LOOT_PDA"; else if(!LCSrandom(2))item="LOOT_CHEAPJEWELERY"; else item="LOOT_COMPUTER"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_LABORATORY_COSMETICS: case SITE_INDUSTRY_NUCLEAR: case SITE_LABORATORY_GENETIC: if(!LCSrandom(5))item="LOOT_RESEARCHFILES"; else if(!LCSrandom(2))item="LOOT_LABEQUIPMENT"; else if(!LCSrandom(2))item="LOOT_COMPUTER"; else if(!LCSrandom(5))item="LOOT_PDA"; else if(!LCSrandom(5))item="LOOT_CHEMICAL"; else item="LOOT_COMPUTER"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_GOVERNMENT_COURTHOUSE: if(!LCSrandom(5))item="LOOT_JUDGEFILES"; else if(!LCSrandom(3))item="LOOT_CELLPHONE"; else if(!LCSrandom(2))item="LOOT_PDA"; else item="LOOT_COMPUTER"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_GOVERNMENT_PRISON: item="WEAPON_SHANK"; itemindex = getweapontype(item); if(itemindex > -1) {shelter->loot.push_back(new Weapon(*weapontype[itemindex]));} else {numberofxmlfails++;} break; case SITE_BUSINESS_BANK: case SITE_GOVERNMENT_FIRESTATION: if(LCSrandom(2))item="LOOT_TRINKET"; else item="LOOT_COMPUTER"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_INDUSTRY_SWEATSHOP: item="LOOT_FINECLOTH"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_INDUSTRY_POLLUTER: item="LOOT_CHEMICAL"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_CORPORATE_HEADQUARTERS: if(!LCSrandom(5))item="LOOT_CORPFILES"; else if(!LCSrandom(3))item="LOOT_CELLPHONE"; else if(!LCSrandom(2))item="LOOT_PDA"; else item="LOOT_COMPUTER"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_CORPORATE_HOUSE: if(!LCSrandom(8))item="LOOT_TRINKET"; else if(!LCSrandom(7))item="LOOT_WATCH"; else if(!LCSrandom(6))item="LOOT_PDA"; else if(!LCSrandom(5))item="LOOT_CELLPHONE"; else if(!LCSrandom(4))item="LOOT_SILVERWARE"; else if(!LCSrandom(3))item="LOOT_CHEAPJEWELERY"; else if(!LCSrandom(2))item="LOOT_FAMILYPHOTO"; else item="LOOT_COMPUTER"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_MEDIA_AMRADIO: if(!LCSrandom(5))item="LOOT_AMRADIOFILES"; else if(!LCSrandom(4))item="LOOT_MICROPHONE"; else if(!LCSrandom(3))item="LOOT_PDA"; else if(!LCSrandom(2))item="LOOT_CELLPHONE"; else item="LOOT_COMPUTER"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_MEDIA_CABLENEWS: if(!LCSrandom(5))item="LOOT_CABLENEWSFILES"; else if(!LCSrandom(4))item="LOOT_MICROPHONE"; else if(!LCSrandom(3))item="LOOT_PDA"; else if(!LCSrandom(2))item="LOOT_CELLPHONE"; else item="LOOT_COMPUTER"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} break; case SITE_GOVERNMENT_POLICESTATION: if(!LCSrandom(3)) { if(!LCSrandom(4))item="WEAPON_SMG_MP5"; else if(!LCSrandom(3))item="WEAPON_SEMIPISTOL_45"; else if(!LCSrandom(2))item="WEAPON_SHOTGUN_PUMP"; else item="WEAPON_SEMIRIFLE_AR15"; itemindex = getweapontype(item); if(itemindex > -1) {shelter->loot.push_back(new Weapon(*weapontype[itemindex]));} else {numberofxmlfails++;} } else if(!LCSrandom(2)) { if(law[LAW_POLICEBEHAVIOR]==-2 && law[LAW_DEATHPENALTY]==-2 && !LCSrandom(4))item="ARMOR_DEATHSQUADUNIFORM"; else if(!LCSrandom(3))item="ARMOR_POLICEUNIFORM"; else if(!LCSrandom(2))item="ARMOR_SWATARMOR"; else item="ARMOR_POLICEARMOR"; itemindex = getarmortype(item); if(itemindex > -1) {shelter->loot.push_back(new Armor(*armortype[itemindex]));} else {numberofxmlfails++;} } else { if(!LCSrandom(5))item="LOOT_POLICERECORDS"; else if(!LCSrandom(3))item="LOOT_CELLPHONE"; else if(!LCSrandom(2))item="LOOT_PDA"; else item="LOOT_COMPUTER"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} } break; case SITE_GOVERNMENT_ARMYBASE: if(!LCSrandom(3)) { if(LCSrandom(3))item="WEAPON_AUTORIFLE_M16"; else item="WEAPON_CARBINE_M4"; itemindex = getweapontype(item); if(itemindex > -1) {shelter->loot.push_back(new Weapon(*weapontype[itemindex]));} else {numberofxmlfails++;} } else if(!LCSrandom(2)) { item="ARMOR_ARMYARMOR"; itemindex = getarmortype(item); if(itemindex > -1) {shelter->loot.push_back(new Armor(*armortype[itemindex]));} else {numberofxmlfails++;} } else { if(!LCSrandom(5))item="LOOT_SECRETDOCUMENTS"; else if(!LCSrandom(3))item="LOOT_CELLPHONE"; else if(!LCSrandom(2))item="LOOT_CHEMICAL"; else item="LOOT_SILVERWARE"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} } break; case SITE_GOVERNMENT_WHITE_HOUSE: case SITE_GOVERNMENT_INTELLIGENCEHQ: if(!LCSrandom(3)) { if(!LCSrandom(4))item="WEAPON_SMG_MP5"; else if(!LCSrandom(3))item="WEAPON_AUTORIFLE_M16"; else if(!LCSrandom(2))item="WEAPON_SHOTGUN_PUMP"; else item="WEAPON_CARBINE_M4"; itemindex = getweapontype(item); if(itemindex > -1) {shelter->loot.push_back(new Weapon(*weapontype[itemindex]));} else {numberofxmlfails++;} } else if(!LCSrandom(2)) { item="ARMOR_BLACKSUIT"; itemindex = getarmortype(item); if(itemindex > -1) {shelter->loot.push_back(new Armor(*armortype[itemindex]));} else {numberofxmlfails++;} } else { if(!LCSrandom(5))item="LOOT_SECRETDOCUMENTS"; else if(!LCSrandom(3))item="LOOT_CELLPHONE"; else if(!LCSrandom(2))item="LOOT_PDA"; else item="LOOT_COMPUTER"; itemindex = getloottype(item); if(itemindex > -1) {shelter->loot.push_back(new Loot(*loottype[itemindex]));} else {numberofxmlfails++;} } break; } } erase(); set_color(COLOR_WHITE,COLOR_BLACK,0); move(6,1); addstr("Sleeper ", gamelog); addstr(cr.name, gamelog); addstr(" has dropped a package off at the homeless shelter.", gamelog); gamelog.nextMessage(); if(numberofxmlfails > 0) { move(8,1); set_color(COLOR_RED,COLOR_BLUE,1); addstr("Items not found in XML files led to ",xmllog); move(9,1); addstr(numberofxmlfails,xmllog); addstr(" lost stolen items! ",xmllog); move(11,1); set_color(COLOR_RED,COLOR_GREEN,1); addstr("Contact the mod author (or DevTeam if playing the vanilla game) at once!",xmllog); xmllog.nextMessage(); } getkey(); }
/* rolls up a creature's stats and equipment */ void makecreature(Creature &cr,short type) { cr.drop_weapons_and_clips(NULL); // Get rid of any old equipment from old encounters. cr.strip(NULL); // cr.creatureinit(); cr.exists=1; cr.squadid=-1; cr.type=type; cr.infiltration=0; cr.location=cursite; cr.worklocation=cursite; verifyworklocation(cr); const CreatureType* crtype=getcreaturetype(type); crtype->make_creature(cr); int attnum=crtype->attribute_points_.roll(); int attcap[ATTNUM]; for(int i=0;i<ATTNUM;i++) { cr.set_attribute(i,crtype->attributes_[i].min); attcap[i]=crtype->attributes_[i].max; } switch(type) { case CREATURE_BOUNCER: if(mode==GAMEMODE_SITE && location[cursite]->highsecurity) { strcpy(cr.name,"Enforcer"); cr.set_skill(SKILL_CLUB,LCSrandom(3)+3); } if(law[LAW_GUNCONTROL]==-2) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SMG_MP5")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_SMG")],4); } else if(law[LAW_GUNCONTROL]==-1) { cr.give_weapon(*weapontype[getweapontype("WEAPON_REVOLVER_44")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_44")],4); } else if(law[LAW_GUNCONTROL]==0) { cr.give_weapon(*weapontype[getweapontype("WEAPON_REVOLVER_38")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_38")],4); } else cr.give_weapon(*weapontype[getweapontype("WEAPON_NIGHTSTICK")],NULL); cr.reload(false); if(disguisesite(sitetype)) { cr.align=ALIGN_CONSERVATIVE; cr.infiltration=0.1f*LCSrandom(4); } else cr.align=ALIGN_MODERATE; break; case CREATURE_SECURITYGUARD: if(law[LAW_GUNCONTROL]==-2) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SMG_MP5")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_SMG")],4); } else if(law[LAW_GUNCONTROL]!=2) { cr.give_weapon(*weapontype[getweapontype("WEAPON_REVOLVER_38")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_38")],4); } else cr.give_weapon(*weapontype[getweapontype("WEAPON_NIGHTSTICK")],NULL); cr.reload(false); break; case CREATURE_SCIENTIST_LABTECH: crtype->give_weapon_civilian(cr); if(!cr.is_armed()&&!LCSrandom(2)) cr.give_weapon(*weapontype[getweapontype("WEAPON_SYRINGE")],NULL); break; case CREATURE_JUDGE_CONSERVATIVE: if(law[LAW_GUNCONTROL]==-2&&!LCSrandom(3)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_REVOLVER_44")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_44")],4); } else if(!LCSrandom(2)) cr.give_weapon(*weapontype[getweapontype("WEAPON_GAVEL")],NULL); cr.reload(false); break; case CREATURE_SCIENTIST_EMINENT: crtype->give_weapon_civilian(cr); if(!cr.is_armed()&&!LCSrandom(2)) cr.give_weapon(*weapontype[getweapontype("WEAPON_SYRINGE")],NULL); break; case CREATURE_CORPORATE_CEO: generate_name(cr.propername,GENDER_WHITEMALEPATRIARCH); strcpy(cr.name,"CEO "); strcat(cr.name,cr.propername); cr.dontname=true; break; case CREATURE_WORKER_FACTORY_NONUNION: crtype->give_weapon_civilian(cr); if(!cr.is_armed()) cr.give_weapon(*weapontype[getweapontype("WEAPON_CHAIN")],NULL); if(cr.align==ALIGN_LIBERAL) cr.align=LCSrandom(2)-1; break; case CREATURE_WORKER_SWEATSHOP: cr.flag|=CREATUREFLAG_ILLEGALALIEN; break; case CREATURE_LAWYER: if(law[LAW_GUNCONTROL]==-2 && !LCSrandom(3)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_REVOLVER_38")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_38")],1); cr.reload(false); } break; case CREATURE_DOCTOR: if(law[LAW_GUNCONTROL]==-2 && !LCSrandom(3)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_REVOLVER_38")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_38")],1); cr.reload(false); } break; case CREATURE_PSYCHOLOGIST: if(law[LAW_GUNCONTROL]==-2 && !LCSrandom(3)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_REVOLVER_38")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_38")],1); cr.reload(false); } if(cr.gender_liberal==GENDER_MALE||LCSrandom(2)) cr.give_armor(*armortype[getarmortype("ARMOR_CHEAPSUIT")],NULL); else cr.give_armor(*armortype[getarmortype("ARMOR_CHEAPDRESS")],NULL); break; case CREATURE_NURSE: if(law[LAW_GUNCONTROL]==-2 && !LCSrandom(3)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_REVOLVER_38")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_38")],1); cr.reload(false); } break; case CREATURE_WORKER_FACTORY_UNION: crtype->give_weapon_civilian(cr); if(!cr.is_armed()) cr.give_weapon(*weapontype[getweapontype("WEAPON_CHAIN")],NULL); break; case CREATURE_TANK: cr.animalgloss=ANIMALGLOSS_TANK; cr.specialattack=ATTACK_CANNON; break; case CREATURE_MERC: cr.give_weapon(*weapontype[getweapontype(law[LAW_GUNCONTROL]<1?"WEAPON_AUTORIFLE_M16":"WEAPON_SEMIRIFLE_AR15")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_ASSAULT")],7); cr.reload(false); break; case CREATURE_HICK: switch(LCSrandom(7)) { case 0:strcpy(cr.name,"Country Boy");break; case 1:strcpy(cr.name,"Good ol' Boy");break; case 2:strcpy(cr.name,"Hick");break; case 3:strcpy(cr.name,"Hillbilly");break; case 4:strcpy(cr.name,"Redneck");break; case 5:strcpy(cr.name,"Rube");break; case 6:strcpy(cr.name,"Yokel");break; } if((law[LAW_GUNCONTROL]==-2&&!LCSrandom(2))||!LCSrandom(10)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SHOTGUN_PUMP")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_BUCKSHOT")],4); } else cr.give_weapon(*weapontype[getweapontype(LCSrandom(2)?"WEAPON_TORCH":"WEAPON_PITCHFORK")],NULL); cr.reload(false); break; case CREATURE_COP: if(law[LAW_POLICEBEHAVIOR]==2 && cr.align==ALIGN_LIBERAL && !LCSrandom(3)) // Peace Officer { cr.align=ALIGN_MODERATE; strcpy(cr.name,"Police Negotiator"); cr.set_skill(SKILL_PERSUASION,LCSrandom(4)+1); cr.set_skill(SKILL_PISTOL,LCSrandom(3)+1); cr.set_attribute(ATTRIBUTE_HEART,4); } else { if(law[LAW_GUNCONTROL]==-2 && !LCSrandom(3)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SMG_MP5")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_SMG")],4); } else if(!LCSrandom(3)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SEMIPISTOL_9MM")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_9")],4); } else if(!LCSrandom(2)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SHOTGUN_PUMP")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_BUCKSHOT")],4); } else cr.give_weapon(*weapontype[getweapontype("WEAPON_NIGHTSTICK")],NULL); cr.reload(false); cr.align=ALIGN_CONSERVATIVE; cr.set_skill(SKILL_PISTOL,LCSrandom(4)+1); cr.set_skill(SKILL_SHOTGUN,LCSrandom(3)+1); cr.set_skill(SKILL_CLUB,LCSrandom(2)+1); cr.set_skill(SKILL_HANDTOHAND,LCSrandom(2)+1); cr.set_attribute(ATTRIBUTE_WISDOM,4); } break; case CREATURE_FIREFIGHTER: if(law[LAW_FREESPEECH]==-2) { cr.give_weapon(*weapontype[getweapontype("WEAPON_FLAMETHROWER")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_GASOLINE")],4); cr.reload(false); cr.set_skill(SKILL_HEAVYWEAPONS,LCSrandom(3)+2); strcpy(cr.name,"Fireman"); cr.align=ALIGN_CONSERVATIVE; } else { cr.give_weapon(*weapontype[getweapontype("WEAPON_AXE")],NULL); cr.set_skill(SKILL_AXE,LCSrandom(3)+2); strcpy(cr.name,"Firefighter"); } if(sitealarm) // Respond to emergencies in bunker gear cr.give_armor(*armortype[getarmortype("ARMOR_BUNKERGEAR")],NULL); break; case CREATURE_CCS_MOLOTOV: if(mode==GAMEMODE_SITE/* && sitealarm>0*/) nameCCSMember(cr); break; case CREATURE_CCS_SNIPER: if(mode==GAMEMODE_SITE/* && sitealarm>0*/) nameCCSMember(cr); break; case CREATURE_CCS_VIGILANTE: cr.give_armor(*armortype[getarmortype("ARMOR_CLOTHES")],NULL); switch(LCSrandom(5)+endgamestate) { case 0: case 1: break; case 2: { cr.give_weapon(*weapontype[getweapontype("WEAPON_SEMIPISTOL_9MM")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_9")],7); break; } case 3: { cr.give_weapon(*weapontype[getweapontype("WEAPON_REVOLVER_44")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_44")],7); break; } case 4: { cr.give_weapon(*weapontype[getweapontype("WEAPON_SHOTGUN_PUMP")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_BUCKSHOT")],7); break; } case 5: { cr.give_weapon(*weapontype[getweapontype("WEAPON_SEMIRIFLE_AR15")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_ASSAULT")],7); cr.give_armor(*armortype[getarmortype("ARMOR_CIVILLIANARMOR")],NULL); break; } case 6: { cr.give_weapon(*weapontype[getweapontype("WEAPON_SEMIRIFLE_AR15")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_ASSAULT")],7); cr.give_armor(*armortype[getarmortype("ARMOR_ARMYARMOR")],NULL); break; } default: { cr.give_weapon(*weapontype[getweapontype("WEAPON_AUTORIFLE_M16")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_ASSAULT")],7); cr.give_armor(*armortype[getarmortype("ARMOR_ARMYARMOR")],NULL); break; } } cr.reload(false); if(mode==GAMEMODE_SITE/* && sitealarm>0*/) nameCCSMember(cr); break; case CREATURE_CCS_ARCHCONSERVATIVE: strcpy(cr.name,(location[cursite]->siege.siege?"CCS Team Leader":(ccs_kills<2?"CCS Lieutenant":"CCS Founder"))); break; case CREATURE_PRISONGUARD: if(law[LAW_GUNCONTROL]==-2&&!LCSrandom(3)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SMG_MP5")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_SMG")],4); } else if(!LCSrandom(3)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SHOTGUN_PUMP")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_BUCKSHOT")],4); } else cr.give_weapon(*weapontype[getweapontype("WEAPON_NIGHTSTICK")],NULL); cr.reload(false); break; case CREATURE_EDUCATOR: if(law[LAW_GUNCONTROL]==-2 && !LCSrandom(3)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SMG_MP5")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_SMG")],4); } else if(!LCSrandom(3)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SEMIPISTOL_9MM")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_9")],4); } else cr.give_weapon(*weapontype[getweapontype("WEAPON_SYRINGE")],NULL); cr.reload(false); break; case CREATURE_GENETIC: if(location[cursite]->type==SITE_CORPORATE_HOUSE) { strcpy(cr.name,"Pet "); attcap[ATTRIBUTE_CHARISMA]=10; } else strcpy(cr.name,""); switch(LCSrandom(11)) { case 0:strcat(cr.name,"Genetic Monster");break; case 1:strcat(cr.name,"Flaming Rabbit"); cr.specialattack=ATTACK_FLAME;break; case 2:strcat(cr.name,"Genetic Nightmare");break; case 3:strcat(cr.name,"Mad Cow");break; case 4:strcat(cr.name,"Giant Mosquito"); cr.specialattack=ATTACK_SUCK;break; case 5:strcat(cr.name,"Six-legged Pig");break; case 6:strcat(cr.name,"Purple Gorilla");break; case 7:strcat(cr.name,"Warped Bear");break; case 8:strcat(cr.name,"Writhing Mass");break; case 9:strcat(cr.name,"Something Bad");break; case 10:strcat(cr.name,"Pink Elephant");break; } cr.animalgloss=ANIMALGLOSS_ANIMAL; if(law[LAW_ANIMALRESEARCH]!=2)cr.money=0; break; case CREATURE_GUARDDOG: cr.animalgloss=ANIMALGLOSS_ANIMAL; if(law[LAW_ANIMALRESEARCH]!=2)cr.money=0; break; case CREATURE_PRISONER: // Prisoners should not be "prisoners" after recruiting them, // they should be some brand of criminal if(!LCSrandom(10)) { // Thief makecreature(cr,CREATURE_THIEF); } else switch(LCSrandom(5)) { case 0: // Gang member makecreature(cr,CREATURE_GANGMEMBER); break; case 1: // Prostitute makecreature(cr,CREATURE_PROSTITUTE); break; case 2: // Crack head makecreature(cr,CREATURE_CRACKHEAD); break; case 3: // Teenager makecreature(cr,CREATURE_TEENAGER); break; case 4: // HS Dropout makecreature(cr,CREATURE_HSDROPOUT); break; } cr.drop_weapons_and_clips(NULL); crtype->give_weapon(cr); cr.strip(NULL); crtype->give_armor(cr); cr.money=crtype->money_.roll(); cr.juice=crtype->juice_.roll(); cr.gender_liberal=cr.gender_conservative=crtype->roll_gender(); strcpy(cr.name,crtype->get_encounter_name()); if(cr.align==ALIGN_CONSERVATIVE) cr.align=LCSrandom(2); break; case CREATURE_BUM: crtype->give_weapon_civilian(cr); if(!cr.is_armed()&&!LCSrandom(5)) cr.give_weapon(*weapontype[getweapontype("WEAPON_SHANK")],NULL); if(cr.align==ALIGN_CONSERVATIVE)cr.align=LCSrandom(2); break; case CREATURE_MUTANT: crtype->give_weapon_civilian(cr); if(!cr.is_armed()&&!LCSrandom(5)) cr.give_weapon(*weapontype[getweapontype("WEAPON_SHANK")],NULL); break; case CREATURE_GANGMEMBER: if(!LCSrandom(20)||(law[LAW_GUNCONTROL]==-2&&!LCSrandom(5))) { cr.give_weapon(*weapontype[getweapontype("WEAPON_AUTORIFLE_AK47")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_ASSAULT")],3); } else if(!LCSrandom(16)||(law[LAW_GUNCONTROL]==-2&&!LCSrandom(5))) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SMG_MP5")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_SMG")],4); } else if(!LCSrandom(15)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SEMIPISTOL_45")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_45")],4); } else if(!LCSrandom(10)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SHOTGUN_PUMP")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_BUCKSHOT")],4); } else if(!LCSrandom(4)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SEMIPISTOL_9MM")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_9")],4); } else if(!LCSrandom(2)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_REVOLVER_38")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_38")],4); } else cr.give_weapon(*weapontype[getweapontype("WEAPON_COMBATKNIFE")],NULL); cr.reload(false); // We'll make the crack house a bit dicey if(location[cursite]->type==SITE_BUSINESS_CRACKHOUSE)cr.align=ALIGN_CONSERVATIVE; if(!LCSrandom(2))switch(LCSrandom(3)) { case 0://cr.crimes_committed[LAWFLAG_BROWNIES]++; cr.crimes_suspected[LAWFLAG_BROWNIES]++;break; case 1://cr.crimes_committed[LAWFLAG_ASSAULT]++; cr.crimes_suspected[LAWFLAG_ASSAULT]++;break; case 2://cr.crimes_committed[LAWFLAG_MURDER]++; cr.crimes_suspected[LAWFLAG_MURDER]++;break; } break; case CREATURE_CRACKHEAD: crtype->give_weapon_civilian(cr); if(!LCSrandom(5)) cr.give_weapon(*weapontype[getweapontype("WEAPON_SHANK")],NULL); if(cr.align==ALIGN_CONSERVATIVE)cr.align=LCSrandom(2); attcap[ATTRIBUTE_HEALTH]=1+LCSrandom(5); break; case CREATURE_FASTFOODWORKER: cr.age=(LCSrandom(2)?AGE_TEENAGER:AGE_YOUNGADULT); break; case CREATURE_FOOTBALLCOACH: if(LCSrandom(2)) { cr.set_attribute(ATTRIBUTE_HEALTH,5); cr.set_attribute(ATTRIBUTE_AGILITY,5); cr.set_attribute(ATTRIBUTE_STRENGTH,5); } break; case CREATURE_PROSTITUTE: if(LCSrandom(7))cr.gender_conservative=cr.gender_liberal=GENDER_FEMALE; else if(!LCSrandom(3))cr.gender_liberal=GENDER_FEMALE; if(cr.align==ALIGN_CONSERVATIVE)cr.align=LCSrandom(2); if(!LCSrandom(3))cr.crimes_suspected[LAWFLAG_PROSTITUTION]++; break; case CREATURE_HIPPIE: if(!LCSrandom(10)) cr.crimes_suspected[LAWFLAG_BROWNIES]++; break; case CREATURE_SOCIALITE: cr.give_armor(*armortype[getarmortype(cr.gender_liberal==GENDER_FEMALE?"ARMOR_EXPENSIVEDRESS":"ARMOR_EXPENSIVESUIT")],NULL); break; case CREATURE_THIEF: switch(LCSrandom(5)) { case 0:strcpy(cr.name,getcreaturetype(CREATURE_SOCIALITE)->get_encounter_name());break; case 1:strcpy(cr.name,getcreaturetype(CREATURE_CLERK)->get_encounter_name());break; case 2:strcpy(cr.name,getcreaturetype(CREATURE_OFFICEWORKER)->get_encounter_name());break; case 3:strcpy(cr.name,getcreaturetype(CREATURE_CRITIC_ART)->get_encounter_name());break; case 4:strcpy(cr.name,getcreaturetype(CREATURE_CRITIC_MUSIC)->get_encounter_name());break; } if(!LCSrandom(10))cr.crimes_suspected[(LCSrandom(2)?LAWFLAG_BREAKING:LAWFLAG_THEFT)]++; break; case CREATURE_MILITARYOFFICER: if(LCSrandom(4)) { cr.give_weapon(*weapontype[getweapontype("WEAPON_SEMIPISTOL_9MM")],NULL); cr.take_clips(*cliptype[getcliptype("CLIP_9")],4); cr.reload(false); } break; case CREATURE_JUDGE_LIBERAL: case CREATURE_POLITICIAN: case CREATURE_CORPORATE_MANAGER: case CREATURE_WORKER_SERVANT: case CREATURE_WORKER_JANITOR: case CREATURE_WORKER_SECRETARY: case CREATURE_LANDLORD: case CREATURE_BANK_TELLER: case CREATURE_BANK_MANAGER: case CREATURE_TEENAGER: case CREATURE_SOLDIER: case CREATURE_VETERAN: case CREATURE_HARDENED_VETERAN: case CREATURE_SWAT: case CREATURE_DEATHSQUAD: case CREATURE_GANGUNIT: case CREATURE_AGENT: case CREATURE_SECRET_SERVICE: case CREATURE_RADIOPERSONALITY: case CREATURE_NEWSANCHOR: case CREATURE_JUROR: case CREATURE_WORKER_FACTORY_CHILD: case CREATURE_SEWERWORKER: case CREATURE_COLLEGESTUDENT: case CREATURE_MUSICIAN: case CREATURE_MATHEMATICIAN: case CREATURE_TEACHER: case CREATURE_HSDROPOUT: case CREATURE_PRIEST: case CREATURE_ENGINEER: case CREATURE_TELEMARKETER: case CREATURE_CARSALESMAN: case CREATURE_OFFICEWORKER: case CREATURE_MAILMAN: case CREATURE_GARBAGEMAN: case CREATURE_PLUMBER: case CREATURE_CHEF: case CREATURE_CONSTRUCTIONWORKER: case CREATURE_AMATEURMAGICIAN: case CREATURE_AUTHOR: case CREATURE_JOURNALIST: case CREATURE_CRITIC_ART: case CREATURE_CRITIC_MUSIC: case CREATURE_BIKER: case CREATURE_TRUCKER: case CREATURE_TAXIDRIVER: case CREATURE_PROGRAMMER: case CREATURE_NUN: case CREATURE_RETIREE: case CREATURE_PAINTER: case CREATURE_SCULPTOR: case CREATURE_DANCER: case CREATURE_PHOTOGRAPHER: case CREATURE_CAMERAMAN: case CREATURE_HAIRSTYLIST: case CREATURE_FASHIONDESIGNER: case CREATURE_CLERK: case CREATURE_ACTOR: case CREATURE_YOGAINSTRUCTOR: case CREATURE_MARTIALARTIST: case CREATURE_ATHLETE: case CREATURE_LOCKSMITH: case CREATURE_MILITARYPOLICE: case CREATURE_SEAL: break; } vector<int> possible; for(int a=0;a<ATTNUM;a++) { attnum-=min(4,cr.get_attribute(a,false)); possible.push_back(a); } while(attnum>0&&len(possible)) { int i=LCSrandom(len(possible)); int a=possible[i]; if(a==ATTRIBUTE_WISDOM&&cr.align==ALIGN_LIBERAL&&LCSrandom(4)) a=ATTRIBUTE_HEART; if(a==ATTRIBUTE_HEART&&cr.align==ALIGN_CONSERVATIVE&&LCSrandom(4)) a=ATTRIBUTE_WISDOM; if(cr.get_attribute(a,false)<attcap[a]) { cr.adjust_attribute(a,+1); attnum--; } else possible.erase(possible.begin()+i); } if(cr.align==ALIGN_LIBERAL) cr.infiltration=0.15f+(LCSrandom(10)-5)*0.01f; else if(cr.align==ALIGN_MODERATE) cr.infiltration=0.25f+(LCSrandom(10)-5)*0.01f; else cr.infiltration+=0.35f*(1-cr.infiltration)+(LCSrandom(10)-5)*0.01f; if(cr.infiltration<0) cr.infiltration=0; if(cr.infiltration>1) cr.infiltration=1; int randomskills=LCSrandom(4)+4; if(cr.age>20) randomskills+=static_cast<int>(randomskills*((cr.age-20.0)/20.0)); else randomskills-=(20-cr.age)/2; possible.clear(); for(int s=0;s<SKILLNUM;s++)possible.push_back(s); //RANDOM STARTING SKILLS while(randomskills>0&&len(possible)) { int i=LCSrandom(len(possible)); int randomskill=possible[i]; // 95% chance of not allowing some skills for anybody... if(LCSrandom(20)) { if(randomskill==SKILL_HEAVYWEAPONS) continue; if(randomskill==SKILL_SMG) continue; if(randomskill==SKILL_SWORD) continue; if(randomskill==SKILL_RIFLE) continue; if(randomskill==SKILL_AXE) continue; if(randomskill==SKILL_CLUB) continue; if(randomskill==SKILL_PSYCHOLOGY) continue; } // 90% chance of not allowing some skills, other than // for conservatives if(LCSrandom(10)&&cr.align!=ALIGN_CONSERVATIVE) { if(randomskill==SKILL_SHOTGUN) continue; if(randomskill==SKILL_PISTOL) continue; } if(cr.skill_cap(randomskill,true)>cr.get_skill(randomskill)) { cr.set_skill(randomskill,cr.get_skill(randomskill)+1); randomskills--; while(randomskills&&LCSrandom(2)) { if(cr.skill_cap(randomskill,true)>cr.get_skill(randomskill) && cr.get_skill(randomskill) < 4) { cr.set_skill(randomskill,cr.get_skill(randomskill)+1); randomskills--; } else { possible.erase(possible.begin()+i); break; } } } else possible.erase(possible.begin()+i); } //ALIENATION if((sitealienate>=1&&cr.align==ALIGN_MODERATE)||(sitealienate==2&&cr.align==ALIGN_LIBERAL))conservatise(cr); }