/* Returns "mortal", "creature" (if allow_creature), or a more specific term. This is mostly used by immortal/unalive entities when talking to other entities. If they're talking /down/, "creature" is normally inappropriate (e.g. "laughing at cowardly creatures"). If they're merely addressing the permonst in question, "creature" is typically fine (e.g. "Hark, creature!"). Undead can be addressed as "creature"; constructs and demons won't be. */ const char * mortal_or_creature(const struct permonst *data, boolean allow_creature) { if (data->mlet == S_HUMAN) return "mortal"; else if (allow_creature && (!nonliving(data) || is_undead(data)) && !is_demon(data)) return "creature"; else if (!nonliving(data) && !is_demon(data)) return "mortal"; else if (is_demon(data) || monsndx(data) == PM_MANES) return "demon"; else if (nonliving(data) && !is_undead(data)) return "construct"; /* golems and vortices */ else if (data->mlet == S_LICH) return "lich"; else if (data->mlet == S_MUMMY) return "mummy"; else if (data->mlet == S_VAMPIRE) return "vampire"; else if (data->mlet == S_ZOMBIE && monsndx(data) != PM_GHOUL && monsndx(data) != PM_SKELETON) return "zombie"; else return data->mname; }
/* cure&cause check */ bool check_undead(CHAR_DATA *ch, CHAR_DATA *victim, int type, int spell) { if ( !is_undead(victim)) return FALSE; return TRUE; }
/* specjalne sprawdzanie affectow z zaklec*/ bool check_hold(CHAR_DATA *ch, CHAR_DATA *victim, int type, int spell) { sh_int sn; if( type < 0 || type > MAX_SPELL_INFO ) return FALSE; sn = si_spell_info[type][spell].sn; //zeby nie wrzucac holda na wardancerow i berserkierow if( IS_AFFECTED( victim, AFF_FREE_ACTION )) return TRUE; if( check_affect( ch, victim, type, spell) ) return TRUE; if( sn == gsn_holdevil ) return !IS_EVIL(victim); else if( sn == gsn_holdperson ) return !IS_SET(race_table[GET_RACE(victim)].type, PERSON); else if ( sn == gsn_holdmonster ) return !IS_SET(race_table[GET_RACE(victim)].type, MONSTER); else if ( sn == gsn_holdplant ) return !IS_SET(race_table[GET_RACE(victim)].type, PLANT); else if ( sn == gsn_holdanimal ) return !IS_SET(race_table[GET_RACE(victim)].type, ANIMAL); else return !is_undead(victim); return FALSE; }
/* returns TRUE if monster is drain-life resistant */ boolean resists_drli(struct monst *mon) { const struct permonst *ptr = mon->data; struct obj *wep = ((mon == &youmonst) ? uwep : MON_WEP(mon)); return (boolean)(is_undead(ptr) || is_demon(ptr) || is_were(ptr) || ptr == &mons[PM_DEATH] || (wep && wep->oartifact && defends(AD_DRLI, wep))); }
//unholy fury bool check_unholy(CHAR_DATA *ch, CHAR_DATA *victim, int type, int spell) { //TRUE to znaczy ze spela nie rzuci if ( is_affected(victim, gsn_unholy_fury) ) return TRUE; if ( !is_undead(victim) || ch == victim ) return TRUE; return FALSE; }
void die() { object killer,*inv,item,mazeobj; int count,finished; string name; //death_msg if(query("death_msg")) message_vision(query("death_msg"),this_object()); else message_vision("\n$NËÀÁË¡£\n\n",this_object()); //check quest killer = query_last_damage_from(); if(killer && userp(killer)) { mazeobj = MAZE_D->query_maze_mainobj(this_object()); if(!mazeobj) mazeobj = MAZE_D->query_maze_mainobj(killer); if(mazeobj->query("quest/to_kill/"+name())) { count = mazeobj->query("quest/to_kill/"+name()); finished = mazeobj->query("quest/killed/"+name()); finished++; if(finished>count) finished = count; mazeobj->set("quest/killed/"+name(),finished); tell_object(killer,HIW"ɱËÀ "+name()+": "+finished+"/"+count+"¡£\n"NOR); } //µÚ6¸öÈÎÎñ£¬ÊØÎÀ¶¡Ò»£¬É±¶þÊ®¸öÍöÁé if(mazeobj->query("quest/quest_index")==6 && is_undead() && environment() && environment()->query("short")==HIY"¾ÛÁé·¨Õó"NOR) { count = mazeobj->query("quest/to_kill/ÍöÁé"); if(count>0) { finished = mazeobj->query("quest/killed/ÍöÁé"); finished++; if(finished>count) finished = count; mazeobj->set("quest/killed/ÍöÁé",finished); tell_object(killer,HIW"³¬¶È ÍöÁé: "+finished+"/"+count+" ¡£\n"NOR); } } } //put all thing to ground inv = all_inventory(this_object()); foreach(item in inv) { if(item) item->move(environment()); } ::die(); }
void dosounds(void) { struct mkroom *sroom; int hallu, vx, vy; struct monst *mtmp; if (!canhear() || Engulfed || Underwater) return; hallu = Hallucination ? 1 : 0; if (has_terrain(level, FOUNTAIN) && !rn2(400)) { static const char *const fountain_msg[4] = { "bubbling water.", "water falling on coins.", "the splashing of a naiad.", "a soda fountain!", }; You_hear("%s", fountain_msg[rn2(3) + hallu]); } if (has_terrain(level, SINK) && !rn2(300)) { static const char *const sink_msg[3] = { "a slow drip.", "a gurgling noise.", "dishes being washed!", }; You_hear("%s", sink_msg[rn2(2) + hallu]); } if (search_special(level, COURT) && !rn2(200)) { static const char *const throne_msg[4] = { "the tones of courtly conversation.", "a sceptre pounded in judgment.", "Someone shouts \"Off with %s head!\"", "Queen Beruthiel's cats!", }; for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if ((mtmp->msleeping || is_lord(mtmp->data) || is_prince(mtmp->data)) && !is_animal(mtmp->data) && mon_in_room(mtmp, COURT)) { /* finding one is enough, at least for now */ int which = rn2(3) + hallu; if (which != 2) You_hear("%s", throne_msg[which]); else pline(throne_msg[2], uhis()); return; } } } if (search_special(level, SWAMP) && !rn2(200)) { static const char *const swamp_msg[3] = { "You hear mosquitoes!", "You smell marsh gas!", /* so it's a smell... */ "You hear Donald Duck!", }; pline("%s", swamp_msg[rn2(2) + hallu]); return; } if ((sroom = search_special(level, VAULT)) && !rn2(200)) { if (gd_sound()) switch (rn2(2) + hallu) { case 1:{ boolean gold_in_vault = FALSE; for (vx = sroom->lx; vx <= sroom->hx; vx++) for (vy = sroom->ly; vy <= sroom->hy; vy++) if (gold_at(level, vx, vy)) gold_in_vault = TRUE; if (vault_occupied(u.urooms) != (ROOM_INDEX(sroom) + ROOMOFFSET)) { if (gold_in_vault) You_hear(!hallu ? "someone counting money." : "the quarterback calling the play."); else You_hear("someone searching."); break; } /* fall into... (yes, even for hallucination) */ } case 0: You_hear("the footsteps of a guard on patrol."); break; case 2: You_hear("Ebenezer Scrooge!"); break; } return; } if (search_special(level, BEEHIVE) && !rn2(200)) { for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if ((mtmp->data->mlet == S_ANT && is_flyer(mtmp->data)) && mon_in_room(mtmp, BEEHIVE)) { switch (rn2(2) + hallu) { case 0: You_hear("a low buzzing."); break; case 1: You_hear("an angry drone."); break; case 2: You_hear("bees in your %sbonnet!", uarmh ? "" : "(nonexistent) "); break; } return; } } } if (search_special(level, MORGUE) && !rn2(200)) { for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if (is_undead(mtmp->data) && mon_in_room(mtmp, MORGUE)) { switch (rn2(2) + hallu) { case 1: if (!strcmp(body_part(HAIR), "hair")) { pline("The %s on the back of your %s stands up.", body_part(HAIR), body_part(NECK)); break; } /* fall through */ case 2: if (!strcmp(body_part(HAIR), "hair")) { pline("The %s on your %s seems to stand up.", body_part(HAIR), body_part(HEAD)); break; } /* fall through */ case 0: pline("You suddenly realize it is unnaturally quiet."); break; } return; } } } if (search_special(level, BARRACKS) && !rn2(200)) { static const char *const barracks_msg[4] = { "blades being honed.", "loud snoring.", "dice being thrown.", "General MacArthur!", }; int count = 0; for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if (is_mercenary(mtmp->data) && mon_in_room(mtmp, BARRACKS) && /* sleeping implies not-yet-disturbed (usually) */ (mtmp->msleeping || ++count > 5)) { You_hear("%s", barracks_msg[rn2(3) + hallu]); return; } } } if (search_special(level, ZOO) && !rn2(200)) { static const char *const zoo_msg[3] = { "a sound reminiscent of an elephant stepping on a peanut.", "a sound reminiscent of a seal barking.", "Doctor Dolittle!", }; for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if ((mtmp->msleeping || is_animal(mtmp->data)) && mon_in_room(mtmp, ZOO)) { You_hear("%s", zoo_msg[rn2(2) + hallu]); return; } } } if ((sroom = search_special(level, ANY_SHOP)) && !rn2(200)) { if (tended_shop(sroom) && !strchr(u.ushops, ROOM_INDEX(sroom) + ROOMOFFSET)) { static const char *const shop_msg[3] = { "someone cursing shoplifters.", "the chime of a cash register.", "Neiman and Marcus arguing!", }; You_hear("%s", shop_msg[rn2(2) + hallu]); } return; } if (search_special(level, DELPHI) && !rn2(400)) { /* make sure the Oracle is still here */ for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) if (!DEADMONSTER(mtmp) && mtmp->data == &mons[PM_POTTER]) break; /* and don't produce silly effects when he's clearly visible */ if (mtmp && (hallu || !canseemon(mtmp))) { static const char *const ora_msg[5] = { "political commentary.", "convulsive ravings about WLAN controllers.", "an Adirondack woodsman.", "someone ask you for your punchcards.", /* if(hallucinating) */ "loud praise for Netgear devices." /* if(hallucinating) */ }; You_hear("%s", ora_msg[rn2(3) + hallu * 2]); } return; } }
void dosounds(void) { struct mkroom *sroom; int hallu, vx, vy; struct monst *mtmp; if (!flags.soundok || u.uswallow || Underwater) return; if (level->sounds && !rn2(level->sounds->freq)) { int idx = rn2(level->sounds->n_sounds); char *buf; struct lvl_sound_bite *snd = &level->sounds->sounds[idx]; buf = string_subst(snd->msg); switch (snd->flags) { default: case LVLSND_HEARD: You_hear(buf); break; case LVLSND_PLINED: pline(buf); break; case LVLSND_VERBAL: verbalize(buf); break; case LVLSND_FELT: pline("You feel %s", buf); break; } } hallu = Hallucination ? 1 : 0; if (level->flags.nfountains && !rn2(400)) { static const char * const fountain_msg[4] = { "bubbling water.", "water falling on coins.", "the splashing of a naiad.", "a soda fountain!", }; You_hear(fountain_msg[rn2(3)+hallu]); } if (level->flags.nsinks && !rn2(300)) { static const char * const sink_msg[3] = { "a slow drip.", "a gurgling noise.", "dishes being washed!", }; You_hear(sink_msg[rn2(2)+hallu]); } if (level->flags.has_court && !rn2(200)) { static const char * const throne_msg[4] = { "the tones of courtly conversation.", "a sceptre pounded in judgment.", "Someone shouts \"Off with %s head!\"", "Queen Beruthiel's cats!", }; for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if ((mtmp->msleeping || is_lord(mtmp->data) || is_prince(mtmp->data)) && !is_animal(mtmp->data) && mon_in_room(mtmp, COURT)) { /* finding one is enough, at least for now */ int which = rn2(3)+hallu; if (which != 2) You_hear(throne_msg[which]); else pline(throne_msg[2], uhis()); return; } } } if (level->flags.has_garden && !rn2(200)) { static const char * const garden_msg[4] = { "crickets chirping.", "birds singing.", "grass growing!", "wind in the willows!", }; You_hear(garden_msg[rn2(2) + 2 * hallu]); return; } if (level->flags.has_swamp && !rn2(200)) { static const char * const swamp_msg[3] = { "You hear mosquitoes!", "You smell marsh gas!", /* so it's a smell...*/ "You hear Donald Duck!", }; pline(swamp_msg[rn2(2)+hallu]); return; } if (level->flags.has_vault && !rn2(200)) { if (!(sroom = search_special(level, VAULT))) { /* strange ... */ level->flags.has_vault = 0; return; } if (gd_sound()) switch (rn2(2)+hallu) { case 1: { boolean gold_in_vault = FALSE; for (vx = sroom->lx;vx <= sroom->hx; vx++) for (vy = sroom->ly; vy <= sroom->hy; vy++) if (gold_at(level, vx, vy)) gold_in_vault = TRUE; if (vault_occupied(u.urooms) != (ROOM_INDEX(sroom) + ROOMOFFSET)) { if (gold_in_vault) You_hear(!hallu ? "someone counting money." : "the quarterback calling the play."); else You_hear("someone searching."); break; } /* fall into... (yes, even for hallucination) */ } case 0: You_hear("the footsteps of a guard on patrol."); break; case 2: You_hear("Ebenezer Scrooge!"); break; } return; } if (level->flags.has_beehive && !rn2(200)) { for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if ((mtmp->data->mlet == S_ANT && is_flyer(mtmp->data)) && mon_in_room(mtmp, BEEHIVE)) { switch (rn2(2)+hallu) { case 0: You_hear("a low buzzing."); break; case 1: You_hear("an angry drone."); break; case 2: You_hear("bees in your %sbonnet!", uarmh ? "" : "(nonexistent) "); break; } return; } } } if (level->flags.has_lemurepit && !rn2(20)) { for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if (mtmp->data == &mons[PM_LEMURE] && mon_in_room(mtmp, LEMUREPIT)) { if (hallu) { switch (rn2(3)) { case 0: You_hear("screams of lust!"); break; case 1: You_hear("the crack of your mistress's whip!"); break; case 2: You_hear("a weeping willow!"); break; } } else { switch (rn2(6)) { case 0: You_hear("the crack of a barbed whip!"); break; case 1: You_hear("the screams of tortured souls!"); break; case 2: You_hear("a wail of eternal anguish!"); break; case 3: You_hear("diabolical laughter!"); break; case 4: You_hear("cries of repentance!"); break; case 5: You_hear("futile pleas for mercy!"); break; } } return; } } } if (level->flags.has_morgue && !rn2(200)) { for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if (is_undead(mtmp->data) && mon_in_room(mtmp, MORGUE)) { switch (rn2(2)+hallu) { case 1: if (!strcmp(body_part(HAIR), "hair")) { pline("The %s on the back of your %s stands up.", body_part(HAIR), body_part(NECK)); break; } /* fall through */ case 2: if (!strcmp(body_part(HAIR), "hair")) { pline("The %s on your %s seems to stand up.", body_part(HAIR), body_part(HEAD)); break; } /* fall through */ case 0: pline("You suddenly realize it is unnaturally quiet."); break; } return; } } } if (level->flags.has_barracks && !rn2(200)) { static const char * const barracks_msg[4] = { "blades being honed.", "loud snoring.", "dice being thrown.", "General MacArthur!", }; int count = 0; for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if (is_mercenary(mtmp->data) && mon_in_room(mtmp, BARRACKS) && /* sleeping implies not-yet-disturbed (usually) */ (mtmp->msleeping || ++count > 5)) { You_hear(barracks_msg[rn2(3)+hallu]); return; } } } if (level->flags.has_zoo && !rn2(200)) { static const char * const zoo_msg[3] = { "a sound reminiscent of an elephant stepping on a peanut.", "a sound reminiscent of a seal barking.", "Doctor Dolittle!", }; for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if ((mtmp->msleeping || is_animal(mtmp->data)) && mon_in_room(mtmp, ZOO)) { You_hear(zoo_msg[rn2(2)+hallu]); return; } } } if (level->flags.has_shop && !rn2(200)) { if (!(sroom = search_special(level, ANY_SHOP))) { /* strange... */ level->flags.has_shop = 0; return; } if (tended_shop(sroom) && !strchr(u.ushops, ROOM_INDEX(sroom) + ROOMOFFSET)) { static const char * const shop_msg[3] = { "someone cursing shoplifters.", "the chime of a cash register.", "Neiman and Marcus arguing!", }; You_hear(shop_msg[rn2(2)+hallu]); } return; } if (Is_oracle_level(&u.uz) && !rn2(400)) { /* make sure the Oracle is still here */ for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) if (!DEADMONSTER(mtmp) && mtmp->data == &mons[PM_ORACLE]) break; /* and don't produce silly effects when she's clearly visible */ if (mtmp && (hallu || !canseemon(level, mtmp))) { static const char * const ora_msg[5] = { "a strange wind.", /* Jupiter at Dodona */ "convulsive ravings.", /* Apollo at Delphi */ "snoring snakes.", /* AEsculapius at Epidaurus */ "someone say \"No more woodchucks!\"", "a loud ZOT!" /* both rec.humor.oracle */ }; You_hear(ora_msg[rn2(3)+hallu*2]); } return; } if (!Is_blackmarket(&u.uz) && at_dgn_entrance(&u.uz, "One-eyed Sam's Market") && !rn2(200)) { static const char *blkmar_msg[3] = { "You hear someone complaining about the prices.", "Somebody whispers: \"Food rations? Only 900 zorkmids.\"", "You feel like searching for more gold.", }; pline(blkmar_msg[rn2(2)+hallu]); } }
/* special effects for The Book of the Dead */ void deadbook(struct obj *book2, boolean invoked) { struct monst *mtmp, *mtmp2; coord mm; if (!invoked) pline("You turn the pages of the Book of the Dead..."); makeknown(SPE_BOOK_OF_THE_DEAD); /* KMH -- Need ->known to avoid "_a_ Book of the Dead" */ book2->known = 1; if (invocation_pos(&u.uz, u.ux, u.uy) && !On_stairs(u.ux, u.uy)) { struct obj *otmp; boolean arti1_primed = FALSE, arti2_primed = FALSE, arti_cursed = FALSE; if (invoked) { if (Blind) You_hear("a crisp flicker..."); else pline("The Book of the Dead opens of its own accord..."); } if (book2->cursed) { if (invoked) { if (Hallucination) You_hear("gratuitous bleeping."); else You_hear("a mumbled curse."); } else pline("The runes appear scrambled. You can't read them!"); return; } if (!Uhave_bell || !Uhave_menorah) { pline("A chill runs down your %s.", body_part(SPINE)); if (!Uhave_bell) { if (Hallucination) pline("You feel like a tuning fork!"); else You_hear("a faint chime..."); } if (!Uhave_menorah) { if (Hallucination) { pline("Nosferatu giggles."); } else if (mvitals[PM_DOPPELGANGER].mvflags & G_GENOD) { /* suggestion by b_jonas: can't talk about doppelgangers if they don't exist */ if (Uhave_bell) pline("Nothing seems to happen."); /* otherwise no message, we already printed one. */ } else { pline("Vlad's doppelganger is amused."); } } return; } for (otmp = invent; otmp; otmp = otmp->nobj) { if (otmp->otyp == CANDELABRUM_OF_INVOCATION && otmp->spe == 7 && otmp->lamplit) { if (!otmp->cursed) arti1_primed = TRUE; else arti_cursed = TRUE; } if (otmp->otyp == BELL_OF_OPENING && (moves - otmp->age) < 5L) { /* you rang it recently */ if (!otmp->cursed) arti2_primed = TRUE; else arti_cursed = TRUE; } } if (arti_cursed) { pline("The invocation fails!"); if (Hallucination) pline("At least one of your heirlooms is in a tizzy!"); else pline("At least one of your artifacts is cursed..."); } else if (arti1_primed && arti2_primed) { unsigned soon = (unsigned)dice(2, 6); /* time til next intervene */ /* successful invocation */ mkinvokearea(); u.uevent.invoked = 1; historic_event(FALSE, TRUE, "performed the invocation."); /* in case you haven't killed the Wizard yet, behave as if you just did */ u.uevent.udemigod = 1; /* wizdead() */ if (!u.udg_cnt || u.udg_cnt > soon) u.udg_cnt = soon; } else { /* at least one artifact not prepared properly */ pline("You have a feeling that something is amiss..."); goto raise_dead; } return; } /* when not an invocation situation */ if (invoked) { pline("Nothing happens."); return; } if (book2->cursed) { raise_dead: if (Hallucination) You_hear("Michael Jackson dancing!"); else pline("You raised the dead!"); /* first maybe place a dangerous adversary; don't bother with MM_CREATEMONSTER, that's mostly used to ensure that consistent species of monsters generate */ if (!rn2(3) && ((mtmp = makemon(&mons[PM_MASTER_LICH], level, u.ux, u.uy, NO_MINVENT)) != 0 || (mtmp = makemon(&mons[PM_NALFESHNEE], level, u.ux, u.uy, NO_MINVENT)) != 0)) { msethostility(mtmp, TRUE, TRUE); } /* next handle the effect on things you're carrying */ unturn_dead(&youmonst); /* last place some monsters around you */ mm.x = u.ux; mm.y = u.uy; mkundead(level, &mm, TRUE, NO_MINVENT); } else if (book2->blessed) { for (mtmp = level->monlist; mtmp; mtmp = mtmp2) { mtmp2 = mtmp->nmon; /* tamedog() changes chain */ if (DEADMONSTER(mtmp)) continue; if (is_undead(mtmp->data) && cansee(mtmp->mx, mtmp->my)) { msethostility(mtmp, FALSE, FALSE); /* TODO: reset alignment? */ if (sgn(mtmp->data->maligntyp) == sgn(u.ualign.type) && distu(mtmp->mx, mtmp->my) < 4) if (mtmp->mtame) { if (mtmp->mtame < 20) mtmp->mtame++; } else tamedog(mtmp, NULL); else monflee(mtmp, 0, FALSE, TRUE); } } } else { switch (rn2(3)) { case 0: pline("Your ancestors are annoyed with you!"); break; case 1: pline("The headstones in the cemetery begin to move!"); break; default: pline("Oh my! Your name appears in the book!"); } } return; }
/* fungi will eat even tainted food */ int dogfood(const struct monst *mon, struct obj *obj) { boolean carni = carnivorous(mon->data); boolean herbi = herbivorous(mon->data); const struct permonst *fptr = &mons[obj->corpsenm]; boolean starving; if (is_quest_artifact(obj) || obj_resists(obj, 0, 95)) return obj->cursed ? TABU : APPORT; switch (obj->oclass) { case FOOD_CLASS: if (obj->otyp == CORPSE && ((touch_petrifies(&mons[obj->corpsenm]) && !resists_ston(mon)) || is_rider(fptr))) return TABU; /* Ghouls only eat old corpses... yum! */ if (mon->data == &mons[PM_GHOUL]) return (obj->otyp == CORPSE && peek_at_iced_corpse_age(obj) + 50L <= moves) ? DOGFOOD : TABU; if (!carni && !herbi) return obj->cursed ? UNDEF : APPORT; /* a starving pet will eat almost anything */ starving = (mon->mtame && !mon->isminion && CONST_EDOG(mon)->mhpmax_penalty); switch (obj->otyp) { case TRIPE_RATION: case MEATBALL: case MEAT_RING: case MEAT_STICK: case HUGE_CHUNK_OF_MEAT: return carni ? DOGFOOD : MANFOOD; case EGG: if (touch_petrifies(&mons[obj->corpsenm]) && !resists_ston(mon)) return POISON; return carni ? CADAVER : MANFOOD; case CORPSE: if ((peek_at_iced_corpse_age(obj) + 50L <= moves && obj->corpsenm != PM_LIZARD && obj->corpsenm != PM_LICHEN && mon->data->mlet != S_FUNGUS) || (acidic(&mons[obj->corpsenm]) && !resists_acid(mon)) || (poisonous(&mons[obj->corpsenm]) && !resists_poison(mon))) return POISON; else if (vegan(fptr)) return herbi ? CADAVER : MANFOOD; else return carni ? CADAVER : MANFOOD; case CLOVE_OF_GARLIC: return (is_undead(mon->data) ? TABU : ((herbi || starving) ? ACCFOOD : MANFOOD)); case TIN: return metallivorous(mon->data) ? ACCFOOD : MANFOOD; case APPLE: case CARROT: return herbi ? DOGFOOD : starving ? ACCFOOD : MANFOOD; case BANANA: return ((mon->data->mlet == S_YETI) ? DOGFOOD : ((herbi || starving) ? ACCFOOD : MANFOOD)); case K_RATION: case C_RATION: case CRAM_RATION: case LEMBAS_WAFER: case FOOD_RATION: if (is_human(mon->data) || is_elf(mon->data) || is_dwarf(mon->data) || is_gnome(mon->data) || is_orc(mon->data)) return ACCFOOD; default: if (starving) return ACCFOOD; return (obj->otyp > SLIME_MOLD ? (carni ? ACCFOOD : MANFOOD) : (herbi ? ACCFOOD : MANFOOD)); } default: if (obj->otyp == AMULET_OF_STRANGULATION || obj->otyp == RIN_SLOW_DIGESTION) return TABU; if (hates_silver(mon->data) && objects[obj->otyp].oc_material == SILVER) return TABU; if (mon->data == &mons[PM_GELATINOUS_CUBE] && is_organic(obj)) return ACCFOOD; if (metallivorous(mon->data) && is_metallic(obj) && (is_rustprone(obj) || mon->data != &mons[PM_RUST_MONSTER])) { /* Non-rustproofed ferrous based metals are preferred. */ return (is_rustprone(obj) && !obj->oerodeproof) ? DOGFOOD : ACCFOOD; } if (!obj->cursed && obj->oclass != BALL_CLASS && obj->oclass != CHAIN_CLASS) return APPORT; /* fall into next case */ case ROCK_CLASS: return UNDEF; } }
void sound_effect( void *vo, int level, int dam, int target ) { if ( target == TARGET_CHAR ) { CHAR_DATA * victim = ( CHAR_DATA * ) vo; OBJ_DATA *obj, *obj_next; AFFECT_DATA af; if ( !victim->in_room ) return ; /* jesli ma uszy moze ogluchnac */ if ( IS_SET( race_table[ GET_RACE( victim ) ].parts, PART_EAR ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MAGICAL ) && !is_undead( victim ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_CONSTRUCT ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MIST ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_BLOB ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_DRAGON ) && !IS_AFFECTED( victim, AFF_DEAFNESS ) && !IS_AFFECTED( victim, AFF_PERFECT_SENSES ) ) { if ( number_percent() < dam - victim->resists[RESIST_SOUND] ) { af.where = TO_AFFECTS; af.type = 169; af.level = level; af.duration = 3; af.rt_duration = 0; af.location = APPLY_NONE; af.modifier = 0; af.bitvector = &AFF_DEAFNESS; affect_to_char( victim, &af, NULL, TRUE ); send_to_char( "Ból w uszach potêguje siê coraz bardziej, a g³osy wokó³ ciebie nagle milkn±.\n\r", victim ); act( "Z uszu $z wyp³ywa stru¿ka krwi.", victim, NULL, NULL, TO_ROOM ); } } if ( is_affected(victim, gsn_mirrorfall) ) { affect_strip(victim, gsn_mirrorfall); return; } for ( obj = victim->carrying; obj != NULL; obj = obj_next ) { OBJ_NEXT_CONTENT( obj, obj_next ); sound_effect( obj, level, dam, TARGET_OBJ ); } return ; } else if ( target == TARGET_OBJ ) { OBJ_DATA * obj = ( OBJ_DATA * ) vo; OBJ_DATA *t_obj, *n_obj; /* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */ //2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow! /*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 ) return;*/ if ( !check_item_resist( obj, RESIST_SOUND, dam+level ) ) return; if ( obj->carried_by != NULL ) { if( obj->liczba_mnoga) act( "$p rozpryskuj± siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL ); else act( "$p rozpryskuje siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL ); } else if ( obj->in_room != NULL && obj->in_room->people != NULL ) { if( obj->liczba_mnoga) act( "$p rozpryskuj± siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL ); else act( "$p rozpryskuje siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL ); } if ( obj->contains ) { for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj ) { n_obj = t_obj->next_content; obj_from_obj( t_obj ); if ( obj->in_room != NULL ) obj_to_room( t_obj, obj->in_room ); else if ( obj->carried_by != NULL ) obj_to_room( t_obj, obj->carried_by->in_room ); else { /*artefact*/ if ( is_artefact( t_obj ) ) extract_artefact( t_obj ); if ( obj->contains ) extract_artefact_container( obj ); extract_obj( t_obj ); continue; } shock_effect( t_obj, level / 2, dam / 2, TARGET_OBJ ); } } /*artefact*/ if ( is_artefact( obj ) ) extract_artefact( obj ); if ( obj->contains ) extract_artefact_container( obj ); extract_obj( obj ); return ; } else if ( target == TARGET_ROOM ) { ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo; OBJ_DATA *obj, *obj_next; for ( obj = room->contents; obj != NULL; obj = obj_next ) { OBJ_NEXT_CONTENT( obj, obj_next ); sound_effect( obj, level, dam, TARGET_OBJ ); } return ; } return; }
void shock_effect( void *vo, int level, int dam, int target ) { if ( target == TARGET_ROOM ) { ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo; OBJ_DATA *obj, *obj_next; for ( obj = room->contents; obj != NULL; obj = obj_next ) { OBJ_NEXT_CONTENT( obj, obj_next ); if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) ) continue; shock_effect( obj, level, dam, TARGET_OBJ ); } return ; } else if ( target == TARGET_CHAR ) { CHAR_DATA * victim = ( CHAR_DATA * ) vo; OBJ_DATA *obj, *obj_next; if ( !victim->in_room ) return ; /* jesli ma mozg znaczy siê mozna zszkokowac */ if ( IS_SET( race_table[ GET_RACE( victim ) ].parts, PART_BRAINS ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MAGICAL ) && !is_undead( victim ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_CONSTRUCT ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MIST ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_BLOB ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_DRAGON ) ) { int chance_of_knockout = 0; if ( IS_SET( race_table[ GET_RACE( victim ) ].type, PERSON ) ) chance_of_knockout = 10 + dam/10 + level/10; else if ( IS_SET( race_table[ GET_RACE( victim ) ].type, ANIMAL ) ) chance_of_knockout = 5 + dam/11.5 + level/11.5; else if ( IS_SET( race_table[ GET_RACE( victim ) ].type, MONSTER ) ) chance_of_knockout = 3 + dam/13 + level/13; if ( chance_of_knockout > 0 && number_percent() < chance_of_knockout && !IS_AFFECTED(victim,AFF_STABILITY) ) { /* wait */ WAIT_STATE( victim, URANGE( 12, dam/3, 36 ) ); /* stoi badz walczy? no to hop na glebe */ if ( victim->position == POS_STANDING || victim->position == POS_FIGHTING ) { if ( victim->sex == 0 ) { send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomne na ziemie.\n\r", victim ); act( "$n osuwa siê polprzytomne na ziemie.", victim, NULL, NULL, TO_ROOM ); } else if ( victim->sex == 1 ) { send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomny na ziemie.\n\r", victim ); act( "$n osuwa siê polprzytomny na ziemie.", victim, NULL, NULL, TO_ROOM ); } else { send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomna na ziemie.\n\r", victim ); act( "$n osuwa siê polprzytomna na ziemie.", victim, NULL, NULL, TO_ROOM ); } victim->position = POS_SITTING; } /* lezy, siedzi, restuje, umiera etc? no to niech dalej umiera */ else { send_to_char( "Tracisz kontrolê nad swoim cia³em.\n\r", victim ); act( "Cia³o $z wyprê¿a siê i wiotczeje pod wp³ywem potê¿nego wy³adowania.", victim, NULL, NULL, TO_ROOM ); } } } if ( is_affected(victim, gsn_mirrorfall) ) { affect_strip(victim, gsn_mirrorfall); return; } /* toast some gear */ for ( obj = victim->carrying; obj != NULL; obj = obj_next ) { OBJ_NEXT_CONTENT( obj, obj_next ); shock_effect( obj, level, dam, TARGET_OBJ ); } return ; } if ( target == TARGET_OBJ ) { OBJ_DATA * obj = ( OBJ_DATA * ) vo; OBJ_DATA *t_obj, *n_obj; char *msg; /* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */ //2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow! /*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 ) return;*/ if ( obj->item_type != ITEM_WAND && obj->item_type != ITEM_STAFF && obj->item_type != ITEM_JEWELRY ) return; if ( !check_item_resist( obj, RESIST_ELECTRICITY, dam ) ) return ; if(obj->liczba_mnoga) { switch ( obj->item_type ) { default: return ; case ITEM_WAND: case ITEM_STAFF: msg = "$p rozb³yskuj± i po chwili eksploduj±!"; break; case ITEM_JEWELRY: msg = "$p stapiaj± siê w bezwarto¶ciow± bry³kê."; } } else { switch ( obj->item_type ) { default: return ; case ITEM_WAND: case ITEM_STAFF: msg = "$p rozb³yskuje i po chwili eksploduje!"; break; case ITEM_JEWELRY: msg = "$p stapia siê w bezwarto¶ciow± bry³kê."; } } if ( obj->carried_by != NULL ) act( msg, obj->carried_by, obj, NULL, TO_ALL ); else if ( obj->in_room != NULL && obj->in_room->people != NULL ) act( msg, obj->in_room->people, obj, NULL, TO_ALL ); /* get rid of the object */ if ( obj->contains ) /* dump contents */ { for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj ) { n_obj = t_obj->next_content; obj_from_obj( t_obj ); if ( obj->in_room != NULL ) obj_to_room( t_obj, obj->in_room ); else if ( obj->carried_by != NULL ) obj_to_room( t_obj, obj->carried_by->in_room ); else { /*artefact*/ if ( is_artefact( t_obj ) ) extract_artefact( t_obj ); if ( obj->contains ) extract_artefact_container( obj ); extract_obj( t_obj ); continue; } shock_effect( t_obj, level / 2, dam / 2, TARGET_OBJ ); } } /*artefact*/ if ( is_artefact( obj ) ) extract_artefact( obj ); if ( obj->contains ) extract_artefact_container( obj ); extract_obj( obj ); return ; } }
int scan_room( CHAR_DATA *ch, const ROOM_INDEX_DATA *room, char *buf, int distance ) { CHAR_DATA *target = room->people; int number_found = 0; AFFECT_DATA *dazzling; if ( EXT_IS_SET( room->room_flags, ROOM_MAGICDARK ) ) { return -1; } while ( target ) { if ( !IS_NPC( target ) && target->invis_level > get_trust( ch ) ) { target = target->next_in_room; continue; } if ( target == ch && ( IS_NPC( ch ) || ( !IS_NPC( ch ) && !ch->pcdata->mind_in ) ) ) { target = target->next_in_room; continue; } if ( can_see( ch, target ) ) { strcat ( buf, " " ); if ( ( IS_NPC(target) || target->ss_data ) && !is_affected(target, gsn_fetch) ) { strcat ( buf, "{y"); strcat ( buf, capitalize(target->short_descr) ); strcat ( buf, "{x{c"); } else { strcat ( buf, "{Y"); strcat ( buf, capitalize(target->name) ); strcat ( buf, "{x{c"); } if ( IS_AFFECTED( target, AFF_INVISIBLE ) ) strcat( buf, " (niewidzialny)" ); else if( is_affected( ch, gsn_dazzling_flash) && affect_find( ch->affected, gsn_dazzling_flash)->level == 0 && is_affected( target, gsn_dazzling_flash) && !IS_AFFECTED( ch, AFF_PERFECT_SENSES) && ( !IS_AFFECTED(ch,AFF_DETECT_INVIS) || IS_AFFECTED(target,AFF_NONDETECTION)) ) { for( dazzling = target->affected ; dazzling; dazzling = dazzling->next ) { if( dazzling->level == 1 && affect_find( ch->affected, gsn_dazzling_flash)->modifier == dazzling->modifier ) strcat( buf, " (niewidzialny)" ); } } if ( IS_AFFECTED( target, AFF_HIDE ) ) { strcat( buf, " (ukryty)" ); } if (( EXT_IS_SET( target->act, ACT_AGGRESSIVE )) && IS_AFFECTED( ch, AFF_DETECT_AGGRESSIVE ) ) { if( ch->level + 10 > target->level ) { strcat( buf, " {R(agresywny){x" ); } else if ( dice(1,3) == 1 ) { strcat( buf, " {R(agresywny){x" ); } } else if ( IS_AFFECTED( ch, AFF_DETECT_AGGRESSIVE ) && ( ch->level + 10 < target->level ) ) { if ( dice(1,3) == 1 ) { strcat( buf, " {R(agresywny){x" ); } } if (( is_undead(target) ) && IS_AFFECTED( ch, AFF_DETECT_UNDEAD ) ) { if( ch->level + 10 > target->level ) { strcat( buf, " {D(nieumar³y){x" ); } else if ( dice(1,3) == 1 ) { strcat( buf, " {D(nieumar³y){x" ); } } else if ( IS_AFFECTED( ch, AFF_DETECT_UNDEAD ) && ( ch->level + 10 < target->level ) ) { if ( dice(1,3) == 1 ) { strcat( buf, " {D(nieumar³y){x" ); } } switch ( distance ) { case 0: strcat ( buf, " jest tutaj." ); break; case 1: strcat ( buf, " zaraz obok." ); break; case 2: strcat ( buf, " niedaleko." ); break; case 3: strcat ( buf, " daleko." ); break; case 4: strcat ( buf, " ca³kiem daleko." ); break; case 5: strcat ( buf, " bardzo daleko." ); break; case 6: strcat ( buf, " niesamowicie daleko." ); break; default: strcat ( buf, " dziwnie daleko." ); break; } strcat ( buf, "\n\r" ); number_found++; } target = target->next_in_room; } return number_found; }
/* * Wield or wear a single item from the pack or floor */ void do_cmd_wield(void) { int i, item, slot; object_type forge; object_type *q_ptr; object_type *o_ptr; cptr act; char o_name[MAX_NLEN]; cptr q, s; bool newrace = FALSE; /* Restrict the choices */ item_tester_hook = item_tester_hook_wear; /* Get an item */ #ifdef JP q = "どれを装備しますか? "; s = "装備可能なアイテムがない。"; #else q = "Wear/Wield which item? "; s = "You have nothing you can wear or wield."; #endif if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) { o_ptr = &inventory[item]; } /* Get the item (on the floor) */ else { o_ptr = &o_list[0 - item]; } /* Check the slot */ slot = wield_slot(o_ptr); /* Where is the item now */ if (slot == INVEN_WIELD) { #ifdef JP act = "を打撃用に装備した"; #else act = "You are wielding"; #endif } else if (slot == INVEN_BOW) { #ifdef JP act = "を射撃用に装備した"; #else act = "You are shooting with"; #endif } else if (slot == INVEN_LITE) { #ifdef JP act = "を光源にした"; #else act = "Your light source is"; #endif } else { #ifdef JP act = "を装備した"; #else act = "You are wearing"; #endif } if ((o_ptr->tval == TV_RING) && inventory[INVEN_LEFT].k_idx && inventory[INVEN_RIGHT].k_idx) { /* Restrict the choices */ item_tester_tval = TV_RING; /* Choose a ring from the equipment only */ #ifdef JP q = "どちらの指輪と取り替えますか?"; s = "おっと。"; #else q = "Replace which ring? "; s = "Oops."; #endif if (!get_item(&slot, q, s, (USE_EQUIP))) return; } if (slot == INVEN_WIELD) { if (is_two_handed()) { /* Restrict the choices */ item_tester_hook = item_tester_hook_melee_weapon; /* Choose a ring from the equipment only */ #ifdef JP q = "どちらの武器と取り替えますか?"; s = "おっと。"; #else q = "Replace which weapon? "; s = "Oops."; #endif if (!get_item(&slot, q, s, (USE_EQUIP))) return; } else if (inventory[slot].k_idx) { /* Confirm doing two handed combat */ #ifdef JP if (get_check("二刀流を行いますか?")) #else if (get_check("Do you want to do two handed combat?")) #endif { slot = INVEN_ARM; } } } /* Prevent wielding into a cursed slot */ if (cursed_p(&inventory[slot])) { /* Describe it */ object_desc(o_name, &inventory[slot], OD_OMIT_PREFIX | OD_NAME_ONLY); /* Message */ #ifdef JP msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name ); #else msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot)); #endif /* Cancel the command */ return; } if (cursed_p(o_ptr) && (object_known_p(o_ptr) || (o_ptr->ident & IDENT_SENSE))) { char dummy[512]; /* Describe it */ object_desc(o_name, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY); #ifdef JP sprintf(dummy, "本当に%s{呪われている}を使いますか?", o_name); #else sprintf(dummy, "Really use the %s {cursed}? ", o_name); #endif if (!get_check(dummy)) return; } #if 0 if ((o_ptr->name1 == ART_STONEMASK) && object_known_p(o_ptr) && (p_ptr->prace != RACE_VAMPIRE)) { char dummy[MAX_NLEN+80]; /* Describe it */ object_desc(o_name, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY); #ifdef JP sprintf(dummy, "%sを装備すると吸血鬼になります。よろしいですか?", o_name); #else msg_format("%s will transforms you into a vampire permanently when equiped.", o_name); sprintf(dummy, "Do you become a vampire?"); #endif if (!get_check(dummy)) return; } #endif /* Check if completed a quest */ for (i = 0; i < max_quests; i++) { if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) && (quest[i].status == QUEST_STATUS_TAKEN) && (quest[i].k_idx == o_ptr->name1)) { quest[i].status = QUEST_STATUS_COMPLETED; quest[i].complev = (byte)p_ptr->lev; #ifdef JP msg_print("クエストを達成した!"); #else msg_print("You completed your quest!"); #endif sound(SOUND_LEVEL); /* (Sound substitute) No quest sound */ msg_print(NULL); } } /* Take a turn */ energy_use = 100; /* Get local object */ q_ptr = &forge; /* Obtain local object */ object_copy(q_ptr, o_ptr); /* Modify quantity */ q_ptr->number = 1; /* Decrease the item (from the pack) */ if (item >= 0) { inven_item_increase(item, -1); inven_item_optimize(item); } /* Decrease the item (from the floor) */ else { floor_item_increase(0 - item, -1); floor_item_optimize(0 - item); } /* Access the wield slot */ o_ptr = &inventory[slot]; /* Take off existing item */ if (o_ptr->k_idx) { /* Take off existing item */ (void)inven_takeoff(slot, 255); } /* Wear the new stuff */ object_copy(o_ptr, q_ptr); /* Player touches it */ o_ptr->marked |= OM_TOUCHED; /* Forget stack */ o_ptr->next_o_idx = 0; /* Forget location */ o_ptr->iy = o_ptr->ix = 0; /* Increase the weight */ p_ptr->total_weight += q_ptr->weight; /* Increment the equip counter by hand */ equip_cnt++; /* Describe the result */ object_desc(o_name, o_ptr, 0); /* Message */ #ifdef JP msg_format("%s(%c)%s。", o_name, index_to_label(slot), act ); #else msg_format("%s %s (%c).", act, o_name, index_to_label(slot)); #endif sound(SOUND_WIELD); /* Cursed! */ if (cursed_p(o_ptr)) { /* Warn the player */ #ifdef JP msg_print("うわ! すさまじく冷たい!"); #else msg_print("Oops! It feels deathly cold!"); #endif sound(SOUND_CURSED); /* Note the curse */ o_ptr->ident |= (IDENT_SENSE); } #if 0 /* if you weild stonemask, you morph into vampire */ if ((o_ptr->name1 == ART_STONEMASK) && (!is_undead())) { p_ptr->prace = RACE_VAMPIRE; newrace = TRUE; #ifdef JP msg_format("あなたは吸血鬼に変化した!"); #else msg_format("You polymorphed into a vampire!"); #endif } #endif if (newrace) { rp_ptr = &race_info[p_ptr->prace]; /* Experience factor */ calc_expfact(); /* Get new height and weight */ get_ahw(FALSE); check_experience(); /* Hitdice */ p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp; do_cmd_rerate(TRUE); p_ptr->redraw |= (PR_BASIC); p_ptr->update |= (PU_BONUS); handle_stuff(); /* Load an autopick preference file */ autopick_load_pref(FALSE); lite_spot(py, px); } /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); /* Recalculate torch */ p_ptr->update |= (PU_TORCH); /* Recalculate mana */ p_ptr->update |= (PU_MANA); p_ptr->redraw |= (PR_EQUIPPY); /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_STATS); }