/* * The implementation of urchin monsters. This is the initial example * of a human-intelligence monster. (Of course, they aren't actually * as smart as a human.) */ #include #include #include "mon.h" #include "obj.h" #include "dice.h" #include "vars.h" #include "objtypes.h" #include "obj-armour.h" /* * The urchin tick method. Just use the standard human tick. */ static void urchin_tick(MONST *m) { std_human_tick(m); } /* * The urchin bevmoed method. Nothing to do here. */ static void urchin_bemoved(MONST *m __attribute__((__unused__))) { } /* * The urchin name method. */ static const char *urchin_name(MONST *m __attribute__((__unused__))) { return("the urchin"); } /* * The urchin Name method. */ static const char *urchin_Name(MONST *m __attribute__((__unused__))) { return("The urchin"); } /* * The urchin attack method. They have a half-decent hit chance. */ static int urchin_attack(MONST *m __attribute__((__unused__))) { return(rnd(100)); } /* * The urchin defend method. They don't have much innate defense. */ static int urchin_defend(MONST *m) { return(rnd(25)+armour_def_bonus(m->armour)); } /* * The urchin damage method. They do minor damage. */ static int urchin_givedamage(MONST *m __attribute__((__unused__)), int dd __attribute__((__unused__))) { return(roll("d1000")); } /* * The urchin MONOPS vector. */ static MONOPS ops = { &urchin_tick, &urchin_bemoved, &urchin_name, &urchin_Name, &urchin_attack, &urchin_defend, &urchin_givedamage, &std_takedamage, &std_kill, &std_destroy }; /* * Create a new urchin. */ static MONST *new_u(MONST *m, LEVEL *lv __attribute__((__unused__))) { m->symbol = 'u'; m->hp = 3000; m->maxhp = 3000; m->flags = Z_mad ? MF_TRACKING : 0; m->ops = &ops; return(m); } /* * The urchin ctl method. */ static void monctl_u(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->flags |= MF_TRACKING; else m->flags &= ~MF_TRACKING; } break; } va_end(ap); } /* * Urchin spawn probabilities. They spawn with equal chance everywhere * except the elemental levels. */ static PROBINIT probinit_u[] = { PROBALL(1), PROBELEM(0), PROBEND() }; /* * The urchin MTINFO. */ #define basespeed_u TIMESCALE #define baseheal_u 3 MTINFO mtinfo_u = MTINFO_INIT(u);