/* * The implementation of pixie monsters. These are intelligent and * carry magic items; damage they deal is not healable by magic. */ #include #include #include "mon.h" #include "obj.h" #include "vars.h" #include "dice.h" #include "damage.h" #include "structs.h" #include "objtypes.h" /* * The pixie tick method. Just use the standard human tick. */ static void pixie_tick(MONST *m) { std_human_tick(m); } /* * The pixie bemoved method. Nothing to do here. */ static void pixie_bemoved(MONST *m __attribute__((__unused__))) { } /* * The pixie name method. */ static const char *pixie_name(MONST *m __attribute__((__unused__))) { return("the pixie"); } /* * The pixie Name method. */ static const char *pixie_Name(MONST *m __attribute__((__unused__))) { return("The pixie"); } /* * The pixie attack method. They have a pretty good hit chance. */ static int pixie_attack(MONST *m __attribute__((__unused__))) { return(rnd(200)); } /* * The pixie defend method. They have decent defense, partly because * they're magical and partly from their small size. */ static int pixie_defend(MONST *m __attribute__((__unused__))) { return(rnd(100)); } /* * The pixie damage method. They do minor damage, but it's not * healable by magic, only by time - unless the pixie is canceled, in * which case it's ordinary damage. */ static DAMAGE pixie_givedamage(MONST *m, int dd __attribute__((__unused__))) { return(damage_simple(roll("d1000"),DK_ORDINARY,(m->baseflags&MBF_CANCEL)?0:DF_TIMEONLY)); } /* * The pixie MONOPS vector. */ static MONOPS ops = { &pixie_tick, &pixie_bemoved, &pixie_name, &pixie_Name, &pixie_attack, &pixie_defend, &pixie_givedamage, &std_takedamage, &std_kill, &std_destroy }; /* * Create a new pixie. */ static MONST *new_p(MONST *m, LEVEL *lv __attribute__((__unused__))) { OBJ *o; m->symbol = 'p'; m->hp = roll("4d1000+4000"); m->maxhp = m->hp; m->baseflags = 0; m->ops = &ops; if (rnd(2)) { o = obj_make(OBJ_GOLD); o->number = roll("d10+d20-1"); add_obj_to_inv(o,&m->invent); } if (! rnd(3)) { static const RANDCHOICE type[] = { { 100, OC_SCROLL }, { 100, OC_POTION }, { 50, OC_WAND }, { 50, OC_RING } }; const OBJCLASS *c; c = &objclass[RANDCHOOSE(type)-OC__BASE]; o = obj_make(c->minn+rnd(c->max+1-c->minn)); add_obj_to_inv(o,&m->invent); } return(m); } /* * The pixie ctl method. */ static void monctl_p(MONST *m, int op, ...) { va_list ap; va_start(ap,op); switch (op) { case MCTL_AGGR: { int ag; ag = va_arg(ap,int); if (ag) m->baseflags |= MBF_TRACKING; else m->baseflags &= ~MBF_TRACKING; } break; } va_end(ap); } /* * The pixie MTINFO. */ #define basespeed_p ((TIMESCALE*2)/3) #define baseheal_p 8 #define exp_p 10000 MTINFO mtinfo_p = MTINFO_INIT(p);