コード例 #1
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();
    }
}
コード例 #2
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;
}