void stealamulet(struct monst *mtmp) { struct obj *otmp = NULL; int real=0, fake=0; /* select the artifact to steal */ if (u.uhave.amulet) { real = AMULET_OF_YENDOR; fake = FAKE_AMULET_OF_YENDOR; } else if (u.uhave.questart && mtmp->mnum == quest_info(MS_NEMESIS)) { for (otmp = invent; otmp; otmp = otmp->nobj) if (is_quest_artifact(otmp)) break; if (!otmp) return; /* should we panic instead? */ } else if (u.uhave.bell) { real = BELL_OF_OPENING; fake = BELL; } else if (u.uhave.book) { real = SPE_BOOK_OF_THE_DEAD; } else if (u.uhave.menorah) { real = CANDELABRUM_OF_INVOCATION; } else return; /* you have nothing of special interest */ if (!otmp) { /* If we get here, real and fake have been set up. */ for (otmp = invent; otmp; otmp = otmp->nobj) if (otmp->otyp == real || (otmp->otyp == fake && !mtmp->iswiz)) break; } if (otmp) { /* we have something to snatch */ if (otmp->owornmask) remove_worn_item(otmp, TRUE); freeinv(otmp); /* mpickobj wont merge otmp because none of the above things to steal are mergable */ mpickobj(mtmp,otmp); /* may merge and free otmp */ pline("%s stole %s!", Monnam(mtmp), doname(otmp)); if (can_teleport(mtmp->data) && !tele_restrict(mtmp)) rloc(level, mtmp, FALSE); } }
/*! \brief Main menu * * Main menu that calls all the other little menus :) */ void menu(void) { int stop = 0, ptr = 0, z = -1; play_effect(SND_MENU, 128); timer_count = 0; while (!stop) { check_animation(); drawmap(); draw_mainmenu(-1); draw_sprite(double_buffer, menuptr, 204 + xofs, ptr * 8 + 73 + yofs); blit2screen(xofs, yofs); readcontrols(); if (PlayerInput.up) { unpress(); ptr--; if (ptr < 0) { ptr = 5; } play_effect(SND_CLICK, 128); } if (PlayerInput.down) { unpress(); ptr++; if (ptr > 5) { ptr = 0; } play_effect(SND_CLICK, 128); } /* Allow player to rearrange the party at any time by pressing LEFT */ if (PlayerInput.left) { z = select_player(); if (z > 0) { party_newlead(); } } if (PlayerInput.balt) { unpress(); switch (ptr) { case 0: camp_item_menu(); break; case 3: spec_items(); break; case 5: quest_info(); break; default: z = select_player(); if (z >= 0) { switch (ptr) { case 1: camp_spell_menu(z); break; case 2: equip_menu(z); break; case 4: status_screen(z); break; } } break; } } if (PlayerInput.bctrl) { unpress(); stop = 1; } if (close_menu == 1) { close_menu = 0; stop = 1; } } }