コード例 #1
0
/* pick a random state */
const char* statename(int i)
{
   if(i < 0) i = LCSrandom(50);

   switch(LCSrandom(50))
   {
   case 0:return "Alabama";
   case 1:return "Alaska";
   case 2:return "Arkansas";
   case 3:return "Arizona";
   case 4:return "California";
   case 5:return "Colorado";
   case 6:return "Connecticut";
   case 7:return "Delaware";
   case 8:return "Florida";
   case 9:return "Georgia";
   case 10:return "Hawaii";
   case 11:return "Idaho";
   case 12:return "Illinois";
   case 13:return "Indiana";
   case 14:return "Iowa";
   case 15:return "Kansas";
   case 16:return "Kentucky";
   case 17:return "Louisiana";
   case 18:return "Maine";
   case 19:return "Maryland";
   case 20:return "Massachusetts";
   case 21:return "Michigan";
   case 22:return "Minnesota";
   case 23:return "Mississippi";
   case 24:return "Missouri";
   case 25:return "Montana";
   case 26:return "Nebraska";
   case 27:return "Nevada";
   case 28:return "New Hampshire";
   case 29:return "New Jersey";
   case 30:return "New Mexico";
   case 31:return "New York";
   case 32:return "North Carolina";
   case 33:return "North Dakota";
   case 34:return "Ohio";
   case 35:return "Oklahoma";
   case 36:return "Oregon";
   case 37:return "Pennsylvania";
   case 38:return "Rhode Island";
   case 39:return "South Carolina";
   case 40:return "South Dakota";
   case 41:return "Tennessee";
   case 42:return "Texas";
   case 43:return "Utah";
   case 44:return "Vermont";
   case 45:return "Virginia";
   case 46:return "Washington";
   case 47:return "West Virginia";
   case 48:return "Wisconsin";
   case 49:return "Wyoming";

   default:return "Hohoq"; // The Areas of My Expertise -- John Hodgman
   }
}
コード例 #2
0
int VehicleType::armorbonus(int location)
{
   switch(location)
   {
   case CARPART_BODY:
      return LCSrandom(lowarmormax_-lowarmormin_+1)+lowarmormin_;
   case CARPART_WINDOW:
      return LCSrandom(higharmormax_-higharmormin_+1)+higharmormin_;
   }
   return 0;
}
コード例 #3
0
int CreatureType::get_alignment() const
{
    if(alignment_public_mood_)
    {
        int mood=publicmood(-1);
        int a=ALIGN_CONSERVATIVE;
        if(LCSrandom(100)<mood) a++;
        if(LCSrandom(100)<mood) a++;
        return a;
    }
    else return alignment_;
}
コード例 #4
0
ファイル: ads.cpp プロジェクト: erik/liberalcrimesquad
void displayads(newsstoryst& ns, bool liberalguardian, short* storyx_s, short* storyx_e,int& it2)
{
   int adnumber=0;
   if(!liberalguardian)
   {
      if(ns.page>=10)adnumber++;
      if(ns.page>=20)adnumber+=LCSrandom(2)+1;
      if(ns.page>=30)adnumber+=LCSrandom(2)+1;
      if(ns.page>=40)adnumber+=LCSrandom(2)+1;
      if(ns.page>=50)adnumber+=LCSrandom(2)+1;
   }
   else
   {
      if(ns.guardianpage>=2)adnumber++;
      if(ns.guardianpage>=3)adnumber+=LCSrandom(2)+1;
      if(ns.guardianpage>=4)adnumber+=LCSrandom(2)+1;
      if(ns.guardianpage>=5)adnumber+=LCSrandom(2)+1;
      if(ns.guardianpage>=6)adnumber+=LCSrandom(2)+1;
   }
   char addplace[2][3]={{0,0,0}, {0,0,0}};
   if(adnumber>6)adnumber=6;
   while(adnumber>0)
   {
      displaysinglead(liberalguardian,addplace,storyx_s,storyx_e,it2);
      adnumber--;
   }
}
コード例 #5
0
/*********************************
**
**   SLEEPERS RECRUITING
**
**********************************/
void sleeper_recruit(Creature &cr,char &clearformess,char canseethings,int (&libpower)[VIEWNUM])
{
   if(subordinatesleft(cr))
   {
      prepareencounter(location[cr.worklocation]->type,0);
      for(int e=0;e<18;e++)
      {
         if(encounter[e].exists == false)
            break;
         if(encounter[e].worklocation == cr.worklocation || !LCSrandom(5))
         {
            if(encounter[e].align!=1&&LCSrandom(5))continue;

            Creature* recruit = new Creature(encounter[e]);
            liberalize(*recruit,0);
            recruit->namecreature();
            recruit->hireid = cr.id;
            if(recruit->infiltration > cr.infiltration)
            {
               recruit->infiltration = cr.infiltration;
            }
            recruit->flag |= CREATUREFLAG_SLEEPER;
            location[recruit->worklocation]->mapped=1;
            location[recruit->worklocation]->hidden=0;
            pool.push_back(recruit);

            erase();
            move(6,1);
            addstr("Sleeper ", gamelog);
            addstr(cr.name, gamelog);
            addstr(" has recruited a new ", gamelog);
            addstr(recruit->get_type_name(), gamelog);
            addstr(".", gamelog);
            gamelog.newline();
            move(8,1);
            addstr(recruit->name, gamelog);
            addstr(" looks forward serving the Liberal cause!", gamelog);
            gamelog.nextMessage();

            getkey();

            if(!subordinatesleft(cr))cr.activity.type = ACTIVITY_NONE;
            stat_recruits++;
            break;
         }
      }
   }
   return;
}
コード例 #6
0
static void getissueeventstring(char* str)
{
   switch(LCSrandom(VIEWNUM-3))
   {
   case VIEW_DRUGS:strcat(str,"a collection of studies on the health effects of marijuana");break;
   case VIEW_MILITARY:strcat(str,"a book on the history of military atrocities");break;
   case VIEW_IMMIGRATION:strcat(str,"a reality TV episode on the lives of immigrants");break;
   case VIEW_CIVILRIGHTS:strcat(str,"a documentary on the civil rights struggle");break;
   case VIEW_WOMEN:strcat(str,"a documentary on the women's rights struggle");break;
   case VIEW_GAY:strcat(str,"a documentary on the gay rights struggle");break;
   case VIEW_DEATHPENALTY:strcat(str,"a research paper on abuses of the death penalty");break;
   case VIEW_TAXES:strcat(str,"an economic paper on the flaws of trickle-down");break;
   case VIEW_NUCLEARPOWER:strcat(str,"a video tour of the Chernobyl dead zone");break;
   case VIEW_ANIMALRESEARCH:strcat(str,"a documentary on animal research");break;
   case VIEW_POLICEBEHAVIOR:strcat(str,"a hand-recorded video of police brutality");break;
   case VIEW_TORTURE:strcat(str,"a government inquiry into military interrogations");break;
   case VIEW_PRISONS:strcat(str,"a documentary on the prisoners' suffering");break;
   case VIEW_INTELLIGENCE:strcat(str,"a documentary on privacy rights");break;
   case VIEW_FREESPEECH:strcat(str,"a collection of banned books");break;
   case VIEW_GENETICS:strcat(str,"a video about genetic engineering accidents");break;
   case VIEW_JUSTICES:strcat(str,"a Liberal policy paper inquiring into judicial decisions");break;
   case VIEW_GUNCONTROL:strcat(str,"a book profiling school shootings");break;
   case VIEW_SWEATSHOPS:strcat(str,"a hand-recorded video of unregulated sweatshops");break;
   case VIEW_POLLUTION:strcat(str,"a leaked government paper on environmental conditions");break;
   case VIEW_CORPORATECULTURE:strcat(str,"a documentary on life under corporate culture");break;
   case VIEW_CEOSALARY:strcat(str,"a Liberal think-tank survey of top CEO salaries");break;
   case VIEW_AMRADIO:strcat(str,"a collection of Conservative radio host rants");break;
   case VIEW_CABLENEWS:strcat(str,"a collection of leaked Conservative cable news memos");break;
   //case VIEW_POLITICALVIOLENCE:strcat(str,"a documentary about progress made by direct action");break;
   }
}
コード例 #7
0
/* recruit struct constructor */
recruitst::recruitst() : task(0), timeleft(0), level(0), eagerness1(0)
{
   //Has heard of the LCS
   if((int)LCSrandom(100)<attitude[VIEW_LIBERALCRIMESQUAD])
   {
      //Likes the LCS
      if((int)LCSrandom(100)<attitude[VIEW_LIBERALCRIMESQUADPOS])
      {
         eagerness1=3;
      }
      //Doesn't like the LCS
      else eagerness1=0;
   }
   else eagerness1=2;
   
}
コード例 #8
0
/*
   Select one string randomly from a table of strings, e.g.
   const char *strtbl[] = {"abc", "d", "efgh"};
   SelectRandomString(strtbl, 3);
*/
const char *selectRandomString(const char **string_table, int table_size)
{
   int roll;

   roll = LCSrandom(table_size);

   return(string_table[roll]);
}
コード例 #9
0
int CreatureType::roll_gender() const
{
    int gender = LCSrandom(2)+1; // Male or female.
    switch(gender_liberal_)
    {
    case GENDER_NEUTRAL:
        return GENDER_NEUTRAL;
    case GENDER_MALE:
        return GENDER_MALE;
    case GENDER_FEMALE:
        return GENDER_FEMALE;
    case GENDER_MALE_BIAS:
        if(law[LAW_WOMEN]==-2||
                (law[LAW_WOMEN]==-1&&LCSrandom(25))||
                (law[LAW_WOMEN]== 0&&LCSrandom(10))||
                (law[LAW_WOMEN]== 1&&LCSrandom( 4)))
            return GENDER_MALE;
    case GENDER_FEMALE_BIAS:
        if(law[LAW_WOMEN]==-2||
                (law[LAW_WOMEN]==-1&&LCSrandom(25))||
                (law[LAW_WOMEN]== 0&&LCSrandom(10))||
                (law[LAW_WOMEN]== 1&&LCSrandom( 4)))
            return GENDER_FEMALE;
    }
    return gender;
}
コード例 #10
0
/* seeking acronym */
void sexseek(char *str)
{
   strcpy(str,"");

   switch(LCSrandom(2))
   { // ISO
   case 0:strcat(str,"ISO");break;
   case 1:strcat(str,"LF");break;
   default:strcat(str,"BAZ");break;
   }
}
コード例 #11
0
ファイル: vehicletype.cpp プロジェクト: Gatleos/lcsgame
int VehicleType::makeyear() const {
    int myear = 0;

    if (year_startcurrent_)
        myear = year;
    else
        myear = year_start_;

    if (year_randomuptocurrent_)
        myear += LCSrandom(year - year_start_ + 1);

    if (year_addrandom_ > 0)
        myear += LCSrandom(year_addrandom_);
    else if (year_addrandom_ < 0)
        myear -= LCSrandom(-year_addrandom_);

    myear += year_add_;

    return myear;
}
コード例 #12
0
/*********************************
**
**   SLEEPERS EMBEZZLING FUNDS
**
**********************************/
void sleeper_embezzle(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 embezzling funds.", gamelog);
         gamelog.nextMessage();

         getkey();

         cr.crimes_suspected[LAWFLAG_COMMERCE]++;
         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;
   }

   int income;
   switch(cr.type)
   {
      case CREATURE_CORPORATE_CEO:
         income=static_cast<int>(50000*cr.infiltration);
         break;
      case CREATURE_SCIENTIST_EMINENT:
      case CREATURE_CORPORATE_MANAGER:
      case CREATURE_BANK_MANAGER:
      case CREATURE_POLITICIAN:
         income=static_cast<int>(5000*cr.infiltration);
         break;
      default:
         income=static_cast<int>(500*cr.infiltration);
         break;
   }
   ledger.add_funds(income,INCOME_EMBEZZLEMENT);
}
コード例 #13
0
/* pick a descriptor acronym */
void sexdesc(char *str)
{
   strcpy(str,"");

   switch(LCSrandom(4))
   { // Descriptors
   case 0:strcat(str,"DTE");break;
   case 1:strcat(str,"ND");break;
   case 2:strcat(str,"NS");break;
   case 3:strcat(str,"VGL");break;

   default:strcat(str,"FOO");break;
   }
}
コード例 #14
0
/* return a letter, number, or one of either. */
void chooseLetterOrNumber(char *str, int type)
{
    strcpy(str,"");

    if(type == 1) // Choose a letter.
    {
        char randChar = 'a' + LCSrandom(26);
        addstr(&randChar);
    } else if(type == 2) // Choose a number.
    {
        char randNum = LCSrandom(10);
        addstr(&randNum);
    } else if(type == 3) {// Choose one of either.
        if(LCSrandom(36) > 25) {
            char randNum = LCSrandom(10);
            addstr(&randNum);
        } else {
        char randChar = 'a' + LCSrandom(26);
        addstr(&randChar);
        }
    } else {
        addstr("-ERR-");
    }
}
コード例 #15
0
void CreatureType::give_weapon_civilian(Creature& cr) const
{
    if (law[LAW_GUNCONTROL] == -1 && !LCSrandom(30))
    {
        cr.give_weapon(*weapontype[getweapontype("WEAPON_REVOLVER_38")], NULL);
        cr.take_clips(*cliptype[getcliptype("CLIP_38")], 4);
        cr.reload(false);
    }
    else if (law[LAW_GUNCONTROL] == -2)
    {
        if (!LCSrandom(10))
        {
            cr.give_weapon(*weapontype[getweapontype("WEAPON_SEMIPISTOL_9MM")], NULL);
            cr.take_clips(*cliptype[getcliptype("CLIP_9")], 4);
            cr.reload(false);
        }
        else if (!LCSrandom(9))
        {
            cr.give_weapon(*weapontype[getweapontype("WEAPON_SEMIPISTOL_45")], NULL);
            cr.take_clips(*cliptype[getcliptype("CLIP_45")], 4);
            cr.reload(false);
        }
    }
}
コード例 #16
0
/* what kind of person? */
void sexwho(char *str)
{
   strcpy(str,"");

   switch(LCSrandom(35))
   { // Who
   case 0:strcat(str,"BB");break;
   case 1:strcat(str,"BBC");break;
   case 2:strcat(str,"BF");break;
   case 3:strcat(str,"BHM");break;
   case 4:strcat(str,"BiF");break;
   case 5:strcat(str,"BiM");break;
   case 6:strcat(str,"BBW");break;
   case 7:strcat(str,"BMW");break; // lol big mexican woman
   case 8:strcat(str,"CD");break;
   case 9:strcat(str,"DWF");break;
   case 10:strcat(str,"DWM");break;
   case 11:strcat(str,"FTM");break;
   case 12:strcat(str,"GAM");break;
   case 13:strcat(str,"GBM");break;
   case 14:strcat(str,"GF");break;
   case 15:strcat(str,"GG");break;
   case 16:strcat(str,"GHM");break;
   case 17:strcat(str,"GWC");break;
   case 18:strcat(str,"GWF");break;
   case 19:strcat(str,"GWM");break;
   case 20:strcat(str,"MBC");break;
   case 21:strcat(str,"MBiC");break;
   case 22:strcat(str,"MHC");break;
   case 23:strcat(str,"MTF");break;
   case 24:strcat(str,"MWC");break;
   case 25:strcat(str,"SBF");break;
   case 26:strcat(str,"SBM");break;
   case 27:strcat(str,"SBiF");break;
   case 28:strcat(str,"SBiM");break;
   case 29:strcat(str,"SSBBW");break;
   case 30:strcat(str,"SWF");break;
   case 31:strcat(str,"SWM");break;
   case 32:strcat(str,"TG");break;
   case 33:strcat(str,"TS");break;
   case 34:strcat(str,"TV");break;

   default:strcat(str,"BAR");break;
   }
}
コード例 #17
0
int VehicleType::gethitlocation(int bodypart)
{
   switch(bodypart)
   {
   case BODYPART_HEAD:
      return CARPART_WINDOW;
      break;
   case BODYPART_BODY:
   case BODYPART_ARM_RIGHT:
   case BODYPART_ARM_LEFT:
      return (LCSrandom(100) < armormidpoint_) ? CARPART_BODY : CARPART_WINDOW;
      break;
   case BODYPART_LEG_RIGHT:
   case BODYPART_LEG_LEFT:
      return CARPART_BODY;
      break;
   }
   
   return CARPART_WINDOW;
}
コード例 #18
0
/**********************************************************************
** *JDS*
** ----- The sleeper system has been completely reworked.
** - Sleepers no longer directly influence the issues. They now affect
** the broad "liberal power" stats across many issues, which are used
** as a kind of monthly liberal roll akin to AM Radio and Cable News.
** - Each sleeper can affect one or more issue, throwing their power
** into the "abstracted debate" on that issue.
** - After all of the sleepers have contributed to the liberal power
** stats, a roll is made on each issue to see whether the liberals
** make background progress on those issues.
** - Several sleepers have special abilities. Lawyers and Judges, as
** always, can aid your people in the legal system. Police officers,
** corporate managers, CEOs, and agents can all now leak secret
** documents of the appropriate types, and they will make a check
** each month. This will only happen if the homeless shelter is not
** under siege, and "canseethings" is enabled (eg, you're not in prison
** or disbanded or some other situation where your sleeper can't get
** in touch with anyone in your squad).
** - News Anchors and Radio Personalities remain the two most powerful
** sleepers.
**********************************************************************/
void sleepereffect(Creature &cr,char &clearformess,char canseethings,int (&libpower)[VIEWNUM])
{
   if(disbanding)cr.activity.type = ACTIVITY_SLEEPER_LIBERAL;
   int infiltrate = 1;

   switch(cr.activity.type)
   {
      case ACTIVITY_SLEEPER_LIBERAL:
         sleeper_influence(cr,clearformess,canseethings,libpower);
         cr.infiltration-=0.02f;
         break;
      case ACTIVITY_SLEEPER_EMBEZZLE:
         sleeper_embezzle(cr,clearformess,canseethings,libpower);
         break;
      case ACTIVITY_SLEEPER_STEAL:
         sleeper_steal(cr,clearformess,canseethings,libpower);
         infiltrate = 0;
         break;
      case ACTIVITY_SLEEPER_RECRUIT:
         sleeper_recruit(cr,clearformess,canseethings,libpower);
         break;
      case ACTIVITY_SLEEPER_SPY:
         sleeper_spy(cr,clearformess,canseethings,libpower);
         break;
      case ACTIVITY_SLEEPER_SCANDAL:
         sleeper_scandal(cr,clearformess,canseethings,libpower);
         break;
      case ACTIVITY_NONE:
      case ACTIVITY_SLEEPER_JOINLCS:
      default:
         break;
   }

   if(infiltrate) cr.infiltration+=LCSrandom(8)*0.01f-0.02f;

   if(cr.infiltration>=1)
      cr.infiltration=1;
   if(cr.infiltration<=0)
      cr.infiltration=0;
}
コード例 #19
0
/* what type of sex? */
void sextype(char *str)
{
   strcpy(str,"");

   switch(LCSrandom(14))
   { // TYPE
   case 0:strcat(str,"225");break;
   case 1:strcat(str,"ATM");break;
   case 2:strcat(str,"BDSM");break;
   case 3:strcat(str,"CBT");break;
   case 4:strcat(str,"BJ");break;
   case 5:strcat(str,"DP");break;
   case 6:strcat(str,"D/s");break;
   case 7:strcat(str,"GB");break;
   case 8:strcat(str,"HJ");break;
   case 9:strcat(str,"OTK");break;
   case 10:strcat(str,"PNP");break;
   case 11:strcat(str,"TT");break;
   case 12:strcat(str,"SWS");break;
   case 13:strcat(str,"W/S");break;
   default:strcat(str,"LOL");break;
   }
}
コード例 #20
0
/* generate a non-vanity plate for the squad. */
void plate(char *str)
{
   strcpy(str,"");

   switch(LCSrandom(8)) // Actual license plate formats.
   {
   case 0: // 123 ABC
         // CT,WA
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      strcat(str," ");
      chooseLetterOrNumber(str, 1);
      chooseLetterOrNumber(str, 1);
      chooseLetterOrNumber(str, 1);
      break;
   case 1: // 12A B34
         // CT,MA
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 1);
      strcat(str," ");
      chooseLetterOrNumber(str, 1);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      break;
   case 2: // 123 4567
         // NH
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      strcat(str," ");
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      break;
   case 3: // ABC 1234
         // PA, NY, MI, MD
      chooseLetterOrNumber(str, 1);
      chooseLetterOrNumber(str, 1);
      chooseLetterOrNumber(str, 1);
      strcat(str," ");
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      break;
   case 4: // 12A34
         // School Buses.
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 1);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      break;
   case 5: // A 12345
         // Trucks, etc.
      chooseLetterOrNumber(str, 1);
      strcat(str," ");
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      break;
   case 6: // 1AB 234
         // CT, MA
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 1);
      chooseLetterOrNumber(str, 1);
      strcat(str," ");
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      break;
   case 7: // ABC 123
         // VT, MD
      chooseLetterOrNumber(str, 1);
      chooseLetterOrNumber(str, 1);
      chooseLetterOrNumber(str, 1);
      strcat(str," ");
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      chooseLetterOrNumber(str, 2);
      break;
   }
}
コード例 #21
0
/* unlock attempt */
char unlock(short type,char &actual)
{
    int p;
    int difficulty=0;

    switch(type)
    {
    case UNLOCK_DOOR:
        if(securityable(location[cursite]->type) == 1)
            difficulty=DIFFICULTY_CHALLENGING;
        else if(securityable(location[cursite]->type) > 1)
            difficulty=DIFFICULTY_HARD;
        else
            difficulty=DIFFICULTY_EASY;
        break;
    case UNLOCK_CAGE:
        difficulty=DIFFICULTY_VERYEASY;
        break;
    case UNLOCK_CAGE_HARD:
        difficulty=DIFFICULTY_AVERAGE;
        break;
    case UNLOCK_CELL:
        difficulty=DIFFICULTY_FORMIDABLE;
        break;
    case UNLOCK_ARMORY:
        difficulty=DIFFICULTY_HEROIC;
        break;
    case UNLOCK_SAFE:
        difficulty=DIFFICULTY_HEROIC;
        break;
    case UNLOCK_VAULT:
        difficulty=DIFFICULTY_HEROIC;
        break;
    }

    int maxattack=-1;

    for(p=0; p<6; p++)
    {
        if(activesquad->squad[p]!=NULL)
        {
            if(activesquad->squad[p]->alive)
            {
                if(activesquad->squad[p]->get_skill(SKILL_SECURITY)>maxattack)
                {
                    maxattack=activesquad->squad[p]->get_skill(SKILL_SECURITY);
                }
            }
        }
    }

    vector<int> goodp;

    for(p=0; p<6; p++)
    {
        if(activesquad->squad[p]!=NULL)
        {
            if(activesquad->squad[p]->alive)
            {
                if(activesquad->squad[p]->get_skill(SKILL_SECURITY)==maxattack)
                {
                    goodp.push_back(p);
                }
            }
        }
    }

    if(goodp.size()>0)
    {
        int p=goodp[LCSrandom(goodp.size())];

        //lock pick succeeded.
        if(activesquad->squad[p]->skill_check(SKILL_SECURITY,difficulty))
        {
            //skill goes up in proportion to the chance of you failing.
            if(maxattack<=difficulty)
            {
                activesquad->squad[p]->train(SKILL_SECURITY,1+(difficulty-maxattack));
            }
            clearmessagearea(false);
            set_color(COLOR_WHITE,COLOR_BLACK,1);
            move(16,1);
            addstr(activesquad->squad[p]->name, gamelog);
            addstr(" ", gamelog);
            switch(type)
            {
            case UNLOCK_DOOR:
                addstr("unlocks the door", gamelog);
                break;
            case UNLOCK_CAGE_HARD:
            case UNLOCK_CAGE:
                addstr("unlocks the cage", gamelog);
                break;
            case UNLOCK_SAFE:
                addstr("cracks the safe", gamelog);
                break;
            case UNLOCK_ARMORY:
                addstr("opens the armory", gamelog);
                break;
            case UNLOCK_CELL:
                addstr("unlocks the cell", gamelog);
                break;
            case UNLOCK_VAULT:
                addstr("cracks the combo locks", gamelog);
                break;
            }
            addstr("!", gamelog);
            gamelog.newline();
            for(int j=0; j<6; j++) //If people witness a successful unlock, they learn a little bit.
            {
                if(j==p) continue;
                if(activesquad->squad[j]!=NULL&&
                        activesquad->squad[j]->alive&&
                        activesquad->squad[j]->get_skill(SKILL_SECURITY)<difficulty)
                {
                    if(activesquad->squad[j]->alive)
                    {
                        activesquad->squad[j]->train(SKILL_SECURITY,difficulty-activesquad->squad[j]->get_skill(SKILL_SECURITY));
                    }
                }
            }

            refresh();
            getch();

            actual=1;
            return 1;
        }
        else
        {
            clearmessagearea(false);
            set_color(COLOR_WHITE,COLOR_BLACK,1);
            move(16,1);

            int i;
            //gain some experience for failing only if you could have succeeded.
            for (i = 0; i < 3; i++)
            {
                if(activesquad->squad[p]->skill_check(SKILL_SECURITY,difficulty))
                {
                    activesquad->squad[p]->train(SKILL_SECURITY,10);

                    addstr(activesquad->squad[p]->name, gamelog);
                    addstr(" is close, but can't quite get the lock open.", gamelog);
                    gamelog.newline();
                    break;
                }
            }

            if (i == 3)
            {
                addstr(activesquad->squad[p]->name, gamelog);
                addstr(" can't figure the lock out.", gamelog);
                gamelog.newline();
            }
            refresh();
            getch();

            actual=1;
            return 0;
        }
    }
    else
    {
        clearmessagearea();
        set_color(COLOR_WHITE,COLOR_BLACK,1);
        move(16,1);
        addstr("You can't find anyone to do the job.", gamelog);
        gamelog.newline();
        refresh();
        getch();
    }

    actual=0;
    return 0;
}
コード例 #22
0
ファイル: creature_test.cpp プロジェクト: Gatleos/lcsgame
creature::creature(int UniqueID) : ID(UniqueID) {
    //enum creature_type      Type;
    Type  = CREATURE_BUM;
    //signed char             Align;
    Align = ALIGN_LIBERAL;
    //enum species            Species;
    Species = SPECIES_HUMAN;

    //enum gender             Gender;
    if(LCSrandom(2))
        Gender = GENDER_FEMALE;
    else
        Gender = GENDER_MALE;

    //enum gender             BirthGender;
    BirthGender = Gender;

    //string                  Name;
    Name = "Transient";
    //const string            ProperName;
    GenerateName(ProperName, Gender);


    //const int               ID;
    //int                     SquadID;
    SquadID = -1;
    //int                     HireID;
    HireID = -1;
    //class date*             JoinDate;
    JoinDate = NULL;
    //class criminal_record*  CriminalRecord;
    CriminalRecord = NULL;



    //class date*             BirthDate;
    BirthDate = NULL;
    //class date*             DeathDate;
    DeathDate = NULL;

    //class weapon*           Weapon;
    Weapon = NULL;
    //class armor*            Armor;
    Armor  = NULL;
    //class clothing*         Clothing;
    Clothing = NULL;
    //class special*          Special;
    Special = NULL;
    //class creature*         Hostage;
    Hostage = NULL;

    //int                     Clip[CLIPNUM];
    std::memset(Clip, 0, sizeof(int)*CLIPNUM);

    //int                     Cash;
    Cash = 0;

    //enum unarmed_style      UnarmedAttack;
    UnarmedAttack = UNARMED_PUGILISM;

    //enum creature_status    Status;
    Status = STATUS_FREE;

    //int                     Blood;
    Blood = 100;
    //bool                    Incapacitated;
    Incapacitated = 0;

    //class bodypart          Wound[BODYPARTNUM];
    for(int i = 0; i < BODYPARTNUM; i++)
        Wound[i].SetType(i);

    //char                    SpecialWound[SPECIALWOUNDNUM];
    SpecialWound[SPECIALWOUND_TEETH] = TOOTHNUM;
    SpecialWound[SPECIALWOUND_RIGHTEYE] = 1;
    SpecialWound[SPECIALWOUND_LEFTEYE] = 1;
    SpecialWound[SPECIALWOUND_NOSE] = 1;
    SpecialWound[SPECIALWOUND_TONGUE] = 1;
    SpecialWound[SPECIALWOUND_RIGHTLUNG] = 1;
    SpecialWound[SPECIALWOUND_LEFTLUNG] = 1;
    SpecialWound[SPECIALWOUND_HEART] = 1;
    SpecialWound[SPECIALWOUND_LIVER] = 1;
    SpecialWound[SPECIALWOUND_STOMACH] = 1;
    SpecialWound[SPECIALWOUND_RIGHTKIDNEY] = 1;
    SpecialWound[SPECIALWOUND_LEFTKIDNEY] = 1;
    SpecialWound[SPECIALWOUND_SPLEEN] = 1;
    SpecialWound[SPECIALWOUND_RIBS] = RIBNUM;
    SpecialWound[SPECIALWOUND_NECK] = 1;
    SpecialWound[SPECIALWOUND_UPPERSPINE] = 1;
    SpecialWound[SPECIALWOUND_LOWERSPINE] = 1;

    //long                    Attributes[ATTNUM];
    for(int i = 0; i < ATTNUM; i++)
        Attributes[i] = 0;

    //int                     Skills[SKILLNUM];
    for(int i = 0; i < SKILLNUM; i++)
        Skills[i] = 0;

    //int                     SkillExp[SKILLNUM];
    for(int i = 0; i < SKILLNUM; i++)
        SkillExp[i] = 0;

    //int                     Juice;
    Juice = 0;

    //int                     Location;
    Location = -1;
    //int                     WorkLocation;
    WorkLocation = -1;
    //int                     Safehouse;
    Safehouse = -1;

    //bool                    CantBeBluffed;
    CantBeBluffed = false;

    //class activity*         Activity;
    Activity = NULL;

    //int                     CarID;
    CarID = -1;
    //bool                    IsDriver;
    IsDriver = false;
    //int                     Prefer_CarID;
    Prefer_CarID = -1;
    //bool                    Prefer_IsDriver;
    Prefer_IsDriver = false;

    //unsigned short          Flags;
    Flags = 0;
}
コード例 #23
0
ファイル: haulkidnap.cpp プロジェクト: Gatleos/lcsgame
/* prompt after you've said you want to kidnap someone */
void kidnapattempt(void) {
    short kidnapper = -1;

    party_status = -1;

    int available = 0;
    char availslot[6] = {0, 0, 0, 0, 0, 0};

    for(int p = 0; p < 6; p++) {
        if(activesquad->squad[p] != NULL) {
            if(activesquad->squad[p]->alive && activesquad->squad[p]->prisoner == NULL) {
                available++;
                availslot[p] = 1;
            }
        }
    }

    if(!available) {
        set_color(COLOR_WHITE, COLOR_BLACK, 1);
        move(16, 1);
        addstr("No one can do the job.            ");
        move(17, 1);
        addstr("                                  ");

        refresh();
        getch();

        return;
    }

    do {
        printparty();

        move(8, 20);
        set_color(COLOR_WHITE, COLOR_BLACK, 1);
        addstr("Choose a Liberal squad member to do the job.");

        refresh();

        int c = getch();
        translategetch(c);

        if(c == 10 || c == ESC)
            return;

        if(c >= '1' && c <= '6') {
            if(availslot[c - '1']) {
                kidnapper = c - '1';
                break;
            }
        }

    } while(1);

    if(kidnapper >= 0) {
        vector<int> target;

        for(int e = 0; e < ENCMAX; e++) {
            if(encounter[e].exists && encounter[e].alive && encounter[e].align == -1 &&
                    (encounter[e].animalgloss == ANIMALGLOSS_NONE || law[LAW_ANIMALRESEARCH] == 2)) {
                if((encounter[e].get_weapon().protects_against_kidnapping() &&
                        encounter[e].blood > 20) || encounter[e].animalgloss == ANIMALGLOSS_TANK)
                    continue;

                target.push_back(e);
            }
        }

        if(target.size() > 0) {
            int t = target[0];

            if(target.size() > 1) {
                do {
                    clearcommandarea();
                    clearmessagearea();
                    clearmaparea();

                    set_color(COLOR_WHITE, COLOR_BLACK, 1);
                    move(9, 1);
                    addstr("Kidnap whom?");

                    int x = 1, y = 11;

                    for(int t2 = 0; t2 < (int)target.size(); t2++) {
                        move(y, x);
                        addch(t2 + 'A');
                        addstr(" - ");
                        addstr(encounter[target[t2]].name);

                        y++;

                        if(y == 17) {
                            y = 11;
                            x += 30;
                        }
                    }

                    refresh();
                    int c = getch();
                    translategetch(c);

                    if(c >= 'a' && c <= 'z') {
                        t = c - 'a';

                        if(t >= (int)target.size())
                            t = -1;
                        else
                            t = target[t];

                        break;
                    }

                    if(c == 10 || c == ESC || c == 32) {
                        t = -1;
                        break;
                    }
                } while(1);
            }

            if(t != -1) {
                char amateur = 0;

                if(kidnap(*activesquad->squad[kidnapper], encounter[t], amateur)) {
                    delenc(t, 0);

                    int time = 20 + LCSrandom(10);

                    if(time < 1)
                        time = 1;

                    if(sitealarmtimer > time || sitealarmtimer == -1)
                        sitealarmtimer = time;
                } else
                    sitealarm = 1;

                if(amateur) {
                    char present = 0;

                    for(int e = 0; e < ENCMAX; e++) {
                        if(encounter[e].exists && encounter[e].alive) {
                            present = 1;
                            break;
                        }
                    }

                    if(present) {
                        alienationcheck(1);

                        if(!sitealarm)
                            sitealarm = 1;

                        sitecrime += 5;
                        criminalizeparty(LAWFLAG_KIDNAPPING);

                        if(activesquad->squad[kidnapper]->prisoner != NULL) {
                            if(activesquad->squad[kidnapper]->prisoner->type == CREATURE_RADIOPERSONALITY)
                                offended_amradio = 1;

                            if(activesquad->squad[kidnapper]->prisoner->type == CREATURE_NEWSANCHOR)
                                offended_cablenews = 1;
                        } else {
                            if(encounter[t].type == CREATURE_RADIOPERSONALITY)
                                offended_amradio = 1;

                            if(encounter[t].type == CREATURE_NEWSANCHOR)
                                offended_cablenews = 1;
                        }
                    }
                }

                if(sitealarm)
                    enemyattack();

                creatureadvance();
            }
        } else {
            set_color(COLOR_WHITE, COLOR_BLACK, 1);
            move(16, 1);
            addstr("All of the targets are too dangerous.                ");
            move(17, 1);
            addstr("                                                     ");

            refresh();
            getch();
        }
    } else {
        set_color(COLOR_WHITE, COLOR_BLACK, 1);
        move(16, 1);
        addstr("No one can do the job.                                  ");
        move(17, 1);
        addstr("                                                        ");

        refresh();
        getch();
    }
}
コード例 #24
0
/* 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();
         }
      }
   }
}
コード例 #25
0
/* daily - recruit - recruit meeting */
char completerecruitmeeting(recruitst &r,int p,char &clearformess)
{
   clearformess=1;

   

   erase();
   set_color(COLOR_WHITE,COLOR_BLACK,1);
   move(0,0);
   if(pool[p]->meetings++>5 && LCSrandom(pool[p]->meetings-5))
   {
      addstr(pool[p]->name, gamelog);
      addstr(" accidentally missed the meeting with ", gamelog);
      addstr(r.recruit->name, gamelog);
      move(1,0);
      addstr("due to multiple booking of recruitment sessions.", gamelog);
      gamelog.newline();

      move(3,0);
      addstr("Get it together, ", gamelog);
      addstr(pool[p]->name, gamelog);
      addstr("!", gamelog);
      gamelog.nextMessage();
      getch();

      return 1;
   }
   addstr("Meeting with ", gamelog);
   addstr(r.recruit->name, gamelog);
   addstr(", ", gamelog);
   char str[75];
   getrecruitcreature(str,r.recruit->type);
   addstr(str, gamelog);
   addstr(", ", gamelog);
   addstr(location[r.recruit->location]->name, gamelog);
   gamelog.newline();

   set_color(COLOR_WHITE,COLOR_BLACK,0);
   printfunds(0,1,"Money: ");

   printcreatureinfo(r.recruit);
   makedelimiter(8,0);

   move(10,0);
   addstr(r.recruit->name);
   switch(r.eagerness())
   {
   case 1:
      addstr(" will take a lot of persuading.");
      break;
   case 2:
      addstr(" is interested in learning more.");
      break;
   case 3:
      addstr(" feels something needs to be done.");
      break;
   default:
      if(r.eagerness()>=4)
         addstr(" is ready to fight for the Liberal Cause.");
      else
      {
         addstr(" kind of regrets agreeing to this.");
      }
      break;
   }
   move(11,0);
   addstr("How should ");
   addstr(pool[p]->name);
   addstr(" approach the situation?");

   move(13,0);
   if(ledger.get_funds()<50)set_color(COLOR_BLACK,COLOR_BLACK,1);
   addstr("A - Spend $50 on props and a book for them to keep afterward.");
   set_color(COLOR_WHITE,COLOR_BLACK,0);
   move(14,0);
   addstr("B - Just casually chat with them and discuss politics.");
   
   move(15,0);
   if(subordinatesleft(*pool[p]) && r.eagerness()>=4)
   {
      addstr("C - Offer to let ");
      addstr(r.recruit->name);
      addstr(" to join the LCS as a full member.");
   }
   else if(!subordinatesleft(*pool[p]))
   {
      set_color(COLOR_BLACK,COLOR_BLACK,1);
      addstr("C - ");
      addstr(pool[p]->name);
      addstr(" needs more Juice to recruit.");
      set_color(COLOR_WHITE,COLOR_BLACK,0);
   }
   else
   {
      set_color(COLOR_BLACK,COLOR_BLACK,1);
      addstr("C - ");
      addstr(r.recruit->name);
      addstr(" isn't ready to join the LCS.");
      set_color(COLOR_WHITE,COLOR_BLACK,0);
   }

   move(16,0);
   addstr("D - Break off the meetings.");

   int y=18;
   

   do
   {
      refresh();
      int c=getch();
      translategetch(c);

      if(c=='c' && subordinatesleft(*pool[p]) && r.eagerness()>=4)
      {
         move(y,0);
         addstr(pool[p]->name, gamelog);
         addstr(" offers to let ", gamelog);
         addstr(r.recruit->name, gamelog);
         addstr(" join the Liberal Crime Squad.", gamelog);
         gamelog.newline();

         refresh();
         getch();

         set_color(COLOR_GREEN,COLOR_BLACK,1);
         move(y+=2,0);
            
         addstr(r.recruit->name, gamelog);
         addstr(" accepts, and is eager to get started.", gamelog);
         gamelog.nextMessage();

         liberalize(*r.recruit,false);

         refresh();
         getch();

         erase();
         sleeperize_prompt(*r.recruit,*pool[p],6);

         r.recruit->hireid=pool[p]->id;

         pool[p]->train(SKILL_PERSUASION,25);

         pool.push_back(r.recruit);
         r.recruit = NULL;
         stat_recruits++;

         return 1;
      }
      if(c=='b' || (c=='a' && ledger.get_funds()>=50))
      {
         if(c=='a')
         {
            ledger.subtract_funds(50,EXPENSE_RECRUITMENT);
         }

         pool[p]->train(SKILL_PERSUASION,
            max(12-pool[p]->get_skill(SKILL_PERSUASION),5));
         pool[p]->train(SKILL_SCIENCE,
            max(r.recruit->get_skill(SKILL_SCIENCE)-pool[p]->get_skill(SKILL_SCIENCE),0));
         pool[p]->train(SKILL_RELIGION,
            max(r.recruit->get_skill(SKILL_RELIGION)-pool[p]->get_skill(SKILL_RELIGION),0));
         pool[p]->train(SKILL_LAW,
            max(r.recruit->get_skill(SKILL_LAW)-pool[p]->get_skill(SKILL_LAW),0));
         pool[p]->train(SKILL_BUSINESS,
            max(r.recruit->get_skill(SKILL_BUSINESS)-pool[p]->get_skill(SKILL_BUSINESS),0));
         
         int lib_persuasiveness = pool[p]->get_skill(SKILL_BUSINESS)+
                                  pool[p]->get_skill(SKILL_SCIENCE)+
                                  pool[p]->get_skill(SKILL_RELIGION)+
                                  pool[p]->get_skill(SKILL_LAW)+
                                  pool[p]->get_attribute(ATTRIBUTE_INTELLIGENCE,true);

         int recruit_reluctance = 5 +
                                  r.recruit->get_skill(SKILL_BUSINESS)+
                                  r.recruit->get_skill(SKILL_SCIENCE)+
                                  r.recruit->get_skill(SKILL_RELIGION)+
                                  r.recruit->get_skill(SKILL_LAW)+
                                  r.recruit->get_attribute(ATTRIBUTE_WISDOM,true)+
                                  r.recruit->get_attribute(ATTRIBUTE_INTELLIGENCE,true);

         if(lib_persuasiveness > recruit_reluctance)
            recruit_reluctance = 0;
         else
            recruit_reluctance -= lib_persuasiveness;

         int difficulty = recruit_reluctance;

         if(c=='a')
         {
            difficulty -= 5;

            move(y++,0);
            addstr(pool[p]->name, gamelog);
            addstr(" shares ", gamelog);
            strcpy(str,"");
            getissueeventstring(str);
            addstr(str), gamelog;
            addstr(".", gamelog);
            gamelog.newline();
            
            refresh();
            getch();
         }
         else
         {
            move(y++,0);
            addstr(pool[p]->name, gamelog);
            addstr(" explains ", gamelog);
            if(pool[p]->gender_liberal==GENDER_MALE)
               addstr("his ", gamelog);
            else if(pool[p]->gender_liberal==GENDER_FEMALE)
               addstr("her ", gamelog);
            else
               addstr("their ", gamelog);
            addstr("views on ", gamelog);
            getviewsmall(str,LCSrandom(VIEWNUM-3));
            addstr(str, gamelog);
            addstr(".", gamelog);
            gamelog.newline();
            refresh();
            getch();
         }
         
         bool success=0;

         if(pool[p]->skill_check(SKILL_PERSUASION,difficulty))
         {
            success=1;
            set_color(COLOR_CYAN,COLOR_BLACK,1);
            if(r.level<127) r.level++;
            if(r.eagerness1<127) r.eagerness1++;
            move(y++,0);
            addstr(r.recruit->name, gamelog);
            addstr(" found ", gamelog);
            addstr(pool[p]->name, gamelog);
            addstr("'s views to be insightful.", gamelog);
            gamelog.newline();
            move(y++,0);
            addstr("They'll definitely meet again tomorrow.", gamelog);
            gamelog.nextMessage();
         }
         else if(pool[p]->skill_check(SKILL_PERSUASION,difficulty)) // Second chance to not fail horribly
         {
            if(r.level<127) r.level++;
            if(r.eagerness1>-128) r.eagerness1--;
            move(y++,0);
            addstr(r.recruit->name, gamelog);
            addstr(" is skeptical about some of ", gamelog);
            addstr(pool[p]->name, gamelog);
            addstr("'s arguments.", gamelog);
            gamelog.newline();
            move(y++,0);
            addstr("They'll meet again tomorrow.", gamelog);
            gamelog.nextMessage();
         }
         else
         {
            set_color(COLOR_MAGENTA,COLOR_BLACK,1);
            move(y++,0);
            if(r.recruit->talkreceptive() && r.recruit->align==ALIGN_LIBERAL)
            {
               addstr(r.recruit->name, gamelog);
               addstr(" isn't convinced ", gamelog);
               addstr(pool[p]->name, gamelog);
               addstr(" really understands the problem.", gamelog);
               gamelog.newline();
               move(y++,0);
               addstr("Maybe ", gamelog);
               addstr(pool[p]->name, gamelog);
               addstr(" needs more experience.", gamelog);
               gamelog.nextMessage();
            }
            else
            {
               addstr(pool[p]->name, gamelog);
               addstr(" comes off as slightly insane.", gamelog);
               gamelog.newline();
               move(y++,0);
               addstr("This whole thing was a mistake. There won't be another meeting.", gamelog);
               gamelog.nextMessage();
            }
            refresh();
            getch();
            return 1;
         }
         refresh();
         getch();
         return 0;
      }
      if(c=='d')
      {
         return 1;
      }
   }while(1);
}
コード例 #26
0
/* run a tv broadcast */
char news_broadcast(void)
{
    sitealarm=1;
    int p;

    int enemy=0;
    for(int e=0; e<ENCMAX; e++)
    {
        if(encounter[e].exists&&encounter[e].alive)
        {
            if(encounter[e].align==-1)enemy++;
        }
    }

    if(enemy>0)
    {
        clearmessagearea();
        set_color(COLOR_WHITE,COLOR_BLACK,1);
        move(16,1);
        addstr("The Conservatives in the room hurry the Squad, so ", gamelog);
        move(17,1);
        addstr("the broadcast never happens.", gamelog);
        gamelog.newline();

        refresh();
        getch();
        return 0;
    }

    criminalizeparty(LAWFLAG_DISTURBANCE);

    clearmessagearea();
    set_color(COLOR_WHITE,COLOR_BLACK,1);
    move(16,1);
    addstr("The Squad steps in front of the cameras and ", gamelog);
    move(17,1);
    int viewhit=LCSrandom(VIEWNUM);
    switch(viewhit)
    {
    case VIEW_GAY:
        addstr("discusses homosexual rights.", gamelog);
        break;
    case VIEW_DEATHPENALTY:
        addstr("examines the death penalty.", gamelog);
        break;
    case VIEW_TAXES:
        addstr("discusses the tax code.", gamelog);
        break;
    case VIEW_NUCLEARPOWER:
        addstr("runs down nuclear power.", gamelog);
        break;
    case VIEW_ANIMALRESEARCH:
        addstr("discusses the horrors of animal research.", gamelog);
        break;
    case VIEW_POLICEBEHAVIOR:
        addstr("goes over cases of police brutality.", gamelog);
        break;
    case VIEW_TORTURE:
        addstr("discusses prisoner abuse and torture.", gamelog);
        break;
    case VIEW_PRISONS:
        addstr("discusses the prison system's flaws.", gamelog);
        break;
    case VIEW_INTELLIGENCE:
        addstr("debates privacy law.", gamelog);
        break;
    case VIEW_FREESPEECH:
        addstr("talks about free speech.", gamelog);
        break;
    case VIEW_GENETICS:
        addstr("discusses the implications of genetic research.", gamelog);
        break;
    case VIEW_JUSTICES:
        addstr("talks about the record of a Conservative judge.", gamelog);
        break;
    case VIEW_GUNCONTROL:
        addstr("talks about gun control.", gamelog);
        break;
    case VIEW_SWEATSHOPS:
        addstr("brings details about sweatshops to light.", gamelog);
        break;
    case VIEW_POLLUTION:
        addstr("does a show on industrial pollution.", gamelog);
        break;
    case VIEW_CORPORATECULTURE:
        addstr("jokes about corporate culture.", gamelog);
        break;
    case VIEW_CEOSALARY:
        addstr("gives examples of CEO excesses.", gamelog);
        break;
    case VIEW_WOMEN:
        addstr("discusses abortion.", gamelog);
        break;// "Performs an abortion live on the air."
    // Get [LAWFLAG_SPEECH], [LAWFLAG_MURDER], [LAWFLAG_DISTURBANCE] -- LK
    case VIEW_CIVILRIGHTS:
        addstr("debates affirmative action.", gamelog);
        break;
    case VIEW_DRUGS:
        addstr("has a frank talk about drugs.", gamelog);
        break;
    case VIEW_IMMIGRATION:
        addstr("examines the issue of immigration.", gamelog);
        break;
    case VIEW_MILITARY:
        addstr("talks about militarism in modern culture.", gamelog);
        break;
    case VIEW_AMRADIO:
        addstr("discusses other AM radio shows.", gamelog);
        break;
    case VIEW_CABLENEWS:
        addstr("talks about Cable News.", gamelog);
        break;
    case VIEW_LIBERALCRIMESQUAD:
        addstr("lets people know about the Liberal Crime Squad.", gamelog);
        break;
    default:
    case VIEW_LIBERALCRIMESQUADPOS:
        addstr("extols the virtues of the Liberal Crime Squad.", gamelog);
        break;
    case VIEW_CONSERVATIVECRIMESQUAD:
        addstr("demonizes the Conservative Crime Squad.", gamelog);
        break;
    }
    gamelog.newline();

    refresh();
    getch();

    int segmentpower=0;
    int usegmentpower;
    int partysize=0;
    for(p=0; p<6; p++)
    {
        if(activesquad->squad[p]!=NULL)
        {
            if(!activesquad->squad[p]->alive)continue;

            segmentpower+=activesquad->squad[p]->get_attribute(ATTRIBUTE_INTELLIGENCE,true);
            segmentpower+=activesquad->squad[p]->get_attribute(ATTRIBUTE_HEART,true);
            segmentpower+=activesquad->squad[p]->get_attribute(ATTRIBUTE_CHARISMA,true);
            segmentpower+=activesquad->squad[p]->get_skill(SKILL_MUSIC);
            segmentpower+=activesquad->squad[p]->get_skill(SKILL_RELIGION);
            segmentpower+=activesquad->squad[p]->get_skill(SKILL_SCIENCE);
            segmentpower+=activesquad->squad[p]->get_skill(SKILL_BUSINESS);
            segmentpower+=activesquad->squad[p]->get_skill(SKILL_PERSUASION);
            activesquad->squad[p]->train(SKILL_PERSUASION,50);
            partysize++;
        }
    }

    // LCS colors enhance the broadcast significantly
    if(activesquad->stance==SQUADSTANCE_BATTLECOLORS)
        segmentpower = (segmentpower * 3) / 2;

    int segmentbonus=segmentpower/4;
    if(partysize>1)segmentpower/=partysize;
    segmentpower+=segmentbonus;

    clearmessagearea();

    set_color(COLOR_WHITE,COLOR_BLACK,1);
    move(16,1);
    if(segmentpower<25)addstr("The Squad looks completely insane.", gamelog);
    else if(segmentpower<35)addstr("The show really sucks.", gamelog);
    else if(segmentpower<45)addstr("It is a very boring hour.", gamelog);
    else if(segmentpower<55)addstr("It is mediocre TV.", gamelog);
    else if(segmentpower<70)addstr("The show was all right.", gamelog);
    else if(segmentpower<85)addstr("The Squad put on a good show.", gamelog);
    else if(segmentpower<100)addstr("It was thought-provoking, even humorous.", gamelog);
    else addstr("It was the best hour of Cable TV EVER.", gamelog);
    gamelog.newline();

    refresh();
    getch();

    //CHECK PUBLIC OPINION
    change_public_opinion(VIEW_LIBERALCRIMESQUAD,10);
    change_public_opinion(VIEW_LIBERALCRIMESQUADPOS,(segmentpower-50)/10);
    if(viewhit!=VIEW_LIBERALCRIMESQUAD)change_public_opinion(viewhit,(segmentpower-50)/5,1);
    else change_public_opinion(viewhit,segmentpower/10);

    //PRISONER PARTS
    for(p=0; p<6; p++)
    {
        if(activesquad->squad[p]!=NULL)
        {
            if(activesquad->squad[p]->prisoner!=NULL && activesquad->squad[p]->prisoner->alive)
            {
                if(activesquad->squad[p]->prisoner->type==CREATURE_NEWSANCHOR)
                {
                    viewhit=LCSrandom(VIEWNUM);
                    clearmessagearea();

                    set_color(COLOR_WHITE,COLOR_BLACK,1);
                    move(16,1);
                    addstr("The hostage ", gamelog);
                    addstr(activesquad->squad[p]->prisoner->name, gamelog);
                    addstr(" is forced on to ", gamelog);
                    move(17,1);
                    switch(viewhit)
                    {
                    case VIEW_GAY:
                        addstr("discuss homosexual rights.", gamelog);
                        break;
                    case VIEW_DEATHPENALTY:
                        addstr("examine the death penalty.", gamelog);
                        break;
                    case VIEW_TAXES:
                        addstr("discuss the tax code.", gamelog);
                        break;
                    case VIEW_NUCLEARPOWER:
                        addstr("run down nuclear power.", gamelog);
                        break;
                    case VIEW_ANIMALRESEARCH:
                        addstr("discuss the horrors of animal research.", gamelog);
                        break;
                    case VIEW_POLICEBEHAVIOR:
                        addstr("go over cases of police brutality.", gamelog);
                        break;
                    case VIEW_TORTURE:
                        addstr("discuss prisoner abuse and torture.", gamelog);
                        break;
                    case VIEW_PRISONS:
                        addstr("discusses the prison system's flaws.", gamelog);
                        break;
                    case VIEW_INTELLIGENCE:
                        addstr("debate privacy law.", gamelog);
                        break;
                    case VIEW_FREESPEECH:
                        addstr("talk about free speech.", gamelog);
                        break;
                    case VIEW_GENETICS:
                        addstr("discuss the implications of genetic research.", gamelog);
                        break;
                    case VIEW_JUSTICES:
                        addstr("talk about the record of a Conservative judge.", gamelog);
                        break;
                    case VIEW_GUNCONTROL:
                        addstr("talk about gun control.", gamelog);
                        break;
                    case VIEW_SWEATSHOPS:
                        addstr("bring details about sweatshops to light.", gamelog);
                        break;
                    case VIEW_POLLUTION:
                        addstr("do a show on industrial pollution.", gamelog);
                        break;
                    case VIEW_CORPORATECULTURE:
                        addstr("joke about corporate culture.", gamelog);
                        break;
                    case VIEW_CEOSALARY:
                        addstr("give examples of CEO excesses.", gamelog);
                        break;
                    case VIEW_WOMEN:
                        addstr("discuss abortion.", gamelog);
                        break;// "Performs an abortion live on the air."
                    // Get [LAWFLAG_SPEECH], [LAWFLAG_MURDER], [LAWFLAG_DISTURBANCE] -- LK
                    case VIEW_CIVILRIGHTS:
                        addstr("debate affirmative action.", gamelog);
                        break;
                    case VIEW_DRUGS:
                        addstr("have a frank talk about drugs.", gamelog);
                        break;
                    case VIEW_IMMIGRATION:
                        addstr("examine the issue of immigration.", gamelog);
                        break;
                    case VIEW_MILITARY:
                        addstr("talk about militarism in modern culture.", gamelog);
                        break;
                    case VIEW_AMRADIO:
                        addstr("discuss other AM radio shows.", gamelog);
                        break;
                    case VIEW_CABLENEWS:
                        addstr("talk about Cable News.", gamelog);
                        break;
                    case VIEW_LIBERALCRIMESQUAD:
                        addstr("let people know about the Liberal Crime Squad.", gamelog);
                        break;
                    default:
                    case VIEW_LIBERALCRIMESQUADPOS:
                        addstr("extol the virtues of the Liberal Crime Squad.", gamelog);
                        break;
                    case VIEW_CONSERVATIVECRIMESQUAD:
                        addstr("demonize the Conservative Crime Squad.", gamelog);
                        break;
                    }
                    gamelog.newline();

                    usegmentpower=10; //FAME BONUS
                    usegmentpower+=activesquad->squad[p]->prisoner->get_attribute(ATTRIBUTE_INTELLIGENCE,true);
                    usegmentpower+=activesquad->squad[p]->prisoner->get_attribute(ATTRIBUTE_HEART,true);
                    usegmentpower+=activesquad->squad[p]->prisoner->get_attribute(ATTRIBUTE_CHARISMA,true);
                    usegmentpower+=activesquad->squad[p]->prisoner->get_skill(SKILL_PERSUASION);

                    if(viewhit!=VIEW_LIBERALCRIMESQUAD)change_public_opinion(viewhit,(usegmentpower-10)/2);
                    else change_public_opinion(viewhit,usegmentpower/2,1);

                    segmentpower+=usegmentpower;

                    refresh();
                    getch();
                }
                else
                {
                    clearmessagearea();

                    set_color(COLOR_WHITE,COLOR_BLACK,1);
                    move(16,1);
                    addstr(activesquad->squad[p]->prisoner->name, gamelog);
                    addstr(", the hostage, is kept off-air.", gamelog);
                    gamelog.newline();

                    refresh();
                    getch();
                }
            }
        }
    }

    if(sitealienate>=1&&segmentpower>=40)
    {
        sitealienate=0;

        clearmessagearea();

        set_color(COLOR_WHITE,COLOR_BLACK,1);
        move(16,1);
        addstr("Moderates at the station appreciated the show.", gamelog);
        gamelog.newline();
        move(17,1);
        addstr("They no longer feel alienated.", gamelog);
        gamelog.newline();

        refresh();
        getch();
    }

    //POST - SECURITY BLITZ IF IT SUCKED
    if(segmentpower<85 && segmentpower>=25)
    {
        clearmessagearea();

        set_color(COLOR_WHITE,COLOR_BLACK,1);
        move(16,1);
        addstr("Security is waiting for the Squad ", gamelog);
        move(17,1);
        addstr("after the show!", gamelog);
        gamelog.newline();

        refresh();
        getch();

        int numleft=LCSrandom(8)+2;
        for(int e=0; e<ENCMAX; e++)
        {
            if(!encounter[e].exists)
            {
                makecreature(encounter[e],CREATURE_SECURITYGUARD);
                numleft--;
            }
            if(numleft==0)break;
        }
    }
    else
    {
        clearmessagearea();

        set_color(COLOR_WHITE,COLOR_BLACK,1);
        move(16,1);
        addstr("The show was so ", gamelog);
        if(segmentpower<50)
            addstr("hilarious", gamelog);
        else
            addstr("entertaining", gamelog);
        addstr(" that security watched it ", gamelog);
        move(17,1);
        addstr("at their desks.  The Squad might yet escape.", gamelog);
        gamelog.newline();

        refresh();
        getch();
    }

    return 1;
}
コード例 #27
0
int main(int argc, char* argv[])
{
   init_console(); // do this FIRST
   //start curses
   initscr();

   gamelog.initialize(GAMELOG_FILEPATH, OVERWRITE_GAMELOG, NEWLINEMODE_GAMELOG); //Initialize the gamelog (and also initialize artdir and homedir)

   time_t t = time(0);
   struct tm *now = localtime(&t); //Do not need to deallocate this. Statically allocated by system
   char datetime[41];
   sprintf(datetime, "---------%i-%02i-%02i %02i:%02i:%02i---------\n\n\n", 
      now->tm_year+1900, now->tm_mon+1, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec); //YYYY-MM-DD HH:MM:SS format

   gamelog.log(string("\n\n\n---------- PROGRAM STARTED ----------\n") + datetime);



   char file_name[13];
   FILE *file;

   music.play(MUSIC_TITLEMODE); // initialize music and play title mode song (do this BEFORE displaying anything on the screen, but AFTER initializing artdir and homedir)

   // set window title
   char wtitle[50];
   strcpy(wtitle,"Liberal Crime Squad ");
   strcat(wtitle,PACKAGE_VERSION);
   set_title(wtitle);

   noecho();

   //initialize curses color
   start_color();

   initMainRNG();

   //initialize the array of color pairs
   for(int i=0;i<8;i++)
      for(int j=0;j<8;j++)
      {
         if(i==0&&j==0)
         {
            init_pair(7*8,0,0);
            continue;
         }
         if(i==7&&j==0) continue;
         init_pair(i*8+j,i,j);
      }

   //turns off cursor
   curs_set(0);

   //begin the game loop
   keypad(stdscr,TRUE);

   raw_output(TRUE);

   //addstr("Loading Graphics... ");
   //getkey();

   loadgraphics();

   //addstr("Loading Init File Options... ");
   //getkey();

   loadinitfile();

   //addstr("Loading sitemaps.txt... ");
   //getkey();

   oldMapMode=!readConfigFile("sitemaps.txt"); // load site map data
   if(oldMapMode)
   {
      addstr("Failed to load sitemaps.txt! Reverting to old map mode.",gamelog);
      gamelog.nextMessage();

      getkey();
   }

   //move(1,0);
   //addstr("Setting initial game data... ");
   //getkey();

   strcpy(slogan,"We need a slogan!");
   if(!LCSrandom(20))
   {
      switch(LCSrandom(7))
      {
      case 0: strcpy(slogan,"To Rogues and Revolution!"); break;
      case 1: strcpy(slogan,"Hell yes, LCS!"); break;
      case 2: strcpy(slogan,"Striking high, standing tall!"); break;
      case 3: strcpy(slogan,"Revolution never comes with a warning!"); break;
      case 4: strcpy(slogan,"True Liberal Justice!"); break;
      case 5: strcpy(slogan,"Laissez ain't fair!"); break;
      case 6: strcpy(slogan,"This is a slogan!"); break;
      }
   }

   //Initialize sorting choices.
   for(int s=0;s<SORTINGCHOICENUM;s++)
      activesortingchoice[s]=SORTING_NONE;

   for(int v=0;v<VIEWNUM;v++)
   {
      attitude[v]=30+LCSrandom(25);
      public_interest[v]=0;
      background_liberal_influence[v]=0;
   }
   attitude[VIEW_LIBERALCRIMESQUAD]=0;
   attitude[VIEW_LIBERALCRIMESQUADPOS]=5;
   //attitude[VIEW_POLITICALVIOLENCE]=5;

#ifdef REVOLUTIONNOW
   for(int v=0;v<VIEWNUM;v++)
      attitude[v]=100;
#endif

   law[LAW_ABORTION]=1;
   law[LAW_ANIMALRESEARCH]=-1;
   law[LAW_POLICEBEHAVIOR]=-1;
   law[LAW_PRIVACY]=-1;
   law[LAW_DEATHPENALTY]=-1;
   law[LAW_NUCLEARPOWER]=-1;
   law[LAW_POLLUTION]=-1;
   law[LAW_LABOR]=0;
   law[LAW_GAY]=1;
   law[LAW_CORPORATE]=0;
   law[LAW_FREESPEECH]=0;
   law[LAW_FLAGBURNING]=1;
   law[LAW_GUNCONTROL]=-1;
   law[LAW_TAX]=0;
   law[LAW_WOMEN]=1;
   law[LAW_CIVILRIGHTS]=1;
   law[LAW_DRUGS]=-1;
   law[LAW_IMMIGRATION]=0;
   law[LAW_ELECTIONS]=0;
   law[LAW_MILITARY]=-1;
   law[LAW_PRISONS]=0;
   law[LAW_TORTURE]=-1;

#ifdef SHITLAWS
   for(int l=0;l<LAWNUM;l++) law[l]=-2;
#endif

#ifdef PERFECTLAWS
   for(int l=0;l<LAWNUM;l++) law[l]=2;
#endif

   for(int s=0;s<SENATENUM;s++)
   {
      if(s<25) senate[s]=-2;
      else if(s<60) senate[s]=-1;
      else if(s<80) senate[s]=0;
      else if(s<95) senate[s]=1;
      else senate[s]=2;
   }

   for(int h=0;h<HOUSENUM;h++)
   {
      if(h<50) house[h]=-2;
      else if(h<250) house[h]=-1;
      else if(h<350) house[h]=0;
      else if(h<400) house[h]=1;
      else house[h]=2;
   }

   for(int c=0;c<COURTNUM;c++)
   {
      if(c<3) court[c]=-2;
      else if(c<5) court[c]=-1;
      else if(c<5) court[c]=0;
      else if(c<8) court[c]=1;
      else court[c]=2;
      do
      {
         if(court[c]==-2) generate_name(courtname[c],GENDER_WHITEMALEPATRIARCH);
         else generate_name(courtname[c]);
      } while(len(courtname[c])>20);
   }

   for(int e=0;e<EXECNUM;e++)
   {
      exec[e]=-2;
      generate_name(execname[e],GENDER_WHITEMALEPATRIARCH);
   }

   initOtherRNG(attorneyseed);
   strcpy(lcityname,cityname());

   xmllog.initialize("xmllog",true,1);
   bool xml_loaded_ok = true;
   xml_loaded_ok&=populate_from_xml(vehicletype,"vehicles.xml",xmllog);
   xml_loaded_ok&=populate_from_xml(cliptype,"clips.xml",xmllog);
   xml_loaded_ok&=populate_from_xml(weapontype,"weapons.xml",xmllog);
   xml_loaded_ok&=populate_from_xml(armortype,"armors.xml",xmllog);
   xml_loaded_ok&=populate_masks_from_xml(armortype,"masks.xml",xmllog);
   xml_loaded_ok&=populate_from_xml(loottype,"loot.xml",xmllog);
   xml_loaded_ok&=populate_from_xml(creaturetype,"creatures.xml",xmllog);
   xml_loaded_ok&=populate_from_xml(augmenttype,"augmentations.xml",xmllog);
   if(!xml_loaded_ok) end_game(EXIT_FAILURE);

   //addstr("Attempting to load saved game... ");
   //getkey();

   //addstr("Setup complete!");
   //getkey();

   clear();

   mode_title();

   //deinitialize curses
   end_game();

   return EXIT_SUCCESS;
}
コード例 #28
0
/* rescues people held at the activeparty's current location */
void partyrescue(short special)
{
    int freeslots=0;
    int p, pl;
    for(p=0; p<6; p++)
    {
        if(activesquad->squad[p]==NULL)freeslots++;
    }
    int hostslots=0;
    for(p=0; p<6; p++)
    {
        if(activesquad->squad[p]!=NULL)
        {
            if(activesquad->squad[p]->alive&&activesquad->squad[p]->prisoner==NULL)
            {
                hostslots++;
            }
        }
    }

    vector<Creature*> waiting_for_rescue;
    for(pl=0; pl<(int)pool.size(); pl++)
    {
        if(pool[pl]->location==cursite&&
                !(pool[pl]->flag & CREATUREFLAG_SLEEPER)&&
                !(special==SPECIAL_PRISON_CONTROL_LOW&&!(pool[pl]->sentence>0&&!pool[pl]->deathpenalty))&& //Low is for normal time-limited sentences.
                !(special==SPECIAL_PRISON_CONTROL_MEDIUM&&!(pool[pl]->sentence<0&&!pool[pl]->deathpenalty))&& //Medium is for life sentences.
                !(special==SPECIAL_PRISON_CONTROL_HIGH&&!pool[pl]->deathpenalty)) //High is for death sentences.
            waiting_for_rescue.push_back(pool[pl]);
    }

    for(pl=0; pl<(int)waiting_for_rescue.size(); pl++)
    {
        if(LCSrandom(2)&&freeslots)
        {
            for(int p=0; p<6; p++)
            {
                if(activesquad->squad[p]==NULL)
                {
                    activesquad->squad[p]=waiting_for_rescue[pl];
                    activesquad->squad[p]->squadid=activesquad->id;
                    criminalize(*activesquad->squad[p],LAWFLAG_ESCAPED);
                    activesquad->squad[p]->flag|=CREATUREFLAG_JUSTESCAPED;
                    break;
                }
            }
            hostslots++;
            freeslots--;

            clearmessagearea();

            set_color(COLOR_WHITE,COLOR_BLACK,1);
            move(16,1);
            addstr("You've rescued ", gamelog);
            addstr(waiting_for_rescue[pl]->name, gamelog);
            addstr(" from the Conservatives.", gamelog);
            gamelog.newline();

            printparty();
            refresh();
            getch();

            waiting_for_rescue[pl]->location=-1;
            waiting_for_rescue[pl]->base=activesquad->squad[0]->base;

            waiting_for_rescue.erase(waiting_for_rescue.begin()+pl);
            --pl;
        }
    }
    for(pl=0; pl<(int)waiting_for_rescue.size(); pl++)
    {
        if(hostslots)
        {
            for(int p=0; p<6; p++)
            {
                if(activesquad->squad[p]!=NULL)
                {
                    if(activesquad->squad[p]->alive&&activesquad->squad[p]->prisoner==NULL)
                    {
                        activesquad->squad[p]->prisoner=waiting_for_rescue[pl];
                        waiting_for_rescue[pl]->squadid=activesquad->id;
                        criminalize(*waiting_for_rescue[pl],LAWFLAG_ESCAPED);
                        waiting_for_rescue[pl]->flag|=CREATUREFLAG_JUSTESCAPED;

                        clearmessagearea();

                        set_color(COLOR_WHITE,COLOR_BLACK,1);
                        move(16,1);
                        addstr("You've rescued ", gamelog);
                        addstr(waiting_for_rescue[pl]->name, gamelog);
                        addstr(" from the Conservatives.", gamelog);
                        gamelog.newline();

                        refresh();
                        getch();

                        clearmessagearea();
                        move(16,1);
                        addstr(waiting_for_rescue[pl]->name, gamelog);
                        addstr(" ", gamelog);
                        switch(LCSrandom(3))
                        {
                        case 0:
                            addstr("was tortured recently ", gamelog);
                            break;
                        case 1:
                            addstr("was beaten severely yesterday ", gamelog);
                            break;
                        case 2:
                            addstr("was on a hunger strike ", gamelog);
                            break;
                        }
                        move(17,1);
                        addstr("so ", gamelog);
                        addstr(activesquad->squad[p]->name, gamelog);
                        addstr(" will have to haul a Liberal.", gamelog);
                        gamelog.newline();

                        waiting_for_rescue[pl]->location=-1;
                        waiting_for_rescue[pl]->base=activesquad->squad[p]->base;

                        printparty();
                        refresh();
                        getch();

                        waiting_for_rescue.erase(waiting_for_rescue.begin()+pl);
                        --pl;
                        break;
                    }
                }
            }

            hostslots--;
        }
        if(!hostslots)break;
    }

    if(waiting_for_rescue.size()==1)
    {
        clearmessagearea();
        set_color(COLOR_YELLOW,COLOR_BLACK,1);
        move(16,1);
        addstr("There's nobody left to carry ", gamelog);
        addstr(waiting_for_rescue[0]->name, gamelog);
        addstr(".", gamelog);
        gamelog.newline();
        set_color(COLOR_WHITE,COLOR_BLACK,1);
        move(17,1);
        addstr("You'll have to come back later.", gamelog);
        gamelog.newline();
        refresh();
        getch();
    }
    else if(waiting_for_rescue.size()>1)
    {
        clearmessagearea();
        set_color(COLOR_YELLOW,COLOR_BLACK,1);
        move(16,1);
        addstr("There's nobody left to carry the others.", gamelog);
        gamelog.newline();
        set_color(COLOR_WHITE,COLOR_BLACK,1);
        move(17,1);
        addstr("You'll have to come back later.", gamelog);
        gamelog.newline();
        refresh();
        getch();
    }
}
コード例 #29
0
ファイル: layout.cpp プロジェクト: erik/liberalcrimesquad
void preparepage(newsstoryst& ns, bool liberalguardian)
{
   for(int x=0;x<80;x++)
   {
      for(int y=0;y<25;y++)
      {
         move(y,x);
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         addch(CH_FULL_BLOCK);
      }
   }

   if(ns.page==1||(liberalguardian&&ns.guardianpage==1))
   {
      //TOP
      int pap=LCSrandom(5);
      for(int x=0;x<80;x++)
      {
         for(int y=0;y<5;y++)
         {
            move(y,x);
            if(liberalguardian)
            {
               set_color(newstops[5][x][y][1],
                         newstops[5][x][y][2],
                         newstops[5][x][y][3]);
               addch(translateGraphicsChar(newstops[5][x][y][0]));
            }
            else
            {
               set_color(newstops[pap][x][y][1],
                         newstops[pap][x][y][2],
                         newstops[pap][x][y][3]);

               addch(translateGraphicsChar(newstops[pap][x][y][0]));
            }
         }
      }

      if(!liberalguardian) // Liberal Guardian graphics don't support adding a date
      {
         //DATE
         set_color(COLOR_BLACK,COLOR_WHITE,0);
         char num[20];
         int pday=day;
         int pmonth=month;
         int pyear=year;
         if(pday>monthday()) // Day counter has increased but end-of-month has not yet
         {                   // been checked so it has to be accounted for here.
            pmonth++;
            pday=1;
            if(pmonth>12)
            {
               pmonth=1;
               pyear++;
            }
         }
         if(pday>=10)move(3,66);
         else move(3,67);
         switch(pmonth)
         {
            case 1:addstr("Jan");break;
            case 2:addstr("Feb");break;
            case 3:addstr("Mar");break;
            case 4:addstr("Apr");break;
            case 5:addstr("May");break;
            case 6:addstr("Jun");break;
            case 7:addstr("Jul");break;
            case 8:addstr("Aug");break;
            case 9:addstr("Sep");break;
            case 10:addstr("Oct");break;
            case 11:addstr("Nov");break;
            case 12:addstr("Dec");break;
         }
         addstr(". ");
         itoa(pday,num,10);
         addstr(num);
         addstr(", ");
         itoa(pyear,num,10);
         addstr(num);
      }
   }
   else
   {
      //PAGE
      set_color(COLOR_BLACK,COLOR_WHITE,0);
      char num[20];
      if(!liberalguardian)itoa(ns.page,num,10);
      else itoa(ns.guardianpage,num,10);
      move(0,76);
      addstr(num);
   }
}
コード例 #30
0
void dispersalcheck(char &clearformess)
{
int p = 0;
   //NUKE DISPERSED SQUAD MEMBERS WHOSE MASTERS ARE NOT AVAILABLE
   if(pool.size()>0)
   {
      // *JDS* I'm documenting this algorithm carefully because it
      // took me awhile to figure out what exactly was going on here.
      //
      // nukeme tracks whether each person has a secure chain of command.
      // 
      // if nukeme == 1, no confirmation of contact has been made
      // if nukeme == 0, confirmation that THEY are safe is given,
      //    but it is still needed to check whether their subordinates
      //    can reach them.
      // if nukeme == -1, confirmation has been made that this squad
      //    member is safe, and their immediate subordinates have also
      //    checked.
      //
      // The way the algorithm works, everyone starts at nukeme = 1.
      // Then we start at the top of the chain of command and walk
      // down it slowly, marking people 0 and then -1 as we sweep
      // down the chain. If someone is dead or in an unreachable state,
      // they block progression down the chain to their subordinates,
      // preventing everyone who requires contact with that person
      // from being marked safe. After everyone reachable has been
      // reached and marked safe, all remaining squad members are nuked.
      vector<int> nukeme;
      nukeme.resize(pool.size());

      for(p=pool.size()-1;p>=0;p--)
      {
         // If member is dead or has no boss (founder level), mark
         // them nukeme = 0, using them as a starting point at the top
         // of the chain.
         if(!pool[p]->alive||pool[p]->hireid==-1)nukeme[p]=0;
         // All remaining members are marked nukeme = 1.
         else nukeme[p]=1;
      }

      char changed;

      do // while(changed!=0)
      {
         changed=0;

         char inprison, alive;

         // Go through the entire pool to locate people at nukeme = 0,
         // so we can verify that their subordinates can reach them.
         for(p=pool.size()-1;p>=0;p--)
         {
            if(pool[p]->location!=-1&&location[pool[p]->location]->type==SITE_GOVERNMENT_PRISON)
               inprison=1;
            else inprison=0;

            if(pool[p]->alive)alive=1;
            else alive=0;

            // If in prison or unreachable due to a member of the command structure
            // above being in prison
            if(nukeme[p]==0&&alive&&inprison||nukeme[p]==2)
            {
               // If you're here because you're unreachable, mark as checked and unreachable
               if(!inprison)
               {
                  // Roll to see if you go into hiding or not
                  if(!pool[p]->hiding&&
                     pool[p]->attval(ATTRIBUTE_HEART)*5+pool[p]->juice<LCSrandom(200))
                  {
                     nukeme[p]=1;
                  }
                  else nukeme[p]=3;
               }
               else nukeme[p]=-1; // Else you're in prison; you're guaranteed contactable
               
               // Find all subordinates if you didn't lose contact completely
               if(nukeme[p]!=1)
               {
                  for(int p2=pool.size()-1;p2>=0;p2--)
                  {
                     if(pool[p2]->hireid==pool[p]->id)
                     {
                        nukeme[p2]=2; // Mark them as unreachable
                        changed=1; // Need another iteration
                     }
                  }
               }
            }
            // Otherwise, if they're both alive and reachable
            else if(nukeme[p]==0&&alive&&!inprison)
            {
               // Start looking through the pool again.
               for(int p2=pool.size()-1;p2>=0;p2--)
               {
                  // Locate each of this person's subordinates.
                  if(pool[p2]->hireid==pool[p]->id)
                  {
                     // Protect them from being dispersed -- their boss is
                     // safe. Their own subordinates will then be considered
                     // in the next loop iteration.
                     nukeme[p2]=0;
                     // If they're hiding indefinately and their boss isn't
                     // hiding at all, then have them discreetly return in a
                     // couple of weeks
                     if(pool[p2]->hiding==-1&&!pool[p]->hiding)
                     {
                        pool[p2]->hiding=LCSrandom(10)+3;
                     }
                     changed=1; // Take note that another iteration is needed.
                  }
               }
               // Now that we've dealt with this person's subordinates, mark
               // them so that we don't look at them again in this loop.
               nukeme[p]=-1;
            }
         }
      }while(changed); // If another iteration is needed, continue the loop.

      // After checking through the entire command structure, proceed
      // to nuke all squad members who are unable to make contact with
      // the LCS.
      for(p=pool.size()-1;p>=0;p--)
      {
         if(nukeme[p]==1||nukeme[p]==3)
         {
            if(clearformess)
            {
               erase();
            }
            else
            {
               makedelimiter(8,0);
            }

            if(!pool[p]->hiding&&nukeme[p]==3)
            {
               set_color(COLOR_WHITE,COLOR_BLACK,1);
               move(8,1);
               addstr(pool[p]->name);
               addstr(" has lost touch with the Liberal Crime Squad.");
               move(9,1);
               addstr("The Liberal has gone into hiding...");
               refresh();
               getch();
            }
            else if(nukeme[p]==1)
            {
               set_color(COLOR_WHITE,COLOR_BLACK,1);
               move(8,1);
               addstr(pool[p]->name);
               addstr(" has lost touch with the Liberal Crime Squad.");
               refresh();
               getch();
            }


            removesquadinfo(*pool[p]);
            if(nukeme[p]==1)
            {
               delete pool[p];
               pool.erase(pool.begin() + p);
            }
            else
            {
               int hs=0;
               for(int l=0;l<location.size();l++)
               {
                  if(location[l]->type==SITE_RESIDENTIAL_SHELTER)
                  {
                     hs=l;
                     break;
                  }
               }
               pool[p]->location=-1;
               pool[p]->base=hs;
               pool[p]->hiding=-1; // Hide indefinately
            }
         }
      }
   }

   //MUST DO AN END OF GAME CHECK HERE BECAUSE OF DISPERSAL
   endcheck(END_DISPERSED);
}