Ejemplo n.º 1
0
void m_trap_teleport(struct monster *m)
{
    char Str1[80];
    Level->site[m->x][m->y].locchar = TRAP;

    if(los_p(m->x, m->y, Player.x, Player.y)) {
        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " walked into a teleport trap!");
        mprint(Str1);
    }

    m_teleport(m);
}
Ejemplo n.º 2
0
void m_trap_acid(struct monster *m)
{
    char Str1[80];

    if(los_p(m->x, m->y, Player.x, Player.y)) {
        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " walked into a acid bath trap!");
        mprint(Str1);
        Level->site[m->x][m->y].locchar = TRAP;
    }

    m_damage(m, random_range(difficulty() * difficulty()), ACID);
}
Ejemplo n.º 3
0
void m_trap_disintegrate(struct monster *m)
{
    char Str1[80];

    if(los_p(m->x, m->y, Player.x, Player.y)) {
        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " walked into a disintegration trap!");
        mprint(Str1);
        Level->site[m->x][m->y].locchar = TRAP;
    }

    disintegrate(m->x, m->y);
}
Ejemplo n.º 4
0
void m_trap_fire(struct monster *m)
{
    char Str1[80];
    Level->site[m->x][m->y].locchar = TRAP;

    if(los_p(m->x, m->y, Player.x, Player.y)) {
        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " was hit by a fire trap!");
        mprint(Str1);
    }

    m_damage(m, (difficulty() + 1) * 5, FLAME);
}
Ejemplo n.º 5
0
void m_trap_blade(struct monster *m)
{
    char Str1[80];
    Level->site[m->x][m->y].locchar = TRAP;

    if(los_p(m->x, m->y, Player.x, Player.y)) {
        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " was hit by a blade trap!");
        mprint(Str1);
    }

    m_damage(m, ((difficulty() + 1) & 7) - Player.defense, NORMAL_DAMAGE);
}
Ejemplo n.º 6
0
void m_trap_abyss(struct monster *m)
{
    char Str1[80];

    if(los_p(m->x, m->y, Player.x, Player.y)) {
        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " fell into the infinite abyss!");
        mprint(Str1);
        Level->site[m->x][m->y].locchar = ABYSS;
        Level->site[m->x][m->y].p_locf = L_ABYSS;
    }

    m_vanish(m);
}
Ejemplo n.º 7
0
void m_lava(struct monster *m)
{
    char Str1[80];

    if(!m_immunityp(m, FLAME)
       || (!m_statusp(m, SWIMMING) && !m_statusp(m, ONLYSWIM))) {
        if(los_p(m->x, m->y, Player.x, Player.y)) {
            if(m->uniqueness != COMMON) {
                strcpy(Str1, m->monstring);
            }
            else {
                strcpy(Str1, "The ");
                strcat(Str1, m->monstring);
            }

            strcat(Str1, " died in a pool of lava!");
            mprint(Str1);
        }

        m_death(m);
    }
}
Ejemplo n.º 8
0
void m_trap_manadrain(struct monster *m)
{
    char Str1[80];

    if(los_p(m->x, m->y, Player.x, Player.y)) {
        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " walked into a manadrain trap!");
        mprint(Str1);
        Level->site[m->x][m->y].locchar = TRAP;
    }

    if(m->specialf == M_SP_SPELL) {
        m->specialf = M_NO_OP;
    }
}
Ejemplo n.º 9
0
void m_trap_sleepgas(struct monster *m)
{
    char Str1[80];

    if(los_p(m->x, m->y, Player.x, Player.y)) {
        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " walked into a sleepgas trap!");
        mprint(Str1);
        Level->site[m->x][m->y].locchar = TRAP;
    }

    if(!m_immunityp(m, SLEEP)) {
        m_status_reset(m, AWAKE);
    }
}
Ejemplo n.º 10
0
void m_trap_snare(struct monster *m)
{
    char Str1[80];
    Level->site[m->x][m->y].locchar = TRAP;

    if(los_p(m->x, m->y, Player.x, Player.y)) {
        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " was caught in a snare!");
        mprint(Str1);
    }

    if(!m_statusp(m, INTANGIBLE)) {
        m_status_reset(m, MOBILE);
    }
}
Ejemplo n.º 11
0
void m_trap_pit(struct monster *m)
{
    if(los_p(m->x, m->y, Player.x, Player.y)) {
        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " fell into a pit!");
        mprint(Str1);
        Level->site[m->x][m->y].locchar = TRAP;
    }

    if(!m_statusp(m, INTANGIBLE)) {
        m_status_reset(m, MOBILE);
    }

    m_damage(m, difficulty() * 5, NORMAL_DAMAGE);
}
Ejemplo n.º 12
0
void m_blind_strike(pmt m)
{

  pml ml;
  if ((Player.status[BLINDED] == 0) &&
      los_p(m->x,m->y,Player.x,Player.y) &&
      (distance(m->x,m->y,Player.x,Player.y) < 5)) {
    if (m->uniqueness == COMMON) {
      strcpy(Str2,"The ");
      strcat(Str2,m->monstring);
    }
    else strcpy(Str2,m->monstring);
    strcat(Str2," gazes at you menacingly");
    mprint(Str2);
    if (! p_immune(GAZE)) {
      mprint("You've been blinded!");
      Player.status[BLINDED] = random_range(4)+1;
      for(ml=Level->mlist;ml!=NULL;ml=ml->next) 
	plotspot(ml->m->x,ml->m->y,FALSE);
    }
    else mprint("You gaze steadily back....");
  }
}
Ejemplo n.º 13
0
void m_water(struct monster *m)
{
    char Str1[80];

    if(!m_statusp(m, INTANGIBLE)
       && !m_statusp(m, SWIMMING)
       && !m_statusp(m, ONLYSWIM)) {
        if(los_p(m->x, m->y, Player.x, Player.y)) {
            if(m->uniqueness != COMMON) {
                strcpy(Str1, m->monstring);
            }
            else {
                strcpy(Str1, "The ");
                strcat(Str1, m->monstring);
            }

            strcat(Str1, " drowned!");
            mprint(Str1);
        }

        m_death(m);
    }
}
Ejemplo n.º 14
0
/* from f to t */
void ball(int fx, int fy, int tx, int ty, int dmg, int dtype)
{
    int xx,yy,ex,ey,i;
    Monster *target;
    Symbol expchar=('@' | CLR(LIGHT_PURPLE));

    xx = fx;
    yy = fy;

    switch(dtype) {
    case FLAME:
        expchar=('*' | CLR(LIGHT_RED));
        break;
    case COLD:
        expchar=('o' | CLR(WHITE));
        break;
    case ELECTRICITY:
        expchar=('^' | CLR(LIGHT_BLUE));
        break;
    }

    do_los(expchar,&xx,&yy,tx,ty);
    draw_explosion(expchar,xx,yy);
    for(i=0; i<9; i++) {
        ex = xx + Dirs[0][i];
        ey = yy + Dirs[1][i];

        if ((ex == Player.x) && (ey == Player.y)) {
            switch(dtype) {
            case FLAME:
                mprint("You were blasted by a fireball!");
                p_damage(random_range(dmg),FLAME,"a fireball");
                break;
            case COLD:
                mprint("You were blasted by a snowball!");
                p_damage(random_range(dmg),COLD,"a snowball");
                break;
            case ELECTRICITY:
                mprint("You were blasted by ball lightning!");
                p_damage(random_range(dmg),ELECTRICITY,"ball lightning");
                break;
            case UNSTOPPABLE:
                mprint("Oh No! Manastorm!");
                p_damage(random_range(dmg),UNSTOPPABLE,"a manastorm!");
                break;
            }
        }
        if (NULL != (target = Level->site[ex][ey].creature)) {
            if (los_p(Player.x,Player.y,target->x,target->y)) {
                if (target->uniqueness == COMMON) {
                    strcpy(Str1,"The ");
                    strcat(Str1,target->name);
                }
                else strcpy(Str1,target->name);
                switch(dtype) {
                case FLAME:
                    strcat(Str1," was zorched by a fireball!");
                    break;
                case COLD:
                    strcat(Str1," was blasted by a snowball!");
                    break;
                case ELECTRICITY:
                    strcat(Str1," was zapped by ball lightning!");
                    break;
                case UNSTOPPABLE:
                    strcat(Str1," was nuked by a manastorm!");
                    break;
                }
                mprint(Str1);
            }
            m_status_set(target,HOSTILE);
            target->m_damage(random_range(dmg),dtype);
        }
        if (Level->site[ex][ey].locchar == HEDGE)
            if (Level->site[ex][ey].p_locf != L_TRIFID) {
                if ((dtype == FLAME)||(dtype == ELECTRICITY)) {
                    mprint("The hedge is blasted away!");
                    Level->site[ex][ey].p_locf = L_NO_OP;
                    Level->site[ex][ey].locchar = FLOOR;
                    plotspot(ex,ey,true);
                    lset(ex, ey, CHANGED);
                }
                else mprint("The hedge is unaffected.");
            }
            else mprint("The trifid absorbs the energy and laughs!");
        else if (Level->site[ex][ey].locchar == WATER)
            if (dtype == FLAME) {
                mprint("The water is vaporised!");
                Level->site[ex][ey].p_locf = L_NO_OP;
                Level->site[ex][ey].locchar = FLOOR;
                plotspot(ex,ey,true);
                lset(ex, ey, CHANGED);
            }
    }
}
Ejemplo n.º 15
0
/* Consider one monster's action */
void m_pulse(struct monster *m)
{
    int range = distance(m->x, m->y, Player.x, Player.y);

    if(Time % 10 == 0) {
        if(m->hp < Monsters[m->id].hp) {
            ++m->hp;
        }
    }

    if(!m_statusp(m, AWAKE) && (range <= m->wakeup)) {
        m_status_set(m, AWAKE);
        resetgamestatus(FAST_MOVE);
    }

    if(m_statusp(m, AWAKE)) {
        if(m_statusp(m, WANDERING)) {
            if(m_statusp(m, MOBILE)) {
                m_random_move(m);
            }

            if(range <= m->sense) {
                m_status_reset(m, WANDERING);
            }
        }
        else {
            /* Not wandering */
            if(m_statusp(m, HOSTILE)) {
                if((range > 2) && (range < m->sense) && (random_range(2) == 1)) {
                    if(los_p(m->x, m->y, Player.x, Player.y)
                       && (Player.status[INVISIBLE] == 0)) {
                        monster_strike(m);
                    }
                }
            }

            if((m_statusp(m, HOSTILE) || m_statusp(m, NEEDY))
               && (range > 1)
               && m_statusp(m, MOBILE)) {
                monster_move(m);

                /* If monster is greedy, picks up treasure it finds */
                if(m_statusp(m, GREEDY)) {
                    while(Level->site[m->x][m->y].things != NULL) {
                        m_pickup(m, Level->site[m->x][m->y].things->thing);
                        Level->site[m->x][m->y].things = Level->site[m->x][m->y].things->next;
                    }
                }
            }

            if(m_statusp(m, HOSTILE) && (range == 1)) {
                resetgamestatus(FAST_MOVE);
                tacmonster(m);
            }
        }

        /* Prevents monsters form casting spells from other side of dungeon */
        if(range < max(5, m->level)) {
            monster_special(m);
        }
    }
}
Ejemplo n.º 16
0
void m_death(struct monster *m)
{
    pob corpse;
    pml ml;
    int x;
    int y;
    int found = FALSE;
    m->hp = -1;

    if(los_p(Player.x, Player.y, m->x, m->y)) {
        putspot(m->x, m->y, getspot(m->x, m->y, FALSE));
        gain_experience(m->xpv);
        calc_melee();

        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " is dead!");
        mprint(Str1);
    }

    m_dropstuff(m);

    /* Death */
    if(m->id == (ML10 + 0)) {
        mprint("Death lies sprawled out on the ground...");
        mprint("Death laughs ironically and gets back to his feet.");
        mprint("He gestures and another scythe appears in his hands.");

        switch(random_range(10)) {
        case 0:
            mprint("Death performs a little bow and goes back on guard.");

            break;
        case 1:
            mprint("\'A hit! A palpable hit!\' Death goes back on the attack.");

            break;
        case 2:
            mprint("\'Ah, if only it could be so simple!\' snickers Death.");

            break;
        case 3:
            mprint("\'This fool things he can slay death! What a jest!\' says Death.");

            break;
        case 4:
            mprint("\'You point is well taken.\' says Death, attacking again.");

            break;
        case 5:
            mprint("\'Oh, come now, stop delaying the inevitable.\' says Death.");

            break;
        case 6:
            mprint("\'Your destiny ends here with me.\' says Death, scythe raised.");

            break;
        case 7:
            mprint("\'I almost felt that.\' says Death, smiling.");

            break;
        case 8:
            mprint("\'Timeo Mortis?\' asks Death quizzically, \'Not me!\'");

            break;
        case 9:
            mprint("Death sighs theatrically. \'They never learn.\'");

            break;
        }

        strengthen_death(m);
    }
    else {
        Level->site[m->x][m->y].creature = NULL;

        if(random_range(2) || (m->uniqueness != COMMON)) {
            corpse = (pob)malloc(sizeof(objtype));
            make_corpse(corpse, m);
            drop_at(m->x, m->y, corpse);
        }

        plotspot(m->x, m->y, FALSE);

        switch(m->id) {
        case ML0 + 8: /* Hiscore NPC */
            switch(m->aux2) {
            case 0:
                mprint("You hear a faroff dirge. You feel a sense of triumph.");

                break;
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
                mprint("You hear a faroff sound like angels crying...");
                strcpy(Priest[1], nameprint());
                Priestbehavior[1] = 2933;

                break;
            case 7:
                mprint("A furtive figure dashes out of the shadows, takes a look at");
                mprint("the corpse, and runs away!");
                strcpy(Shadowlord, nameprint());
                Shadowlordbehavior = 2912;

                break;
            case 8:
                mprint("An aide-de-camp approaches, removes the corpse's insignia,");
                mprint("and departs.");
                strcpy(Commandant, nameprint());
                Commandantbehavior = 2912;

                break;
            case 9:
                mprint("An odd glow surrounds the corpse, and slowly fades.");
                strcpy(Archmage, nameprint());
                Archmagebehavior = 2933;

                break;
            case 10:
                mprint("A demon materializes, takes a quick look at the corpse,");
                mprint("and teleports away with a faint popping noise.");
                strcpy(Prime, nameprint());
                Primebehavior = 2932;

                break;
            case 11:
                mprint("A sports columnist rushes forward and takes a quick photo");
                mprint("of the corpse and rushes off muttering about a deadline.");
                strcpy(Champion, nameprint());
                Championbehavior = 2913;

                break;
            case 12:
                mprint("You hear a fanfare in the distance, and feel dismayed.");
                strcpy(Duke, nameprint());
                Dukebehavior = 2911;

                break;
            case 13:
                if(Player.alignment > 10) {
                    mprint("You feel smug.");
                }
                else if(Player.alignment < 10) {
                    mprint("You feel ashamed.");
                }

                strcpy(Chaoslord, nameprint());
                Chaoslordbehavior = 2912;

                break;
            case 14:
                if(Player.alignment < 10) {
                    mprint("You feel smug.");
                }
                else if(Player.alignment > 10) {
                    mprint("You feel ashamed.");
                }

                strcpy(Lawlord, nameprint());
                Lawlordbehavior = 2911;

                break;
            case 15:
                /*
                 * Just a tad complicated. Promote a new justiciar if
                 * an guards are left in the city, otherwise destroy
                 * the Order!
                 */
                Player.alignment -= 100;

                if(!gamestatusp(DESTROYED_ORDER)) {
                    mprint("In the distance you hear a trumpet. A Servent of Law");
                    mprint("materializes, sheds a tear, and leaves.");
                    strcpy(Justiciar, nameprint());
                    Justiciarbehavior = 2911;

                    /* Promote one of the city guards to be justiciar */
                    ml = City->mlist;

                    while(!found && (ml != NULL)) {
                        if((ml->m->id == (ML0 + 3)) && (ml->m->hp > 0)) {
                            found = 1;
                        }
                        else {
                            found = 0;
                        }

                        if(!found) {
                            ml = ml->next;
                        }
                    }

                    if(ml != NULL) {
                        mprint("A new justiciar has been promoted!");
                        x = ml->m->x;
                        y = ml->m->y;
                        ml->m->x = x;
                        ml->m->y = y;
                        ml->m->click = (Tick + 1) % 60;
                        m_status_reset(ml->m, AWAKE);
                        m_status_reset(ml->m, HOSTILE);
                    }

                    /* 
                     * Will cause order to be destroyed if no guards or justiciar
                     */
                    alert_guards();
                }
                else {
                    mprint("A Servant of Chaos materializes, grabs the corpse,");
                    mprint("snickers a bit, and vanishes.");
                }
            }
            
            break;
        case ML0 + 3: /* Guard */
            Player.alignment -= 10;
            
            if((Current_Environment == E_CITY)
               || (Current_Environment == E_VILLAGE)) {
                alert_guards();
            }
            
            break;
        case ML3 + 5: /* Goblin king */
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("You seem to hear a woman's voice from far off:");
                mprint("\'Well don! Come to me now...\'");
            }
            
            setgamestatus(COMPLETED_CAVES);
            
            break;
        case ML7 + 5: /* Great worm */
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("A female voice sounds from just behind your ear:");
                mprint("\'Well fought! I have some new advice for you...\'");
            }
            
            setgamestatus(COMPLETED_SEWERS);
            
            break;
        case ML10 + 1:
            setgamestatus(KILLED_EATER);
            
            break;
        case ML10 + 2:
            setgamestatus(KILLED_LAWBRINGER);
            
            break;
        case ML10 + 3:
            setgamestatus(KILLED_DRAGONLORD);
            
            break;
        case ML10 + 4:
            setgamestatus(COMPLETED_VOLCANO);
            
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("You feel a soft touch on your shoulder...");
                mprint("You turn around but there is no one there!");
                mprint("You turn back and see a not: \'See me soon.\'");
                mprint("The note vanishes in a burst of blue fire!");
            }
            
            break;
        case ML10 + 9: /* Elemental master */
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("Words appear before you, traced in blue flame!");
                mprint("\'Return to the Prime Plane via the Circle of Sorcerors...");
            }
            
            break;
        }
    }
    
    dodrawspot(m->x, m->y);
}