/* * Go to any level */ static void do_cmd_wiz_jump(void) { /* Ask for level */ if (p_ptr->command_arg <= 0) { char ppp[80]; char tmp_val[160]; /* Prompt */ sprintf(ppp, "Jump to level (0-%d): ", MAX_DEPTH-1); /* Default */ sprintf(tmp_val, "%d", p_ptr->depth); /* Ask for a level */ if (!get_string(ppp, tmp_val, 10)) return; /* Extract request */ p_ptr->command_arg = atoi(tmp_val); } /* Paranoia */ if (p_ptr->command_arg < 0) p_ptr->command_arg = 0; /* Paranoia */ if (p_ptr->command_arg > MAX_DEPTH - 1) p_ptr->command_arg = MAX_DEPTH - 1; /* Accept request */ msg_format("You jump to dungeon level %d.", p_ptr->command_arg); if (autosave_l) do_cmd_save_game(TRUE); /* Change level */ p_ptr->depth = p_ptr->command_arg; leaving_quest = p_ptr->inside_quest; /* Leaving an 'only once' quest marks it as failed */ if (leaving_quest && (quest[leaving_quest].flags & QUEST_FLAG_ONCE) && (quest[leaving_quest].status == QUEST_STATUS_TAKEN)) { quest[leaving_quest].status = QUEST_STATUS_FAILED; } p_ptr->inside_quest = 0; /* Leaving */ p_ptr->leaving = TRUE; }
static void cmd_racial_power_aux(const mutation_type *mut_ptr) { s16b plev = p_ptr->lev; int dir = 0; if (racial_aux(mut_ptr->level, mut_ptr->cost, mut_ptr->stat, mut_ptr->diff)) { switch (p_ptr->prace) { case RACE_DWARF: { msg_print("You examine your surroundings."); (void)detect_traps(); (void)detect_doors(); (void)detect_stairs(); break; } case RACE_HOBBIT: { object_type *q_ptr; object_type forge; /* Get local object */ q_ptr = &forge; /* Create the food ration */ object_prep(q_ptr, 21); /* Drop the object from heaven */ (void)drop_near(q_ptr, -1, p_ptr->py, p_ptr->px); msg_print("You cook some food."); break; } case RACE_GNOME: { msg_print("Blink!"); teleport_player(10 + plev); break; } case RACE_HALF_ORC: { msg_print("You play tough."); (void)set_afraid(0); break; } case RACE_HALF_TROLL: { msg_print("RAAAGH!"); if (!p_ptr->shero) { (void)hp_player(30); } (void)set_afraid(0); (void)set_shero(p_ptr->shero + 10 + randint1(plev)); break; } case RACE_AMBERITE: { /* Hack - use levels to choose ability */ if (mut_ptr->level == 30) { msg_print("You picture the Pattern in your mind and walk it..."); (void)set_poisoned(0); (void)set_image(0); (void)set_stun(0); (void)set_cut(0); (void)set_blind(0); (void)set_afraid(0); (void)do_res_stat(A_STR, 200); (void)do_res_stat(A_INT, 200); (void)do_res_stat(A_WIS, 200); (void)do_res_stat(A_DEX, 200); (void)do_res_stat(A_CON, 200); (void)do_res_stat(A_CHR, 200); (void)restore_level(); } else if (mut_ptr->level == 40) { /* No effect in arena or quest */ if (p_ptr->inside_quest) { msg_print("There is no effect."); } else { msg_print("You start walking around. Your surroundings change."); if (autosave_l) do_cmd_save_game(TRUE); /* Leaving */ p_ptr->leaving = TRUE; } } break; } case RACE_BARBARIAN: { msg_print("Raaagh!"); if (!p_ptr->shero) { (void)hp_player(30); } (void)set_afraid(0); (void)set_shero(p_ptr->shero + 10 + randint1(plev)); break; } case RACE_HALF_OGRE: { msg_print("You carefully set an explosive rune..."); (void)explosive_rune(); break; } case RACE_HALF_GIANT: { if (!get_aim_dir(&dir)) break; msg_print("You bash at a stone wall."); (void)wall_to_mud(dir); break; } case RACE_HALF_TITAN: { msg_print("You examine your foes..."); (void)probing(); break; } case RACE_CYCLOPS: { if (!get_aim_dir(&dir)) break; msg_print("You throw a huge boulder."); (void)fire_bolt(GF_MISSILE, dir, (3 * plev) / 2); break; } case RACE_YEEK: { if (!get_aim_dir(&dir)) break; msg_print("You make a horrible scream!"); (void)fear_monster(dir, plev); break; } case RACE_KLACKON: { if (!get_aim_dir(&dir)) break; msg_print("You spit acid."); if (plev < 25) (void)fire_bolt(GF_ACID, dir, plev); else (void)fire_ball(GF_ACID, dir, plev, 2); break; } case RACE_KOBOLD: { if (!get_aim_dir(&dir)) break; msg_print("You throw a dart of poison."); (void)fire_bolt(GF_POIS, dir, plev); break; } case RACE_NIBELUNG: { msg_print("You examine your surroundings."); (void)detect_traps(); (void)detect_doors(); (void)detect_stairs(); break; } case RACE_DARK_ELF: { if (!get_aim_dir(&dir)) break; msg_print("You cast a magic missile."); (void)fire_bolt_or_beam(10, GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4)); break; } case RACE_DRACONIAN: { int Type = (one_in_(3) ? GF_COLD : GF_FIRE); cptr Type_desc = ((Type == GF_COLD) ? "cold" : "fire"); if (randint1(100) < plev) { switch (p_ptr->pclass) { case CLASS_WARRIOR: case CLASS_RANGER: if (one_in_(3)) { Type = GF_MISSILE; Type_desc = "the elements"; } else { Type = GF_SHARDS; Type_desc = "shards"; } break; case CLASS_MAGE: case CLASS_WARRIOR_MAGE: case CLASS_HIGH_MAGE: if (one_in_(3)) { Type = GF_MANA; Type_desc = "mana"; } else { Type = GF_DISENCHANT; Type_desc = "disenchantment"; } break; case CLASS_CHAOS_WARRIOR: if (!one_in_(3)) { Type = GF_CONFUSION; Type_desc = "confusion"; } else { Type = GF_CHAOS; Type_desc = "chaos"; } break; case CLASS_MONK: if (!one_in_(3)) { Type = GF_CONFUSION; Type_desc = "confusion"; } else { Type = GF_SOUND; Type_desc = "sound"; } break; case CLASS_MINDCRAFTER: if (!one_in_(3)) { Type = GF_CONFUSION; Type_desc = "confusion"; } else { Type = GF_PSI; Type_desc = "mental energy"; } break; case CLASS_PRIEST: case CLASS_PALADIN: if (one_in_(3)) { Type = GF_HELL_FIRE; Type_desc = "hellfire"; } else { Type = GF_HOLY_FIRE; Type_desc = "holy fire"; } break; case CLASS_ROGUE: if (one_in_(3)) { Type = GF_DARK; Type_desc = "darkness"; } else { Type = GF_POIS; Type_desc = "poison"; } break; } } if (!get_aim_dir(&dir)) break; msg_format("You breathe %s.", Type_desc); (void)fire_ball(Type, dir, plev * 2, (plev / 15) + 1); break; } case RACE_MIND_FLAYER: { if (!get_aim_dir(&dir)) break; else { msg_print("You concentrate and your eyes glow red..."); (void)fire_bolt(GF_PSI, dir, plev); } break; } case RACE_IMP: { if (!get_aim_dir(&dir)) break; if (plev >= 30) { msg_print("You cast a ball of fire."); (void)fire_ball(GF_FIRE, dir, plev, 2); } else { msg_print("You cast a bolt of fire."); (void)fire_bolt(GF_FIRE, dir, plev); } break; } case RACE_GOLEM: { (void)set_shield(p_ptr->shield + rand_range(30, 50)); break; } case RACE_SKELETON: case RACE_ZOMBIE: { msg_print("You attempt to restore your lost energies."); (void)restore_level(); break; } case RACE_VAMPIRE: { int y, x, dummy; cave_type *c_ptr; /* Only works on adjacent monsters */ if (!get_rep_dir(&dir)) break; y = p_ptr->py + ddy[dir]; x = p_ptr->px + ddx[dir]; /* Paranoia */ if (!in_bounds2(y, x)) break; c_ptr = area(y, x); if (!c_ptr->m_idx) { msg_print("You bite into thin air!"); break; } msg_print("You grin and bare your fangs..."); dummy = plev + randint1(plev) * MAX(1, plev / 10); /* Dmg */ if (drain_gain_life(dir, dummy)) { /* Gain nutritional sustenance: 150/hp drained */ /* A Food ration gives 5000 food points (by contrast) */ /* Don't ever get more than "Full" this way */ /* But if we ARE Gorged, it won't cure us */ dummy = p_ptr->food + MIN(5000, 100 * dummy); if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */ (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy); } else msg_print("Yechh. That tastes foul."); break; } case RACE_SPECTRE: { msg_print("You emit an eldritch howl!"); if (!get_aim_dir(&dir)) break; (void)fear_monster(dir, plev); break; } case RACE_SPRITE: { msg_print("You throw some magic dust..."); if (plev < 25) (void)sleep_monsters_touch(); else (void)sleep_monsters(); break; } case RACE_GHOUL: { if (mut_ptr->level == 30) { /* Sense living */ (void)detect_monsters_living(); } else { eat_corpse(); } break; } default: msg_print("This race has no bonus power."); p_ptr->energy_use = 0; } } /* Redraw mana and hp */ p_ptr->redraw |= (PR_HP | PR_MANA); /* Window stuff */ p_ptr->window |= (PW_PLAYER | PW_SPELL); }
/*! * @brief 任意のダンジョン及び階層に飛ぶ / * Go to any level * @return なし */ static void do_cmd_wiz_jump(void) { /* Ask for level */ if (command_arg <= 0) { char ppp[80]; char tmp_val[160]; int tmp_dungeon_type; /* Prompt */ sprintf(ppp, "Jump which dungeon : "); /* Default */ sprintf(tmp_val, "%d", dungeon_type); /* Ask for a level */ if (!get_string(ppp, tmp_val, 2)) return; tmp_dungeon_type = atoi(tmp_val); if (!d_info[tmp_dungeon_type].maxdepth || (tmp_dungeon_type > max_d_idx)) tmp_dungeon_type = DUNGEON_ANGBAND; /* Prompt */ sprintf(ppp, "Jump to level (0, %d-%d): ", d_info[tmp_dungeon_type].mindepth, d_info[tmp_dungeon_type].maxdepth); /* Default */ sprintf(tmp_val, "%d", dun_level); /* Ask for a level */ if (!get_string(ppp, tmp_val, 10)) return; /* Extract request */ command_arg = atoi(tmp_val); dungeon_type = tmp_dungeon_type; } /* Paranoia */ if (command_arg < d_info[dungeon_type].mindepth) command_arg = 0; /* Paranoia */ if (command_arg > d_info[dungeon_type].maxdepth) command_arg = d_info[dungeon_type].maxdepth; /* Accept request */ msg_format("You jump to dungeon level %d.", command_arg); if (autosave_l) do_cmd_save_game(TRUE); /* Change level */ dun_level = command_arg; prepare_change_floor_mode(CFM_RAND_PLACE); if (!dun_level) dungeon_type = 0; p_ptr->inside_arena = FALSE; p_ptr->wild_mode = FALSE; leave_quest_check(); if (record_stair) do_cmd_write_nikki(NIKKI_WIZ_TELE,0,NULL); p_ptr->inside_quest = 0; p_ptr->energy_use = 0; /* Prevent energy_need from being too lower than 0 */ p_ptr->energy_need = 0; /* * Clear all saved floors * and create a first saved floor */ prepare_change_floor_mode(CFM_FIRST_FLOOR); /* Leaving */ p_ptr->leaving = TRUE; }
// TODO: Hookify this void close_game(void) { char buf[1024]; /* Handle stuff */ handle_stuff(); /* Flush the messages */ message_flush(); /* Flush the input */ flush(); /* No suspending now */ signals_ignore_tstp(); #ifndef AVT_HOOKIFY_EXIT /* Hack -- Increase "icky" depth */ character_icky++; /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw"); /* Grab permissions */ safe_setuid_grab(); /* Open the high score file, for reading/writing */ highscore_fd = fd_open(buf, O_RDWR); /* Drop permissions */ safe_setuid_drop(); /* Handle death */ if (p_ptr->is_dead) { /* Auxiliary routine */ close_game_aux(); } /* Still alive */ else { /* Save the game */ do_cmd_save_game(); /* Prompt for scores XXX XXX XXX */ prt("Press Return (or Escape).", 0, 40); /* Predict score (or ESCAPE) */ if (inkey() != ESCAPE) predict_score(); } /* Shut the high score file */ fd_close(highscore_fd); /* Forget the high score fd */ highscore_fd = -1; /* Hack -- Decrease "icky" depth */ character_icky--; #endif /* Allow suspending now */ signals_handle_tstp(); }