Beispiel #1
0
/* hostage freed due to host unable to haul */
void freehostage(Creature &cr, char situation) {
    if(cr.prisoner == NULL)
        return;

    if(cr.prisoner->alive) {
        if(situation == 0) {
            if(cr.prisoner->squadid == -1)
                addstr(" and a hostage is freed", gamelog);
            else {
                addstr(" and ", gamelog);
                addstr(cr.prisoner->name, gamelog);

                if(cr.prisoner->flag & CREATUREFLAG_JUSTESCAPED)
                    addstr(" is recaptured", gamelog);
                else
                    addstr(" is captured", gamelog);
            }

            gamelog.newline(); //New line.
        } else if(situation == 1) {
            clearmessagearea();
            set_color(COLOR_WHITE, COLOR_BLACK, 1);
            move(16, 1);

            if(cr.prisoner->squadid == -1)
                addstr("A hostage escapes!", gamelog);
            else {
                addstr(cr.prisoner->name, gamelog);

                if(cr.prisoner->flag & CREATUREFLAG_JUSTESCAPED)
                    addstr(" is recaptured.", gamelog);
                else
                    addstr(" is captured.", gamelog);
            }

            gamelog.newline(); //New line.
        } else if(situation == 2) {
            //Don't print anything.
        }

        if(cr.prisoner->squadid == -1) {
            for(int e = 0; e < ENCMAX; e++) {
                if(encounter[e].exists == 0) {
                    encounter[e] = *cr.prisoner;
                    encounter[e].exists = 1;
                    conservatise(encounter[e]);
                    break;
                }
            }

            delete cr.prisoner;
        } else
            capturecreature(*cr.prisoner);
    } else {
        if(cr.prisoner->squadid != -1) {
            //MUST DELETE PARTY MEMBER FROM POOL COMPLETELY
            //(That may not be the case any longer -jds)
            for(int pl = 0; pl < (int)pool.size(); pl++) {
                if(pool[pl] == cr.prisoner) {
                    removesquadinfo(*pool[pl]);
                    pool[pl]->die();
                    pool[pl]->location = -1;
                    //delete_and_remove(pool,pl);
                    break;
                }
            }
        }
    }

    cr.prisoner = NULL;

    if(situation == 1) {
        printparty();

        if(mode == GAMEMODE_CHASECAR ||
                mode == GAMEMODE_CHASEFOOT)
            printchaseencounter();
        else
            printencounter();

        refresh();
        getch();
    }
}
Beispiel #2
0
/* checks if your liberal behavior/attack alienates anyone */
char alienationcheck(char mistake)
{
    if(location[cursite]->siege.siege)return 0;


    char alienate=0;
    char alienatebig=0;

    char sneak=0;

    int oldsitealienate=sitealienate;

    vector<int> noticer;
    for(int e=0; e<ENCMAX; e++)
    {
        // Prisoners should never be alienated by your crimes, as
        // they're happy to have you attacking their place of holding
        //if(encounter[e].type==CREATURE_PRISONER)continue;

        // ...but Prisoners are now spawned with a variety of creature
        // types, so we'll go by name instead
        if(!strcmp(encounter[e].name,"Prisoner"))continue;

        if(encounter[e].exists&&encounter[e].alive&&
                (encounter[e].align==0||(encounter[e].align==1&&mistake)))
        {
            noticer.push_back(e);
        }
    }

    if(noticer.size()>0)
    {
        int n,an;

        do
        {
            an=LCSrandom(noticer.size());
            n=noticer[an];
            noticer.erase(noticer.begin() + an);

            if(encounter[n].align==1)alienatebig=1;
            else alienate=1;
        } while(noticer.size()>0);

        if(alienatebig)sitealienate=2;
        if(alienate&&sitealienate!=2)sitealienate=1;

        if(oldsitealienate<sitealienate)
        {
            set_color(COLOR_YELLOW,COLOR_BLACK,1);

            move(16,1);
            if(sitealienate==1)addstr("We've alienated the masses here!              ");
            else addstr("We've alienated absolutely everyone here!               ");
            move(17,1);
            addstr("                                                        ");

            sitealarm=1;

            for(int i=0; i<ENCMAX; i++)
            {
                if(encounter[i].exists && encounter[i].align != ALIGN_CONSERVATIVE)
                {
                    if(encounter[i].align == ALIGN_MODERATE || alienatebig)
                        conservatise(encounter[i]);
                }
            }

            if(mode==GAMEMODE_CHASECAR||
                    mode==GAMEMODE_CHASEFOOT)printchaseencounter();
            else printencounter();
            refresh();
            getch();
        }
    }

    return alienate;
}