/* 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();
    }
}
Exemplo n.º 2
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();
         }
      }
   }
}
Exemplo n.º 3
0
void
transformation_animal_spell (CHAR_DATA * ch, AFFECTED_TYPE * spell,
			     void *target, int target_type)
{
  WOUND_DATA *wound, *next_wound;
  CHAR_DATA *tch;
  OBJ_DATA *tobj, *obj, *next_obj;
  char buf[MAX_STRING_LENGTH];
  bool base = false, extended = false;

  if (target_type == TARGET_OBJ)
    {
      tobj = (OBJ_DATA *) target;
      if (GET_ITEM_TYPE (tobj) == ITEM_CONTAINER
	  && tobj->nVirtual == VNUM_CORPSE)
	{
	  if ((spell->a.spell.discipline == SKILL_VOODOO
	       || spell->a.spell.discipline == SKILL_VOODOO)
	      && spell->a.spell.magnitude < MAGNITUDE_POWERFUL)
	    {
	      sprintf (buf,
		       "Suddenly, #2%s#0 appears to mend slightly, looking decidedly less decayed.",
		       tobj->short_description);
	      act (buf, false, ch, tobj, 0, TO_ROOM | _ACT_FORMAT);
	      act (buf, false, ch, 0, 0, TO_CHAR | _ACT_FORMAT);
	      tobj->obj_timer += spell->a.spell.magnitude;
	      return;
	    }
	  else
	    if ((spell->a.spell.discipline == SKILL_VOODOO
		 || spell->a.spell.discipline == SKILL_VOODOO)
		&& spell->a.spell.magnitude >= MAGNITUDE_POWERFUL)
	    {
	      sprintf (buf,
		       "A faint white aura briefly limns #2%s#0 before fading away.",
		       tobj->short_description);
	      act (buf, false, ch, tobj, 0, TO_ROOM | _ACT_FORMAT);
	      act (buf, false, ch, 0, 0, TO_CHAR | _ACT_FORMAT);
	      tobj->obj_flags.extra_flags &= ~ITEM_TIMER;
	      return;
	    }
	  if (spell->a.spell.discipline == SKILL_VOODOO
	      && spell->a.spell.magnitude < MAGNITUDE_POWERFUL)
	    {
	      sprintf (buf,
		       "Before your very eyes, #2%s#0 appears to putrefy with startling abruptness.",
		       tobj->short_description);
	      act (buf, false, ch, tobj, 0, TO_ROOM | _ACT_FORMAT);
	      act (buf, false, ch, 0, 0, TO_CHAR | _ACT_FORMAT);
	      tobj->obj_timer -= spell->a.spell.magnitude;
	      tobj->obj_timer = MAX (1, tobj->obj_timer);
	      return;
	    }
	  else if (spell->a.spell.discipline == SKILL_VOODOO
		   && spell->a.spell.magnitude >= MAGNITUDE_POWERFUL)
	    {
	      sprintf (buf,
		       "Without warning, #2%s#0 putrifies wretchedly before decaying into nothingness.",
		       tobj->short_description);
	      act (buf, false, ch, tobj, 0, TO_ROOM | _ACT_FORMAT);
	      act (buf, false, ch, 0, 0, TO_CHAR | _ACT_FORMAT);
	      for (obj = tobj->contains; obj; obj = next_obj)
		{
		  next_obj = obj->next_content;
		  obj->obj_timer = 12;
		  obj_from_obj (&obj, 0);
		  if (tobj->in_room != NOWHERE)
		    obj_to_room (obj, tobj->in_room);
		  else
		    extract_obj (obj);
		}
	      extract_obj (tobj);
	      return;
	    }
	}
    }

  else if (target_type == TARGET_OTHER || target_type == TARGET_SELF)
    {
      tch = (CHAR_DATA *) target;
      if (spell->a.spell.discipline == SKILL_VOODOO)
	{
	  sprintf (buf,
		   "You suddenly feel quite envigorated, tingling with health and well-being.\n");
	  send_to_char (buf, tch);
	  sprintf (buf,
		   "$n's eyes suddenly take on an envigorated sparkle, and $s posture straightens.");
	  act (buf, true, tch, 0, 0, TO_ROOM | _ACT_FORMAT);
	  tch->move += spell->a.spell.magnitude * 10;
	  return;
	}
      else if (spell->a.spell.discipline == SKILL_VOODOO)
	{
	  for (wound = tch->wounds; wound; wound = next_wound)
	    {
	      next_wound = wound->next;
	      wound->healerskill =
		ch->skills[SKILL_VOODOO] + (spell->a.spell.magnitude * 5);
	      wound->healerskill = MIN (90, wound->healerskill);
	      base = true;
	      if (wound->infection)
		wound->infection = -1;
	      if (wound->bleeding)
		wound->bleeding = 0;
	      if (spell->a.spell.magnitude > MAGNITUDE_STAUNCH)
		{
		  if (wound->infection)
		    wound->infection = 0;
		  adjust_wound (tch, wound, spell->a.spell.magnitude * -1);
		  extended = true;
		}
	    }
	  sprintf (buf,
		   "You are briefly surrounded by a cool, soothing nimbus of white light.\n");
	  send_to_char (buf, tch);

	  if (base)
	    {
	      sprintf (buf,
		       "\nYour wounds ache less beneath the touch of the magical radiance.\n");
	      send_to_char (buf, tch);
	    }

	  if (extended)
	    {
	      sprintf (buf,
		       "\nBefore your very eyes, your wounds begin to gently mend themselves.\n");
	      send_to_char (buf, tch);
	    }

	  sprintf (buf,
		   "$n is briefly surrounded by a soft nimbus of white light.");
	  act (buf, true, tch, 0, 0, TO_ROOM | _ACT_FORMAT);

	  return;
	}
      else if (spell->a.spell.discipline == SKILL_VOODOO)
	{
	  sprintf (buf,
		   "You are briefly surrounded by an inky cloud of fetid darkness.\n");
	  send_to_char (buf, tch);

	  sprintf (buf, "$n is momentarily enveloped in an inky darkness.");
	  act (buf, true, tch, 0, 0, TO_ROOM | _ACT_FORMAT);

	  for (wound = tch->wounds; wound; wound = next_wound)
	    {
	      next_wound = wound->next;
	      if (((ch->skills[SKILL_VOODOO] / 5 +
		    spell->a.spell.magnitude) > tch->con)
		  || number (1, 25) > tch->con)
		{
		  wound->infection = -1;
		  wound->healerskill = 0;
		  base = true;
		}
	      if (spell->a.spell.magnitude > MAGNITUDE_STAUNCH)
		{
		  if (adjust_wound (tch, wound, spell->a.spell.magnitude))
		    return;
		  extended = true;
		}
	    }

	  if (base)
	    {
	      sprintf (buf,
		       "\nYour wounds ache at the darkness' touch, before slowly beginning to pustulate.\n");
	      send_to_char (buf, tch);
	    }

	  if (extended)
	    {
	      sprintf (buf,
		       "\nHorrified, you watch as your wounds seem to worsen before your very eyes.\n");
	      send_to_char (buf, tch);
	    }

	  criminalize (ch, tch, tch->room->zone, CRIME_KILL);

	  return;
	}
    }

  send_to_char
    ("Your incantation, though complete, does not seem to have any effect.\n",
     ch);
}