X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fspells3.c;h=6f92fd83f3fd0781e4ad3b01570b108af532af08;hb=00f341adda94315aae0c3543ec4f713473d02186;hp=3a22045b619d1a9c4b26a22c5eb139924f7b2a83;hpb=acfedf5b4b5fac4863648d12c38bd5267bb7e5a3;p=hengband%2Fhengband.git diff --git a/src/spells3.c b/src/spells3.c index 3a22045b6..ba0e2825d 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -12,45 +12,20 @@ */ #include "angband.h" +#include "floor.h" +#include "object-hook.h" +#include "melee.h" +#include "player-status.h" +#include "projection.h" +#include "spells-summon.h" +#include "quest.h" +#include "artifact.h" +#include "avatar.h" + /*! テレポート先探索の試行数 / Maximum number of tries for teleporting */ #define MAX_TRIES 100 -/*! 能力値現象の基本確率(1 / HURT_CHANCE) / 1/x chance of reducing stats (for elemental attacks) */ -#define HURT_CHANCE 16 - -/*! - * @brief 指定されたマスがモンスターのテレポート可能先かどうかを判定する。 - * @param m_idx モンスターID - * @param y 移動先Y座標 - * @param x 移動先X座標 - * @param mode オプション - * @return テレポート先として妥当ならばtrue - */ -static bool cave_monster_teleportable_bold(MONSTER_IDX m_idx, int y, int x, BIT_FLAGS mode) -{ - monster_type *m_ptr = &m_list[m_idx]; - cave_type *c_ptr = &cave[y][x]; - feature_type *f_ptr = &f_info[c_ptr->feat]; - - /* Require "teleportable" space */ - if (!have_flag(f_ptr->flags, FF_TELEPORTABLE)) return FALSE; - - if (c_ptr->m_idx && (c_ptr->m_idx != m_idx)) return FALSE; - if (player_bold(y, x)) return FALSE; - - /* Hack -- no teleport onto glyph of warding */ - if (is_glyph_grid(c_ptr)) return FALSE; - if (is_explosive_rune_grid(c_ptr)) return FALSE; - - if (!(mode & TELEPORT_PASSIVE)) - { - if (!monster_can_cross_terrain(c_ptr->feat, &r_info[m_ptr->r_idx], 0)) return FALSE; - } - - return TRUE; -} - /*! * @brief モンスターのテレポートアウェイ処理 / @@ -63,9 +38,9 @@ static bool cave_monster_teleportable_bold(MONSTER_IDX m_idx, int y, int x, BIT_ * Attempt to move the monster at least "dis/2" grids away. * But allow variation to prevent infinite loops. */ -bool teleport_away(MONSTER_IDX m_idx, int dis, BIT_FLAGS mode) +bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode) { - int oy, ox, d, i, min; + POSITION oy, ox, d, i, min; int tries = 0; POSITION ny = 0, nx = 0; @@ -76,7 +51,6 @@ bool teleport_away(MONSTER_IDX m_idx, int dis, BIT_FLAGS mode) /* Paranoia */ if (!m_ptr->r_idx) return (FALSE); - /* Save the old location */ oy = m_ptr->fy; ox = m_ptr->fx; @@ -117,7 +91,7 @@ bool teleport_away(MONSTER_IDX m_idx, int dis, BIT_FLAGS mode) /* No teleporting into vaults and such */ if (!(p_ptr->inside_quest || p_ptr->inside_arena)) - if (cave[ny][nx].info & CAVE_ICKY) continue; + if (grid_array[ny][nx].info & CAVE_ICKY) continue; /* This grid looks good */ look = FALSE; @@ -136,14 +110,13 @@ bool teleport_away(MONSTER_IDX m_idx, int dis, BIT_FLAGS mode) if (tries > MAX_TRIES) return (FALSE); } - /* Sound */ sound(SOUND_TPOTHER); /* Update the old location */ - cave[oy][ox].m_idx = 0; + grid_array[oy][ox].m_idx = 0; /* Update the new location */ - cave[ny][nx].m_idx = m_idx; + grid_array[ny][nx].m_idx = m_idx; /* Move the monster */ m_ptr->fy = ny; @@ -152,13 +125,8 @@ bool teleport_away(MONSTER_IDX m_idx, int dis, BIT_FLAGS mode) /* Forget the counter target */ reset_target(m_ptr); - /* Update the monster (new location) */ - update_mon(m_idx, TRUE); - - /* Redraw the old grid */ + update_monster(m_idx, TRUE); lite_spot(oy, ox); - - /* Redraw the new grid */ lite_spot(ny, nx); if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) @@ -180,23 +148,21 @@ bool teleport_away(MONSTER_IDX m_idx, int dis, BIT_FLAGS mode) */ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, BIT_FLAGS mode) { - int ny, nx, oy, ox, d, i, min; + POSITION ny, nx, oy, ox; + int d, i, min; int attempts = 500; - int dis = 2; + POSITION dis = 2; bool look = TRUE; monster_type *m_ptr = &m_list[m_idx]; /* Paranoia */ - if (!m_ptr->r_idx) return; + if(!m_ptr->r_idx) return; /* "Skill" test */ - if (randint1(100) > power) return; + if(randint1(100) > power) return; - /* Initialize */ ny = m_ptr->fy; nx = m_ptr->fx; - - /* Save the old location */ oy = m_ptr->fy; ox = m_ptr->fx; @@ -227,7 +193,7 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue; /* No teleporting into vaults and such */ - /* if (cave[ny][nx].info & (CAVE_ICKY)) continue; */ + /* if (grid_array[ny][nx].info & (CAVE_ICKY)) continue; */ /* This grid looks good */ look = FALSE; @@ -245,26 +211,20 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, if (attempts < 1) return; - /* Sound */ sound(SOUND_TPOTHER); /* Update the old location */ - cave[oy][ox].m_idx = 0; + grid_array[oy][ox].m_idx = 0; /* Update the new location */ - cave[ny][nx].m_idx = m_idx; + grid_array[ny][nx].m_idx = m_idx; /* Move the monster */ m_ptr->fy = ny; m_ptr->fx = nx; - /* Update the monster (new location) */ - update_mon(m_idx, TRUE); - - /* Redraw the old grid */ + update_monster(m_idx, TRUE); lite_spot(oy, ox); - - /* Redraw the new grid */ lite_spot(ny, nx); if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) @@ -272,56 +232,6 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, } /*! - * @brief 指定されたマスにプレイヤーがテレポート可能かどうかを判定する。 - * @param y 移動先Y座標 - * @param x 移動先X座標 - * @param mode オプション - * @return テレポート先として妥当ならばtrue - */ -bool cave_player_teleportable_bold(int y, int x, BIT_FLAGS mode) -{ - cave_type *c_ptr = &cave[y][x]; - feature_type *f_ptr = &f_info[c_ptr->feat]; - - /* Require "teleportable" space */ - if (!have_flag(f_ptr->flags, FF_TELEPORTABLE)) return FALSE; - - /* No magical teleporting into vaults and such */ - if (!(mode & TELEPORT_NONMAGICAL) && (c_ptr->info & CAVE_ICKY)) return FALSE; - - if (c_ptr->m_idx && (c_ptr->m_idx != p_ptr->riding)) return FALSE; - - /* don't teleport on a trap. */ - if (have_flag(f_ptr->flags, FF_HIT_TRAP)) return FALSE; - - if (!(mode & TELEPORT_PASSIVE)) - { - if (!player_can_enter(c_ptr->feat, 0)) return FALSE; - - if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP)) - { - if (!p_ptr->levitation && !p_ptr->can_swim) return FALSE; - } - - if (have_flag(f_ptr->flags, FF_LAVA) && !p_ptr->immune_fire && !IS_INVULN()) - { - /* Always forbid deep lava */ - if (have_flag(f_ptr->flags, FF_DEEP)) return FALSE; - - /* Forbid shallow lava when the player don't have levitation */ - if (!p_ptr->levitation) return FALSE; - } - - } - - return TRUE; -} - - -/*! テレポート最大距離 */ -#define MAX_TELEPORT_DISTANCE 200 - -/*! * @brief プレイヤーのテレポート先選定と移動処理 / * Teleport the player to a location up to "dis" grids away. * @param dis 基本移動距離 @@ -344,7 +254,7 @@ bool cave_player_teleportable_bold(int y, int x, BIT_FLAGS mode) * */ -bool teleport_player_aux(int dis, BIT_FLAGS mode) +bool teleport_player_aux(POSITION dis, BIT_FLAGS mode) { int candidates_at[MAX_TELEPORT_DISTANCE + 1]; int total_candidates, cur_candidates; @@ -441,7 +351,6 @@ bool teleport_player_aux(int dis, BIT_FLAGS mode) if (player_bold(y, x)) return FALSE; - /* Sound */ sound(SOUND_TELEPORT); #ifdef JP @@ -449,9 +358,7 @@ bool teleport_player_aux(int dis, BIT_FLAGS mode) msg_format("『こっちだぁ、%s』", p_ptr->name); #endif - /* Move the player */ (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); - return TRUE; } @@ -461,13 +368,11 @@ bool teleport_player_aux(int dis, BIT_FLAGS mode) * @param mode オプション * @return なし */ -void teleport_player(int dis, BIT_FLAGS mode) +void teleport_player(POSITION dis, BIT_FLAGS mode) { - int yy, xx; - - /* Save the old location */ - int oy = p_ptr->y; - int ox = p_ptr->x; + POSITION yy, xx; + POSITION oy = p_ptr->y; + POSITION ox = p_ptr->x; if (!teleport_player_aux(dis, mode)) return; @@ -476,7 +381,7 @@ void teleport_player(int dis, BIT_FLAGS mode) { for (yy = -1; yy < 2; yy++) { - MONSTER_IDX tmp_m_idx = cave[oy+yy][ox+xx].m_idx; + MONSTER_IDX tmp_m_idx = grid_array[oy+yy][ox+xx].m_idx; /* A monster except your mount may follow */ if (tmp_m_idx && (p_ptr->riding != tmp_m_idx)) @@ -505,13 +410,11 @@ void teleport_player(int dis, BIT_FLAGS mode) * @param dis テレポート距離 * @return なし */ -void teleport_player_away(MONSTER_IDX m_idx, int dis) +void teleport_player_away(MONSTER_IDX m_idx, POSITION dis) { - int yy, xx; - - /* Save the old location */ - int oy = p_ptr->y; - int ox = p_ptr->x; + POSITION yy, xx; + POSITION oy = p_ptr->y; + POSITION ox = p_ptr->x; if (!teleport_player_aux(dis, TELEPORT_PASSIVE)) return; @@ -520,7 +423,7 @@ void teleport_player_away(MONSTER_IDX m_idx, int dis) { for (yy = -1; yy < 2; yy++) { - IDX tmp_m_idx = cave[oy+yy][ox+xx].m_idx; + MONSTER_IDX tmp_m_idx = grid_array[oy+yy][ox+xx].m_idx; /* A monster except your mount or caster may follow */ if (tmp_m_idx && (p_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx)) @@ -559,7 +462,7 @@ void teleport_player_away(MONSTER_IDX m_idx, int dis) void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode) { POSITION y, x; - int dis = 0, ctr = 0; + POSITION dis = 0, ctr = 0; if (p_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL)) { @@ -579,7 +482,7 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode) } /* Accept any grid when wizard mode */ - if (p_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!cave[y][x].m_idx || (cave[y][x].m_idx == p_ptr->riding))) break; + if (p_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!grid_array[y][x].m_idx || (grid_array[y][x].m_idx == p_ptr->riding))) break; /* Accept teleportable floor grids */ if (cave_player_teleportable_bold(y, x, mode)) break; @@ -592,10 +495,7 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode) } } - /* Sound */ sound(SOUND_TELEPORT); - - /* Move the player */ (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); } @@ -603,10 +503,10 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode) void teleport_away_followable(MONSTER_IDX m_idx) { monster_type *m_ptr = &m_list[m_idx]; - int oldfy = m_ptr->fy; - int oldfx = m_ptr->fx; - bool old_ml = m_ptr->ml; - int old_cdis = m_ptr->cdis; + POSITION oldfy = m_ptr->fy; + POSITION oldfx = m_ptr->fx; + bool old_ml = m_ptr->ml; + POSITION old_cdis = m_ptr->cdis; teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L); @@ -617,9 +517,9 @@ void teleport_away_followable(MONSTER_IDX m_idx) if ((p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR)) follow = TRUE; else { - u32b flgs[TR_FLAG_SIZE]; + BIT_FLAGS flgs[TR_FLAG_SIZE]; object_type *o_ptr; - int i; + INVENTORY_IDX i; for (i = INVEN_RARM; i < INVEN_TOTAL; i++) { @@ -653,6 +553,32 @@ void teleport_away_followable(MONSTER_IDX m_idx) } +bool teleport_level_other(player_type *creature_ptr) +{ + MONSTER_IDX target_m_idx; + monster_type *m_ptr; + monster_race *r_ptr; + GAME_TEXT m_name[MAX_NLEN]; + + if (!target_set(TARGET_KILL)) return FALSE; + target_m_idx = grid_array[target_row][target_col].m_idx; + if (!target_m_idx) return TRUE; + if (!player_has_los_bold(target_row, target_col)) return TRUE; + if (!projectable(creature_ptr->y, creature_ptr->x, target_row, target_col)) return TRUE; + m_ptr = &m_list[target_m_idx]; + r_ptr = &r_info[m_ptr->r_idx]; + monster_desc(m_name, m_ptr, 0); + msg_format(_("%^sの足を指さした。", "You gesture at %^s's feet."), m_name); + + if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) || + (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > creature_ptr->lev + randint1(60))) + { + msg_format(_("しかし効果がなかった!", "%^s is unaffected!"), m_name); + } + else teleport_level(target_m_idx); + return TRUE; +} + /*! * @brief プレイヤー及びモンスターをレベルテレポートさせる / * Teleport the player one level up or down (random when legal) @@ -662,7 +588,7 @@ void teleport_away_followable(MONSTER_IDX m_idx) void teleport_level(MONSTER_IDX m_idx) { bool go_up; - char m_name[160]; + GAME_TEXT m_name[160]; bool see_m = TRUE; if (m_idx <= 0) /* To player */ @@ -703,7 +629,7 @@ void teleport_level(MONSTER_IDX m_idx) } /* Down only */ - if ((ironman_downward && (m_idx <= 0)) || (dun_level <= d_info[dungeon_type].mindepth)) + if ((ironman_downward && (m_idx <= 0)) || (dun_level <= d_info[p_ptr->dungeon_idx].mindepth)) { #ifdef JP if (see_m) msg_format("%^sは床を突き破って沈んでいく。", m_name); @@ -714,7 +640,7 @@ void teleport_level(MONSTER_IDX m_idx) { if (!dun_level) { - dungeon_type = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon; + p_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon; p_ptr->oldpy = p_ptr->y; p_ptr->oldpx = p_ptr->x; } @@ -725,7 +651,7 @@ void teleport_level(MONSTER_IDX m_idx) if (!dun_level) { - dun_level = d_info[dungeon_type].mindepth; + dun_level = d_info[p_ptr->dungeon_idx].mindepth; prepare_change_floor_mode(CFM_RAND_PLACE); } else @@ -739,7 +665,7 @@ void teleport_level(MONSTER_IDX m_idx) } /* Up only */ - else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth)) + else if (quest_number(dun_level) || (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) { #ifdef JP if (see_m) msg_format("%^sは天井を突き破って宙へ浮いていく。", m_name); @@ -795,7 +721,7 @@ void teleport_level(MONSTER_IDX m_idx) if (m_idx <= 0) /* To player */ { /* Never reach this code on the surface */ - /* if (!dun_level) dungeon_type = p_ptr->recall_dungeon; */ + /* if (!dun_level) p_ptr->dungeon_idx = p_ptr->recall_dungeon; */ if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL); @@ -818,7 +744,7 @@ void teleport_level(MONSTER_IDX m_idx) if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) { - char m2_name[80]; + char m2_name[MAX_NLEN]; monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE); do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_TELE_LEVEL, m2_name); @@ -827,7 +753,6 @@ void teleport_level(MONSTER_IDX m_idx) delete_monster_idx(m_idx); } - /* Sound */ sound(SOUND_TPLEVEL); } @@ -839,7 +764,7 @@ void teleport_level(MONSTER_IDX m_idx) * @param x コンソールX座標 * @return 選択されたダンジョンID */ -DUNGEON_IDX choose_dungeon(cptr note, POSITION y, POSITION x) +DUNGEON_IDX choose_dungeon(concptr note, POSITION y, POSITION x) { DUNGEON_IDX select_dungeon; DUNGEON_IDX i; @@ -859,7 +784,7 @@ DUNGEON_IDX choose_dungeon(cptr note, POSITION y, POSITION x) } /* Allocate the "dun" array */ - C_MAKE(dun, max_d_idx, s16b); + C_MAKE(dun, max_d_idx, DUNGEON_IDX); screen_save(); for(i = 1; i < max_d_idx; i++) @@ -893,7 +818,7 @@ DUNGEON_IDX choose_dungeon(cptr note, POSITION y, POSITION x) if ((i == ESCAPE) || !num) { /* Free the "dun" array */ - C_KILL(dun, max_d_idx, s16b); + C_KILL(dun, max_d_idx, DUNGEON_IDX); screen_load(); return 0; @@ -908,7 +833,7 @@ DUNGEON_IDX choose_dungeon(cptr note, POSITION y, POSITION x) screen_load(); /* Free the "dun" array */ - C_KILL(dun, max_d_idx, s16b); + C_KILL(dun, max_d_idx, DUNGEON_IDX); return select_dungeon; } @@ -920,7 +845,7 @@ DUNGEON_IDX choose_dungeon(cptr note, POSITION y, POSITION x) * @param turns 発動までのターン数 * @return 常にTRUEを返す */ -bool recall_player(TIME_EFFECT turns) +bool recall_player(player_type *creature_ptr, TIME_EFFECT turns) { /* * TODO: Recall the player to the last @@ -928,53 +853,82 @@ bool recall_player(TIME_EFFECT turns) */ /* Ironman option */ - if (p_ptr->inside_arena || ironman_downward) + if (creature_ptr->inside_arena || ironman_downward) { msg_print(_("何も起こらなかった。", "Nothing happens.")); return TRUE; } - if (dun_level && (max_dlv[dungeon_type] > dun_level) && !p_ptr->inside_quest && !p_ptr->word_recall) + if (dun_level && (max_dlv[p_ptr->dungeon_idx] > dun_level) && !creature_ptr->inside_quest && !creature_ptr->word_recall) { if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? "))) { - max_dlv[dungeon_type] = dun_level; + max_dlv[p_ptr->dungeon_idx] = dun_level; if (record_maxdepth) - do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, _("帰還のときに", "when recall from dungeon")); + do_cmd_write_nikki(NIKKI_TRUMP, p_ptr->dungeon_idx, _("帰還のときに", "when recall from dungeon")); } } - if (!p_ptr->word_recall) + if (!creature_ptr->word_recall) { if (!dun_level) { DUNGEON_IDX select_dungeon; select_dungeon = choose_dungeon(_("に帰還", "recall"), 2, 14); if (!select_dungeon) return FALSE; - p_ptr->recall_dungeon = select_dungeon; + creature_ptr->recall_dungeon = select_dungeon; } - p_ptr->word_recall = turns; + creature_ptr->word_recall = turns; msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged...")); - p_ptr->redraw |= (PR_STATUS); + creature_ptr->redraw |= (PR_STATUS); } else { - p_ptr->word_recall = 0; + creature_ptr->word_recall = 0; msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you...")); - p_ptr->redraw |= (PR_STATUS); + creature_ptr->redraw |= (PR_STATUS); } return TRUE; } -/*! - * @brief 帰還用メインルーチン - * @return 常にTRUEを返す - */ -bool word_of_recall(void) +bool free_level_recall(player_type *creature_ptr) { - return(recall_player(randint0(21) + 15)); + DUNGEON_IDX select_dungeon; + DEPTH max_depth; + QUANTITY amt; + + select_dungeon = choose_dungeon(_("にテレポート", "teleport"), 4, 0); + + if (!select_dungeon) return FALSE; + + max_depth = d_info[select_dungeon].maxdepth; + + /* Limit depth in Angband */ + if (select_dungeon == DUNGEON_ANGBAND) + { + if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED) max_depth = 98; + else if (quest[QUEST_SERPENT].status != QUEST_STATUS_FINISHED) max_depth = 99; + } + amt = get_quantity(format(_("%sの何階にテレポートしますか?", "Teleport to which level of %s? "), + d_name + d_info[select_dungeon].name), (QUANTITY)max_depth); + + if (amt > 0) + { + creature_ptr->word_recall = 1; + creature_ptr->recall_dungeon = select_dungeon; + max_dlv[creature_ptr->recall_dungeon] = ((amt > d_info[select_dungeon].maxdepth) ? d_info[select_dungeon].maxdepth : ((amt < d_info[select_dungeon].mindepth) ? d_info[select_dungeon].mindepth : amt)); + if (record_maxdepth) + do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, _("トランプタワーで", "at Trump Tower")); + + msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged...")); + + creature_ptr->redraw |= (PR_STATUS); + return TRUE; + } + return FALSE; } + /*! * @brief フロア・リセット処理 * @return リセット処理が実際に行われたらTRUEを返す @@ -1021,7 +975,7 @@ bool reset_recall(void) do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, _("フロア・リセットで", "using a scroll of reset recall")); /* Accept request */ #ifdef JP -msg_format("%sの帰還レベルを %d 階にセット。", d_name+d_info[select_dungeon].name, dummy, dummy * 50); + msg_format("%sの帰還レベルを %d 階にセット。", d_name+d_info[select_dungeon].name, dummy, dummy * 50); #else msg_format("Recall depth set to level %d (%d').", dummy, dummy * 50); #endif @@ -1045,8 +999,8 @@ msg_format("%sの帰還レベルを %d 階にセット。", d_name+d_info[select bool apply_disenchant(BIT_FLAGS mode) { int t = 0; - object_type *o_ptr; - char o_name[MAX_NLEN]; + object_type *o_ptr; + GAME_TEXT o_name[MAX_NLEN]; int to_h, to_d, to_a, pval; /* Pick a random slot */ @@ -1062,7 +1016,6 @@ bool apply_disenchant(BIT_FLAGS mode) case 8: t = INVEN_FEET; break; } - /* Get the item */ o_ptr = &inventory[t]; /* No item, nothing happens */ @@ -1079,25 +1032,17 @@ bool apply_disenchant(BIT_FLAGS mode) return (FALSE); } - - /* Describe the object */ object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - /* Artifacts have 71% chance to resist */ if (object_is_artifact(o_ptr) && (randint0(100) < 71)) { - /* Message */ #ifdef JP -msg_format("%s(%c)は劣化を跳ね返した!",o_name, index_to_label(t) ); + msg_format("%s(%c)は劣化を跳ね返した!",o_name, index_to_label(t) ); #else - msg_format("Your %s (%c) resist%s disenchantment!", - o_name, index_to_label(t), - ((o_ptr->number != 1) ? "" : "s")); + msg_format("Your %s (%c) resist%s disenchantment!", o_name, index_to_label(t), + ((o_ptr->number != 1) ? "" : "s")); #endif - - - /* Notice */ return (TRUE); } @@ -1127,29 +1072,21 @@ msg_format("%s(%c)は劣化を跳ね返した!",o_name, index_to_label(t) ); if ((to_h != o_ptr->to_h) || (to_d != o_ptr->to_d) || (to_a != o_ptr->to_a) || (pval != o_ptr->pval)) { - /* Message */ #ifdef JP - msg_format("%s(%c)は劣化してしまった!", - o_name, index_to_label(t) ); + msg_format("%s(%c)は劣化してしまった!", o_name, index_to_label(t) ); #else - msg_format("Your %s (%c) %s disenchanted!", - o_name, index_to_label(t), - ((o_ptr->number != 1) ? "were" : "was")); + msg_format("Your %s (%c) %s disenchanted!", o_name, index_to_label(t), + ((o_ptr->number != 1) ? "were" : "was")); #endif chg_virtue(V_HARMONY, 1); chg_virtue(V_ENCHANT, -2); - - /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); - - /* Window stuff */ p_ptr->window |= (PW_EQUIP | PW_PLAYER); calc_android_exp(); } - /* Notice */ return (TRUE); } @@ -1163,8 +1100,8 @@ void mutate_player(void) int ii, jj, i; /* Pick a pair of stats */ - ii = randint0(6); - for (jj = ii; jj == ii; jj = randint0(6)) /* loop */; + ii = randint0(A_MAX); + for (jj = ii; jj == ii; jj = randint0(A_MAX)) /* loop */; max1 = p_ptr->stat_max[ii]; cur1 = p_ptr->stat_cur[ii]; @@ -1176,7 +1113,7 @@ void mutate_player(void) p_ptr->stat_max[jj] = max1; p_ptr->stat_cur[jj] = cur1; - for (i=0;i<6;i++) + for (i = 0; i < A_MAX; i++) { if(p_ptr->stat_max[i] > p_ptr->stat_max_max[i]) p_ptr->stat_max[i] = p_ptr->stat_max_max[i]; if(p_ptr->stat_cur[i] > p_ptr->stat_max_max[i]) p_ptr->stat_cur[i] = p_ptr->stat_max_max[i]; @@ -1243,7 +1180,7 @@ void apply_nexus(monster_type *m_ptr) */ void phlogiston(void) { - int max_flog = 0; + GAME_TURN max_flog = 0; object_type * o_ptr = &inventory[INVEN_LITE]; /* It's a lamp */ @@ -1272,15 +1209,13 @@ void phlogiston(void) } /* Refuel */ - o_ptr->xtra4 += (max_flog / 2); + o_ptr->xtra4 += (XTRA16)(max_flog / 2); - /* Message */ msg_print(_("照明用アイテムに燃素を補充した。", "You add phlogiston to your light item.")); - /* Comment */ if (o_ptr->xtra4 >= max_flog) { - o_ptr->xtra4 = max_flog; + o_ptr->xtra4 = (XTRA16)max_flog; msg_print(_("照明用アイテムは満タンになった。", "Your light item is full.")); } @@ -1299,31 +1234,17 @@ void brand_weapon(int brand_type) { OBJECT_IDX item; object_type *o_ptr; - cptr q, s; + concptr q, s; /* Assume enchant weapon */ item_tester_hook = object_allow_enchant_melee_weapon; - item_tester_no_ryoute = TRUE; - /* Get an item */ q = _("どの武器を強化しますか? ", "Enchant which weapon? "); s = _("強化できる武器がない。", "You have nothing to enchant."); - if (!get_item(&item, q, s, (USE_EQUIP))) 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]; - } - + o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr) return; /* you can never modify artifacts / ego-items */ /* you can never modify cursed items */ @@ -1334,10 +1255,10 @@ void brand_weapon(int brand_type) !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) && !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE))) { - cptr act = NULL; + concptr act = NULL; /* Let's get the name before it is changed... */ - char o_name[MAX_NLEN]; + GAME_TEXT o_name[MAX_NLEN]; object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); switch (brand_type) @@ -1455,11 +1376,11 @@ void brand_weapon(int brand_type) */ static bool vanish_dungeon(void) { - int y, x; - cave_type *c_ptr; + POSITION y, x; + grid_type *g_ptr; feature_type *f_ptr; monster_type *m_ptr; - char m_name[80]; + GAME_TEXT m_name[MAX_NLEN]; /* Prevent vasishing of quest levels and town */ if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level) @@ -1472,29 +1393,26 @@ static bool vanish_dungeon(void) { for (x = 1; x < cur_wid - 1; x++) { - c_ptr = &cave[y][x]; + g_ptr = &grid_array[y][x]; /* Seeing true feature code (ignore mimic) */ - f_ptr = &f_info[c_ptr->feat]; + f_ptr = &f_info[g_ptr->feat]; /* Lose room and vault */ - c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); + g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); - m_ptr = &m_list[c_ptr->m_idx]; + m_ptr = &m_list[g_ptr->m_idx]; /* Awake monster */ - if (c_ptr->m_idx && MON_CSLEEP(m_ptr)) + if (g_ptr->m_idx && MON_CSLEEP(m_ptr)) { /* Reset sleep counter */ - (void)set_monster_csleep(c_ptr->m_idx, 0); + (void)set_monster_csleep(g_ptr->m_idx, 0); /* Notice the "waking up" */ if (m_ptr->ml) { - /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); - - /* Dump a message */ msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name); } } @@ -1507,84 +1425,74 @@ static bool vanish_dungeon(void) /* Special boundary walls -- Top and bottom */ for (x = 0; x < cur_wid; x++) { - c_ptr = &cave[0][x]; - f_ptr = &f_info[c_ptr->mimic]; + g_ptr = &grid_array[0][x]; + f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ - c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); + g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); /* Set boundary mimic if needed */ - if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) + if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI); + g_ptr->mimic = feat_state(g_ptr->mimic, FF_HURT_DISI); /* Check for change to boring grid */ - if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK); + if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); } - c_ptr = &cave[cur_hgt - 1][x]; - f_ptr = &f_info[c_ptr->mimic]; + g_ptr = &grid_array[cur_hgt - 1][x]; + f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ - c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); + g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); /* Set boundary mimic if needed */ - if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) + if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI); + g_ptr->mimic = feat_state(g_ptr->mimic, FF_HURT_DISI); /* Check for change to boring grid */ - if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK); + if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); } } /* Special boundary walls -- Left and right */ for (y = 1; y < (cur_hgt - 1); y++) { - c_ptr = &cave[y][0]; - f_ptr = &f_info[c_ptr->mimic]; + g_ptr = &grid_array[y][0]; + f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ - c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); + g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); /* Set boundary mimic if needed */ - if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) + if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI); + g_ptr->mimic = feat_state(g_ptr->mimic, FF_HURT_DISI); /* Check for change to boring grid */ - if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK); + if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); } - c_ptr = &cave[y][cur_wid - 1]; - f_ptr = &f_info[c_ptr->mimic]; + g_ptr = &grid_array[y][cur_wid - 1]; + f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ - c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); + g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); /* Set boundary mimic if needed */ - if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) + if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI); + g_ptr->mimic = feat_state(g_ptr->mimic, FF_HURT_DISI); /* Check for change to boring grid */ - if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK); + if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); } } /* Mega-Hack -- Forget the view and lite */ - p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE); - - /* Update stuff */ - p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE); - - /* Update the monsters */ - p_ptr->update |= (PU_MONSTERS); - - /* Redraw map */ + p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS); p_ptr->redraw |= (PR_MAP); - - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); return TRUE; @@ -1597,17 +1505,17 @@ static bool vanish_dungeon(void) void call_the_(void) { int i; - cave_type *c_ptr; + grid_type *g_ptr; bool do_call = TRUE; for (i = 0; i < 9; i++) { - c_ptr = &cave[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]]; + g_ptr = &grid_array[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]]; - if (!cave_have_flag_grid(c_ptr, FF_PROJECT)) + if (!cave_have_flag_grid(g_ptr, FF_PROJECT)) { - if (!c_ptr->mimic || !have_flag(f_info[c_ptr->mimic].flags, FF_PROJECT) || - !permanent_wall(&f_info[c_ptr->feat])) + if (!g_ptr->mimic || !have_flag(f_info[g_ptr->mimic].flags, FF_PROJECT) || + !permanent_wall(&f_info[g_ptr->feat])) { do_call = FALSE; break; @@ -1644,13 +1552,12 @@ void call_the_(void) #ifdef JP msg_format("あなたは%sを壁に近すぎる場所で唱えてしまった!", ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "祈り" : "呪文")); - msg_print("大きな爆発音があった!"); #else msg_format("You %s the %s too close to a wall!", ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"), ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell")); - msg_print("There is a loud explosion!"); #endif + msg_print(_("大きな爆発音があった!", "There is a loud explosion!")); if (one_in_(666)) { @@ -1681,12 +1588,12 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) { POSITION ty, tx; OBJECT_IDX i; - cave_type *c_ptr; + grid_type *g_ptr; object_type *o_ptr; - char o_name[MAX_NLEN]; + GAME_TEXT o_name[MAX_NLEN]; /* Check to see if an object is already there */ - if (cave[p_ptr->y][p_ptr->x].o_idx) + if (grid_array[p_ptr->y][p_ptr->x].o_idx) { msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something.")); return; @@ -1704,17 +1611,17 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) return; } - c_ptr = &cave[ty][tx]; + g_ptr = &grid_array[ty][tx]; /* We need an item to fetch */ - if (!c_ptr->o_idx) + if (!g_ptr->o_idx) { msg_print(_("そこには何もありません。", "There is no object at this place.")); return; } /* No fetching from vault */ - if (c_ptr->info & CAVE_ICKY) + if (g_ptr->info & CAVE_ICKY) { msg_print(_("アイテムがコントロールを外れて落ちた。", "The item slips from your control.")); return; @@ -1737,23 +1644,21 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) } else { - /* Use a direction */ - ty = p_ptr->y; /* Where to drop the item */ + ty = p_ptr->y; tx = p_ptr->x; - do { ty += ddy[dir]; tx += ddx[dir]; - c_ptr = &cave[ty][tx]; + g_ptr = &grid_array[ty][tx]; if ((distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) || !cave_have_flag_bold(ty, tx, FF_PROJECT)) return; } - while (!c_ptr->o_idx); + while (!g_ptr->o_idx); } - o_ptr = &o_list[c_ptr->o_idx]; + o_ptr = &o_list[g_ptr->o_idx]; if (o_ptr->weight > wgt) { @@ -1762,13 +1667,13 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) return; } - i = c_ptr->o_idx; - c_ptr->o_idx = o_ptr->next_o_idx; - cave[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */ + i = g_ptr->o_idx; + g_ptr->o_idx = o_ptr->next_o_idx; + grid_array[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */ o_ptr->next_o_idx = 0; - o_ptr->iy = (byte)p_ptr->y; - o_ptr->ix = (byte)p_ptr->x; + o_ptr->iy = p_ptr->y; + o_ptr->ix = p_ptr->x; object_desc(o_name, o_ptr, OD_NAME_ONLY); msg_format(_("%^sがあなたの足元に飛んできた。", "%^s flies through the air to your feet."), o_name); @@ -1816,7 +1721,6 @@ void alter_reality(void) */ bool warding_glyph(void) { - /* XXX XXX XXX */ if (!cave_clean_bold(p_ptr->y, p_ptr->x)) { msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell.")); @@ -1824,13 +1728,10 @@ bool warding_glyph(void) } /* Create a glyph */ - cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; - cave[p_ptr->y][p_ptr->x].mimic = feat_glyph; + grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + grid_array[p_ptr->y][p_ptr->x].mimic = feat_glyph; - /* Notice */ note_spot(p_ptr->y, p_ptr->x); - - /* Redraw */ lite_spot(p_ptr->y, p_ptr->x); return TRUE; @@ -1842,7 +1743,6 @@ bool warding_glyph(void) */ bool place_mirror(void) { - /* XXX XXX XXX */ if (!cave_clean_bold(p_ptr->y, p_ptr->x)) { msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell.")); @@ -1850,18 +1750,14 @@ bool place_mirror(void) } /* Create a mirror */ - cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; - cave[p_ptr->y][p_ptr->x].mimic = feat_mirror; + grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + grid_array[p_ptr->y][p_ptr->x].mimic = feat_mirror; /* Turn on the light */ - cave[p_ptr->y][p_ptr->x].info |= CAVE_GLOW; + grid_array[p_ptr->y][p_ptr->x].info |= CAVE_GLOW; - /* Notice */ note_spot(p_ptr->y, p_ptr->x); - - /* Redraw */ lite_spot(p_ptr->y, p_ptr->x); - update_local_illumination(p_ptr->y, p_ptr->x); return TRUE; @@ -1875,7 +1771,6 @@ bool place_mirror(void) */ bool explosive_rune(void) { - /* XXX XXX XXX */ if (!cave_clean_bold(p_ptr->y, p_ptr->x)) { msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell.")); @@ -1883,13 +1778,10 @@ bool explosive_rune(void) } /* Create a glyph */ - cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; - cave[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune; + grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + grid_array[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune; - /* Notice */ - note_spot(p_ptr->y, p_ptr->x); - - /* Redraw */ + note_spot(p_ptr->y, p_ptr->x); lite_spot(p_ptr->y, p_ptr->x); return TRUE; @@ -1904,7 +1796,7 @@ bool explosive_rune(void) */ void identify_pack(void) { - int i; + INVENTORY_IDX i; /* Simply identify and know every item */ for (i = 0; i < INVEN_TOTAL; i++) @@ -1914,7 +1806,6 @@ void identify_pack(void) /* Skip non-objects */ if (!o_ptr->k_idx) continue; - /* Identify it */ identify_item(o_ptr); /* Auto-inscription */ @@ -1974,30 +1865,25 @@ static int remove_curse_aux(int all) /* Perma-Cursed Items can NEVER be uncursed */ if (o_ptr->curse_flags & TRC_PERMA_CURSE) { - /* Uncurse it */ o_ptr->curse_flags &= (TRC_CURSED | TRC_HEAVY_CURSE | TRC_PERMA_CURSE); continue; } - /* Uncurse it */ o_ptr->curse_flags = 0L; - - /* Hack -- Assume felt */ o_ptr->ident |= (IDENT_SENSE); - - /* Take note */ o_ptr->feeling = FEEL_NONE; - /* Recalculate the bonuses */ p_ptr->update |= (PU_BONUS); - - /* Window stuff */ p_ptr->window |= (PW_EQUIP); /* Count the uncursings */ cnt++; } + if (cnt) + { + msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you.")); + } /* Return "something uncursed" */ return (cnt); } @@ -2037,32 +1923,19 @@ bool alchemy(void) PRICE price; bool force = FALSE; object_type *o_ptr; - char o_name[MAX_NLEN]; + GAME_TEXT o_name[MAX_NLEN]; char out_val[MAX_NLEN+40]; - cptr q, s; + concptr q, s; /* Hack -- force destruction */ if (command_arg > 0) force = TRUE; - /* Get an item */ q = _("どのアイテムを金に変えますか?", "Turn which item to gold? "); s = _("金に変えられる物がありません。", "You have nothing to turn to gold."); - if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE); - - /* 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]; - } - + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + if (!o_ptr) return (FALSE); /* See how many items */ if (o_ptr->number > 1) @@ -2074,8 +1947,6 @@ bool alchemy(void) if (amt <= 0) return FALSE; } - - /* Describe the object */ old_number = o_ptr->number; o_ptr->number = amt; object_desc(o_name, o_ptr, 0); @@ -2095,10 +1966,8 @@ bool alchemy(void) /* Artifacts cannot be destroyed */ if (!can_player_destroy_object(o_ptr)) { - /* Message */ msg_format(_("%sを金に変えることに失敗した。", "You fail to turn %s to gold!"), o_name); - /* Done */ return FALSE; } @@ -2106,7 +1975,6 @@ bool alchemy(void) if (price <= 0) { - /* Message */ msg_format(_("%sをニセの金に変えた。", "You turn %s to fool's gold."), o_name); } else @@ -2119,13 +1987,8 @@ bool alchemy(void) msg_format(_("%sを$%d の金に変えた。", "You turn %s to %ld coins worth of gold."), o_name, price); p_ptr->au += price; - - /* Redraw gold */ p_ptr->redraw |= (PR_GOLD); - - /* Window stuff */ p_ptr->window |= (PW_PLAYER); - } /* Eliminate the item (from the pack) */ @@ -2196,7 +2059,6 @@ bool enchant(object_type *o_ptr, int n, int eflag) bool a = object_is_artifact(o_ptr); bool force = (eflag & ENCH_FORCE); - /* Large piles resist enchantment */ prob = o_ptr->number * 100; @@ -2271,14 +2133,7 @@ bool enchant(object_type *o_ptr, int n, int eflag) /* Failure */ if (!res) return (FALSE); - - /* Recalculate bonuses */ - p_ptr->update |= (PU_BONUS); - - /* Combine / Reorder the pack (later) */ - p_ptr->notice |= (PN_COMBINE | PN_REORDER); - - /* Window stuff */ + p_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER); p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); calc_android_exp(); @@ -2304,50 +2159,28 @@ bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac) OBJECT_IDX item; bool okay = FALSE; object_type *o_ptr; - char o_name[MAX_NLEN]; - cptr q, s; - + GAME_TEXT o_name[MAX_NLEN]; + concptr q, s; /* Assume enchant weapon */ item_tester_hook = object_allow_enchant_weapon; - item_tester_no_ryoute = TRUE; /* Enchant armor if requested */ if (num_ac) item_tester_hook = object_is_armour; - /* Get an item */ q = _("どのアイテムを強化しますか? ", "Enchant which item? "); s = _("強化できるアイテムがない。", "You have nothing to enchant."); - if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE); - - /* 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]; - } - + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr) return (FALSE); - /* Description */ object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - - /* Describe */ #ifdef JP -msg_format("%s は明るく輝いた!", - o_name); + msg_format("%s は明るく輝いた!", o_name); #else - msg_format("%s %s glow%s brightly!", - ((item >= 0) ? "Your" : "The"), o_name, - ((o_ptr->number > 1) ? "" : "s")); + msg_format("%s %s glow%s brightly!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s")); #endif - /* Enchant */ if (enchant(o_ptr, num_hit, ENCH_TOHIT)) okay = TRUE; if (enchant(o_ptr, num_dam, ENCH_TODAM)) okay = TRUE; @@ -2356,12 +2189,8 @@ msg_format("%s は明るく輝いた!", /* Failure */ if (!okay) { - /* Flush */ if (flush_failure) flush(); - - /* Message */ msg_print(_("強化に失敗した。", "The enchantment failed.")); - if (one_in_(3)) chg_virtue(V_ENCHANT, -1); } else @@ -2375,70 +2204,31 @@ msg_format("%s は明るく輝いた!", /*! - * @brief アイテムが並の価値のアイテムかどうか判定する / - * Check if an object is nameless weapon or armour - * @param o_ptr 判定するアイテムの情報参照ポインタ - * @return 並ならばTRUEを返す - */ -static bool item_tester_hook_nameless_weapon_armour(object_type *o_ptr) -{ - /* Require weapon or armour */ - if (!object_is_weapon_armour_ammo(o_ptr)) return FALSE; - - /* Require nameless object if the object is well known */ - if (object_is_known(o_ptr) && !object_is_nameless(o_ptr)) - return FALSE; - - return TRUE; -} - -/*! * @brief アーティファクト生成の巻物処理 / * @return 生成が実際に試みられたらTRUEを返す */ bool artifact_scroll(void) { OBJECT_IDX item; - bool okay = FALSE; - object_type *o_ptr; - char o_name[MAX_NLEN]; - cptr q, s; - - - item_tester_no_ryoute = TRUE; + bool okay = FALSE; + object_type *o_ptr; + GAME_TEXT o_name[MAX_NLEN]; + concptr q, s; /* Enchant weapon/armour */ item_tester_hook = item_tester_hook_nameless_weapon_armour; - /* Get an item */ q = _("どのアイテムを強化しますか? ", "Enchant which item? "); s = _("強化できるアイテムがない。", "You have nothing to enchant."); - if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE); - - /* 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]; - } - + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr) return (FALSE); - /* Description */ object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - - /* Describe */ #ifdef JP msg_format("%s は眩い光を発した!",o_name); #else - msg_format("%s %s radiate%s a blinding light!", - ((item >= 0) ? "Your" : "The"), o_name, - ((o_ptr->number > 1) ? "" : "s")); + msg_format("%s %s radiate%s a blinding light!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s")); #endif if (object_is_artifact(o_ptr)) @@ -2446,9 +2236,7 @@ bool artifact_scroll(void) #ifdef JP msg_format("%sは既に伝説のアイテムです!", o_name ); #else - msg_format("The %s %s already %s!", - o_name, ((o_ptr->number > 1) ? "are" : "is"), - ((o_ptr->number > 1) ? "artifacts" : "an artifact")); + msg_format("The %s %s already %s!", o_name, ((o_ptr->number > 1) ? "are" : "is"), ((o_ptr->number > 1) ? "artifacts" : "an artifact")); #endif okay = FALSE; @@ -2472,8 +2260,7 @@ bool artifact_scroll(void) #ifdef JP msg_format("%sは既に強化されています!", o_name ); #else - msg_format("The %s %s already %s!", - o_name, ((o_ptr->number > 1) ? "are" : "is"), + msg_format("The %s %s already %s!", o_name, ((o_ptr->number > 1) ? "are" : "is"), ((o_ptr->number > 1) ? "customized items" : "a customized item")); #endif } @@ -2482,21 +2269,20 @@ bool artifact_scroll(void) { if (o_ptr->number > 1) { + msg_print(_("複数のアイテムに魔法をかけるだけのエネルギーはありません!", "Not enough energy to enchant more than one object!")); #ifdef JP - msg_print("複数のアイテムに魔法をかけるだけのエネルギーはありません!"); msg_format("%d 個の%sが壊れた!",(o_ptr->number)-1, o_name); #else - msg_print("Not enough enough energy to enchant more than one object!"); msg_format("%d of your %s %s destroyed!",(o_ptr->number)-1, o_name, (o_ptr->number>2?"were":"was")); #endif if (item >= 0) { - inven_item_increase(item, 1-(o_ptr->number)); + inven_item_increase(item, 1 - (o_ptr->number)); } else { - floor_item_increase(0-item, 1-(o_ptr->number)); + floor_item_increase(0 - item, 1 - (o_ptr->number)); } } okay = create_artifact(o_ptr, TRUE); @@ -2505,19 +2291,14 @@ bool artifact_scroll(void) /* Failure */ if (!okay) { - /* Flush */ if (flush_failure) flush(); - - /* Message */ msg_print(_("強化に失敗した。", "The enchantment failed.")); - if (one_in_(3)) chg_virtue(V_ENCHANT, -1); } else { if (record_rand_art) { - /* Description */ object_desc(o_name, o_ptr, OD_NAME_ONLY); do_cmd_write_nikki(NIKKI_ART_SCROLL, 0, o_name); } @@ -2540,9 +2321,8 @@ bool artifact_scroll(void) bool identify_item(object_type *o_ptr) { bool old_known = FALSE; - char o_name[MAX_NLEN]; + GAME_TEXT o_name[MAX_NLEN]; - /* Description */ object_desc(o_name, o_ptr, 0); if (o_ptr->ident & IDENT_KNOWN) @@ -2554,26 +2334,16 @@ bool identify_item(object_type *o_ptr) chg_virtue(V_KNOWLEDGE, 1); } - /* Identify it fully */ object_aware(o_ptr); object_known(o_ptr); - - /* Player touches it */ o_ptr->marked |= OM_TOUCHED; - /* Recalculate bonuses */ - p_ptr->update |= (PU_BONUS); - - /* Combine / Reorder the pack (later) */ - p_ptr->notice |= (PN_COMBINE | PN_REORDER); - - /* Window stuff */ + p_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER); p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); strcpy(record_o_name, o_name); record_turn = turn; - /* Description */ object_desc(o_name, o_ptr, OD_NAME_ONLY); if(record_fix_art && !old_known && object_is_fixed_artifact(o_ptr)) @@ -2585,28 +2355,6 @@ bool identify_item(object_type *o_ptr) } /*! - * @brief アイテムが鑑定済みかを判定する / - * @param o_ptr 判定するアイテムの情報参照ポインタ - * @return 実際に鑑定済みならばTRUEを返す - */ -static bool item_tester_hook_identify(object_type *o_ptr) -{ - return (bool)!object_is_known(o_ptr); -} - -/*! - * @brief アイテムが鑑定済みの武器防具かを判定する / - * @param o_ptr 判定するアイテムの情報参照ポインタ - * @return 実際に鑑定済みならばTRUEを返す - */ -static bool item_tester_hook_identify_weapon_armour(object_type *o_ptr) -{ - if (object_is_known(o_ptr)) - return FALSE; - return object_is_weapon_armour_ammo(o_ptr); -} - -/*! * @brief アイテム鑑定のメインルーチン処理 / * Identify an object in the inventory (or on the floor) * @param only_equip 装備品のみを対象とするならばTRUEを返す @@ -2618,13 +2366,11 @@ static bool item_tester_hook_identify_weapon_armour(object_type *o_ptr) bool ident_spell(bool only_equip) { OBJECT_IDX item; - object_type *o_ptr; - char o_name[MAX_NLEN]; - cptr q, s; + object_type *o_ptr; + GAME_TEXT o_name[MAX_NLEN]; + concptr q, s; bool old_known; - item_tester_no_ryoute = TRUE; - if (only_equip) item_tester_hook = item_tester_hook_identify_weapon_armour; else @@ -2644,30 +2390,14 @@ bool ident_spell(bool only_equip) q = _("すべて鑑定済みです。 ", "All items are identified. "); } - /* Get an item */ s = _("鑑定するべきアイテムがない。", "You have nothing to identify."); - if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE); - - /* 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]; - } + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr) return (FALSE); - /* Identify it */ old_known = identify_item(o_ptr); - /* Description */ object_desc(o_name, o_ptr, 0); - - /* Describe */ if (item >= INVEN_RARM) { msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(item), o_name, index_to_label(item)); @@ -2704,38 +2434,24 @@ bool ident_spell(bool only_equip) bool mundane_spell(bool only_equip) { OBJECT_IDX item; - object_type *o_ptr; - cptr q, s; + object_type *o_ptr; + concptr q, s; if (only_equip) item_tester_hook = object_is_weapon_armour_ammo; - item_tester_no_ryoute = TRUE; - /* Get an item */ q = _("どれを使いますか?", "Use which item? "); s = _("使えるものがありません。", "You have nothing you can use."); - if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE); - - /* 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]; - } + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr) return (FALSE); - /* Oops */ msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!")); { POSITION iy = o_ptr->iy; /* Y-position on map, or zero */ POSITION ix = o_ptr->ix; /* X-position on map, or zero */ - s16b next_o_idx = o_ptr->next_o_idx; /* Next object in stack (if any) */ + OBJECT_IDX next_o_idx = o_ptr->next_o_idx; /* Next object in stack (if any) */ byte marked = o_ptr->marked; /* Object is marked */ - s16b weight = o_ptr->number * o_ptr->weight; + WEIGHT weight = o_ptr->number * o_ptr->weight; u16b inscription = o_ptr->inscription; /* Wipe it clean */ @@ -2755,28 +2471,6 @@ bool mundane_spell(bool only_equip) } /*! - * @brief アイテムが*鑑定*済みかを判定する / - * @param o_ptr 判定するアイテムの情報参照ポインタ - * @return 実際に鑑定済みならばTRUEを返す - */ -static bool item_tester_hook_identify_fully(object_type *o_ptr) -{ - return (bool)(!object_is_known(o_ptr) || !(o_ptr->ident & IDENT_MENTAL)); -} - -/*! - * @brief アイテムが*鑑定*済みの武器防具かを判定する / - * @param o_ptr 判定するアイテムの情報参照ポインタ - * @return 実際に鑑定済みならばTRUEを返す - */ -static bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr) -{ - if (!item_tester_hook_identify_fully(o_ptr)) - return FALSE; - return object_is_weapon_armour_ammo(o_ptr); -} - -/*! * @brief アイテム*鑑定*のメインルーチン処理 / * Identify an object in the inventory (or on the floor) * @param only_equip 装備品のみを対象とするならばTRUEを返す @@ -2788,12 +2482,11 @@ static bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr) bool identify_fully(bool only_equip) { OBJECT_IDX item; - object_type *o_ptr; - char o_name[MAX_NLEN]; - cptr q, s; + object_type *o_ptr; + GAME_TEXT o_name[MAX_NLEN]; + concptr q, s; bool old_known; - item_tester_no_ryoute = TRUE; if (only_equip) item_tester_hook = item_tester_hook_identify_fully_weapon_armour; else @@ -2813,36 +2506,18 @@ bool identify_fully(bool only_equip) q = _("すべて*鑑定*済みです。 ", "All items are *identified*. "); } - /* Get an item */ s = _("*鑑定*するべきアイテムがない。", "You have nothing to *identify*."); - if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE); - - /* 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]; - } + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr) return (FALSE); - /* Identify it */ old_known = identify_item(o_ptr); /* Mark the item as fully known */ o_ptr->ident |= (IDENT_MENTAL); - - /* Handle stuff */ handle_stuff(); - /* Description */ object_desc(o_name, o_ptr, 0); - - /* Describe */ if (item >= INVEN_RARM) { msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(item), o_name, index_to_label(item)); @@ -2867,27 +2542,6 @@ bool identify_fully(bool only_equip) } -/*! - * @brief 魔力充填が可能なアイテムかどうか判定する / - * Hook for "get_item()". Determine if something is rechargable. - * @param o_ptr 判定するアイテムの情報参照ポインタ - * @return 魔力充填が可能ならばTRUEを返す - */ -bool item_tester_hook_recharge(object_type *o_ptr) -{ - /* Recharge staffs */ - if (o_ptr->tval == TV_STAFF) return (TRUE); - - /* Recharge wands */ - if (o_ptr->tval == TV_WAND) return (TRUE); - - /* Hack -- Recharge rods */ - if (o_ptr->tval == TV_ROD) return (TRUE); - - /* Nope */ - return (FALSE); -} - /*! * @brief 魔力充填処理 / @@ -2907,12 +2561,12 @@ bool item_tester_hook_recharge(object_type *o_ptr) * strongly they recharge. Staffs, however, each get fewer charges if * stacked. * - * XXX XXX XXX Beware of "sliding index errors". + * Beware of "sliding index errors". */ bool recharge(int power) { OBJECT_IDX item; - int lev; + DEPTH lev; int recharge_strength; TIME_EFFECT recharge_amount; @@ -2922,29 +2576,17 @@ bool recharge(int power) bool fail = FALSE; byte fail_type = 1; - cptr q, s; - char o_name[MAX_NLEN]; + concptr q, s; + GAME_TEXT o_name[MAX_NLEN]; /* Only accept legal items */ item_tester_hook = item_tester_hook_recharge; - /* Get an item */ q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? "); s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge."); - if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE); - - /* 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]; - } + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + if (!o_ptr) return (FALSE); /* Get the object kind. */ k_ptr = &k_info[o_ptr->k_idx]; @@ -2957,7 +2599,7 @@ bool recharge(int power) if (o_ptr->tval == TV_ROD) { /* Extract a recharge strength by comparing object level to power. */ - recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5; + recharge_strength = ((power > lev / 2) ? (power - lev / 2) : 0) / 5; /* Back-fire */ @@ -2989,12 +2631,10 @@ bool recharge(int power) * Divide up a stack of wands' charges to calculate charge penalty. */ if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1)) - recharge_strength = (100 + power - lev - - (8 * o_ptr->pval / o_ptr->number)) / 15; + recharge_strength = (100 + power - lev - (8 * o_ptr->pval / o_ptr->number)) / 15; /* All staffs, unstacked wands. */ - else recharge_strength = (100 + power - lev - - (8 * o_ptr->pval)) / 15; + else recharge_strength = (100 + power - lev - (8 * o_ptr->pval)) / 15; /* Paranoia */ if (recharge_strength < 0) recharge_strength = 0; @@ -3026,7 +2666,7 @@ bool recharge(int power) */ if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1)) { - recharge_amount /= o_ptr->number; + recharge_amount /= (TIME_EFFECT)o_ptr->number; if (recharge_amount < 1) recharge_amount = 1; } @@ -3068,7 +2708,7 @@ bool recharge(int power) /*** Determine Seriousness of Failure ***/ /* Mages recharge objects more safely. */ - if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER || p_ptr->pclass == CLASS_MAGIC_EATER || p_ptr->pclass == CLASS_BLUE_MAGE) + if (IS_WIZARD_CLASS() || p_ptr->pclass == CLASS_MAGIC_EATER || p_ptr->pclass == CLASS_BLUE_MAGE) { /* 10% chance to blow up one rod, otherwise draining. */ if (o_ptr->tval == TV_ROD) @@ -3187,11 +2827,7 @@ bool recharge(int power) } } } - - /* Combine / Reorder the pack (later) */ - p_ptr->notice |= (PN_COMBINE | PN_REORDER); - - /* Window stuff */ + p_ptr->update |= (PU_COMBINE | PU_REORDER); p_ptr->window |= (PW_INVEN); /* Something was done */ @@ -3207,40 +2843,21 @@ bool recharge(int power) bool bless_weapon(void) { OBJECT_IDX item; - object_type *o_ptr; + object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; - char o_name[MAX_NLEN]; - cptr q, s; - - item_tester_no_ryoute = TRUE; + GAME_TEXT o_name[MAX_NLEN]; + concptr q, s; /* Bless only weapons */ item_tester_hook = object_is_weapon; - /* Get an item */ q = _("どのアイテムを祝福しますか?", "Bless which weapon? "); s = _("祝福できる武器がありません。", "You have weapon to bless."); - if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) - return FALSE; - - /* 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]; - } - + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr) return FALSE; - /* Description */ object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - - /* Extract the flags */ object_flags(o_ptr, flgs); if (object_is_cursed(o_ptr)) @@ -3251,38 +2868,28 @@ bool bless_weapon(void) (o_ptr->curse_flags & TRC_PERMA_CURSE)) { #ifdef JP -msg_format("%sを覆う黒いオーラは祝福を跳ね返した!", - o_name); + msg_format("%sを覆う黒いオーラは祝福を跳ね返した!", o_name); #else - msg_format("The black aura on %s %s disrupts the blessing!", - ((item >= 0) ? "your" : "the"), o_name); + msg_format("The black aura on %s %s disrupts the blessing!", ((item >= 0) ? "your" : "the"), o_name); #endif return TRUE; } #ifdef JP -msg_format("%s から邪悪なオーラが消えた。", - o_name); + msg_format("%s から邪悪なオーラが消えた。", o_name); #else - msg_format("A malignant aura leaves %s %s.", - ((item >= 0) ? "your" : "the"), o_name); + msg_format("A malignant aura leaves %s %s.", ((item >= 0) ? "your" : "the"), o_name); #endif - /* Uncurse it */ o_ptr->curse_flags = 0L; - /* Hack -- Assume felt */ o_ptr->ident |= (IDENT_SENSE); - - /* Take note */ o_ptr->feeling = FEEL_NONE; /* Recalculate the bonuses */ p_ptr->update |= (PU_BONUS); - - /* Window stuff */ p_ptr->window |= (PW_EQUIP); } @@ -3297,8 +2904,7 @@ msg_format("%s から邪悪なオーラが消えた。", if (have_flag(flgs, TR_BLESSED)) { #ifdef JP -msg_format("%s は既に祝福されている。", - o_name ); + msg_format("%s は既に祝福されている。", o_name); #else msg_format("%s %s %s blessed already.", ((item >= 0) ? "Your" : "The"), o_name, @@ -3310,10 +2916,8 @@ msg_format("%s は既に祝福されている。", if (!(object_is_artifact(o_ptr) || object_is_ego(o_ptr)) || one_in_(3)) { - /* Describe */ #ifdef JP -msg_format("%sは輝いた!", - o_name); + msg_format("%sは輝いた!", o_name); #else msg_format("%s %s shine%s!", ((item >= 0) ? "Your" : "The"), o_name, @@ -3360,23 +2964,17 @@ msg_format("%sは輝いた!", msg_print(_("周囲が凡庸な雰囲気で満ちた...", "There is a static feeling in the air...")); #ifdef JP -msg_format("%s は劣化した!", - o_name ); + msg_format("%s は劣化した!", o_name); #else - msg_format("%s %s %s disenchanted!", - ((item >= 0) ? "Your" : "The"), o_name, - ((o_ptr->number > 1) ? "were" : "was")); + msg_format("%s %s %s disenchanted!", ((item >= 0) ? "Your" : "The"), o_name, + ((o_ptr->number > 1) ? "were" : "was")); #endif } } - /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); - - /* Window stuff */ p_ptr->window |= (PW_EQUIP | PW_PLAYER); - calc_android_exp(); return TRUE; @@ -3391,50 +2989,30 @@ msg_format("%s は劣化した!", bool pulish_shield(void) { OBJECT_IDX item; - object_type *o_ptr; - u32b flgs[TR_FLAG_SIZE]; - char o_name[MAX_NLEN]; - cptr q, s; + object_type *o_ptr; + BIT_FLAGS flgs[TR_FLAG_SIZE]; + GAME_TEXT o_name[MAX_NLEN]; + concptr q, s; - item_tester_no_ryoute = TRUE; /* Assume enchant weapon */ item_tester_tval = TV_SHIELD; - /* Get an item */ q = _("どの盾を磨きますか?", "Pulish which weapon? "); s = _("磨く盾がありません。", "You have weapon to pulish."); - if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) - return FALSE; - - /* 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]; - } + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr) return FALSE; - - /* Description */ object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - - /* Extract the flags */ object_flags(o_ptr, flgs); if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) && !object_is_cursed(o_ptr) && (o_ptr->sval != SV_MIRROR_SHIELD)) { #ifdef JP -msg_format("%sは輝いた!", o_name); + msg_format("%sは輝いた!", o_name); #else - msg_format("%s %s shine%s!", - ((item >= 0) ? "Your" : "The"), o_name, - ((o_ptr->number > 1) ? "" : "s")); + msg_format("%s %s shine%s!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s")); #endif o_ptr->name2 = EGO_REFLECTION; enchant(o_ptr, randint0(3) + 4, ENCH_TOAC); @@ -3553,7 +3131,7 @@ bool potion_smash_effect(MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_ID dt = GF_DARK; angry = TRUE; break; - case SV_POTION_CONFUSION: /* Booze */ + case SV_POTION_BOOZE: /* Booze */ dt = GF_OLD_CONF; angry = TRUE; break; @@ -3617,8 +3195,7 @@ bool potion_smash_effect(MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_ID /* Do nothing */ ; } - (void)project(who, radius, y, x, dam, dt, - (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1); + (void)project(who, radius, y, x, dam, dt, (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1); /* XXX those potions that explode need to become "known" */ return angry; @@ -3630,27 +3207,24 @@ bool potion_smash_effect(MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_ID * Hack -- Display all known spells in a window * return なし * @details - * XXX XXX XXX Need to analyze size of the window. - * XXX XXX XXX Need more color coding. + * Need to analyze size of the window. + * Need more color coding. */ void display_spell_list(void) { - int i, j; - int y, x; - int m[9]; + int i, j; + TERM_LEN y, x; + int m[9]; const magic_type *s_ptr; - char name[80]; - char out_val[160]; - + GAME_TEXT name[MAX_NLEN]; + char out_val[160]; - /* Erase window */ clear_from(0); /* They have too many spells to list */ if (p_ptr->pclass == CLASS_SORCERER) return; if (p_ptr->pclass == CLASS_RED_MAGE) return; - /* Snipers */ if (p_ptr->pclass == CLASS_SNIPER) { display_snipe_list(); @@ -3665,7 +3239,7 @@ void display_spell_list(void) (p_ptr->pclass == CLASS_FORCETRAINER)) { int minfail = 0; - int plev = p_ptr->lev; + PLAYER_LEVEL plev = p_ptr->lev; int chance = 0; mind_type spell; char comment[80]; @@ -3851,7 +3425,7 @@ void display_spell_list(void) * @param use_realm 魔法領域 * @return 経験値 */ -s16b experience_of_spell(int spell, int use_realm) +EXP experience_of_spell(SPELL_IDX spell, REALM_IDX use_realm) { if (p_ptr->pclass == CLASS_SORCERER) return SPELL_EXP_MASTER; else if (p_ptr->pclass == CLASS_RED_MAGE) return SPELL_EXP_SKILLED; @@ -3869,7 +3443,7 @@ s16b experience_of_spell(int spell, int use_realm) * @param realm 魔法領域 * @return 消費MP */ -int mod_need_mana(int need_mana, int spell, int realm) +MANA_POINT mod_need_mana(MANA_POINT need_mana, SPELL_IDX spell, REALM_IDX realm) { #define MANA_CONST 2400 #define MANA_DIV 4 @@ -3910,7 +3484,7 @@ int mod_need_mana(int need_mana, int spell, int realm) * @return 失敗率(%) * @todo 統合を検討 */ -int mod_spell_chance_1(int chance) +PERCENTAGE mod_spell_chance_1(PERCENTAGE chance) { chance += p_ptr->to_m_chance; @@ -3935,7 +3509,7 @@ int mod_spell_chance_1(int chance) * Note: variable "chance" cannot be negative. * @todo 統合を検討 */ -int mod_spell_chance_2(int chance) +PERCENTAGE mod_spell_chance_2(PERCENTAGE chance) { if (p_ptr->dec_mana) chance--; @@ -3952,12 +3526,12 @@ int mod_spell_chance_2(int chance) * @param use_realm 魔法領域ID * @return 失敗率(%) */ -s16b spell_chance(int spell, int use_realm) +PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm) { - int chance, minfail; + PERCENTAGE chance, minfail; const magic_type *s_ptr; - int need_mana; - int penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4; + MANA_POINT need_mana; + PERCENTAGE penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4; /* Paranoia -- must be literate */ @@ -4043,7 +3617,7 @@ s16b spell_chance(int spell, int use_realm) if ((use_realm == p_ptr->realm1) || (use_realm == p_ptr->realm2) || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) { - s16b exp = experience_of_spell(spell, use_realm); + EXP exp = experience_of_spell(spell, use_realm); if (exp >= SPELL_EXP_EXPERT) chance--; if (exp >= SPELL_EXP_MASTER) chance--; } @@ -4119,20 +3693,21 @@ bool spell_okay(int spell, bool learned, bool study_pray, int use_realm) * @param use_realm 魔法領域ID * @return なし */ -void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_POSITION y, TERM_POSITION x, REALM_IDX use_realm) +void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y, TERM_LEN x, REALM_IDX use_realm) { - int i, spell, exp_level, increment = 64; + int i; + SPELL_IDX spell; + int exp_level, increment = 64; const magic_type *s_ptr; - cptr comment; - char info[80]; - char out_val[160]; - byte line_attr; - int need_mana; - char ryakuji[5]; - char buf[256]; + concptr comment; + char info[80]; + char out_val[160]; + byte line_attr; + MANA_POINT need_mana; + char ryakuji[5]; + char buf[256]; bool max = FALSE; - if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && p_ptr->wizard) msg_print(_("警告! print_spell が領域なしに呼ばれた", "Warning! print_spells called with null realm")); @@ -4153,10 +3728,8 @@ void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_POSIT /* Dump the spells */ for (i = 0; i < num; i++) { - /* Access the spell */ spell = spells[i]; - /* Access the spell */ if (!is_magic(use_realm)) { s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell]; @@ -4170,7 +3743,7 @@ void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_POSIT need_mana = s_ptr->smana; else { - s16b exp = experience_of_spell(spell, use_realm); + EXP exp = experience_of_spell(spell, use_realm); /* Extract mana consumption rate */ need_mana = mod_need_mana(s_ptr->smana, spell, use_realm); @@ -4279,599 +3852,6 @@ void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_POSIT } -/*! - * @brief アイテムが酸で破損するかどうかを判定する - * @param o_ptr アイテムの情報参照ポインタ - * @return 破損するならばTRUEを返す - * Note that amulets, rods, and high-level spell books are immune - * to "inventory damage" of any kind. Also sling ammo and shovels. - * Does a given class of objects (usually) hate acid? - * Note that acid can either melt or corrode something. - */ -bool hates_acid(object_type *o_ptr) -{ - /* Analyze the type */ - switch (o_ptr->tval) - { - /* Wearable items */ - case TV_ARROW: - case TV_BOLT: - case TV_BOW: - case TV_SWORD: - case TV_HAFTED: - case TV_POLEARM: - case TV_HELM: - case TV_CROWN: - case TV_SHIELD: - case TV_BOOTS: - case TV_GLOVES: - case TV_CLOAK: - case TV_SOFT_ARMOR: - case TV_HARD_ARMOR: - case TV_DRAG_ARMOR: - { - return (TRUE); - } - - /* Staffs/Scrolls are wood/paper */ - case TV_STAFF: - case TV_SCROLL: - { - return (TRUE); - } - - /* Ouch */ - case TV_CHEST: - { - return (TRUE); - } - - /* Junk is useless */ - case TV_SKELETON: - case TV_BOTTLE: - case TV_JUNK: - { - return (TRUE); - } - } - - return (FALSE); -} - - -/*! - * @brief アイテムが電撃で破損するかどうかを判定する / - * Does a given object (usually) hate electricity? - * @param o_ptr アイテムの情報参照ポインタ - * @return 破損するならばTRUEを返す - */ -bool hates_elec(object_type *o_ptr) -{ - switch (o_ptr->tval) - { - case TV_RING: - case TV_WAND: - { - return (TRUE); - } - } - - return (FALSE); -} - - -/*! - * @brief アイテムが火炎で破損するかどうかを判定する / - * Does a given object (usually) hate fire? - * @param o_ptr アイテムの情報参照ポインタ - * @return 破損するならばTRUEを返す - * @details - * Hafted/Polearm weapons have wooden shafts. - * Arrows/Bows are mostly wooden. - */ -bool hates_fire(object_type *o_ptr) -{ - /* Analyze the type */ - switch (o_ptr->tval) - { - /* Wearable */ - case TV_LITE: - case TV_ARROW: - case TV_BOW: - case TV_HAFTED: - case TV_POLEARM: - case TV_BOOTS: - case TV_GLOVES: - case TV_CLOAK: - case TV_SOFT_ARMOR: - { - return (TRUE); - } - - /* Books */ - case TV_LIFE_BOOK: - case TV_SORCERY_BOOK: - case TV_NATURE_BOOK: - case TV_CHAOS_BOOK: - case TV_DEATH_BOOK: - case TV_TRUMP_BOOK: - case TV_ARCANE_BOOK: - case TV_CRAFT_BOOK: - case TV_DAEMON_BOOK: - case TV_CRUSADE_BOOK: - case TV_MUSIC_BOOK: - case TV_HISSATSU_BOOK: - case TV_HEX_BOOK: - { - return (TRUE); - } - - /* Chests */ - case TV_CHEST: - { - return (TRUE); - } - - /* Staffs/Scrolls burn */ - case TV_STAFF: - case TV_SCROLL: - { - return (TRUE); - } - } - - return (FALSE); -} - - -/*! - * @brief アイテムが冷気で破損するかどうかを判定する / - * Does a given object (usually) hate cold? - * @param o_ptr アイテムの情報参照ポインタ - * @return 破損するならばTRUEを返す - */ -bool hates_cold(object_type *o_ptr) -{ - switch (o_ptr->tval) - { - case TV_POTION: - case TV_FLASK: - case TV_BOTTLE: - { - return (TRUE); - } - } - - return (FALSE); -} - - -/*! - * @brief アイテムが酸で破損するかどうかを判定する(メインルーチン) / - * Melt something - * @param o_ptr アイテムの情報参照ポインタ - * @return 破損するならばTRUEを返す - * @todo 統合を検討 - */ -int set_acid_destroy(object_type *o_ptr) -{ - u32b flgs[TR_FLAG_SIZE]; - if (!hates_acid(o_ptr)) return (FALSE); - object_flags(o_ptr, flgs); - if (have_flag(flgs, TR_IGNORE_ACID)) return (FALSE); - return (TRUE); -} - - -/*! - * @brief アイテムが電撃で破損するかどうかを判定する(メインルーチン) / - * Electrical damage - * @param o_ptr アイテムの情報参照ポインタ - * @return 破損するならばTRUEを返す - * @todo 統合を検討 - */ -int set_elec_destroy(object_type *o_ptr) -{ - u32b flgs[TR_FLAG_SIZE]; - if (!hates_elec(o_ptr)) return (FALSE); - object_flags(o_ptr, flgs); - if (have_flag(flgs, TR_IGNORE_ELEC)) return (FALSE); - return (TRUE); -} - - -/*! - * @brief アイテムが火炎で破損するかどうかを判定する(メインルーチン) / - * Burn something - * @param o_ptr アイテムの情報参照ポインタ - * @return 破損するならばTRUEを返す - * @todo 統合を検討 - */ -int set_fire_destroy(object_type *o_ptr) -{ - u32b flgs[TR_FLAG_SIZE]; - if (!hates_fire(o_ptr)) return (FALSE); - object_flags(o_ptr, flgs); - if (have_flag(flgs, TR_IGNORE_FIRE)) return (FALSE); - return (TRUE); -} - - -/*! - * @brief アイテムが冷気で破損するかどうかを判定する(メインルーチン) / - * Freeze things - * @param o_ptr アイテムの情報参照ポインタ - * @return 破損するならばTRUEを返す - * @todo 統合を検討 - */ -int set_cold_destroy(object_type *o_ptr) -{ - u32b flgs[TR_FLAG_SIZE]; - if (!hates_cold(o_ptr)) return (FALSE); - object_flags(o_ptr, flgs); - if (have_flag(flgs, TR_IGNORE_COLD)) return (FALSE); - return (TRUE); -} - - -/*! - * @brief アイテムが指定確率で破損するかどうかを判定する / - * Destroys a type of item on a given percent chance - * @param typ 破損判定関数ポインタ - * @param perc 基本確率 - * @return 破損したアイテムの数 - * @details - * Note that missiles are no longer necessarily all destroyed - * Destruction taken from "melee.c" code for "stealing". - * New-style wands and rods handled correctly. -LM- - * Returns number of items destroyed. - */ -int inven_damage(inven_func typ, int perc) -{ - int i, j, k, amt; - object_type *o_ptr; - char o_name[MAX_NLEN]; - - if (CHECK_MULTISHADOW()) return 0; - - if (p_ptr->inside_arena) return 0; - - /* Count the casualties */ - k = 0; - - /* Scan through the slots backwards */ - for (i = 0; i < INVEN_PACK; i++) - { - o_ptr = &inventory[i]; - - /* Skip non-objects */ - if (!o_ptr->k_idx) continue; - - /* Hack -- for now, skip artifacts */ - if (object_is_artifact(o_ptr)) continue; - - /* Give this item slot a shot at death */ - if ((*typ)(o_ptr)) - { - /* Count the casualties */ - for (amt = j = 0; j < o_ptr->number; ++j) - { - if (randint0(100) < perc) amt++; - } - - /* Some casualities */ - if (amt) - { - /* Get a description */ - object_desc(o_name, o_ptr, OD_OMIT_PREFIX); - - /* Message */ - msg_format(_("%s(%c)が%s壊れてしまった!", "%sour %s (%c) %s destroyed!"), - -#ifdef JP -o_name, index_to_label(i), - ((o_ptr->number > 1) ? - ((amt == o_ptr->number) ? "全部" : - (amt > 1 ? "何個か" : "一個")) : "") ); -#else - ((o_ptr->number > 1) ? - ((amt == o_ptr->number) ? "All of y" : - (amt > 1 ? "Some of y" : "One of y")) : "Y"), - o_name, index_to_label(i), - ((amt > 1) ? "were" : "was")); -#endif - -#ifdef JP - if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) - msg_print("やりやがったな!"); -#endif - - /* Potions smash open */ - if (object_is_potion(o_ptr)) - { - (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, o_ptr->k_idx); - } - - /* Reduce the charges of rods/wands */ - reduce_charges(o_ptr, amt); - - /* Destroy "amt" items */ - inven_item_increase(i, -amt); - inven_item_optimize(i); - - /* Count the casualties */ - k += amt; - } - } - } - - /* Return the casualty count */ - return (k); -} - - -/*! - * @brief 酸攻撃による装備のAC劣化処理 / - * Acid has hit the player, attempt to affect some armor. - * @return ACが実際に劣化したらTRUEを返す - * @details - * Note that the "base armor" of an object never changes. - * If any armor is damaged (or resists), the player takes less damage. - */ -static int minus_ac(void) -{ - object_type *o_ptr = NULL; - u32b flgs[TR_FLAG_SIZE]; - char o_name[MAX_NLEN]; - - - /* Pick a (possibly empty) inventory slot */ - switch (randint1(7)) - { - case 1: o_ptr = &inventory[INVEN_RARM]; break; - case 2: o_ptr = &inventory[INVEN_LARM]; break; - case 3: o_ptr = &inventory[INVEN_BODY]; break; - case 4: o_ptr = &inventory[INVEN_OUTER]; break; - case 5: o_ptr = &inventory[INVEN_HANDS]; break; - case 6: o_ptr = &inventory[INVEN_HEAD]; break; - case 7: o_ptr = &inventory[INVEN_FEET]; break; - } - - /* Nothing to damage */ - if (!o_ptr->k_idx) return (FALSE); - - if (!object_is_armour(o_ptr)) return (FALSE); - - /* No damage left to be done */ - if (o_ptr->ac + o_ptr->to_a <= 0) return (FALSE); - - - /* Describe */ - object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - - /* Extract the flags */ - object_flags(o_ptr, flgs); - - /* Object resists */ - if (have_flag(flgs, TR_IGNORE_ACID)) - { - msg_format(_("しかし%sには効果がなかった!", "Your %s is unaffected!"), o_name); - return (TRUE); - } - - /* Message */ - msg_format(_("%sがダメージを受けた!", "Your %s is damaged!"), o_name); - - /* Damage the item */ - o_ptr->to_a--; - - /* Calculate bonuses */ - p_ptr->update |= (PU_BONUS); - - /* Window stuff */ - p_ptr->window |= (PW_EQUIP | PW_PLAYER); - - calc_android_exp(); - - /* Item was damaged */ - return (TRUE); -} - - -/*! - * @brief 酸属性によるプレイヤー損害処理 / - * Hurt the player with Acid - * @param dam 基本ダメージ量 - * @param kb_str ダメージ原因記述 - * @param monspell 原因となったモンスター特殊攻撃ID - * @param aura オーラよるダメージが原因ならばTRUE - * @return 修正HPダメージ量 - */ -int acid_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura) -{ - int get_damage; - int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3; - bool double_resist = IS_OPPOSE_ACID(); - - /* Total Immunity */ - if (p_ptr->immune_acid || (dam <= 0)) - { - learn_spell(monspell); - return 0; - } - - /* Vulnerability (Ouch!) */ - if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2; - if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3; - - /* Resist the damage */ - if (p_ptr->resist_acid) dam = (dam + 2) / 3; - if (double_resist) dam = (dam + 2) / 3; - - if (aura || !CHECK_MULTISHADOW()) - { - if ((!(double_resist || p_ptr->resist_acid)) && - one_in_(HURT_CHANCE)) - (void)do_dec_stat(A_CHR); - - /* If any armor gets hit, defend the player */ - if (minus_ac()) dam = (dam + 1) / 2; - } - - /* Take damage */ - get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); - - /* Inventory damage */ - if (!aura && !(double_resist && p_ptr->resist_acid)) - inven_damage(set_acid_destroy, inv); - return get_damage; -} - - -/*! - * @brief 電撃属性によるプレイヤー損害処理 / - * Hurt the player with electricity - * @param dam 基本ダメージ量 - * @param kb_str ダメージ原因記述 - * @param monspell 原因となったモンスター特殊攻撃ID - * @param aura オーラよるダメージが原因ならばTRUE - * @return 修正HPダメージ量 - */ -int elec_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura) -{ - int get_damage; - int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3; - bool double_resist = IS_OPPOSE_ELEC(); - - /* Total immunity */ - if (p_ptr->immune_elec || (dam <= 0)) - { - learn_spell(monspell); - return 0; - } - - /* Vulnerability (Ouch!) */ - if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2; - if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3; - if (prace_is_(RACE_ANDROID)) dam += dam / 3; - - /* Resist the damage */ - if (p_ptr->resist_elec) dam = (dam + 2) / 3; - if (double_resist) dam = (dam + 2) / 3; - - if (aura || !CHECK_MULTISHADOW()) - { - if ((!(double_resist || p_ptr->resist_elec)) && - one_in_(HURT_CHANCE)) - (void)do_dec_stat(A_DEX); - } - - /* Take damage */ - get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); - - /* Inventory damage */ - if (!aura && !(double_resist && p_ptr->resist_elec)) - inven_damage(set_elec_destroy, inv); - - return get_damage; -} - - -/*! - * @brief 火炎属性によるプレイヤー損害処理 / - * Hurt the player with Fire - * @param dam 基本ダメージ量 - * @param kb_str ダメージ原因記述 - * @param monspell 原因となったモンスター特殊攻撃ID - * @param aura オーラよるダメージが原因ならばTRUE - * @return 修正HPダメージ量 - */ -int fire_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura) -{ - int get_damage; - int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3; - bool double_resist = IS_OPPOSE_FIRE(); - - /* Totally immune */ - if (p_ptr->immune_fire || (dam <= 0)) - { - learn_spell(monspell); - return 0; - } - - /* Vulnerability (Ouch!) */ - if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2; - if (prace_is_(RACE_ENT)) dam += dam / 3; - if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3; - - /* Resist the damage */ - if (p_ptr->resist_fire) dam = (dam + 2) / 3; - if (double_resist) dam = (dam + 2) / 3; - - if (aura || !CHECK_MULTISHADOW()) - { - if ((!(double_resist || p_ptr->resist_fire)) && - one_in_(HURT_CHANCE)) - (void)do_dec_stat(A_STR); - } - - /* Take damage */ - get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); - - /* Inventory damage */ - if (!aura && !(double_resist && p_ptr->resist_fire)) - inven_damage(set_fire_destroy, inv); - - return get_damage; -} - - -/*! - * @brief 冷気属性によるプレイヤー損害処理 / - * Hurt the player with Cold - * @param dam 基本ダメージ量 - * @param kb_str ダメージ原因記述 - * @param monspell 原因となったモンスター特殊攻撃ID - * @param aura オーラよるダメージが原因ならばTRUE - * @return 修正HPダメージ量 - */ -int cold_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura) -{ - int get_damage; - int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3; - bool double_resist = IS_OPPOSE_COLD(); - - /* Total immunity */ - if (p_ptr->immune_cold || (dam <= 0)) - { - learn_spell(monspell); - return 0; - } - - /* Vulnerability (Ouch!) */ - if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2; - if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3; - - /* Resist the damage */ - if (p_ptr->resist_cold) dam = (dam + 2) / 3; - if (double_resist) dam = (dam + 2) / 3; - - if (aura || !CHECK_MULTISHADOW()) - { - if ((!(double_resist || p_ptr->resist_cold)) && - one_in_(HURT_CHANCE)) - (void)do_dec_stat(A_STR); - } - - /* Take damage */ - get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); - - /* Inventory damage */ - if (!aura && !(double_resist && p_ptr->resist_cold)) - inven_damage(set_cold_destroy, inv); - - return get_damage; -} /*! * @brief 防具の錆止め防止処理 @@ -4881,33 +3861,18 @@ bool rustproof(void) { OBJECT_IDX item; object_type *o_ptr; - char o_name[MAX_NLEN]; - cptr q, s; + GAME_TEXT o_name[MAX_NLEN]; + concptr q, s; - item_tester_no_ryoute = TRUE; /* Select a piece of armour */ item_tester_hook = object_is_armour; - /* Get an item */ q = _("どの防具に錆止めをしますか?", "Rustproof which piece of armour? "); s = _("錆止めできるものがありません。", "You have nothing to rustproof."); - if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return FALSE; + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr) return FALSE; - /* 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]; - } - - - /* Description */ object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); add_flag(o_ptr->art_flags, TR_IGNORE_ACID); @@ -4915,27 +3880,21 @@ bool rustproof(void) if ((o_ptr->to_a < 0) && !object_is_cursed(o_ptr)) { #ifdef JP -msg_format("%sは新品同様になった!",o_name); + msg_format("%sは新品同様になった!",o_name); #else - msg_format("%s %s look%s as good as new!", - ((item >= 0) ? "Your" : "The"), o_name, - ((o_ptr->number > 1) ? "" : "s")); + msg_format("%s %s look%s as good as new!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s")); #endif o_ptr->to_a = 0; } #ifdef JP -msg_format("%sは腐食しなくなった。", o_name); + msg_format("%sは腐食しなくなった。", o_name); #else - msg_format("%s %s %s now protected against corrosion.", - ((item >= 0) ? "Your" : "The"), o_name, - ((o_ptr->number > 1) ? "are" : "is")); + msg_format("%s %s %s now protected against corrosion.", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "are" : "is")); #endif - calc_android_exp(); - return TRUE; } @@ -4950,8 +3909,7 @@ bool curse_armor(void) int i; object_type *o_ptr; - char o_name[MAX_NLEN]; - + GAME_TEXT o_name[MAX_NLEN]; /* Curse the body armor */ o_ptr = &inventory[INVEN_BODY]; @@ -4959,8 +3917,6 @@ bool curse_armor(void) /* Nothing to curse */ if (!o_ptr->k_idx) return (FALSE); - - /* Describe */ object_desc(o_name, o_ptr, OD_OMIT_PREFIX); /* Attempt a saving throw for artifacts */ @@ -4968,11 +3924,11 @@ bool curse_armor(void) { /* Cool */ #ifdef JP -msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返した!", -"恐怖の暗黒オーラ", "防具", o_name); + msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返した!", + "恐怖の暗黒オーラ", "防具", o_name); #else msg_format("A %s tries to %s, but your %s resists the effects!", - "terrible black aura", "surround your armor", o_name); + "terrible black aura", "surround your armor", o_name); #endif } @@ -4980,7 +3936,6 @@ msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返し /* not artifact or failed save... */ else { - /* Oops */ msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name); chg_virtue(V_ENCHANT, -5); @@ -5002,14 +3957,7 @@ msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返し /* Break it */ o_ptr->ident |= (IDENT_BROKEN); - - /* Recalculate bonuses */ - p_ptr->update |= (PU_BONUS); - - /* Recalculate mana */ - p_ptr->update |= (PU_MANA); - - /* Window stuff */ + p_ptr->update |= (PU_BONUS | PU_MANA); p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); } @@ -5026,12 +3974,10 @@ msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返し bool curse_weapon_object(bool force, object_type *o_ptr) { int i; - char o_name[MAX_NLEN]; + GAME_TEXT o_name[MAX_NLEN]; /* Nothing to curse */ if (!o_ptr->k_idx) return (FALSE); - - /* Describe */ object_desc(o_name, o_ptr, OD_OMIT_PREFIX); /* Attempt a saving throw */ @@ -5050,7 +3996,6 @@ bool curse_weapon_object(bool force, object_type *o_ptr) /* not artifact or failed save... */ else { - /* Oops */ if (!force) msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name); chg_virtue(V_ENCHANT, -5); @@ -5072,18 +4017,10 @@ bool curse_weapon_object(bool force, object_type *o_ptr) /* Break it */ o_ptr->ident |= (IDENT_BROKEN); - - /* Recalculate bonuses */ - p_ptr->update |= (PU_BONUS); - - /* Recalculate mana */ - p_ptr->update |= (PU_MANA); - - /* Window stuff */ + p_ptr->update |= (PU_BONUS | PU_MANA); p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); } - /* Notice */ return (TRUE); } @@ -5128,26 +4065,19 @@ bool brand_bolts(void) /* Randomize */ if (randint0(100) < 75) continue; - /* Message */ msg_print(_("クロスボウの矢が炎のオーラに包まれた!", "Your bolts are covered in a fiery aura!")); /* Ego-item */ o_ptr->name2 = EGO_FLAME; - - /* Enchant */ enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM); - - /* Notice */ return (TRUE); } - /* Flush */ if (flush_failure) flush(); /* Fail */ msg_print(_("炎で強化するのに失敗した。", "The fiery enchantment failed.")); - /* Notice */ return (TRUE); } @@ -5160,7 +4090,7 @@ bool brand_bolts(void) * @details * Note that this function is one of the more "dangerous" ones... */ -static IDX poly_r_idx(MONRACE_IDX r_idx) +static MONRACE_IDX poly_r_idx(MONRACE_IDX r_idx) { monster_race *r_ptr = &r_info[r_idx]; @@ -5169,8 +4099,7 @@ static IDX poly_r_idx(MONRACE_IDX r_idx) DEPTH lev1, lev2; /* Hack -- Uniques/Questors never polymorph */ - if ((r_ptr->flags1 & RF1_UNIQUE) || - (r_ptr->flags1 & RF1_QUESTOR)) + if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags1 & RF1_QUESTOR)) return (r_idx); /* Allowable range of "levels" for resulting monster */ @@ -5198,11 +4127,8 @@ static IDX poly_r_idx(MONRACE_IDX r_idx) /* Use that index */ r_idx = r; - /* Done */ break; } - - /* Result */ return (r_idx); } @@ -5215,18 +4141,18 @@ static IDX poly_r_idx(MONRACE_IDX r_idx) */ bool polymorph_monster(POSITION y, POSITION x) { - cave_type *c_ptr = &cave[y][x]; - monster_type *m_ptr = &m_list[c_ptr->m_idx]; + grid_type *g_ptr = &grid_array[y][x]; + monster_type *m_ptr = &m_list[g_ptr->m_idx]; bool polymorphed = FALSE; MONRACE_IDX new_r_idx; MONRACE_IDX old_r_idx = m_ptr->r_idx; - bool targeted = (target_who == c_ptr->m_idx) ? TRUE : FALSE; - bool health_tracked = (p_ptr->health_who == c_ptr->m_idx) ? TRUE : FALSE; + bool targeted = (target_who == g_ptr->m_idx) ? TRUE : FALSE; + bool health_tracked = (p_ptr->health_who == g_ptr->m_idx) ? TRUE : FALSE; monster_type back_m; if (p_ptr->inside_arena || p_ptr->inside_battle) return (FALSE); - if ((p_ptr->riding == c_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return (FALSE); + if ((p_ptr->riding == g_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return (FALSE); /* Memorize the monster before polymorphing */ back_m = *m_ptr; @@ -5239,7 +4165,7 @@ bool polymorph_monster(POSITION y, POSITION x) { BIT_FLAGS mode = 0L; bool preserve_hold_objects = back_m.hold_o_idx ? TRUE : FALSE; - s16b this_o_idx, next_o_idx = 0; + OBJECT_IDX this_o_idx, next_o_idx = 0; /* Get the monsters attitude */ if (is_friendly(m_ptr)) mode |= PM_FORCE_FRIENDLY; @@ -5250,7 +4176,7 @@ bool polymorph_monster(POSITION y, POSITION x) m_ptr->hold_o_idx = 0; /* "Kill" the "old" monster */ - delete_monster_idx(c_ptr->m_idx); + delete_monster_idx(g_ptr->m_idx); /* Create a new monster (no groups) */ if (place_monster_aux(0, y, x, new_r_idx, mode)) @@ -5280,7 +4206,6 @@ bool polymorph_monster(POSITION y, POSITION x) { for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { - /* Acquire object */ object_type *o_ptr = &o_list[this_o_idx]; /* Acquire next object */ @@ -5292,13 +4217,10 @@ bool polymorph_monster(POSITION y, POSITION x) } else if (back_m.hold_o_idx) /* Failed (paranoia) */ { - /* Delete objects */ for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { /* Acquire next object */ next_o_idx = o_list[this_o_idx].next_o_idx; - - /* Delete the object */ delete_object_idx(this_o_idx); } } @@ -5389,34 +4311,25 @@ bool mirror_tunnel(void) */ bool eat_magic(int power) { - object_type * o_ptr; + object_type *o_ptr; object_kind *k_ptr; - int lev; + DEPTH lev; OBJECT_IDX item; int recharge_strength = 0; bool fail = FALSE; byte fail_type = 1; - cptr q, s; - char o_name[MAX_NLEN]; + concptr q, s; + GAME_TEXT o_name[MAX_NLEN]; item_tester_hook = item_tester_hook_recharge; - /* Get an item */ q = _("どのアイテムから魔力を吸収しますか?", "Drain which item? "); s = _("魔力を吸収できるアイテムがありません。", "You have nothing to drain."); - if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE; - - if (item >= 0) - { - o_ptr = &inventory[item]; - } - else - { - o_ptr = &o_list[0 - item]; - } + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + if (!o_ptr) return FALSE; k_ptr = &k_info[o_ptr->k_idx]; lev = k_info[o_ptr->k_idx].level; @@ -5470,8 +4383,6 @@ bool eat_magic(int power) { object_type forge; object_type *q_ptr; - - /* Get local object */ q_ptr = &forge; /* Obtain a local object */ @@ -5488,7 +4399,6 @@ bool eat_magic(int power) p_ptr->total_weight -= q_ptr->weight; item = inven_carry(q_ptr); - /* Message */ msg_print(_("杖をまとめなおした。", "You unstack your staff.")); } } @@ -5525,7 +4435,7 @@ bool eat_magic(int power) /*** Determine Seriousness of Failure ***/ /* Mages recharge objects more safely. */ - if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER || p_ptr->pclass == CLASS_MAGIC_EATER || p_ptr->pclass == CLASS_BLUE_MAGE) + if (IS_WIZARD_CLASS()) { /* 10% chance to blow up one rod, otherwise draining. */ if (o_ptr->tval == TV_ROD) @@ -5652,130 +4562,13 @@ bool eat_magic(int power) p_ptr->csp = p_ptr->msp; } - /* Redraw mana and hp */ p_ptr->redraw |= (PR_MANA); - - p_ptr->notice |= (PN_COMBINE | PN_REORDER); + p_ptr->update |= (PU_COMBINE | PU_REORDER); p_ptr->window |= (PW_INVEN); return TRUE; } -/*! - * @brief 同族召喚(援軍)処理 - * @param level 召喚基準レベル - * @param y 召喚先Y座標 - * @param x 召喚先X座標 - * @param mode 召喚オプション - * @return ターンを消費した場合TRUEを返す - */ -bool summon_kin_player(int level, int y, int x, BIT_FLAGS mode) -{ - bool pet = (bool)(mode & PM_FORCE_PET); - if (!pet) mode |= PM_NO_PET; - - switch (p_ptr->mimic_form) - { - case MIMIC_NONE: - switch (p_ptr->prace) - { - case RACE_HUMAN: - case RACE_AMBERITE: - case RACE_BARBARIAN: - case RACE_BEASTMAN: - case RACE_DUNADAN: - summon_kin_type = 'p'; - break; - case RACE_HALF_ELF: - case RACE_ELF: - case RACE_HOBBIT: - case RACE_GNOME: - case RACE_DWARF: - case RACE_HIGH_ELF: - case RACE_NIBELUNG: - case RACE_DARK_ELF: - case RACE_MIND_FLAYER: - case RACE_KUTAR: - case RACE_S_FAIRY: - summon_kin_type = 'h'; - break; - case RACE_HALF_ORC: - summon_kin_type = 'o'; - break; - case RACE_HALF_TROLL: - summon_kin_type = 'T'; - break; - case RACE_HALF_OGRE: - summon_kin_type = 'O'; - break; - case RACE_HALF_GIANT: - case RACE_HALF_TITAN: - case RACE_CYCLOPS: - summon_kin_type = 'P'; - break; - case RACE_YEEK: - summon_kin_type = 'y'; - break; - case RACE_KLACKON: - summon_kin_type = 'K'; - break; - case RACE_KOBOLD: - summon_kin_type = 'k'; - break; - case RACE_IMP: - if (one_in_(13)) summon_kin_type = 'U'; - else summon_kin_type = 'u'; - break; - case RACE_DRACONIAN: - summon_kin_type = 'd'; - break; - case RACE_GOLEM: - case RACE_ANDROID: - summon_kin_type = 'g'; - break; - case RACE_SKELETON: - if (one_in_(13)) summon_kin_type = 'L'; - else summon_kin_type = 's'; - break; - case RACE_ZOMBIE: - summon_kin_type = 'z'; - break; - case RACE_VAMPIRE: - summon_kin_type = 'V'; - break; - case RACE_SPECTRE: - summon_kin_type = 'G'; - break; - case RACE_SPRITE: - summon_kin_type = 'I'; - break; - case RACE_ENT: - summon_kin_type = '#'; - break; - case RACE_ANGEL: - summon_kin_type = 'A'; - break; - case RACE_DEMON: - summon_kin_type = 'U'; - break; - default: - summon_kin_type = 'p'; - break; - } - break; - case MIMIC_DEMON: - if (one_in_(13)) summon_kin_type = 'U'; - else summon_kin_type = 'u'; - break; - case MIMIC_DEMON_LORD: - summon_kin_type = 'U'; - break; - case MIMIC_VAMPIRE: - summon_kin_type = 'V'; - break; - } - return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, mode); -} /*! * @brief 皆殺し(全方向攻撃)処理 @@ -5785,22 +4578,191 @@ bool summon_kin_player(int level, int y, int x, BIT_FLAGS mode) */ void massacre(void) { - int x, y; - cave_type *c_ptr; - monster_type *m_ptr; - int dir; + POSITION x, y; + grid_type *g_ptr; + monster_type *m_ptr; + DIRECTION dir; for (dir = 0; dir < 8; dir++) { y = p_ptr->y + ddy_ddd[dir]; x = p_ptr->x + ddx_ddd[dir]; - c_ptr = &cave[y][x]; - - /* Get the monster */ - m_ptr = &m_list[c_ptr->m_idx]; + g_ptr = &grid_array[y][x]; + m_ptr = &m_list[g_ptr->m_idx]; /* Hack -- attack monsters */ - if (c_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT))) + if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT))) py_attack(y, x, 0); } } + +bool eat_lock(void) +{ + POSITION x, y; + grid_type *g_ptr; + feature_type *f_ptr, *mimic_f_ptr; + DIRECTION dir; + + if (!get_direction(&dir, FALSE, FALSE)) return FALSE; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; + g_ptr = &grid_array[y][x]; + f_ptr = &f_info[g_ptr->feat]; + mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)]; + + stop_mouth(); + + if (!have_flag(mimic_f_ptr->flags, FF_HURT_ROCK)) + { + msg_print(_("この地形は食べられない。", "You cannot eat this feature.")); + } + else if (have_flag(f_ptr->flags, FF_PERMANENT)) + { + msg_format(_("いてっ!この%sはあなたの歯より硬い!", "Ouch! This %s is harder than your teeth!"), f_name + mimic_f_ptr->name); + } + else if (g_ptr->m_idx) + { + monster_type *m_ptr = &m_list[g_ptr->m_idx]; + msg_print(_("何かが邪魔しています!", "There's something in the way!")); + + if (!m_ptr->ml || !is_pet(m_ptr)) py_attack(y, x, 0); + } + else if (have_flag(f_ptr->flags, FF_TREE)) + { + msg_print(_("木の味は好きじゃない!", "You don't like the woody taste!")); + } + else if (have_flag(f_ptr->flags, FF_GLASS)) + { + msg_print(_("ガラスの味は好きじゃない!", "You don't like the glassy taste!")); + } + else if (have_flag(f_ptr->flags, FF_DOOR) || have_flag(f_ptr->flags, FF_CAN_DIG)) + { + (void)set_food(p_ptr->food + 3000); + } + else if (have_flag(f_ptr->flags, FF_MAY_HAVE_GOLD) || have_flag(f_ptr->flags, FF_HAS_GOLD)) + { + (void)set_food(p_ptr->food + 5000); + } + else + { + msg_format(_("この%sはとてもおいしい!", "This %s is very filling!"), f_name + mimic_f_ptr->name); + (void)set_food(p_ptr->food + 10000); + } + + /* Destroy the wall */ + cave_alter_feat(y, x, FF_HURT_ROCK); + + (void)move_player_effect(y, x, MPE_DONT_PICKUP); + return TRUE; +} + + +bool shock_power(void) +{ + DIRECTION dir; + POSITION y, x; + HIT_POINT dam; + PLAYER_LEVEL plev = p_ptr->lev; + int boost = P_PTR_KI; + if (heavy_armor()) boost /= 2; + + project_length = 1; + if (!get_aim_dir(&dir)) return FALSE; + + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; + dam = damroll(8 + ((plev - 5) / 4) + boost / 12, 8); + fire_beam(GF_MISSILE, dir, dam); + if (grid_array[y][x].m_idx) + { + int i; + POSITION ty = y, tx = x; + POSITION oy = y, ox = x; + MONSTER_IDX m_idx = grid_array[y][x].m_idx; + monster_type *m_ptr = &m_list[m_idx]; + monster_race *r_ptr = &r_info[m_ptr->r_idx]; + GAME_TEXT m_name[MAX_NLEN]; + + monster_desc(m_name, m_ptr, 0); + + if (randint1(r_ptr->level * 3 / 2) > randint0(dam / 2) + dam / 2) + { + msg_format(_("%sは飛ばされなかった。", "%^s was not blown away."), m_name); + } + else + { + for (i = 0; i < 5; i++) + { + y += ddy[dir]; + x += ddx[dir]; + if (cave_empty_bold(y, x)) + { + ty = y; + tx = x; + } + else break; + } + if ((ty != oy) || (tx != ox)) + { + msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name); + grid_array[oy][ox].m_idx = 0; + grid_array[ty][tx].m_idx = m_idx; + m_ptr->fy = ty; + m_ptr->fx = tx; + + update_monster(m_idx, TRUE); + lite_spot(oy, ox); + lite_spot(ty, tx); + + if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) + p_ptr->update |= (PU_MON_LITE); + } + } + } + return TRUE; +} + +bool booze(player_type *creature_ptr) +{ + bool ident = FALSE; + if (creature_ptr->pclass != CLASS_MONK) chg_virtue(V_HARMONY, -1); + else if (!creature_ptr->resist_conf) creature_ptr->special_attack |= ATTACK_SUIKEN; + if (!creature_ptr->resist_conf) + { + if (set_confused(randint0(20) + 15)) + { + ident = TRUE; + } + } + + if (!creature_ptr->resist_chaos) + { + if (one_in_(2)) + { + if (set_image(creature_ptr->image + randint0(150) + 150)) + { + ident = TRUE; + } + } + if (one_in_(13) && (creature_ptr->pclass != CLASS_MONK)) + { + ident = TRUE; + if (one_in_(3)) lose_all_info(); + else wiz_dark(); + (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE); + wiz_dark(); + msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head...")); + msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing, or how you got here!")); + } + } + return ident; +} + +bool detonation(player_type *creature_ptr) +{ + msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!")); + take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1); + (void)set_stun(creature_ptr->stun + 75); + (void)set_cut(creature_ptr->cut + 5000); + return TRUE; +} \ No newline at end of file