/* * Display the text from a note on the screen. */ void note_info_screen(const object_type *o_ptr) { /* Redirect output to the screen */ text_out_hook = text_out_to_screen; /* Save the screen */ screen_save(); /* Indent output by 14 characters, and wrap at column 60 */ text_out_wrap = 60; text_out_indent = 14; /* Note intro */ Term_gotoxy(text_out_indent, 0); text_out_c(TERM_L_WHITE+TERM_SHADE, "The note here reads:\n\n"); /* Note text */ Term_gotoxy(text_out_indent, 2); text_out_to_screen(TERM_WHITE, k_text + k_info[o_ptr->k_idx].text); /* Note outro */ text_out_c(TERM_L_WHITE+TERM_SHADE, "\n\n(press any key)\n"); /* Reset text_out() vars */ text_out_wrap = 0; text_out_indent = 0; /* Wait for input */ (void)inkey(); /* Load the screen */ screen_load(); return; }
/** * Show quiver missiles in full inventory */ static void item_menu_browser(int oid, void *data, const region *local_area) { char tmp_val[80]; int count, j, i = num_obj; int quiver_slots = (player->upkeep->quiver_cnt + z_info->quiver_slot_size - 1) / z_info->quiver_slot_size; /* Set up to output below the menu */ text_out_hook = text_out_to_screen; text_out_wrap = 0; text_out_indent = local_area->col - 1; text_out_pad = 1; prt("", local_area->row + local_area->page_rows, MAX(0, local_area->col - 1)); Term_gotoxy(local_area->col, local_area->row + local_area->page_rows); /* If we're printing pack slots the quiver takes up */ if (olist_mode & OLIST_QUIVER && player->upkeep->command_wrk == USE_INVEN) { /* Quiver may take multiple lines */ for (j = 0; j < quiver_slots; j++, i++) { const char *fmt = "in Quiver: %d missile%s\n"; char letter = I2A(i); /* Number of missiles in this "slot" */ if (j == quiver_slots - 1) count = player->upkeep->quiver_cnt - (z_info->quiver_slot_size * (quiver_slots - 1)); else count = z_info->quiver_slot_size; /* Print the (disabled) label */ strnfmt(tmp_val, sizeof(tmp_val), "%c) ", letter); text_out_c(COLOUR_SLATE, tmp_val, local_area->row + i, local_area->col); /* Print the count */ strnfmt(tmp_val, sizeof(tmp_val), fmt, count, count == 1 ? "" : "s"); text_out_c(COLOUR_L_UMBER, tmp_val, local_area->row + i, local_area->col + 3); } } /* Always print a blank line */ prt("", local_area->row + i, MAX(0, local_area->col - 1)); /* Blank out whole tiles */ while ((tile_height > 1) && ((local_area->row + i) % tile_height != 0)) { i++; prt("", local_area->row + i, MAX(0, local_area->col - 1)); } text_out_pad = 0; text_out_indent = 0; }
/** * Show specialty long description when browsing */ static void view_spec_menu_browser(int oid, void *data, const region *loc) { ability *choices = data; /* Redirect output to the screen */ text_out_hook = text_out_to_screen; text_out_wrap = 0; text_out_indent = loc->col - 1; text_out_pad = 1; clear_from(loc->row + loc->page_rows); Term_gotoxy(loc->col, loc->row + loc->page_rows); if (choices[oid].index == PF_MAX) text_out_c(TERM_L_BLUE, "\n%s\n", race_other_desc); else text_out_c(TERM_L_BLUE, "\n%s\n", (char *)choices[oid].desc); /* XXX */ text_out_pad = 0; text_out_indent = 0; }
/** * Show quiver missiles in full inventory */ static void item_menu_browser(int oid, void *data, const region *area) { char tmp_val[80]; int count, j, i = num_obj; int quiver_slots = (player->upkeep->quiver_cnt + z_info->stack_size - 1) / z_info->stack_size; /* Set up to output below the menu */ text_out_hook = text_out_to_screen; text_out_wrap = 0; text_out_indent = area->col - 1; text_out_pad = 1; prt("", area->row + area->page_rows, MAX(0, area->col - 1)); Term_gotoxy(area->col, area->row + area->page_rows); /* Quiver may take multiple lines */ for (j = 0; j < quiver_slots; j++, i++) { const char *fmt = "in Quiver: %d missile%s\n"; char letter = I2A(i); /* Number of missiles in this "slot" */ if (j == quiver_slots - 1) count = player->upkeep->quiver_cnt - (z_info->stack_size * (quiver_slots - 1)); else count = z_info->stack_size; /* Print the (disabled) label */ strnfmt(tmp_val, sizeof(tmp_val), "%c) ", letter); text_out_c(COLOUR_SLATE, tmp_val, area->row + i, area->col); /* Print the count */ strnfmt(tmp_val, sizeof(tmp_val), fmt, count, count == 1 ? "" : "s"); text_out_c(COLOUR_L_UMBER, tmp_val, area->row + i, area->col + 3); } text_out_pad = 0; text_out_indent = 0; }
/* * Header for additional information when printing to screen. * * Header for additional information when printing to screen. */ static bool screen_out_head(const object_type *o_ptr) { char *o_name; int name_size = Term->wid; bool has_description = FALSE; /* Allocate memory to the size of the screen */ o_name = C_RNEW(name_size, char); /* Description */ object_desc(o_name, name_size, o_ptr, TRUE, 3); /* Print, in colour */ text_out_c(TERM_YELLOW, format("%^s", o_name)); /* Free up the memory */ FREE(o_name); /* Display the known artefact description */ if (!adult_rand_artefacts && o_ptr->name1 && object_known_p(o_ptr) && a_info[o_ptr->name1].text) { p_text_out("\n\n "); p_text_out(a_text + a_info[o_ptr->name1].text); has_description = TRUE; } /* Display the known object description */ else if (object_aware_p(o_ptr) || object_known_p(o_ptr)) { if (k_info[o_ptr->k_idx].text) { p_text_out("\n\n "); p_text_out(k_text + k_info[o_ptr->k_idx].text); has_description = TRUE; } /* Display an additional special item description */ if (o_ptr->name2 && object_known_p(o_ptr) && e_info[o_ptr->name2].text) { p_text_out("\n\n "); p_text_out(e_text + e_info[o_ptr->name2].text); has_description = TRUE; } } return (has_description); }
/** * Show spell long description when browsing */ static void spell_menu_browser(int oid, void *data, const region * loc) { struct spell_menu_data *d = data; int spell = d->spells[oid]; const magic_type *s_ptr = &mp_ptr->info[spell]; /* Redirect output to the screen */ text_out_hook = text_out_to_screen; text_out_wrap = 0; text_out_indent = loc->col - 1; text_out_pad = 1; Term_gotoxy(loc->col, loc->row + loc->page_rows); text_out_c(TERM_DEEP_L_BLUE, format("\n%s\n", s_info[s_ptr->index].text)); /* XXX */ text_out_pad = 0; text_out_indent = 0; }
/* * Place an item description on the screen. */ void object_info_screen(const object_type *o_ptr) { bool has_description, has_info; /* Redirect output to the screen */ text_out_hook = text_out_to_screen; /* Save the screen */ screen_save(); has_description = screen_out_head(o_ptr); object_info_out_flags = object_flags_known; /* Dump the info */ new_paragraph = TRUE; has_info = object_info_out(o_ptr); new_paragraph = FALSE; if (!object_known_p(o_ptr)) { p_text_out("\n\n This item has not been identified."); } else if ((!has_description) && (!has_info)) { p_text_out("\n\n This item does not seem to possess any special abilities."); } text_out_c(TERM_L_BLUE, "\n\n(press any key)\n"); /* Wait for input */ (void)inkey(); /* Load the screen */ screen_load(); return; }
static void mon_lore(int oid) { /* Update the monster recall window */ monster_race_track(default_join[oid].oid); handle_stuff(p_ptr); /* Save the screen */ screen_save(); /* Describe */ text_out_hook = text_out_to_screen; /* Recall monster */ roff_top(default_join[oid].oid); Term_gotoxy(0, 2); describe_monster(default_join[oid].oid, FALSE); text_out_c(TERM_L_BLUE, "\n[Press any key to continue]\n"); (void) anykey(); /* Load the screen */ screen_load(); }
static void describe_monster_kills(int r_idx, const monster_lore *l_ptr) { const monster_race *r_ptr = &r_info[r_idx]; int msex = 0; bool out = TRUE; /* Extract a gender (if applicable) */ if (r_ptr->flags1 & RF1_FEMALE) msex = 2; else if (r_ptr->flags1 & RF1_MALE) msex = 1; /* Treat uniques differently */ if (l_ptr->flags1 & RF1_UNIQUE) { /* Hack -- Determine if the unique is "dead" */ bool dead = (r_ptr->max_num == 0) ? TRUE : FALSE; /* We've been killed... */ if (l_ptr->deaths) { /* Killed ancestors */ text_out(format("%^s has slain %d of your ancestors", wd_he[msex], l_ptr->deaths)); /* But we've also killed it */ if (dead) { text_out(", but you have taken revenge! "); } /* Unavenged (ever) */ else { text_out(format(", who %s unavenged. ", plural(l_ptr->deaths, "remains", "remain"))); } } /* Dead unique who never hurt us */ else if (dead) { text_out("You have slain this foe. "); } else { /* Alive and never killed us */ out = FALSE; } } /* Not unique, but killed us */ else if (l_ptr->deaths) { /* Dead ancestors */ text_out(format("%d of your ancestors %s been killed by this creature, ", l_ptr->deaths, plural(l_ptr->deaths, "has", "have"))); /* Some kills this life */ if (l_ptr->pkills) { text_out(format("and you have exterminated at least %d of the creatures. ", l_ptr->pkills)); } /* Some kills past lives */ else if (l_ptr->tkills) { text_out(format("and %s have exterminated at least %d of the creatures. ", "your ancestors", l_ptr->tkills)); } /* No kills */ else { text_out_c(TERM_RED, format("and %s is not ever known to have been defeated. ", wd_he[msex])); } } /* Normal monsters */ else { /* Killed some this life */ if (l_ptr->pkills) { text_out(format("You have killed at least %d of these creatures. ", l_ptr->pkills)); } /* Killed some last life */ else if (l_ptr->tkills) { text_out(format("Your ancestors have killed at least %d of these creatures. ", l_ptr->tkills)); } /* Killed none */ else { text_out("No battles to the death are recalled. "); } } /* Separate */ if (out) text_out("\n"); }
static void describe_monster_abilities(int r_idx, const monster_lore *l_ptr) { const monster_race *r_ptr = &r_info[r_idx]; int n; int vn; cptr vp[64]; int msex = 0; /* Extract a gender (if applicable) */ if (r_ptr->flags1 & RF1_FEMALE) msex = 2; else if (r_ptr->flags1 & RF1_MALE) msex = 1; /* Collect special abilities. */ vn = 0; if (l_ptr->flags2 & RF2_OPEN_DOOR) vp[vn++] = "open doors"; if (l_ptr->flags2 & RF2_BASH_DOOR) vp[vn++] = "bash down doors"; if (l_ptr->flags2 & RF2_PASS_WALL) vp[vn++] = "pass through walls"; if (l_ptr->flags2 & RF2_KILL_WALL) vp[vn++] = "bore through walls"; if (l_ptr->flags2 & RF2_MOVE_BODY) vp[vn++] = "push past weaker monsters"; if (l_ptr->flags2 & RF2_KILL_BODY) vp[vn++] = "destroy weaker monsters"; if (l_ptr->flags2 & RF2_TAKE_ITEM) vp[vn++] = "pick up objects"; if (l_ptr->flags2 & RF2_KILL_ITEM) vp[vn++] = "destroy objects"; /* Describe special abilities. */ if (vn) { /* Intro */ text_out(format("%^s", wd_he[msex])); /* Scan */ for (n = 0; n < vn; n++) { /* Intro */ if (n == 0) text_out(" can "); else if (n < vn-1) text_out(", "); else text_out(" and "); /* Dump */ text_out(vp[n]); } /* End */ text_out(". "); } /* Describe special abilities. */ if (l_ptr->flags2 & RF2_INVISIBLE) { text_out(format("%^s is invisible. ", wd_he[msex])); } if (l_ptr->flags2 & RF2_COLD_BLOOD) { text_out(format("%^s is cold blooded. ", wd_he[msex])); } if (l_ptr->flags2 & RF2_EMPTY_MIND) { text_out(format("%^s is not detected by telepathy. ", wd_he[msex])); } if (l_ptr->flags2 & RF2_WEIRD_MIND) { text_out(format("%^s is rarely detected by telepathy. ", wd_he[msex])); } if (l_ptr->flags2 & RF2_MULTIPLY) { text_out(format("%^s breeds explosively. ", wd_he[msex])); } if (l_ptr->flags2 & RF2_REGENERATE) { text_out(format("%^s regenerates quickly. ", wd_he[msex])); } /* Collect susceptibilities */ vn = 0; if (l_ptr->flags3 & RF3_HURT_ROCK) vp[vn++] = "rock remover"; if (l_ptr->flags3 & RF3_HURT_LITE) vp[vn++] = "bright light"; if (l_ptr->flags3 & RF3_HURT_FIRE) vp[vn++] = "fire"; if (l_ptr->flags3 & RF3_HURT_COLD) vp[vn++] = "cold"; /* Describe susceptibilities */ if (vn) { /* Intro */ text_out(format("%^s", wd_he[msex])); /* Scan */ for (n = 0; n < vn; n++) { /* Intro */ if (n == 0) text_out(" is hurt by "); else if (n < vn-1) text_out(", "); else text_out(" and "); /* Dump */ text_out_c(TERM_YELLOW, vp[n]); } /* End */ text_out(". "); } /* Collect immunities */ vn = 0; if (l_ptr->flags3 & RF3_IM_ACID) vp[vn++] = "acid"; if (l_ptr->flags3 & RF3_IM_ELEC) vp[vn++] = "lightning"; if (l_ptr->flags3 & RF3_IM_FIRE) vp[vn++] = "fire"; if (l_ptr->flags3 & RF3_IM_COLD) vp[vn++] = "cold"; if (l_ptr->flags3 & RF3_IM_POIS) vp[vn++] = "poison"; /* Describe immunities */ if (vn) { /* Intro */ text_out(format("%^s", wd_he[msex])); /* Scan */ for (n = 0; n < vn; n++) { /* Intro */ if (n == 0) text_out(" resists "); else if (n < vn-1) text_out(", "); else text_out(" and "); /* Dump */ text_out_c(TERM_ORANGE, vp[n]); } /* End */ text_out(". "); } /* Collect resistances */ vn = 0; if (l_ptr->flags3 & RF3_RES_NETH) vp[vn++] = "nether"; if (l_ptr->flags3 & RF3_RES_WATE) vp[vn++] = "water"; if (l_ptr->flags3 & RF3_RES_PLAS) vp[vn++] = "plasma"; if (l_ptr->flags3 & RF3_RES_NEXU) vp[vn++] = "nexus"; if (l_ptr->flags3 & RF3_RES_DISE) vp[vn++] = "disenchantment"; /* Describe resistances */ if (vn) { /* Intro */ text_out(format("%^s", wd_he[msex])); /* Scan */ for (n = 0; n < vn; n++) { /* Intro */ if (n == 0) text_out(" resists "); else if (n < vn-1) text_out(", "); else text_out(" and "); /* Dump */ text_out_c(TERM_ORANGE, vp[n]); } /* End */ text_out(". "); } /* Collect non-effects */ vn = 0; if (l_ptr->flags3 & RF3_NO_STUN) vp[vn++] = "stunned"; if (l_ptr->flags3 & RF3_NO_FEAR) vp[vn++] = "frightened"; if (l_ptr->flags3 & RF3_NO_CONF) vp[vn++] = "confused"; if (l_ptr->flags3 & RF3_NO_SLEEP) vp[vn++] = "slept"; /* Describe non-effects */ if (vn) { /* Intro */ text_out(format("%^s", wd_he[msex])); /* Scan */ for (n = 0; n < vn; n++) { /* Intro */ if (n == 0) text_out(" cannot be "); else if (n < vn-1) text_out(", "); else text_out(" or "); /* Dump */ text_out_c(TERM_YELLOW, vp[n]); } /* End */ text_out(". "); } /* Do we know how aware it is? */ if ((((int)l_ptr->wake * (int)l_ptr->wake) > r_ptr->sleep) || (l_ptr->ignore == MAX_UCHAR) || ((r_ptr->sleep == 0) && (l_ptr->tkills >= 10))) { cptr act; if (r_ptr->sleep > 200) { act = "prefers to ignore"; } else if (r_ptr->sleep > 95) { act = "pays very little attention to"; } else if (r_ptr->sleep > 75) { act = "pays little attention to"; } else if (r_ptr->sleep > 45) { act = "tends to overlook"; } else if (r_ptr->sleep > 25) { act = "takes quite a while to see"; } else if (r_ptr->sleep > 10) { act = "takes a while to see"; } else if (r_ptr->sleep > 5) { act = "is fairly observant of"; } else if (r_ptr->sleep > 3) { act = "is observant of"; } else if (r_ptr->sleep > 1) { act = "is very observant of"; } else if (r_ptr->sleep > 0) { act = "is vigilant for"; } else { act = "is ever vigilant for"; } text_out(format("%^s %s intruders, which %s may notice from %d feet. ", wd_he[msex], act, wd_he[msex], 10 * r_ptr->aaf)); } /* Describe escorts */ if ((l_ptr->flags1 & RF1_ESCORT) || (l_ptr->flags1 & RF1_ESCORTS)) { text_out(format("%^s usually appears with escorts. ", wd_he[msex])); } /* Describe friends */ else if ((l_ptr->flags1 & RF1_FRIEND) || (l_ptr->flags1 & RF1_FRIENDS)) { text_out(format("%^s usually appears in groups. ", wd_he[msex])); } }
static void describe_monster_attack(int r_idx, const monster_lore *l_ptr) { const monster_race *r_ptr = &r_info[r_idx]; int m, n, r; cptr p, q; int msex = 0; /* Extract a gender (if applicable) */ if (r_ptr->flags1 & RF1_FEMALE) msex = 2; else if (r_ptr->flags1 & RF1_MALE) msex = 1; /* Count the number of "known" attacks */ for (n = 0, m = 0; m < MONSTER_BLOW_MAX; m++) { /* Skip non-attacks */ if (!r_ptr->blow[m].method) continue; /* Count known attacks */ if (l_ptr->blows[m]) n++; } /* Examine (and count) the actual attacks */ for (r = 0, m = 0; m < MONSTER_BLOW_MAX; m++) { int method, effect, d1, d2; /* Skip non-attacks */ if (!r_ptr->blow[m].method) continue; /* Skip unknown attacks */ if (!l_ptr->blows[m]) continue; /* Extract the attack info */ method = r_ptr->blow[m].method; effect = r_ptr->blow[m].effect; d1 = r_ptr->blow[m].d_dice; d2 = r_ptr->blow[m].d_side; /* No method yet */ p = NULL; /* Get the method */ switch (method) { case RBM_HIT: p = "hit"; break; case RBM_TOUCH: p = "touch"; break; case RBM_PUNCH: p = "punch"; break; case RBM_KICK: p = "kick"; break; case RBM_CLAW: p = "claw"; break; case RBM_BITE: p = "bite"; break; case RBM_STING: p = "sting"; break; case RBM_XXX1: break; case RBM_BUTT: p = "butt"; break; case RBM_CRUSH: p = "crush"; break; case RBM_ENGULF: p = "engulf"; break; case RBM_XXX2: break; case RBM_CRAWL: p = "crawl on you"; break; case RBM_DROOL: p = "drool on you"; break; case RBM_SPIT: p = "spit"; break; case RBM_XXX3: break; case RBM_GAZE: p = "gaze"; break; case RBM_WAIL: p = "wail"; break; case RBM_SPORE: p = "release spores"; break; case RBM_XXX4: break; case RBM_BEG: p = "beg"; break; case RBM_INSULT: p = "insult"; break; case RBM_MOAN: p = "moan"; break; case RBM_XXX5: break; } /* Default effect */ q = NULL; /* Get the effect */ switch (effect) { case RBE_HURT: q = "attack"; break; case RBE_POISON: q = "poison"; break; case RBE_UN_BONUS: q = "disenchant"; break; case RBE_UN_POWER: q = "drain charges"; break; case RBE_EAT_GOLD: q = "steal gold"; break; case RBE_EAT_ITEM: q = "steal items"; break; case RBE_EAT_FOOD: q = "eat your food"; break; case RBE_EAT_LITE: q = "absorb light"; break; case RBE_ACID: q = "shoot acid"; break; case RBE_ELEC: q = "electrify"; break; case RBE_FIRE: q = "burn"; break; case RBE_COLD: q = "freeze"; break; case RBE_BLIND: q = "blind"; break; case RBE_CONFUSE: q = "confuse"; break; case RBE_TERRIFY: q = "terrify"; break; case RBE_PARALYZE: q = "paralyze"; break; case RBE_LOSE_STR: q = "reduce strength"; break; case RBE_LOSE_INT: q = "reduce intelligence"; break; case RBE_LOSE_WIS: q = "reduce wisdom"; break; case RBE_LOSE_DEX: q = "reduce dexterity"; break; case RBE_LOSE_CON: q = "reduce constitution"; break; case RBE_LOSE_CHR: q = "reduce charisma"; break; case RBE_LOSE_ALL: q = "reduce all stats"; break; case RBE_SHATTER: q = "shatter"; break; case RBE_EXP_10: q = "lower experience"; break; case RBE_EXP_20: q = "lower experience"; break; case RBE_EXP_40: q = "lower experience"; break; case RBE_EXP_80: q = "lower experience"; break; case RBE_HALLU: q = "cause hallucinations"; break; } /* Introduce the attack description */ if (!r) { text_out(format("%^s can ", wd_he[msex])); } else if (r < n-1) { text_out(", "); } else { text_out(", and "); } /* Hack -- force a method */ if (!p) p = "do something weird"; /* Describe the method */ text_out(p); /* Describe the effect (if any) */ if (q) { /* Describe the attack type */ text_out(" to "); text_out_c(TERM_L_RED, q); /* Describe damage (if known) */ if (d1 && d2 && know_damage(r_idx, l_ptr, m)) { /* Display the damage */ text_out(" with damage"); text_out(format(" %dd%d", d1, d2)); } } /* Count the attacks as printed */ r++; } /* Finish sentence above */ if (r) { text_out(". "); } /* Notice lack of attacks */ else if (l_ptr->flags1 & RF1_NEVER_BLOW) { text_out(format("%^s has no physical attacks. ", wd_he[msex])); } /* Or describe the lack of knowledge */ else { text_out(format("Nothing is known about %s attack. ", wd_his[msex])); } }
static void describe_monster_movement(int r_idx, const monster_lore *l_ptr) { const monster_race *r_ptr = &r_info[r_idx]; bool old = FALSE; text_out("This"); if (l_ptr->flags3 & RF3_ANIMAL) text_out_c(TERM_L_BLUE, " natural"); if (l_ptr->flags3 & RF3_EVIL) text_out_c(TERM_L_BLUE, " evil"); if (l_ptr->flags3 & RF3_UNDEAD) text_out_c(TERM_L_BLUE, " undead"); if (l_ptr->flags3 & RF3_DRAGON) text_out_c(TERM_L_BLUE, " dragon"); else if (l_ptr->flags3 & RF3_DEMON) text_out_c(TERM_L_BLUE, " demon"); else if (l_ptr->flags3 & RF3_GIANT) text_out_c(TERM_L_BLUE, " giant"); else if (l_ptr->flags3 & RF3_TROLL) text_out_c(TERM_L_BLUE, " troll"); else if (l_ptr->flags3 & RF3_ORC) text_out_c(TERM_L_BLUE, " orc"); else text_out(" creature"); /* Describe location */ if (r_ptr->level == 0) { text_out_c(TERM_SLATE, " lives in the town"); old = TRUE; } else if (l_ptr->tkills) { if (l_ptr->flags1 & RF1_FORCE_DEPTH) text_out_c(TERM_SLATE, " is found "); else text_out_c(TERM_SLATE, " is normally found "); if (depth_in_feet) { text_out_c(TERM_SLATE, format("at depths of %d feet", r_ptr->level * 50)); } else { text_out_c(TERM_SLATE, format("on dungeon level %d", r_ptr->level)); } old = TRUE; } if (old) text_out(", and"); text_out(" moves"); /* Random-ness */ if ((l_ptr->flags1 & RF1_RAND_50) || (l_ptr->flags1 & RF1_RAND_25)) { /* Adverb */ if ((l_ptr->flags1 & RF1_RAND_50) && (l_ptr->flags1 & RF1_RAND_25)) { text_out(" extremely"); } else if (l_ptr->flags1 & RF1_RAND_50) { text_out(" somewhat"); } else if (l_ptr->flags1 & RF1_RAND_25) { text_out(" a bit"); } /* Adjective */ text_out(" erratically"); /* Hack -- Occasional conjunction */ if (r_ptr->speed != 110) text_out(", and"); } /* Speed */ if (r_ptr->speed > 110) { if (r_ptr->speed > 130) text_out_c(TERM_GREEN, " incredibly"); else if (r_ptr->speed > 120) text_out_c(TERM_GREEN, " very"); text_out_c(TERM_GREEN, " quickly"); } else if (r_ptr->speed < 110) { if (r_ptr->speed < 90) text_out_c(TERM_GREEN, " incredibly"); else if (r_ptr->speed < 100) text_out_c(TERM_GREEN, " very"); text_out_c(TERM_GREEN, " slowly"); } else { text_out_c(TERM_GREEN, " at normal speed"); } /* The code above includes "attack speed" */ if (l_ptr->flags1 & RF1_NEVER_MOVE) { text_out(", but does not deign to chase intruders"); } /* End this sentence */ text_out(". "); }
static void describe_monster_spells(int r_idx, const monster_lore *l_ptr) { const monster_race *r_ptr = &r_info[r_idx]; int m, n; int msex = 0; bool breath = FALSE; bool magic = FALSE; int vn; cptr vp[64]; /* Extract a gender (if applicable) */ if (r_ptr->flags1 & RF1_FEMALE) msex = 2; else if (r_ptr->flags1 & RF1_MALE) msex = 1; /* Collect innate attacks */ vn = 0; if (l_ptr->flags4 & RF4_SHRIEK) vp[vn++] = "shriek for help"; if (l_ptr->flags4 & RF4_XXX2) vp[vn++] = "do something"; if (l_ptr->flags4 & RF4_XXX3) vp[vn++] = "do something"; if (l_ptr->flags4 & RF4_XXX4) vp[vn++] = "do something"; if (l_ptr->flags4 & RF4_ARROW_1) vp[vn++] = "fire an arrow"; if (l_ptr->flags4 & RF4_ARROW_2) vp[vn++] = "fire arrows"; if (l_ptr->flags4 & RF4_ARROW_3) vp[vn++] = "fire a missile"; if (l_ptr->flags4 & RF4_ARROW_4) vp[vn++] = "fire missiles"; if (l_ptr->flags4 & RF4_BOULDER) vp[vn++] = "throw boulders"; /* Describe innate attacks */ if (vn) { /* Intro */ text_out(format("%^s", wd_he[msex])); /* Scan */ for (n = 0; n < vn; n++) { /* Intro */ if (n == 0) text_out(" may "); else if (n < vn-1) text_out(", "); else text_out(" or "); /* Dump */ text_out_c(TERM_L_RED, vp[n]); } /* End */ text_out(". "); } /* Collect breaths */ vn = 0; if (l_ptr->flags4 & RF4_BR_ACID) vp[vn++] = "acid"; if (l_ptr->flags4 & RF4_BR_ELEC) vp[vn++] = "lightning"; if (l_ptr->flags4 & RF4_BR_FIRE) vp[vn++] = "fire"; if (l_ptr->flags4 & RF4_BR_COLD) vp[vn++] = "frost"; if (l_ptr->flags4 & RF4_BR_POIS) vp[vn++] = "poison"; if (l_ptr->flags4 & RF4_BR_NETH) vp[vn++] = "nether"; if (l_ptr->flags4 & RF4_BR_LITE) vp[vn++] = "light"; if (l_ptr->flags4 & RF4_BR_DARK) vp[vn++] = "darkness"; if (l_ptr->flags4 & RF4_BR_CONF) vp[vn++] = "confusion"; if (l_ptr->flags4 & RF4_BR_SOUN) vp[vn++] = "sound"; if (l_ptr->flags4 & RF4_BR_CHAO) vp[vn++] = "chaos"; if (l_ptr->flags4 & RF4_BR_DISE) vp[vn++] = "disenchantment"; if (l_ptr->flags4 & RF4_BR_NEXU) vp[vn++] = "nexus"; if (l_ptr->flags4 & RF4_BR_TIME) vp[vn++] = "time"; if (l_ptr->flags4 & RF4_BR_INER) vp[vn++] = "inertia"; if (l_ptr->flags4 & RF4_BR_GRAV) vp[vn++] = "gravity"; if (l_ptr->flags4 & RF4_BR_SHAR) vp[vn++] = "shards"; if (l_ptr->flags4 & RF4_BR_PLAS) vp[vn++] = "plasma"; if (l_ptr->flags4 & RF4_BR_WALL) vp[vn++] = "force"; if (l_ptr->flags4 & RF4_BR_MANA) vp[vn++] = "mana"; if (l_ptr->flags4 & RF4_XXX5) vp[vn++] = "something"; if (l_ptr->flags4 & RF4_XXX6) vp[vn++] = "something"; if (l_ptr->flags4 & RF4_XXX7) vp[vn++] = "something"; /* Describe breaths */ if (vn) { /* Note breath */ breath = TRUE; /* Intro */ text_out(format("%^s", wd_he[msex])); /* Scan */ for (n = 0; n < vn; n++) { /* Intro */ if (n == 0) text_out(" may breathe "); else if (n < vn-1) text_out(", "); else text_out(" or "); /* Dump */ text_out_c(TERM_L_RED, vp[n]); } } /* Collect spells */ vn = 0; if (l_ptr->flags5 & RF5_BA_ACID) vp[vn++] = "produce acid balls"; if (l_ptr->flags5 & RF5_BA_ELEC) vp[vn++] = "produce lightning balls"; if (l_ptr->flags5 & RF5_BA_FIRE) vp[vn++] = "produce fire balls"; if (l_ptr->flags5 & RF5_BA_COLD) vp[vn++] = "produce frost balls"; if (l_ptr->flags5 & RF5_BA_POIS) vp[vn++] = "produce poison balls"; if (l_ptr->flags5 & RF5_BA_NETH) vp[vn++] = "produce nether balls"; if (l_ptr->flags5 & RF5_BA_WATE) vp[vn++] = "produce water balls"; if (l_ptr->flags5 & RF5_BA_MANA) vp[vn++] = "invoke mana storms"; if (l_ptr->flags5 & RF5_BA_DARK) vp[vn++] = "invoke darkness storms"; if (l_ptr->flags5 & RF5_DRAIN_MANA) vp[vn++] = "drain mana"; if (l_ptr->flags5 & RF5_MIND_BLAST) vp[vn++] = "cause mind blasting"; if (l_ptr->flags5 & RF5_BRAIN_SMASH) vp[vn++] = "cause brain smashing"; if (l_ptr->flags5 & RF5_CAUSE_1) vp[vn++] = "cause light wounds"; if (l_ptr->flags5 & RF5_CAUSE_2) vp[vn++] = "cause serious wounds"; if (l_ptr->flags5 & RF5_CAUSE_3) vp[vn++] = "cause critical wounds"; if (l_ptr->flags5 & RF5_CAUSE_4) vp[vn++] = "cause mortal wounds"; if (l_ptr->flags5 & RF5_BO_ACID) vp[vn++] = "produce acid bolts"; if (l_ptr->flags5 & RF5_BO_ELEC) vp[vn++] = "produce lightning bolts"; if (l_ptr->flags5 & RF5_BO_FIRE) vp[vn++] = "produce fire bolts"; if (l_ptr->flags5 & RF5_BO_COLD) vp[vn++] = "produce frost bolts"; if (l_ptr->flags5 & RF5_BO_POIS) vp[vn++] = "produce poison bolts"; if (l_ptr->flags5 & RF5_BO_NETH) vp[vn++] = "produce nether bolts"; if (l_ptr->flags5 & RF5_BO_WATE) vp[vn++] = "produce water bolts"; if (l_ptr->flags5 & RF5_BO_MANA) vp[vn++] = "produce mana bolts"; if (l_ptr->flags5 & RF5_BO_PLAS) vp[vn++] = "produce plasma bolts"; if (l_ptr->flags5 & RF5_BO_ICEE) vp[vn++] = "produce ice bolts"; if (l_ptr->flags5 & RF5_MISSILE) vp[vn++] = "produce magic missiles"; if (l_ptr->flags5 & RF5_SCARE) vp[vn++] = "terrify"; if (l_ptr->flags5 & RF5_BLIND) vp[vn++] = "blind"; if (l_ptr->flags5 & RF5_CONF) vp[vn++] = "confuse"; if (l_ptr->flags5 & RF5_SLOW) vp[vn++] = "slow"; if (l_ptr->flags5 & RF5_HOLD) vp[vn++] = "paralyze"; if (l_ptr->flags6 & RF6_HASTE) vp[vn++] = "haste-self"; if (l_ptr->flags6 & RF6_XXX1) vp[vn++] = "do something"; if (l_ptr->flags6 & RF6_HEAL) vp[vn++] = "heal-self"; if (l_ptr->flags6 & RF6_XXX2) vp[vn++] = "do something"; if (l_ptr->flags6 & RF6_BLINK) vp[vn++] = "blink-self"; if (l_ptr->flags6 & RF6_TPORT) vp[vn++] = "teleport-self"; if (l_ptr->flags6 & RF6_XXX3) vp[vn++] = "do something"; if (l_ptr->flags6 & RF6_XXX4) vp[vn++] = "do something"; if (l_ptr->flags6 & RF6_TELE_TO) vp[vn++] = "teleport to"; if (l_ptr->flags6 & RF6_TELE_AWAY) vp[vn++] = "teleport away"; if (l_ptr->flags6 & RF6_TELE_LEVEL) vp[vn++] = "teleport level"; if (l_ptr->flags6 & RF6_XXX5) vp[vn++] = "do something"; if (l_ptr->flags6 & RF6_DARKNESS) vp[vn++] = "create darkness"; if (l_ptr->flags6 & RF6_TRAPS) vp[vn++] = "create traps"; if (l_ptr->flags6 & RF6_FORGET) vp[vn++] = "cause amnesia"; if (l_ptr->flags6 & RF6_XXX6) vp[vn++] = "do something"; if (l_ptr->flags6 & RF6_S_KIN) vp[vn++] = "summon similar monsters"; if (l_ptr->flags6 & RF6_S_MONSTER) vp[vn++] = "summon a monster"; if (l_ptr->flags6 & RF6_S_MONSTERS) vp[vn++] = "summon monsters"; if (l_ptr->flags6 & RF6_S_ANIMAL) vp[vn++] = "summon animals"; if (l_ptr->flags6 & RF6_S_SPIDER) vp[vn++] = "summon spiders"; if (l_ptr->flags6 & RF6_S_HOUND) vp[vn++] = "summon hounds"; if (l_ptr->flags6 & RF6_S_HYDRA) vp[vn++] = "summon hydras"; if (l_ptr->flags6 & RF6_S_ANGEL) vp[vn++] = "summon an angel"; if (l_ptr->flags6 & RF6_S_DEMON) vp[vn++] = "summon a demon"; if (l_ptr->flags6 & RF6_S_UNDEAD) vp[vn++] = "summon an undead"; if (l_ptr->flags6 & RF6_S_DRAGON) vp[vn++] = "summon a dragon"; if (l_ptr->flags6 & RF6_S_HI_UNDEAD) vp[vn++] = "summon Greater Undead"; if (l_ptr->flags6 & RF6_S_HI_DRAGON) vp[vn++] = "summon Ancient Dragons"; if (l_ptr->flags6 & RF6_S_HI_DEMON) vp[vn++] = "summon Greater Demons"; if (l_ptr->flags6 & RF6_S_WRAITH) vp[vn++] = "summon Ring Wraiths"; if (l_ptr->flags6 & RF6_S_UNIQUE) vp[vn++] = "summon Unique Monsters"; /* Describe spells */ if (vn) { /* Note magic */ magic = TRUE; /* Intro */ if (breath) { text_out(", and is also"); } else { text_out(format("%^s is", wd_he[msex])); } /* Verb Phrase */ text_out(" magical, casting spells"); /* Adverb */ if (l_ptr->flags2 & RF2_SMART) text_out_c(TERM_ORANGE, " intelligently"); /* Scan */ for (n = 0; n < vn; n++) { /* Intro */ if (n == 0) text_out(" which "); else if (n < vn-1) text_out(", "); else text_out(" or "); /* Dump */ text_out_c(TERM_L_RED, vp[n]); } } /* End the sentence about innate/other spells */ if (breath || magic) { /* Total casting */ m = l_ptr->cast_innate + l_ptr->cast_spell; /* Average frequency */ n = (r_ptr->freq_innate + r_ptr->freq_spell) / 2; /* Describe the spell frequency */ if (m > 100) { text_out(format("; 1 time in %d", 100 / n)); } /* Guess at the frequency */ else if (m) { n = ((n + 9) / 10) * 10; text_out(format("; about 1 time in %d", 100 / n)); } /* End this sentence */ text_out(". "); } }
/* * Display targeting help at the bottom of the screen. */ static void target_display_help(bool monster, bool free) { /* Determine help location */ int wid, hgt, help_loc; Term_get_size(&wid, &hgt); help_loc = hgt - HELP_HEIGHT - (mouse_buttons ? 1 : 0); /* Clear */ clear_from(help_loc); /* Prepare help hooks */ text_out_hook = text_out_to_screen; text_out_indent = 1; Term_gotoxy(1, help_loc); /* Display help */ text_out_c(TERM_L_GREEN, "<dir>"); text_out(" and "); text_out_c(TERM_L_GREEN, "<click>"); text_out(" look around. '"); text_out_c(TERM_L_GREEN, "g"); text_out(" moves to the selection. '"); text_out_c(TERM_L_GREEN, "p"); text_out("' selects the player. '"); text_out_c(TERM_L_GREEN, "q"); text_out("' exits. '"); text_out_c(TERM_L_GREEN, "r"); text_out("' displays details. '"); if (free) { text_out_c(TERM_L_GREEN, "m"); text_out("' restricts to interesting places. "); } else { text_out_c(TERM_L_GREEN, "+"); text_out("' and '"); text_out_c(TERM_L_GREEN, "-"); text_out("' cycle through interesting places. '"); text_out_c(TERM_L_GREEN, "o"); text_out("' allows free selection. "); } if (monster || free) { text_out("'"); text_out_c(TERM_L_GREEN, "t"); text_out("' targets the current selection."); } /* Reset */ text_out_indent = 0; }
/* * Display list of svals to be squelched. */ static bool sval_menu(int tval, const char *desc) { menu_type menu; menu_iter menu_f = { NULL, NULL, sval_display, sval_action }; region area = { 1, 5, -1, -1 }; int num = 0; size_t i; squelch_choice *choice; /* Create the array, with entries both for aware and unaware squelch */ choice = C_ZNEW(2 * z_info->k_max, squelch_choice); /* Iterate over all possible object kinds, finding ones which can be squelched */ for (i = 1; i < z_info->k_max; i++) { object_kind *k_ptr = &k_info[i]; /* Skip empty objects, unseen objects, and incorrect tvals */ if (!k_ptr->name) continue; if (k_ptr->tval != tval) continue; if (!k_ptr->aware) { /* can unaware squelch anything */ /* XXX Eddie should it be required that unaware squelched flavors have been seen this game, if so, how to save that info? */ choice[num].idx = i; choice[num].aware = FALSE; num++; } if (k_ptr->everseen || k_ptr->tval == TV_GOLD) { /* aware squelch requires everseen */ /* do not require awareness for aware squelch, so people can set at game start */ choice[num].idx = i; choice[num].aware = TRUE; num++; } } /* Return here if there are no objects */ if (!num) { FREE(choice); return FALSE; } /* sort by name in squelch menus except for categories of items that are aware from the start */ switch(tval) { case TV_LIGHT: case TV_MAGIC_BOOK: case TV_PRAYER_BOOK: case TV_DRAG_ARMOR: case TV_GOLD: /* leave sorted by sval */ break; default: /* sort by name */ ang_sort_comp = ang_sort_comp_hook_squelch_choices; ang_sort_swap = ang_sort_swap_hook_squelch_choices; ang_sort((void*)choice, NULL, num); } /* Save the screen and clear it */ screen_save(); clear_from(0); /* Help text */ /* Output to the screen */ text_out_hook = text_out_to_screen; /* Indent output */ text_out_indent = 1; text_out_wrap = 79; Term_gotoxy(1, 0); /* Display some helpful information */ text_out("Use the "); text_out_c(TERM_L_GREEN, "movement keys"); text_out(" to scroll the list or "); text_out_c(TERM_L_GREEN, "ESC"); text_out(" to return to the previous menu. "); text_out_c(TERM_L_BLUE, "Enter"); text_out(" toggles the current setting."); text_out_indent = 0; /* Run menu */ menu_init(&menu, MN_SKIN_SCROLL, &menu_f); menu_setpriv(&menu, num, choice); menu_layout(&menu, &area); menu_select(&menu, 0); /* Free memory */ FREE(choice); /* Load screen */ screen_load(); return TRUE; }