#include #include "mon.h" #include "obj.h" #include "vars.h" #include "dice.h" #include "pline.h" #include "format.h" #include "structs.h" #include "objtypes.h" #include "mon-@-you.h" #include "obj-potion.h" void quaff_it(INVOBJ *io) { OBJ *o; if (io->n > 1) abort(); o = io->v[0]; if (objtypes[o->type].class != OC_POTION) { pline("Quaffing non-potion?"); impossible(); return; } switch (o->type) { case OBJ_POTION_OF_MEMORY: objtypes[o->type].flags |= OTF_KNOWN; pline("Your memory seems exceptionally sharp!"); extend_memory_mapping(1000); break; case OBJ_POTION_OF_HEALING: pline("You feel better!"); gainhp(you,roll("10000+d5000")); break; } } static OBJ *new(int type __attribute__((__unused__)), OBJ *o) { o->private = 0; return(o); } static void old(OBJ *o __attribute__((__unused__))) { } static int identical(OBJ *o1, OBJ *o2) { return(o1->type==o2->type); } static int collapsible(OBJ *o1, OBJ *o2) { return(identical(o1,o2)); } static int identified(INVOBJ *io) { return(!!(objtypes[io->v[0]->type].flags&OTF_KNOWN)); } static INVOBJ *identify(INVOBJ *io) { objtypes[io->v[0]->type].flags |= OTF_KNOWN; return(io); } OBJOPS objops_potion = { &new, &old, &std_format, 0, 0, &collapsible, &identical, &std_split, &identified, &identify };