static int _choose_spell(spell_info* spells, int ct, cptr desc, int max_cost) { int choice = -1; char prompt1[140]; char prompt2[140]; variant name; bool describe = FALSE; var_init(&name); for (;;) { char ch = '\0'; strnfmt(prompt1, 78, "Use which %s? (Type '?' to Browse) ", desc); strnfmt(prompt2, 78, "Browse which %s? (Type '?' to Use)", desc); _list_spells(spells, ct, max_cost); /* Prompt User */ choice = -1; if (!get_com(describe ? prompt2 : prompt1, &ch, FALSE)) break; if (ch == '?') { describe = !describe; if (!get_com(describe ? prompt2 : prompt1, &ch, FALSE)) break; } if (isupper(ch)) choice = ch - 'A' + 26; else if (islower(ch)) choice = ch - 'a'; else if (ch >= '0' && ch <= '9') choice = ch - '0' + 52; /* Valid Choice? */ if (choice < 0 || choice >= ct) { bell(); continue; } if (describe) { _describe_spell(&spells[choice], _col_height(ct)); continue; } /* Good to go! */ break; } var_clear(&name); return choice; }
static int _choose_form_imp(int ct) { int choice = -1; char prompt1[140]; char prompt2[140]; bool describe = FALSE; strnfmt(prompt1, 78, "Mimic which %s? (Type '?' to Browse) ", "Race"); strnfmt(prompt2, 78, "Browse which %s? (Type '?' to Use)", "Race"); _list_forms(ct); for (;;) { char ch = '\0'; /* Prompt User */ choice = -1; if (!get_com(describe ? prompt2 : prompt1, &ch, FALSE)) break; if (ch == '?') { describe = !describe; if (!get_com(describe ? prompt2 : prompt1, &ch, FALSE)) break; } if (isupper(ch)) choice = ch - 'A' + 26; else if (islower(ch)) choice = ch - 'a'; else if (ch >= '0' && ch <= '9') choice = ch - '0' + 52; /* Valid Choice? */ if (choice < 0 || choice >= ct) { bell(); continue; } if (describe) { _describe_form(choice, _col_height(ct)); continue; } /* Good to go! */ break; } return choice; }
static bool _create_ammo(void) { char com[256]; if (p_ptr->confused) { msg_print("You are too confused!"); return FALSE; } if (p_ptr->blind) { msg_print("You can't see!"); return FALSE; } if (p_ptr->lev >= 20) sprintf(com, "Create [S]hots, Create [A]rrow or Create [B]olt ?"); else if (p_ptr->lev >= 10) sprintf(com, "Create [S]hots or Create [A]rrow ?"); else sprintf(com, "Create [S]hots ?"); for(;;) { char ch; if (!get_com(com, &ch, TRUE)) return FALSE; if (ch == 'S' || ch == 's') return _create_shots(); if ((ch == 'A' || ch == 'a') && p_ptr->lev >= 10) return _create_arrows(); else if ((ch == 'B' || ch == 'b') && p_ptr->lev >= 20) return _create_bolts(); } }
/* ** Get next menu command number. */ get_cmd () { if (new_cmd == -1) cmd_nbr = get_com (); else cmd_nbr = new_cmd; new_cmd = -1; }
void print_dead_character() { /*{ Allow the bozo to print out his dead character... -KRC- }*/ char command; if (get_com("Print character sheet to file? (Y/N)",&command)) { if (command == 'y' || command == 'Y') { file_character(); } } };
void chan_post::print() const { std::cout << "Board = " << get_board() << "\n" << "Thread_id = " << get_thread_id() << "\n" << "Post_id = " << get_id() << "\n" << "Content = " << get_com().substr(0, 160) << "\n" << "Filenames = [" << std::endl; for (const auto &a : get_filenames()) { std::cout << a << "\n"; } std::cout << "]" << std::endl; }
/* * Allow user to choose a imitation. * * If a valid spell is chosen, saves it in '*sn' and returns TRUE * If the user hits escape, returns FALSE, and set '*sn' to -1 * If there are no legal choices, returns FALSE, and sets '*sn' to -2 * * The "prompt" should be "cast", "recite", or "study" * The "known" should be TRUE for cast/pray, FALSE for study * * nb: This function has a (trivial) display bug which will be obvious * when you run it. It's probably easy to fix but I haven't tried, * sorry. */ static int get_mane_power(int *sn, bool baigaesi) { int i = 0; int num = 0; int y = 1; int x = 18; int minfail = 0; int plev = p_ptr->lev; int chance = 0; int ask; char choice; char out_val[160]; char comment[80]; #ifdef JP cptr p = "能力"; #else cptr p = "power"; #endif monster_power spell; bool flag, redraw; /* Assume cancelled */ *sn = (-1); /* Nothing chosen yet */ flag = FALSE; /* No redraw yet */ redraw = FALSE; num = p_ptr->mane_num; /* Build a prompt (accept all spells) */ (void)strnfmt(out_val, 78, #ifdef JP "(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", #else "(%c-%c, *=List, ESC=exit) Use which %s? ", #endif I2A(0), I2A(num - 1), p); /* Get a spell from the user */ choice= always_show_list ? ESCAPE:1 ; while (!flag) { if(choice==ESCAPE) choice = ' '; else if( !get_com(out_val, &choice, TRUE) )break; /* Request redraw */ if ((choice == ' ') || (choice == '*') || (choice == '?')) { /* Show the list */ if (!redraw) { char psi_desc[80]; /* Show list */ redraw = TRUE; /* Save the screen */ screen_save(); /* Display a list of spells */ prt("", y, x); #ifdef JP put_str("名前", y, x + 5); #else put_str("Name", y, x + 5); #endif #ifdef JP put_str("失率 効果", y, x + 36); #else put_str("Fail Info", y, x + 35); #endif /* Dump the spells */ for (i = 0; i < num; i++) { /* Access the spell */ spell = monster_powers[p_ptr->mane_spell[i]]; chance = spell.manefail; /* Reduce failure rate by "effective" level adjustment */ if (plev > spell.level) chance -= 3 * (plev - spell.level); /* Reduce failure rate by INT/WIS adjustment */ chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 2) / 2; if (spell.manedam) chance = chance * p_ptr->mane_dam[i] / spell.manedam; chance += p_ptr->to_m_chance; /* Extract the minimum failure rate */ minfail = adj_mag_fail[p_ptr->stat_ind[spell.use_stat]]; /* Minimum failure rate */ if (chance < minfail) chance = minfail; /* Stunning makes spells harder */ if (p_ptr->stun > 50) chance += 25; else if (p_ptr->stun) chance += 15; /* Always a 5 percent chance of working */ if (chance > 95) chance = 95; /* Get info */ mane_info(comment, p_ptr->mane_spell[i], (baigaesi ? p_ptr->mane_dam[i]*2 : p_ptr->mane_dam[i])); /* Dump the spell --(-- */ sprintf(psi_desc, " %c) %-30s %3d%%%s", I2A(i), spell.name, chance, comment); prt(psi_desc, y + i + 1, x); } /* Clear the bottom line */ prt("", y + i + 1, x); } /* Hide the list */ else { /* Hide list */ redraw = FALSE; /* Restore the screen */ screen_load(); } /* Redo asking */ continue; } /* Note verify */ ask = isupper(choice); /* Lowercase */ if (ask) choice = tolower(choice); /* Extract request */ i = (islower(choice) ? A2I(choice) : -1); /* Totally Illegal */ if ((i < 0) || (i >= num)) { bell(); continue; } /* Save the spell index */ spell = monster_powers[p_ptr->mane_spell[i]]; /* Verify it */ if (ask) { char tmp_val[160]; /* Prompt */ #ifdef JP (void) strnfmt(tmp_val, 78, "%sをまねますか?", monster_powers[p_ptr->mane_spell[i]].name); #else (void)strnfmt(tmp_val, 78, "Use %s? ", monster_powers[p_ptr->mane_spell[i]].name); #endif /* Belay that order */ if (!get_check(tmp_val)) continue; } /* Stop the loop */ flag = TRUE; } /* Restore the screen */ if (redraw) screen_load(); /* Show choices */ p_ptr->window |= (PW_SPELL); /* Window stuff */ window_stuff(); /* Abort if needed */ if (!flag) return (FALSE); /* Save the choice */ (*sn) = i; damage = (baigaesi ? p_ptr->mane_dam[i]*2 : p_ptr->mane_dam[i]); /* Success */ return (TRUE); }
/* * Identify a character, allow recall of monsters * * Several "special" responses recall "mulitple" monsters: * ^A (all monsters) * ^U (all unique monsters) * ^N (all non-unique monsters) * * The responses may be sorted in several ways, see below. * * Note that the player ghosts are ignored, since they do not exist. */ void do_cmd_query_symbol(void) { int i, n, r_idx; char sym, query; char buf[128]; bool all = FALSE; bool uniq = FALSE; bool norm = FALSE; bool kill = TRUE; bool recall = FALSE; u16b why = 0; u16b *who; /* Get a character, or abort */ if (!get_com("Enter character to be identified: ", &sym)) return; /* Find that character info, and describe it */ for (i = 0; ident_info[i]; ++i) { if (sym == ident_info[i][0]) break; } /* Describe */ if (sym == KTRL('A')) { all = TRUE; strcpy(buf, "Full monster list."); } else if (sym == KTRL('U')) { all = uniq = TRUE; strcpy(buf, "Unique monster list."); } else if (sym == KTRL('N')) { all = norm = TRUE; strcpy(buf, "Non-unique monster list."); } else if (sym == KTRL('K')) { all = kill = TRUE; strcpy(buf, "Killed monster list."); } else if (ident_info[i]) { sprintf(buf, "%c - %s.", sym, ident_info[i] + 2); } else { sprintf(buf, "%c - %s.", sym, "Unknown Symbol"); } /* Display the result */ prt(buf, 0, 0); /* Allocate the "who" array */ C_MAKE(who, z_info->r_max, u16b); /* Collect matching monsters */ for (n = 0, i = 1; i < z_info->r_max - 1; i++) { monster_race *r_ptr = &r_info[i]; monster_lore *l_ptr = &l_list[i]; /* Nothing to recall */ if (!cheat_know && !l_ptr->sights) continue; /* Skip unused monsters */ if (!(r_ptr->hdice)) continue; /* Require non-unique monsters if needed */ if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue; /* Require unique monsters if needed */ if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue; /* Require killed if needed */ if (kill && !(l_ptr->pkills)) continue; /* Collect "appropriate" monsters */ if (all || (r_ptr->d_char == sym)) who[n++] = i; } /* Nothing to recall */ if (!n) { /* XXX XXX Free the "who" array */ FREE(who); return; } /* Prompt */ put_str("Recall details? (k/K/p/P/a/A/y/n): ", 0, 40); /* Query */ query = inkey(); /* Restore */ prt(buf, 0, 0); /* Sort by kills (and level) */ if (query == 'k') { why = 4; query = 'y'; } if (query == 'K') { why = 4+16; query = 'y'; } /* Sort by total kills (and level) */ if (query == 'a') { why = 3; query = 'y'; } if (query == 'A') { why = 3+16; query = 'y'; } /* Sort by level (and experience) */ if (query == 'p') { why = 2; query = 'y'; } if (query == 'P') { why = 2+16; query = 'y'; } /* Catch "escape" */ if (query != 'y') { /* XXX XXX Free the "who" array */ FREE(who); return; } /* Sort if needed */ if (why) { /* Select the sort method */ ang_sort_comp = ang_sort_comp_hook; ang_sort_swap = ang_sort_swap_hook; /* Sort the array */ ang_sort(who, &why, n); } /* Start at the end */ i = n - 1; /* Scan the monster memory */ while (1) { /* Extract a race */ r_idx = who[i]; /* Hack -- Auto-recall */ monster_race_track(r_idx); /* Hack -- Handle stuff */ handle_stuff(); /* Hack -- Begin the prompt */ roff_top(r_idx); /* Hack -- Complete the prompt */ Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]"); /* Interact */ while (1) { /* Recall */ if (recall) { /* Save screen */ screen_save(); /* Recall on screen */ screen_roff(who[i]); /* Hack -- Complete the prompt (again) */ Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]"); } /* Command */ query = inkey(); /* Unrecall */ if (recall) { /* Load screen */ screen_load(); } /* Normal commands */ if (query != 'r') break; /* Toggle recall */ recall = !recall; } /* Stop scanning */ if (query == ESCAPE) break; /* Move to "prev" monster */ if (query == '-') { if (++i == n) { i = 0; if (!expand_list) break; } } /* Move to "next" monster */ else { if (i-- == 0) { i = n - 1; if (!expand_list) break; } } } /* Re-display the identity */ prt(buf, 0, 0); /* Free the "who" array */ FREE(who); }
/* * Allow the player to examine other sectors on the map */ void do_cmd_locate(void) { int dir, y1, x1, y2, x2; char tmp_val[80]; char out_val[160]; /* Start at current panel */ y1 = p_ptr->wy; x1 = p_ptr->wx; /* Show panels until done */ while (1) { /* Get the current panel */ y2 = p_ptr->wy; x2 = p_ptr->wx; /* Describe the location */ if ((y2 == y1) && (x2 == x1)) { tmp_val[0] = '\0'; } else { sprintf(tmp_val, "%s%s of", ((y2 < y1) ? " north" : (y2 > y1) ? " south" : ""), ((x2 < x1) ? " west" : (x2 > x1) ? " east" : "")); } /* Prepare to ask which way to look */ sprintf(out_val, "Map sector [%d,%d], which is%s your sector. Direction?", (y2 / PANEL_HGT), (x2 / PANEL_WID), tmp_val); /* More detail */ if (center_player) { sprintf(out_val, "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?", (y2 / PANEL_HGT), (y2 % PANEL_HGT), (x2 / PANEL_WID), (x2 % PANEL_WID), tmp_val); } /* Assume no direction */ dir = 0; /* Get a direction */ while (!dir) { char command; /* Get a command (or Cancel) */ if (!get_com(out_val, &command)) break; /* Extract direction */ dir = target_dir(command); /* Error */ if (!dir) bell("Illegal direction for locate!"); } /* No direction */ if (!dir) break; /* Apply the motion */ change_panel(dir); /* Handle stuff */ handle_stuff(); } /* Verify panel */ verify_panel(); }
/*! * @brief デバッグコマンドを選択する処理のメインルーチン / * Ask for and parse a "debug command" * The "command_arg" may have been set. * @return なし */ void do_cmd_debug(void) { int x, y, i; char cmd; /* Get a "debug command" */ get_com("Debug Command: ", &cmd, FALSE); /* Analyze the command */ switch (cmd) { /* Nothing */ case ESCAPE: case ' ': case '\n': case '\r': break; #ifdef ALLOW_SPOILERS /* Hack -- Generate Spoilers */ case '"': do_cmd_spoilers(); break; #endif /* ALLOW_SPOILERS */ /* Hack -- Help */ case '?': do_cmd_help(); break; /* Cure all maladies */ case 'a': do_cmd_wiz_cure_all(); break; /* Know alignment */ case 'A': msg_format("Your alignment is %d.", p_ptr->align); break; /* Teleport to target */ case 'b': do_cmd_wiz_bamf(); break; case 'B': battle_monsters(); break; /* Create any object */ case 'c': wiz_create_item(); break; /* Create a named artifact */ case 'C': wiz_create_named_art(); break; /* Detect everything */ case 'd': detect_all(DETECT_RAD_ALL * 3); break; /* Dimension_door */ case 'D': wiz_dimension_door(); break; /* Edit character */ case 'e': do_cmd_wiz_change(); break; /* Blue Mage Only */ case 'E': if (p_ptr->pclass == CLASS_BLUE_MAGE) { do_cmd_wiz_blue_mage(); } break; /* View item info */ case 'f': identify_fully(FALSE); break; /* Create desired feature */ case 'F': do_cmd_wiz_create_feature(); break; /* Good Objects */ case 'g': if (command_arg <= 0) command_arg = 1; acquirement(p_ptr->y, p_ptr->x, command_arg, FALSE, FALSE, TRUE); break; /* Hitpoint rerating */ case 'h': do_cmd_rerate(TRUE); break; #ifdef MONSTER_HORDES case 'H': do_cmd_summon_horde(); break; #endif /* MONSTER_HORDES */ /* Identify */ case 'i': (void)ident_spell(FALSE); break; /* Go up or down in the dungeon */ case 'j': do_cmd_wiz_jump(); break; /* Self-Knowledge */ case 'k': self_knowledge(); break; /* Learn about objects */ case 'l': do_cmd_wiz_learn(); break; /* Magic Mapping */ case 'm': map_area(DETECT_RAD_ALL * 3); break; /* Mutation */ case 'M': (void)gain_random_mutation(command_arg); break; /* Reset Class */ case 'R': (void)do_cmd_wiz_reset_class(); break; /* Specific reward */ case 'r': (void)gain_level_reward(command_arg); break; /* Summon _friendly_ named monster */ case 'N': do_cmd_wiz_named_friendly(command_arg); break; /* Summon Named Monster */ case 'n': do_cmd_wiz_named(command_arg); break; /* Dump option bits usage */ case 'O': do_cmd_dump_options(); break; /* Object playing routines */ case 'o': do_cmd_wiz_play(); break; /* Phase Door */ case 'p': teleport_player(10, 0L); break; /* Complete a Quest -KMW- */ case 'q': if(p_ptr->inside_quest) { if (quest[p_ptr->inside_quest].status == QUEST_STATUS_TAKEN) { complete_quest(p_ptr->inside_quest); break; } } else { msg_print("No current quest"); msg_print(NULL); } break; /* Make every dungeon square "known" to test streamers -KMW- */ case 'u': for (y = 0; y < cur_hgt; y++) { for (x = 0; x < cur_wid; x++) { cave[y][x].info |= (CAVE_GLOW | CAVE_MARK); } } wiz_lite(FALSE); break; /* Summon Random Monster(s) */ case 's': if (command_arg <= 0) command_arg = 1; do_cmd_wiz_summon(command_arg); break; /* Special(Random Artifact) Objects */ case 'S': if (command_arg <= 0) command_arg = 1; acquirement(p_ptr->y, p_ptr->x, command_arg, TRUE, TRUE, TRUE); break; /* Teleport */ case 't': teleport_player(100, 0L); break; /* Very Good Objects */ case 'v': if (command_arg <= 0) command_arg = 1; acquirement(p_ptr->y, p_ptr->x, command_arg, TRUE, FALSE, TRUE); break; /* Wizard Light the Level */ case 'w': wiz_lite((bool)(p_ptr->pclass == CLASS_NINJA)); break; /* Increase Experience */ case 'x': gain_exp(command_arg ? command_arg : (p_ptr->exp + 1)); break; /* Zap Monsters (Genocide) */ case 'z': do_cmd_wiz_zap(); break; /* Zap Monsters (Omnicide) */ case 'Z': do_cmd_wiz_zap_all(); break; /* Hack -- whatever I desire */ case '_': do_cmd_wiz_hack_ben(); break; /* Not a Wizard Command */ default: msg_print("That is not a valid debug command."); break; } }
/* * Get an object kind for creation (or zero) * * List up to 60 choices in three columns */ static int wiz_create_itemtype(void) { int i, num, max_num; int col, row; int tval; cptr tval_desc; char ch; int choice[60]; static const char choice_name[] = ("abcdefghijklmnopqrst" "ABCDEFGHIJKLMNOPQRST" "0123456789:;<=>?@%&*"); const char *cp; char buf[160]; /* Clear screen */ Term_clear(); /* Print all tval's and their descriptions */ for (num = 0; (num < 60) && object_group_tval[num]; num++) { row = 2 + (num % 20); col = 30 * (num / 20); ch = choice_name[num]; prt(format("[%c] %s", ch, object_group_text[num]), row, col); } /* We need to know the maximal possible tval_index */ max_num = num; /* Choose! */ if (!get_com("Get what type of object? ", &ch)) return (0); /* Analyze choice */ num = -1; if ((cp = strchr(choice_name, ch)) != NULL) num = cp - choice_name; /* Bail out if choice is illegal */ if ((num < 0) || (num >= max_num)) return (0); /* Base object type chosen, fill in tval */ tval = object_group_tval[num]; tval_desc = object_group_text[num]; /*** And now we go for k_idx ***/ /* Clear screen */ Term_clear(); /* We have to search the whole itemlist. */ for (num = 0, i = 1; (num < 60) && (i < z_info->k_max); i++) { object_kind *k_ptr = &k_info[i]; /* Analyze matching items */ if (k_ptr->tval == tval) { /* Hack -- Skip instant artifacts */ if (k_ptr->flags3 & (TR3_INSTA_ART)) continue; /* Prepare it */ row = 2 + (num % 20); col = 30 * (num / 20); ch = choice_name[num]; /* Get the "name" of object "i" */ strip_name(buf, i); /* Print it */ prt(format("[%c] %s", ch, buf), row, col); /* Remember the object index */ choice[num++] = i; } } /* Me need to know the maximal possible remembered object_index */ max_num = num; /* Choose! */ if (!get_com(format("What Kind of %s? ", tval_desc), &ch)) return (0); /* Analyze choice */ num = -1; if ((cp = strchr(choice_name, ch)) != NULL) num = cp - choice_name; /* Bail out if choice is "illegal" */ if ((num < 0) || (num >= max_num)) return (0); /* And return successful */ return (choice[num]); }
/* * Specify tval and sval (type and subtype of object) originally * by RAK, heavily modified by -Bernd- * * This function returns the k_idx of an object type, or zero if failed * * List up to 50 choices in three columns */ static int wiz_create_itemtype(void) { int i, num, max_num; int col, row; int tval; cptr tval_desc; char ch; int choice[60]; char buf[160]; /* Clear screen */ Term_clear(); /* Print all tval's and their descriptions */ for (num = 0; (num < 60) && tvals[num].tval; num++) { row = 2 + (num % 20); col = 30 * (num / 20); ch = listsym[num]; prt(format("[%c] %s", ch, tvals[num].desc), row, col); } /* We need to know the maximal possible tval_index */ max_num = num; /* Choose! */ if (!get_com("Get what type of object? ", &ch)) return (0); /* Analyze choice */ for (num = 0; num < max_num; num++) { if (listsym[num] == ch) break; } /* Bail out if choice is illegal */ if (num >= max_num) return (0); /* Base object type chosen, fill in tval */ tval = tvals[num].tval; tval_desc = tvals[num].desc; /*** And now we go for k_idx ***/ /* Clear screen */ Term_clear(); /* We have to search the whole itemlist. */ for (num = 0, i = 1; (num < 60) && (i < max_k_idx); i++) { object_kind *k_ptr = &k_info[i]; /* Analyze matching items */ if (k_ptr->tval == tval) { /* Prepare it */ row = 2 + (num % 20); col = 30 * (num / 20); ch = listsym[num]; /* Acquire the "name" of object "i" */ strip_name(buf, i); /* Print it */ prt(format("[%c] %s", ch, buf), row, col); /* Remember the object index */ choice[num++] = i; } } /* We need to know the maximal possible remembered object_index */ max_num = num; /* Choose! */ if (!get_com(format("What Kind of %s? ", tval_desc), &ch)) return (0); /* Analyze choice */ for (num = 0; num < max_num; num++) { if (listsym[num] == ch) break; } /* Bail out if choice is "illegal" */ if (num >= max_num) return (0); /* And return successful */ return (choice[num]); }
/* * Play with an item. Options include: * - Output statistics (via wiz_roll_item) * - Reroll item (via wiz_reroll_item) * - Change properties (via wiz_tweak_item) * - Change the number of items (via wiz_quantity_item) */ static void do_cmd_wiz_play(void) { int item; object_type forge; object_type *q_ptr; object_type *o_ptr; char ch; bool changed = FALSE; cptr q, s; /* Get an item */ q = "Play with which object? "; s = "You have nothing to play with."; if (!get_item(&item, q, s, (USE_EQUIP | 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]; } /* Save the screen */ screen_save(); /* Get local object */ q_ptr = &forge; /* Copy object */ object_copy(q_ptr, o_ptr); /* Display the item */ wiz_display_item(q_ptr); /* Display the rarity graph - turned off for now (too slow).*/ /* prt_alloc(o_ptr, 2, 0, 1000); */ /* The main loop */ while (TRUE) { /* Display the item */ wiz_display_item(q_ptr); /* Get choice */ if (!get_com("[a]ccept [s]tatistics [r]eroll [t]weak [q]uantity? ", &ch)) { break; } if (ch == 'A' || ch == 'a') { changed = TRUE; break; } if (ch == 's' || ch == 'S') { wiz_statistics(q_ptr); } if (ch == 'r' || ch == 'r') { wiz_reroll_item(q_ptr); } if (ch == 't' || ch == 'T') { wiz_tweak_item(q_ptr); } if (ch == 'q' || ch == 'Q') { wiz_quantity_item(q_ptr); } } /* Restore the screen */ screen_load(); /* Accept change */ if (changed) { /* Message */ msg_print("Changes accepted."); /* Change */ object_copy(o_ptr, q_ptr); /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); /* Combine / Reorder the pack (later) */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_PLAYRES); } /* Ignore change */ else { msg_print("Changes ignored."); } }
/* * Apply magic to an item or turn it into an artifact. -Bernd- */ static void wiz_reroll_item(object_type *o_ptr) { object_type *i_ptr; object_type object_type_body; struct keypress ch; bool changed = FALSE; /* Hack -- leave artifacts alone */ if (o_ptr->artifact) return; /* Get local object */ i_ptr = &object_type_body; /* Copy the object */ object_copy(i_ptr, o_ptr); /* Main loop. Ask for magification and artifactification */ while (TRUE) { /* Display full item debug information */ wiz_display_item(i_ptr, TRUE); /* Ask wizard what to do. */ if (!get_com("[a]ccept, [n]ormal, [g]ood, [e]xcellent? ", &ch)) break; /* Create/change it! */ if (ch.code == 'A' || ch.code == 'a') { changed = TRUE; break; } /* Apply normal magic, but first clear object */ else if (ch.code == 'n' || ch.code == 'N') { object_prep(i_ptr, o_ptr->kind, p_ptr->depth, RANDOMISE); apply_magic(i_ptr, p_ptr->depth, FALSE, FALSE, FALSE); } /* Apply good magic, but first clear object */ else if (ch.code == 'g' || ch.code == 'G') { object_prep(i_ptr, o_ptr->kind, p_ptr->depth, RANDOMISE); apply_magic(i_ptr, p_ptr->depth, FALSE, TRUE, FALSE); } /* Apply great magic, but first clear object */ else if (ch.code == 'e' || ch.code == 'E') { object_prep(i_ptr, o_ptr->kind, p_ptr->depth, RANDOMISE); apply_magic(i_ptr, p_ptr->depth, FALSE, TRUE, TRUE); } } /* Notice change */ if (changed) { /* Mark as cheat */ i_ptr->origin = ORIGIN_CHEAT; /* Restore the position information */ i_ptr->iy = o_ptr->iy; i_ptr->ix = o_ptr->ix; i_ptr->next_o_idx = o_ptr->next_o_idx; i_ptr->marked = o_ptr->marked; /* Apply changes */ object_copy(o_ptr, i_ptr); /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); /* Combine / Reorder the pack (later) */ p_ptr->notice |= (PN_COMBINE | PN_REORDER | PN_SORT_QUIVER); /* Window stuff */ p_ptr->redraw |= (PR_INVEN | PR_EQUIP ); } }
/* * Try to create an item again. Output some statistics. -Bernd- * * The statistics are correct now. We acquire a clean grid, and then * repeatedly place an object in this grid, copying it into an item * holder, and then deleting the object. We fiddle with the artifact * counter flags to prevent weirdness. We use the items to collect * statistics on item creation relative to the initial item. */ static void wiz_statistics(object_type *o_ptr, int level) { long i, matches, better, worse, other; int j; struct keypress ch; const char *quality; bool good, great, ismatch, isbetter, isworse; object_type *i_ptr; object_type object_type_body; const char *q = "Rolls: %ld, Matches: %ld, Better: %ld, Worse: %ld, Other: %ld"; /* Allow multiple artifacts, because breaking the game is fine here */ if (o_ptr->artifact) o_ptr->artifact->created = FALSE; /* Interact */ while (TRUE) { const char *pmt = "Roll for [n]ormal, [g]ood, or [e]xcellent treasure? "; /* Display item */ wiz_display_item(o_ptr, TRUE); /* Get choices */ if (!get_com(pmt, &ch)) break; if (ch.code == 'n' || ch.code == 'N') { good = FALSE; great = FALSE; quality = "normal"; } else if (ch.code == 'g' || ch.code == 'G') { good = TRUE; great = FALSE; quality = "good"; } else if (ch.code == 'e' || ch.code == 'E') { good = TRUE; great = TRUE; quality = "excellent"; } else { #if 0 /* unused */ good = FALSE; great = FALSE; #endif /* unused */ break; } /* Let us know what we are doing */ msg("Creating a lot of %s items. Base level = %d.", quality, p_ptr->depth); message_flush(); /* Set counters to zero */ matches = better = worse = other = 0; /* Let's rock and roll */ for (i = 0; i <= TEST_ROLL; i++) { /* Output every few rolls */ if ((i < 100) || (i % 100 == 0)) { struct keypress kp; /* Do not wait */ inkey_scan = SCAN_INSTANT; /* Allow interupt */ kp = inkey(); if (kp.type != EVT_NONE) { flush(); break; } /* Dump the stats */ prt(format(q, i, matches, better, worse, other), 0, 0); Term_fresh(); } /* Get local object */ i_ptr = &object_type_body; /* Wipe the object */ object_wipe(i_ptr); /* Create an object */ make_object(cave, i_ptr, level, good, great, NULL); /* Allow multiple artifacts, because breaking the game is fine here */ if (o_ptr->artifact) o_ptr->artifact->created = FALSE; /* Test for the same tval and sval. */ if ((o_ptr->tval) != (i_ptr->tval)) continue; if ((o_ptr->sval) != (i_ptr->sval)) continue; /* Check pvals */ ismatch = TRUE; for (j = 0; j < MAX_PVALS; j++) if (i_ptr->pval[j] != o_ptr->pval[j]) ismatch = FALSE; isbetter = TRUE; for (j = 0; j < MAX_PVALS; j++) if (i_ptr->pval[j] < o_ptr->pval[j]) isbetter = FALSE; isworse = TRUE; for (j = 0; j < MAX_PVALS; j++) if (i_ptr->pval[j] > o_ptr->pval[j]) isworse = FALSE; /* Check for match */ if (ismatch && (i_ptr->to_a == o_ptr->to_a) && (i_ptr->to_h == o_ptr->to_h) && (i_ptr->to_d == o_ptr->to_d) && (i_ptr->num_pvals == o_ptr->num_pvals)) { matches++; } /* Check for better */ else if (isbetter && (i_ptr->to_a >= o_ptr->to_a) && (i_ptr->to_h >= o_ptr->to_h) && (i_ptr->to_d >= o_ptr->to_d)) { better++; } /* Check for worse */ else if (isworse && (i_ptr->to_a <= o_ptr->to_a) && (i_ptr->to_h <= o_ptr->to_h) && (i_ptr->to_d <= o_ptr->to_d)) { worse++; } /* Assume different */ else { other++; } } /* Final dump */ msg(q, i, matches, better, worse, other); message_flush(); } /* Hack -- Normally only make a single artifact */ if (o_ptr->artifact) o_ptr->artifact->created = TRUE; }
/* * Query the dungeon */ static void do_cmd_wiz_query(void) { int py = p_ptr->py; int px = p_ptr->px; int y, x; struct keypress cmd; u16b mask = 0x00; /* Get a "debug command" */ if (!get_com("Debug Command Query: ", &cmd)) return; /* Extract a flag */ switch (cmd.code) { case '0': mask = (1 << 0); break; case '1': mask = (1 << 1); break; case '2': mask = (1 << 2); break; case '3': mask = (1 << 3); break; case '4': mask = (1 << 4); break; case '5': mask = (1 << 5); break; case '6': mask = (1 << 6); break; case '7': mask = (1 << 7); break; case 'm': mask |= (CAVE_MARK); break; case 'g': mask |= (CAVE_GLOW); break; case 'r': mask |= (CAVE_ROOM); break; case 'i': mask |= (CAVE_ICKY); break; case 's': mask |= (CAVE_SEEN); break; case 'v': mask |= (CAVE_VIEW); break; case 't': mask |= (CAVE_TEMP); break; case 'w': mask |= (CAVE_WALL); break; } /* Scan map */ for (y = Term->offset_y; y < Term->offset_y + SCREEN_HGT; y++) { for (x = Term->offset_x; x < Term->offset_x + SCREEN_WID; x++) { byte a = TERM_RED; if (!in_bounds_fully(y, x)) continue; /* Given mask, show only those grids */ if (mask && !(cave->info[y][x] & mask)) continue; /* Given no mask, show unknown grids */ if (!mask && (cave->info[y][x] & (CAVE_MARK))) continue; /* Color */ if (cave_floor_bold(y, x)) a = TERM_YELLOW; /* Display player/floors/walls */ if ((y == py) && (x == px)) print_rel(L'@', a, y, x); else if (cave_floor_bold(y, x)) print_rel(L'*', a, y, x); else print_rel(L'#', a, y, x); } } /* Get keypress */ msg("Press any key."); message_flush(); /* Redraw map */ prt_map(); }
/* * Ask for and parse a "debug command" * * The "p_ptr->command_arg" may have been set. */ void do_cmd_debug(void) { int py = p_ptr->py; int px = p_ptr->px; struct keypress cmd; const monster_race *r_ptr; /* Get a "debug command" */ if (!get_com("Debug Command: ", &cmd)) return; /* Analyze the command */ switch (cmd.code) { /* Ignore */ case ESCAPE: case ' ': case KC_ENTER: { break; } #ifdef ALLOW_SPOILERS /* Hack -- Generate Spoilers */ case '"': { do_cmd_spoilers(); break; } #endif /* Hack -- Help */ case '?': { do_cmd_wiz_help(); break; } /* Cure all maladies */ case 'a': { do_cmd_wiz_cure_all(); break; } /* Make the player powerful */ case 'A': { do_cmd_wiz_advance(); break; } /* Teleport to target */ case 'b': { do_cmd_wiz_bamf(); break; } /* Create any object */ case 'c': { wiz_create_item(); break; } /* Create an artifact */ case 'C': { if (p_ptr->command_arg > 0) { wiz_create_artifact(p_ptr->command_arg); } else { char name[80] = ""; int a_idx = -1; /* Avoid the prompt getting in the way */ screen_save(); /* Prompt */ prt("Create which artifact? ", 0, 0); /* Get the name */ if (askfor_aux(name, sizeof(name), NULL)) { /* See if an a_idx was entered */ a_idx = get_idx_from_name(name); /* If not, find the artifact with that name */ if (a_idx < 1) a_idx = lookup_artifact_name(name); /* Did we find a valid artifact? */ if (a_idx != -1) wiz_create_artifact(a_idx); else msg("No artifact found."); } /* Reload the screen */ screen_load(); } break; } /* Detect everything */ case 'd': { detect_all(TRUE); break; } /* Test for disconnected dungeon */ case 'D': { disconnect_stats(); break; } /* Edit character */ case 'e': { do_cmd_wiz_change(); break; } case 'f': { stats_collect(); break; } /* Good Objects */ case 'g': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; acquirement(py, px, p_ptr->depth, p_ptr->command_arg, FALSE); break; } /* GF demo */ case 'G': { wiz_gf_demo(); break; } /* Hitpoint rerating */ case 'h': { do_cmd_rerate(); break; } /* Identify */ case 'i': { (void)ident_spell(); break; } /* Go up or down in the dungeon */ case 'j': { do_cmd_wiz_jump(); break; } /* Learn about objects */ case 'l': { do_cmd_wiz_learn(); break; } case 'L': do_cmd_keylog(); break; /* Magic Mapping */ case 'm': { map_area(); break; } /* Summon Named Monster */ case 'n': { s16b r_idx = 0; if (p_ptr->command_arg > 0) { r_idx = p_ptr->command_arg; } else { char name[80] = ""; /* Avoid the prompt getting in the way */ screen_save(); /* Prompt */ prt("Summon which monster? ", 0, 0); /* Get the name */ if (askfor_aux(name, sizeof(name), NULL)) { /* See if a r_idx was entered */ r_idx = get_idx_from_name(name); /* If not, find the monster with that name */ if (r_idx < 1) r_idx = lookup_monster(name); p_ptr->redraw |= (PR_MAP | PR_MONLIST); /* Reload the screen */ screen_load(); } } if (r_idx > 0) do_cmd_wiz_named(r_idx, TRUE); else msg("No monster found."); break; } /* Object playing routines */ case 'o': { do_cmd_wiz_play(); break; } /* Phase Door */ case 'p': { teleport_player(10); break; } /* Monster pit stats */ case 'P': { pit_stats(); break; } /* Query the dungeon */ case 'q': { do_cmd_wiz_query(); break; } /* Get full recall for a monster */ case 'r': { s16b r_idx = 0; if (p_ptr->command_arg > 0) { r_idx = p_ptr->command_arg; } else { struct keypress sym; const char *prompt = "Full recall for [a]ll monsters or [s]pecific monster? "; if (!get_com(prompt, &sym)) return; if (sym.code == 'a' || sym.code == 'A') { int i; for (i = 1; i < z_info->r_max; i++) { r_ptr = &r_info[i]; cheat_monster_lore(r_ptr, &l_list[i]); } break; } else if (sym.code == 's' || sym.code == 'S') { char name[80] = ""; /* Avoid the prompt getting in the way */ screen_save(); /* Prompt */ prt("Which monster? ", 0, 0); /* Get the name */ if (askfor_aux(name, sizeof(name), NULL)) { /* See if a r_idx was entered */ r_idx = get_idx_from_name(name); /* If not, find the monster with that name */ if (r_idx < 1) r_idx = lookup_monster(name); } /* Reload the screen */ screen_load(); } else { /* Assume user aborts */ break; } } /* Did we find a valid monster? */ if (r_idx > 0) { r_ptr = &r_info[r_idx]; cheat_monster_lore(r_ptr, &l_list[r_idx]); } else msg("No monster found."); break; } /* Summon Random Monster(s) */ case 's': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; do_cmd_wiz_summon(p_ptr->command_arg); break; } /* Collect stats (S) */ case 'S': { stats_collect(); break; } /* Teleport */ case 't': { teleport_player(100); break; } /* Create a trap */ case 'T': { if (cave->feat[p_ptr->py][p_ptr->px] != FEAT_FLOOR) msg("You can't place a trap there!"); else if (p_ptr->depth == 0) msg("You can't place a trap in the town!"); else cave_set_feat(cave, p_ptr->py, p_ptr->px, FEAT_INVIS); break; } /* Un-hide all monsters */ case 'u': { detect_monsters_entire_level(); break; } /* Very Good Objects */ case 'v': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; acquirement(py, px, p_ptr->depth, p_ptr->command_arg, TRUE); break; } case 'V': { wiz_test_kind(p_ptr->command_arg); break; } /* Wizard Light the Level */ case 'w': { wiz_light(TRUE); break; } /* Wipe recall for a monster */ case 'W': { s16b r_idx = 0; if (p_ptr->command_arg > 0) { r_idx = p_ptr->command_arg; } else { struct keypress sym; const char *prompt = "Wipe recall for [a]ll monsters or [s]pecific monster? "; if (!get_com(prompt, &sym)) return; if (sym.code == 'a' || sym.code == 'A') { int i; for (i = 1; i < z_info->r_max; i++) { r_ptr = &r_info[i]; wipe_monster_lore(r_ptr, &l_list[i]); } break; } else if (sym.code == 's' || sym.code == 'S') { char name[80] = ""; /* Avoid the prompt getting in the way */ screen_save(); /* Prompt */ prt("Which monster? ", 0, 0); /* Get the name */ if (askfor_aux(name, sizeof(name), NULL)) { /* See if a r_idx was entered */ r_idx = get_idx_from_name(name); /* If not, find the monster with that name */ if (r_idx < 1) r_idx = lookup_monster(name); } /* Reload the screen */ screen_load(); } else { /* Assume user aborts */ break; } } /* Did we find a valid monster? */ if (r_idx > 0) { r_ptr = &r_info[r_idx]; wipe_monster_lore(r_ptr, &l_list[r_idx]); } else msg("No monster found."); break; } /* Increase Experience */ case 'x': { if (p_ptr->command_arg) { player_exp_gain(p_ptr, p_ptr->command_arg); } else { player_exp_gain(p_ptr, p_ptr->exp + 1); } break; } /* Zap Monsters (Banishment) */ case 'z': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = MAX_SIGHT; do_cmd_wiz_zap(p_ptr->command_arg); break; } /* Hack */ case '_': { do_cmd_wiz_hack_ben(); break; } /* Oops */ default: { msg("That is not a valid debug command."); break; } } }
/* * Play with an item. Options include: * - Output statistics (via wiz_roll_item) * - Reroll item (via wiz_reroll_item) * - Change properties (via wiz_tweak_item) * - Change the number of items (via wiz_quantity_item) */ static void do_cmd_wiz_play(void) { int item; object_type *i_ptr; object_type object_type_body; object_type *o_ptr; struct keypress ch; const char *q, *s; bool changed = FALSE; bool all = TRUE; /* Get an item */ q = "Play with which object? "; s = "You have nothing to play with."; if (!get_item(&item, q, s, 0, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return; o_ptr = object_from_item_idx(item); /* Save screen */ screen_save(); /* Get local object */ i_ptr = &object_type_body; /* Copy object */ object_copy(i_ptr, o_ptr); /* The main loop */ while (TRUE) { /* Display the item */ wiz_display_item(i_ptr, all); /* Get choice */ if (!get_com("[a]ccept [s]tatistics [r]eroll [t]weak [c]urse [q]uantity [k]nown? ", &ch)) break; if (ch.code == 'A' || ch.code == 'a') { changed = TRUE; break; } else if (ch.code == 'c' || ch.code == 'C') wiz_tweak_curse(i_ptr); else if (ch.code == 's' || ch.code == 'S') wiz_statistics(i_ptr, p_ptr->depth); else if (ch.code == 'r' || ch.code == 'R') wiz_reroll_item(i_ptr); else if (ch.code == 't' || ch.code == 'T') wiz_tweak_item(i_ptr); else if (ch.code == 'k' || ch.code == 'K') all = !all; else if (ch.code == 'q' || ch.code == 'Q') { bool carried = (item >= 0) ? TRUE : FALSE; wiz_quantity_item(i_ptr, carried); } } /* Load screen */ screen_load(); /* Accept change */ if (changed) { /* Message */ msg("Changes accepted."); /* Change */ object_copy(o_ptr, i_ptr); /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); /* Combine / Reorder the pack (later) */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); /* Window stuff */ p_ptr->redraw |= (PR_INVEN | PR_EQUIP ); } /* Ignore change */ else { msg("Changes ignored."); } }
static int _choose(menu_ptr menu) { int choice = -1; bool describe = FALSE; bool allow_browse = FALSE; char choose_prompt[255]; char browse_prompt[255]; char keys[100]; if (menu->browse_prompt) { allow_browse = TRUE; sprintf(choose_prompt, "%s (Type '?' to browse)", menu->choose_prompt); sprintf(browse_prompt, "%s (Type '?' to choose)", menu->browse_prompt); } else { sprintf(choose_prompt, "%s", menu->choose_prompt); sprintf(browse_prompt, "%s", ""); } _list(menu, keys); for (;;) { char ch = '\0'; int i; choice = -1; if (!get_com(describe ? browse_prompt : choose_prompt, &ch, FALSE)) break; if (ch == '?' && allow_browse) { describe = !describe; continue; } for (i = 0; i < menu->count; i++) { if (menu->count <= 26) { if (toupper(keys[i]) == toupper(ch)) { choice = i; break; } } else if (keys[i] == ch) { choice = i; break; } } if (choice < 0 || choice >= menu->count) { bell(); continue; } if (describe) { _describe(menu, choice); continue; } break; } return choice; }
/* * Try to create an item again. Output some statistics. -Bernd- * * The statistics are correct now. We acquire a clean grid, and then * repeatedly place an object in this grid, copying it into an item * holder, and then deleting the object. We fiddle with the artifact * counter flags to prevent weirdness. We use the items to collect * statistics on item creation relative to the initial item. */ static void wiz_statistics(object_type *o_ptr) { long i, matches, better, worse, other; char ch; char *quality; bool good, great; object_type *i_ptr; object_type object_type_body; cptr q = "Rolls: %ld, Matches: %ld, Better: %ld, Worse: %ld, Other: %ld"; /* Mega-Hack -- allow multiple artifacts XXX XXX XXX */ if (artifact_p(o_ptr)) a_info[o_ptr->name1].cur_num = 0; /* Interact */ while (TRUE) { cptr pmt = "Roll for [n]ormal, [g]ood, or [e]xcellent treasure? "; /* Display item */ wiz_display_item(o_ptr); /* Get choices */ if (!get_com(pmt, &ch)) break; if (ch == 'n' || ch == 'N') { good = FALSE; great = FALSE; quality = "normal"; } else if (ch == 'g' || ch == 'G') { good = TRUE; great = FALSE; quality = "good"; } else if (ch == 'e' || ch == 'E') { good = TRUE; great = TRUE; quality = "excellent"; } else { #if 0 /* unused */ good = FALSE; great = FALSE; #endif /* unused */ break; } /* Let us know what we are doing */ msg_format("Creating a lot of %s items. Base level = %d.", quality, p_ptr->depth); message_flush(); /* Set counters to zero */ matches = better = worse = other = 0; /* Let's rock and roll */ for (i = 0; i <= TEST_ROLL; i++) { /* Output every few rolls */ if ((i < 100) || (i % 100 == 0)) { /* Do not wait */ inkey_scan = TRUE; /* Allow interupt */ if (inkey()) { /* Flush */ flush(); /* Stop rolling */ break; } /* Dump the stats */ prt(format(q, i, matches, better, worse, other), 0, 0); Term_fresh(); } /* Get local object */ i_ptr = &object_type_body; /* Wipe the object */ object_wipe(i_ptr); /* Create an object */ make_object(i_ptr, good, great); /* Mega-Hack -- allow multiple artifacts XXX XXX XXX */ if (artifact_p(i_ptr)) a_info[i_ptr->name1].cur_num = 0; /* Test for the same tval and sval. */ if ((o_ptr->tval) != (i_ptr->tval)) continue; if ((o_ptr->sval) != (i_ptr->sval)) continue; /* Check for match */ if ((i_ptr->pval == o_ptr->pval) && (i_ptr->to_a == o_ptr->to_a) && (i_ptr->to_h == o_ptr->to_h) && (i_ptr->to_d == o_ptr->to_d)) { matches++; } /* Check for better */ else if ((i_ptr->pval >= o_ptr->pval) && (i_ptr->to_a >= o_ptr->to_a) && (i_ptr->to_h >= o_ptr->to_h) && (i_ptr->to_d >= o_ptr->to_d)) { better++; } /* Check for worse */ else if ((i_ptr->pval <= o_ptr->pval) && (i_ptr->to_a <= o_ptr->to_a) && (i_ptr->to_h <= o_ptr->to_h) && (i_ptr->to_d <= o_ptr->to_d)) { worse++; } /* Assume different */ else { other++; } } /* Final dump */ msg_format(q, i, matches, better, worse, other); message_flush(); } /* Hack -- Normally only make a single artifact */ if (artifact_p(o_ptr)) a_info[o_ptr->name1].cur_num = 1; }
static int get_snipe_power(int *sn, bool only_browse) { int i; int num = 0; int y = 1; int x = 20; int plev = p_ptr->lev; int ask; char choice; char out_val[160]; cptr p = "power"; snipe_power spell; bool flag, redraw; #ifdef ALLOW_REPEAT /* TNB */ repeat_push(*sn); /* Assume cancelled */ *sn = (-1); /* Repeat previous command */ /* Get the spell, if available */ if (repeat_pull(sn)) { /* Verify the spell */ if ((snipe_powers[*sn].min_lev <= plev) && (snipe_powers[*sn].mana_cost <= (int)p_ptr->concent)) { /* Success */ return (TRUE); } } #endif /* ALLOW_REPEAT -- TNB */ /* Nothing chosen yet */ flag = FALSE; /* No redraw yet */ redraw = FALSE; for (i = 0; i < MAX_SNIPE_POWERS; i++) { if ((snipe_powers[i].min_lev <= plev) && ((only_browse) || (snipe_powers[i].mana_cost <= (int)p_ptr->concent))) { num = i; } } /* Build a prompt (accept all spells) */ if (only_browse) { (void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ", p, I2A(0), I2A(num), p); } else { (void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ", p, I2A(0), I2A(num), p); } /* Get a spell from the user */ choice = always_show_list ? ESCAPE : 1; while (!flag) { if(choice == ESCAPE) choice = ' '; else if( !get_com(out_val, &choice, FALSE) )break; /* Request redraw */ if ((choice == ' ') || (choice == '*') || (choice == '?')) { /* Show the list */ if (!redraw) { char psi_desc[80]; /* Show list */ redraw = TRUE; /* Save the screen */ if (!only_browse) screen_save(); /* Display a list of spells */ prt("", y, x); put_str("Name", y, x + 5); if (only_browse) put_str("Lv Pow", y, x + 35); /* Dump the spells */ for (i = 0; i < MAX_SNIPE_POWERS; i++) { Term_erase(x, y + i + 1, 255); /* Access the spell */ spell = snipe_powers[i]; if (spell.min_lev > plev) continue; if (!only_browse && (spell.mana_cost > (int)p_ptr->concent)) continue; /* Dump the spell --(-- */ if (only_browse) sprintf(psi_desc, " %c) %-30s%2d %4d", I2A(i), spell.name, spell.min_lev, spell.mana_cost); else sprintf(psi_desc, " %c) %-30s", I2A(i), spell.name); prt(psi_desc, y + i + 1, x); } /* Clear the bottom line */ prt("", y + i + 1, x); } /* Hide the list */ else { /* Hide list */ redraw = FALSE; /* Restore the screen */ if (!only_browse) screen_load(); } /* Redo asking */ continue; } /* Note verify */ ask = isupper(choice); /* Lowercase */ if (ask) choice = tolower(choice); /* Extract request */ i = (islower(choice) ? A2I(choice) : -1); /* Totally Illegal */ if ((i < 0) || (i > num) || (!only_browse &&(snipe_powers[i].mana_cost > (int)p_ptr->concent))) { bell(); continue; } /* Save the spell index */ spell = snipe_powers[i]; /* Verify it */ if (ask) { char tmp_val[160]; /* Prompt */ (void)strnfmt(tmp_val, 78, "Use %s? ", snipe_powers[i].name); /* Belay that order */ if (!get_check(tmp_val)) continue; } /* Stop the loop */ flag = TRUE; } /* Restore the screen */ if (redraw && !only_browse) screen_load(); /* Show choices */ p_ptr->window |= (PW_SPELL); /* Window stuff */ window_stuff(); /* Abort if needed */ if (!flag) return (FALSE); /* Save the choice */ (*sn) = i; #ifdef ALLOW_REPEAT /* TNB */ repeat_push(*sn); #endif /* ALLOW_REPEAT -- TNB */ /* Success */ return (TRUE); }
/*! * @brief 検査対象のアイテムを基準とした生成テストを行う / * Try to create an item again. Output some statistics. -Bernd- * @param o_ptr 生成テストの基準となるアイテム情報の参照ポインタ * @return なし * The statistics are correct now. We acquire a clean grid, and then * repeatedly place an object in this grid, copying it into an item * holder, and then deleting the object. We fiddle with the artifact * counter flags to prevent weirdness. We use the items to collect * statistics on item creation relative to the initial item. */ static void wiz_statistics(object_type *o_ptr) { u32b i, matches, better, worse, other, correct; u32b test_roll = 1000000; char ch; cptr quality; u32b mode; object_type forge; object_type *q_ptr; cptr q = "Rolls: %ld Correct: %ld Matches: %ld Better: %ld Worse: %ld Other: %ld"; cptr p = "Enter number of items to roll: "; char tmp_val[80]; /* XXX XXX XXX Mega-Hack -- allow multiple artifacts */ if (object_is_fixed_artifact(o_ptr)) a_info[o_ptr->name1].cur_num = 0; /* Interact */ while (TRUE) { cptr pmt = "Roll for [n]ormal, [g]ood, or [e]xcellent treasure? "; /* Display item */ wiz_display_item(o_ptr); /* Get choices */ if (!get_com(pmt, &ch, FALSE)) break; if (ch == 'n' || ch == 'N') { mode = 0L; quality = "normal"; } else if (ch == 'g' || ch == 'G') { mode = AM_GOOD; quality = "good"; } else if (ch == 'e' || ch == 'E') { mode = AM_GOOD | AM_GREAT; quality = "excellent"; } else { break; } sprintf(tmp_val, "%ld", (long int)test_roll); if (get_string(p, tmp_val, 10)) test_roll = atol(tmp_val); test_roll = MAX(1, test_roll); /* Let us know what we are doing */ msg_format("Creating a lot of %s items. Base level = %d.", quality, dun_level); msg_print(NULL); /* Set counters to zero */ correct = matches = better = worse = other = 0; /* Let's rock and roll */ for (i = 0; i <= test_roll; i++) { /* Output every few rolls */ if ((i < 100) || (i % 100 == 0)) { /* Do not wait */ inkey_scan = TRUE; /* Allow interupt */ if (inkey()) { /* Flush */ flush(); /* Stop rolling */ break; } /* Dump the stats */ prt(format(q, i, correct, matches, better, worse, other), 0, 0); Term_fresh(); } /* Get local object */ q_ptr = &forge; /* Wipe the object */ object_wipe(q_ptr); /* Create an object */ make_object(q_ptr, mode); /* XXX XXX XXX Mega-Hack -- allow multiple artifacts */ if (object_is_fixed_artifact(q_ptr)) a_info[q_ptr->name1].cur_num = 0; /* Test for the same tval and sval. */ if ((o_ptr->tval) != (q_ptr->tval)) continue; if ((o_ptr->sval) != (q_ptr->sval)) continue; /* One more correct item */ correct++; /* Check for match */ if ((q_ptr->pval == o_ptr->pval) && (q_ptr->to_a == o_ptr->to_a) && (q_ptr->to_h == o_ptr->to_h) && (q_ptr->to_d == o_ptr->to_d) && (q_ptr->name1 == o_ptr->name1)) { matches++; } /* Check for better */ else if ((q_ptr->pval >= o_ptr->pval) && (q_ptr->to_a >= o_ptr->to_a) && (q_ptr->to_h >= o_ptr->to_h) && (q_ptr->to_d >= o_ptr->to_d)) { better++; } /* Check for worse */ else if ((q_ptr->pval <= o_ptr->pval) && (q_ptr->to_a <= o_ptr->to_a) && (q_ptr->to_h <= o_ptr->to_h) && (q_ptr->to_d <= o_ptr->to_d)) { worse++; } /* Assume different */ else { other++; } } /* Final dump */ msg_format(q, i, correct, matches, better, worse, other); msg_print(NULL); } /* Hack -- Normally only make a single artifact */ if (object_is_fixed_artifact(o_ptr)) a_info[o_ptr->name1].cur_num = 1; }
/* * Ask for and parse a "debug command" * The "command_arg" may have been set. */ void do_cmd_debug(void) { int py = p_ptr->py; int px = p_ptr->px; int x, y; char cmd; /* Get a "debug command" */ (void)get_com("Debug Command: ", &cmd); /* Analyze the command */ switch (cmd) { /* Nothing */ case ESCAPE: case ' ': case '\n': case '\r': break; #ifdef ALLOW_SPOILERS /* Hack -- Generate Spoilers */ case '"': do_cmd_spoilers(); break; #endif /* ALLOW_SPOILERS */ #ifdef MATLAB case '=': output_monster_matlab(); break; #endif /* MATLAB */ /* Hack -- Help */ case '?': screen_save(); (void)show_file("wizard.txt", NULL, 0 , 0); screen_load(); break; /* Cure all maladies */ case 'a': do_cmd_wiz_cure_all(); break; /* Know alignment */ case 'A': msg_format("Your alignment is %d.", p_ptr->align); break; /* Teleport to target */ case 'b': do_cmd_wiz_bamf(); break; /* Create any object */ case 'c': wiz_create_item(); break; /* Create a named artifact */ case 'C': /* wiz_create_named_art(p_ptr->command_arg);*/ break; /* Detect everything */ case 'd': (void)detect_all(); break; /* Edit character */ case 'e': do_cmd_wiz_change(); break; /* View item info */ case 'f': (void)identify_fully(); break; /* Create feature */ case 'F': if (p_ptr->command_arg > 0) do_cmd_wiz_feature(p_ptr->command_arg); break; /* Good Objects */ case 'g': if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; acquirement(py, px, p_ptr->command_arg, FALSE, TRUE); break; /* Hitpoint rerating */ case 'h': do_cmd_rerate(); break; #ifdef MONSTER_HORDES case 'H': do_cmd_summon_horde(); break; #endif /* MONSTER_HORDES */ /* Identify */ case 'i': (void)ident_spell(); break; /* Fields Integrity */ case 'I': (void)test_field_data_integrity(); break; /* Go up or down in the dungeon */ case 'j': do_cmd_wiz_jump(); break; /* Test compression code */ case 'J': /* test_compress_module(); */ break; /* Self-Knowledge */ case 'k': self_knowledge(); break; /* Learn about objects */ case 'l': do_cmd_wiz_learn(); break; /* Lose Mutation */ case 'L': (void)lose_mutation(p_ptr->command_arg); break; /* Magic Mapping */ case 'm': map_area(); break; /* Gain Mutation */ case 'M': (void)gain_mutation(p_ptr->command_arg); break; /* Specific reward */ case 'r': (void)gain_level_reward(p_ptr->command_arg); break; /* Summon _friendly_ named monster */ case 'N': do_cmd_wiz_named_friendly(p_ptr->command_arg, TRUE); break; /* Summon Named Monster */ case 'n': do_cmd_wiz_named(p_ptr->command_arg, TRUE); break; /* Object playing routines */ case 'o': do_cmd_wiz_play(); break; /* Phase Door */ case 'p': teleport_player(10); break; #if 0 /* Complete a Quest -KMW- */ case 'q': { for (i = 0; i < max_quests; i++) { if (p_ptr->quest[i].status == QUEST_STATUS_TAKEN) { p_ptr->quest[i].status++; msg_print("Completed Quest"); msg_print(NULL); break; } } if (i == max_quests) { msg_print("No current quest"); msg_print(NULL); } break; } #endif /* Make every dungeon square "known" to test streamers -KMW- */ case 'u': { for (y = min_hgt; y < max_hgt; y++) { for (x = min_wid; x < max_wid; x++) { area(y, x)->info |= (CAVE_GLOW | CAVE_MARK); } } wiz_lite(); break; } /* Summon Random Monster(s) */ case 's': if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; do_cmd_wiz_summon(p_ptr->command_arg); break; /* Teleport */ case 't': teleport_player(100); break; /* Very Good Objects */ case 'v': if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; acquirement(py, px, p_ptr->command_arg, TRUE, TRUE); break; /* Wizard Light the Level */ case 'w': if (p_ptr->depth) { wiz_lite(); } else { learn_map(); } break; case 'W': test_decision_tree(); break; /* Increase Experience */ case 'x': if (p_ptr->command_arg) { gain_exp(p_ptr->command_arg); } else { gain_exp(p_ptr->exp + 1); } break; /* Zap Monsters (Genocide) */ case 'z': do_cmd_wiz_zap(); break; case 'Z': do_cmd_wiz_zap_all(); break; /* Hack -- whatever I desire */ case '_': do_cmd_wiz_hack_ben(); break; #ifdef USE_SCRIPT /* Hack -- activate a script */ case '@': do_cmd_wiz_script(); break; #endif /* USE_SCRIPT */ /* Not a Wizard Command */ default: msg_print("That is not a valid debug command."); break; } }
/* * Identify a character, allow recall of monsters * * Several "special" responses recall "multiple" monsters: * ^A (all monsters) * ^U (all unique monsters) * ^N (all non-unique monsters) * * The responses may be sorted in several ways, see below. * * Note that the player ghosts are ignored. XXX XXX XXX */ void do_cmd_query_symbol(void) { int i, n, r_idx; char sym, query; char buf[128]; bool all = FALSE; bool uniq = FALSE; bool norm = FALSE; bool ride = FALSE; char temp[80] = ""; bool recall = FALSE; u16b why = 0; u16b *who; /* Get a character, or abort */ if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE)) return; /* Find that character info, and describe it */ for (i = 0; ident_info[i]; ++i) { if (sym == ident_info[i][0]) break; } /* Describe */ if (sym == KTRL('A')) { all = TRUE; strcpy(buf, "Full monster list."); } else if (sym == KTRL('U')) { all = uniq = TRUE; strcpy(buf, "Unique monster list."); } else if (sym == KTRL('N')) { all = norm = TRUE; strcpy(buf, "Non-unique monster list."); } else if (sym == KTRL('R')) { all = ride = TRUE; strcpy(buf, "Ridable monster list."); } /* XTRA HACK WHATSEARCH */ else if (sym == KTRL('M')) { all = TRUE; if (!get_string("Enter name:",temp, 70)) { temp[0]=0; return; } sprintf(buf, "Monsters with a name \"%s\"",temp); } else if (ident_info[i]) { sprintf(buf, "%c - %s.", sym, ident_info[i] + 2); } else { sprintf(buf, "%c - %s.", sym, "Unknown Symbol"); } /* Display the result */ prt(buf, 0, 0); /* Allocate the "who" array */ C_MAKE(who, max_r_idx, u16b); /* Collect matching monsters */ for (n = 0, i = 1; i < max_r_idx; i++) { monster_race *r_ptr = &r_info[i]; /* Nothing to recall */ if (!(cheat_know || p_ptr->wizard) && !r_ptr->r_sights) continue; /* Require non-unique monsters if needed */ if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue; /* Require unique monsters if needed */ if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue; /* Require ridable monsters if needed */ if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue; /* XTRA HACK WHATSEARCH */ if (temp[0]) { int xx; char temp2[80]; for (xx=0; temp[xx] && xx<80; xx++) { if (isupper(temp[xx])) temp[xx]=tolower(temp[xx]); } strcpy(temp2, r_name+r_ptr->name); for (xx=0; temp2[xx] && xx<80; xx++) if (isupper(temp2[xx])) temp2[xx]=tolower(temp2[xx]); if (my_strstr(temp2, temp)) who[n++]=i; } /* Collect "appropriate" monsters */ else if (all || (r_ptr->d_char == sym)) who[n++] = i; } /* Nothing to recall */ if (!n) { /* Free the "who" array */ C_KILL(who, max_r_idx, u16b); return; } /* Prompt XXX XXX XXX */ put_str("Recall details? (k/y/n): ", 0, 40); /* Query */ query = inkey(); /* Restore */ prt(buf, 0, 0); why = 2; /* Select the sort method */ ang_sort_comp = ang_sort_comp_hook; ang_sort_swap = ang_sort_swap_hook; /* Sort the array */ ang_sort(who, &why, n); /* Sort by kills (and level) */ if (query == 'k') { why = 4; query = 'y'; } /* Catch "escape" */ if (query != 'y') { /* Free the "who" array */ C_KILL(who, max_r_idx, u16b); return; } /* Sort if needed */ if (why == 4) { /* Select the sort method */ ang_sort_comp = ang_sort_comp_hook; ang_sort_swap = ang_sort_swap_hook; /* Sort the array */ ang_sort(who, &why, n); } /* Start at the end */ i = n - 1; /* Scan the monster memory */ while (1) { /* Extract a race */ r_idx = who[i]; /* Hack -- Auto-recall */ monster_race_track(r_idx); /* Hack -- Handle stuff */ handle_stuff(); /* Interact */ while (1) { /* Recall */ if (recall) { /* Save the screen */ screen_save(); /* Recall on screen */ screen_roff(who[i], 0); } /* Hack -- Begin the prompt */ roff_top(r_idx); /* Hack -- Complete the prompt */ Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]"); /* Command */ query = inkey(); /* Unrecall */ if (recall) { /* Restore */ screen_load(); } /* Normal commands */ if (query != 'r') break; /* Toggle recall */ recall = !recall; } /* Stop scanning */ if (query == ESCAPE) break; /* Move to "prev" monster */ if (query == '-') { if (++i == n) { i = 0; if (!expand_list) break; } } /* Move to "next" monster */ else { if (i-- == 0) { i = n - 1; if (!expand_list) break; } } } /* Free the "who" array */ C_KILL(who, max_r_idx, u16b); /* Re-display the identity */ prt(buf, 0, 0); }
/* * Apply magic to an item or turn it into an artifact. -Bernd- */ static void wiz_reroll_item(object_type *o_ptr) { object_type forge; object_type *q_ptr; char ch; bool changed = FALSE; /* Hack -- leave normal artifacts alone */ if ((o_ptr->flags3 & TR3_INSTA_ART) && (o_ptr->activate > 128)) return; /* Get local object */ q_ptr = &forge; /* Copy the object */ object_copy(q_ptr, o_ptr); /* Main loop. Ask for magification and artifactification */ while (TRUE) { /* Display full item debug information */ wiz_display_item(q_ptr); /* Ask wizard what to do. */ if (!get_com("[a]ccept, [w]orthless, [n]ormal, [e]xcellent, [s]pecial? ", &ch)) { } /* Create/change it! */ if (ch == 'A' || ch == 'a') { changed = TRUE; break; } switch (ch) { /* Apply bad magic, but first clear object */ case 'w': case 'W': { object_prep(q_ptr, o_ptr->k_idx); apply_magic(q_ptr, p_ptr->depth, 0, OC_FORCE_BAD, FALSE); break; } /* Apply normal magic, but first clear object */ case 'n': case 'N': { object_prep(q_ptr, o_ptr->k_idx); apply_magic(q_ptr, p_ptr->depth, 0, OC_NORMAL, FALSE); break; } /* Apply great magic, but first clear object */ case 'e': case 'E': { object_prep(q_ptr, o_ptr->k_idx); apply_magic(q_ptr, p_ptr->depth, 30, OC_FORCE_GOOD, FALSE); break; } case 's': case 'S': { object_prep(q_ptr, o_ptr->k_idx); /* Make a random artifact */ (void)create_artifact(q_ptr, FALSE, FALSE); break; } } } /* Notice change */ if (changed) { /* Restore the position information */ q_ptr->iy = o_ptr->iy; q_ptr->ix = o_ptr->ix; q_ptr->next_o_idx = o_ptr->next_o_idx; q_ptr->marked = o_ptr->marked; /* Apply changes */ object_copy(o_ptr, q_ptr); /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); /* Combine / Reorder the pack (later) */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_PLAYRES); } }
/* * Allow the player to examine other sectors on the map */ void do_cmd_locate(void) { int dir, y1, x1, y2, x2; char tmp_val[80]; char out_val[160]; int wid, hgt; /* Get size */ get_screen_size(&wid, &hgt); /* Start at current panel */ y2 = y1 = panel_row_min; x2 = x1 = panel_col_min; /* Show panels until done */ while (1) { /* Describe the location */ if ((y2 == y1) && (x2 == x1)) { tmp_val[0] = '\0'; } else { sprintf(tmp_val, "%s%s of", ((y2 < y1) ? " North" : (y2 > y1) ? " South" : ""), ((x2 < x1) ? " West" : (x2 > x1) ? " East" : "")); } /* Prepare to ask which way to look */ sprintf(out_val, "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?", y2 / (hgt / 2), y2 % (hgt / 2), x2 / (wid / 2), x2 % (wid / 2), tmp_val); /* Assume no direction */ dir = 0; /* Get a direction */ while (!dir) { char command; /* Get a command (or Cancel) */ if (!get_com(out_val, &command, TRUE)) break; if (command == '5') break; /* Extract the action (if any) */ dir = get_keymap_dir(command); /* Error */ if (!dir) bell(); } /* No direction */ if (!dir) break; /* Apply the motion */ if (change_panel(ddy[dir], ddx[dir])) { y2 = panel_row_min; x2 = panel_col_min; } } /* Recenter the map around the player */ verify_panel(); /* Update stuff */ p_ptr->update |= (PU_MONSTERS); /* Redraw map */ p_ptr->redraw |= (PR_MAP); /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); /* Handle stuff */ handle_stuff(); }
/*! * @brief プレイヤーが詠唱中の呪術から一つを選んで停止する * @return なし */ bool stop_hex_spell(void) { int spell; char choice; char out_val[160]; bool flag = FALSE; int y = 1; int x = 20; int sp[MAX_KEEP]; if (!hex_spelling_any()) { #ifdef JP msg_print("呪文を詠唱していません。"); #else msg_print("You are casting no spell."); #endif return FALSE; } /* Stop all spells */ else if ((p_ptr->magic_num2[0] == 1) || (p_ptr->lev < 35)) { return stop_hex_spell_all(); } else { #ifdef JP strnfmt(out_val, 78, "どの呪文の詠唱を中断しますか?(呪文 %c-%c, 'l'全て, ESC)", I2A(0), I2A(p_ptr->magic_num2[0] - 1)); #else strnfmt(out_val, 78, "Which spell do you stop casting? (Spell %c-%c, 'l' to all, ESC)", I2A(0), I2A(p_ptr->magic_num2[0] - 1)); #endif screen_save(); while (!flag) { int n = 0; Term_erase(x, y, 255); prt(" 名前", y, x + 5); for (spell = 0; spell < 32; spell++) { if (hex_spelling(spell)) { Term_erase(x, y + n + 1, 255); put_str(format("%c) %s", I2A(n), do_spell(REALM_HEX, spell, SPELL_NAME)), y + n + 1, x + 2); sp[n++] = spell; } } if (!get_com(out_val, &choice, TRUE)) break; if (isupper(choice)) choice = tolower(choice); if (choice == 'l') /* All */ { screen_load(); return stop_hex_spell_all(); } if ((choice < I2A(0)) || (choice > I2A(p_ptr->magic_num2[0] - 1))) continue; flag = TRUE; } } screen_load(); if (flag) { int n = sp[A2I(choice)]; do_spell(REALM_HEX, n, SPELL_STOP); p_ptr->magic_num1[0] &= ~(1L << n); p_ptr->magic_num2[0]--; } /* Redraw status */ p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); p_ptr->redraw |= (PR_EXTRA | PR_HP | PR_MANA); return flag; }
/*! * @brief アイテムの質を選択して再生成する / * Apply magic to an item or turn it into an artifact. -Bernd- * @param o_ptr 再生成の対象となるアイテム情報の参照ポインタ * @return なし */ static void wiz_reroll_item(object_type *o_ptr) { object_type forge; object_type *q_ptr; char ch; bool changed = FALSE; /* Hack -- leave artifacts alone */ if (object_is_artifact(o_ptr)) return; /* Get local object */ q_ptr = &forge; /* Copy the object */ object_copy(q_ptr, o_ptr); /* Main loop. Ask for magification and artifactification */ while (TRUE) { /* Display full item debug information */ wiz_display_item(q_ptr); /* Ask wizard what to do. */ if (!get_com("[a]ccept, [w]orthless, [c]ursed, [n]ormal, [g]ood, [e]xcellent, [s]pecial? ", &ch, FALSE)) { /* Preserve wizard-generated artifacts */ if (object_is_fixed_artifact(q_ptr)) { a_info[q_ptr->name1].cur_num = 0; q_ptr->name1 = 0; } changed = FALSE; break; } /* Create/change it! */ if (ch == 'A' || ch == 'a') { changed = TRUE; break; } /* Preserve wizard-generated artifacts */ if (object_is_fixed_artifact(q_ptr)) { a_info[q_ptr->name1].cur_num = 0; q_ptr->name1 = 0; } switch(ch) { /* Apply bad magic, but first clear object */ case 'w': case 'W': { object_prep(q_ptr, o_ptr->k_idx); apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT | AM_CURSED); break; } /* Apply bad magic, but first clear object */ case 'c': case 'C': { object_prep(q_ptr, o_ptr->k_idx); apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_CURSED); break; } /* Apply normal magic, but first clear object */ case 'n': case 'N': { object_prep(q_ptr, o_ptr->k_idx); apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART); break; } /* Apply good magic, but first clear object */ case 'g': case 'G': { object_prep(q_ptr, o_ptr->k_idx); apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART | AM_GOOD); break; } /* Apply great magic, but first clear object */ case 'e': case 'E': { object_prep(q_ptr, o_ptr->k_idx); apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT); break; } /* Apply special magic, but first clear object */ case 's': case 'S': { object_prep(q_ptr, o_ptr->k_idx); apply_magic(q_ptr, dun_level, AM_GOOD | AM_GREAT | AM_SPECIAL); /* Failed to create artifact; make a random one */ if (!object_is_artifact(q_ptr)) create_artifact(q_ptr, FALSE); break; } } q_ptr->iy = o_ptr->iy; q_ptr->ix = o_ptr->ix; q_ptr->next_o_idx = o_ptr->next_o_idx; q_ptr->marked = o_ptr->marked; } /* Notice change */ if (changed) { /* Apply changes */ object_copy(o_ptr, q_ptr); /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); /* Combine / Reorder the pack (later) */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER); } }
void b__misc_effects(integer effect, boolean *idented, treas_ptr item_ptr) { integer i3, i4, loss, dur; integer dumy,y_dumy,x_dumy; integer y,x; stat_set tstat; boolean ident; char dir; ident = *idented; switch (effect) { case 1 : /*{Silver Cross}*/ msg_print("You feel secure..."); protect_evil(); ident = true; break; case 2 : /*{Gold Cross}*/ ident = zap_area(0x0400,100,c_hp); break; case 3 : /*{Mithril Cross}*/ x = char_row; y = char_col; ident = summon_undead(&x,&y); break; case 4 : /*{Cross}*/ x = char_row; y = char_col; ident = summon_demon(&x,&y); break; case 5 : /*{Cross}*/ strcat(item_ptr->data.name, "(Empty)"); msg_print("You free a Djinni from the bottle!"); msg_print("He grants you a wish..."); msg_print("'I will raise one of your stats by two...'"); msg_print("'Which stat would you like to raise?'"); ident = (get_com("1=str 2=int 3=wis 4=dex 5=con 6=cha",&dir)); if ((dir > '0') && (dir < '7')) { tstat = (integer)dir-49; ident = gain_stat(tstat,"X"); ident = gain_stat(tstat," and x2, too!"); } else { msg_print("Oh well, maybe next time."); } break; case 6 : /*{ Corked Bottle of Demons }*/ msg_print("You release several demons!"); x = char_row; y = char_col; for (i3 = 1; i3 <= 4; i3++) { summon_demon(&x,&y); } py.flags.paralysis += 2; strcat(item_ptr->data.name, "(Empty)"); ident = true; break; case 7 : ident = create_water(char_row,char_col); break; case 8 : ident = destroy_water(char_row,char_col); break; case 9 : msg_print("Many Undead appear!"); x = char_row; y = char_col; for (i3 = 1; i3 <= 8; i3++) { ident = summon_undead(&x,&y); } py.flags.paralysis += 2; break; case 10 : msg_print("Many Demons appear!"); x = char_row; y = char_col; for (i3 = 1; i3 <= 8; i3++) { ident = summon_demon(&x,&y); } py.flags.paralysis += 2; ident = true; break; case 11: //with py.stat do; for (tstat = STR; tstat <= CHR; tstat++) { if (restore_stat(tstat,"X")) { ident = true; } } if (hp_player(damroll("6d7"),"a statue.")) { ident = true; } //with py.flags do; if (PF.slow > 0) { ident = true; PF.slow = 1; } /* bitwise or, otherwise it shortcuts and not everything happens */ if (cure_me(&PF.blind) | cure_me(&PF.poisoned) | cure_me(&PF.confused) | cure_me(&PF.afraid) | restore_level()) { ident = true; } if (ident) { msg_print("The statue fills you with life and all maladies are cured."); } break; case 12: ident = true; break; case 13 : redraw = true; wizard_light(); for (i3 = (char_col + 1); i3 <= (char_col - 1); i3++) { for (i4 = (char_row + 1); i4 <= (char_row - 1); i4++) { if (test_light(i4,i3)) { redraw = false; } } } if (redraw) { wizard_light(); } break; case 14: ident = zap_area(0,2,c_speed); break; case 15: //with py.misc do; loss = 0; for (i3 = 1; i3 <= 6; i3++) { loss += (PM.money[i3]-PM.money[i3] / 2) * COIN_WEIGHT; PM.money[i3] /= 2; } inven_weight -= loss; reset_total_cash(); msg_print("most of your money turns to dust!"); prt_gold(); prt_weight(); ident = true; break; case 16 : //with py.misc do; if (PM.cmana < PM.mana) { PM.cmana = PM.mana; ident = true; msg_print("Your feel your head clear..."); } break; case 17 : ident = item_petrify(); break; case 18 : strcpy(item_ptr->data.damage,"50d5"); item_ptr->data.cost = -1; msg_print("Click!"); ident = true; break; case 19 : ident = detect_creatures(c_monster); break; case 20 : ident = zap_area(0x0004,60,c_hp); break; case 21 : ident = unlight_area(char_row,char_col); break; case 22 : if (d__get_dir("Which direction?",&dur,&dumy,&y_dumy,&x_dumy)) { i3 = char_row; i4 = char_col; ident = fire_ball(3,dur,i3,i4,40,"Acid Ball"); } else { item_ptr->data.p1++; } break; case 23 : ident = detect_creatures(c_invisible); break; case 24 : ident = ident_spell(); break; case 25 : ident = light_area(char_row,char_col); break; case 26 : for (i3 = 1; i3 <= randint(4); i3++) { /*{who"s the idiot who wrote these things anyhow? }*/ y = char_row; x = char_col; if (is_in(cave[y][x].fval, water_set)) { summon_water_monster(&y,&x,false); } else { summon_land_monster(&y,&x,false); } } ident = true; break; case 27 : if (remove_curse()) { msg_print("Your junk glows black for a moment..."); ident = true; } break; case 28 : ident = destroy_area(char_row,char_col); break; case 29 : py.flags.word_recall = 10 + randint(10); msg_print("You feel dizzy for a moment..."); ident = true; break; case 30 : msg_print("The teeth flare into flames."); py.flags.ring_fire += 3+randint(3); ident = true; break; case 31 : msg_print("The Demon teeth try to possess you..."); lose_exp(100); change_rep(-10); ident = true; break; default: msg_print("Todd Gardiner is fat!"); ident = true; break; } *idented = ident; };
/* * Ask for and parse a "debug command" * * The "p_ptr->command_arg" may have been set. */ void do_cmd_debug(void) { int py = p_ptr->py; int px = p_ptr->px; char cmd; /* Get a "debug command" */ if (!get_com("Debug Command: ", &cmd)) return; /* Analyze the command */ switch (cmd) { /* Ignore */ case ESCAPE: case ' ': case '\n': case '\r': { break; } #ifdef ALLOW_SPOILERS /* Hack -- Generate Spoilers */ case '"': { do_cmd_spoilers(); break; } #endif /* Hack -- Help */ case '?': { do_cmd_help(); break; } /* Cure all maladies */ case 'a': { do_cmd_wiz_cure_all(); break; } /* Teleport to target */ case 'b': { do_cmd_wiz_bamf(); break; } /* Create any object */ case 'c': { wiz_create_item(); break; } /* Create an artifact */ case 'C': { wiz_create_artifact(p_ptr->command_arg); break; } /* Detect everything */ case 'd': { detect_all(); break; } /* Edit character */ case 'e': { do_cmd_wiz_change(); break; } /* View item info */ case 'f': { (void)identify_fully(); break; } /* Good Objects */ case 'g': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; acquirement(py, px, p_ptr->command_arg, FALSE); break; } /* Hitpoint rerating */ case 'h': { do_cmd_rerate(); break; } /* Identify */ case 'i': { (void)ident_spell(); break; } /* Go up or down in the dungeon */ case 'j': { do_cmd_wiz_jump(); break; } /* Self-Knowledge */ case 'k': { self_knowledge(); break; } /* Learn about objects */ case 'l': { do_cmd_wiz_learn(); break; } /* Magic Mapping */ case 'm': { map_area(); break; } /* Summon Named Monster */ case 'n': { do_cmd_wiz_named(p_ptr->command_arg, TRUE); break; } /* Object playing routines */ case 'o': { do_cmd_wiz_play(); break; } /* Phase Door */ case 'p': { teleport_player(10); break; } /* Query the dungeon */ case 'q': { do_cmd_wiz_query(); break; } /* Summon Random Monster(s) */ case 's': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; do_cmd_wiz_summon(p_ptr->command_arg); break; } /* Teleport */ case 't': { teleport_player(100); break; } /* Un-hide all monsters */ case 'u': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 255; do_cmd_wiz_unhide(p_ptr->command_arg); break; } /* Very Good Objects */ case 'v': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; acquirement(py, px, p_ptr->command_arg, TRUE); break; } /* Wizard Light the Level */ case 'w': { wiz_lite(); break; } /* Increase Experience */ case 'x': { if (p_ptr->command_arg) { gain_exp(p_ptr->command_arg); } else { gain_exp(p_ptr->exp + 1); } break; } /* Zap Monsters (Genocide) */ case 'z': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = MAX_SIGHT; do_cmd_wiz_zap(p_ptr->command_arg); break; } /* Oops */ default: { msg_print("That is not a valid debug command."); break; } } }