X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fspells3.c;h=6f92fd83f3fd0781e4ad3b01570b108af532af08;hb=00f341adda94315aae0c3543ec4f713473d02186;hp=232975f484681923ecabde6622540cdedf305939;hpb=dea1751245b109c395a4de2eb238ed25fd53840e;p=hengband%2Fhengband.git diff --git a/src/spells3.c b/src/spells3.c index 232975f48..ba0e2825d 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -1,61 +1,48 @@ -/* File: spells3.c */ - -/* +/*! + * @file spells3.c + * @brief 魔法効果の実装/ Spell code (part 3) + * @date 2014/07/26 + * @author + *
  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
- *
  * This software may be copied and distributed for educational, research,
  * and not for profit purposes provided that this copyright and statement
  * are included in all such copies.  Other copyrights may also apply.
+ * 
*/ -/* Purpose: Spell code (part 3) */ - #include "angband.h" - -/* Maximum number of tries for teleporting */ +#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/x chance of reducing stats (for elemental attacks) */ -#define HURT_CHANCE 16 - - -static bool cave_monster_teleportable_bold(int m_idx, int y, int x, u32b 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 モンスターのテレポートアウェイ処理 / * Teleport a monster, normally up to "dis" grids away. - * + * @param m_idx モンスターID + * @param dis テレポート距離 + * @param mode オプション + * @return テレポートが実際に行われたらtrue + * @details * Attempt to move the monster at least "dis/2" grids away. - * * But allow variation to prevent infinite loops. */ -bool teleport_away(int m_idx, int dis, u32b 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; - int ny = 0, nx = 0; + POSITION ny = 0, nx = 0; bool look = TRUE; @@ -64,7 +51,6 @@ bool teleport_away(int m_idx, int dis, u32b mode) /* Paranoia */ if (!m_ptr->r_idx) return (FALSE); - /* Save the old location */ oy = m_ptr->fy; ox = m_ptr->fx; @@ -105,7 +91,7 @@ bool teleport_away(int m_idx, int dis, u32b 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; @@ -124,14 +110,13 @@ bool teleport_away(int m_idx, int dis, u32b 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; @@ -140,13 +125,8 @@ bool teleport_away(int m_idx, int dis, u32b 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)) @@ -156,29 +136,33 @@ bool teleport_away(int m_idx, int dis, u32b mode) } - -/* +/*! + * @brief モンスターを指定された座標付近にテレポートする / * Teleport monster next to a grid near the given location + * @param m_idx モンスターID + * @param ty 目安Y座標 + * @param tx 目安X座標 + * @param power テレポート成功確率 + * @param mode オプション + * @return なし */ -void teleport_monster_to(int m_idx, int ty, int tx, int power, u32b 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; @@ -209,7 +193,7 @@ void teleport_monster_to(int m_idx, int ty, int tx, int power, u32b mode) 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; @@ -227,76 +211,34 @@ void teleport_monster_to(int m_idx, int ty, int tx, int power, u32b mode) 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)) p_ptr->update |= (PU_MON_LITE); } - -bool cave_player_teleportable_bold(int y, int x, u32b 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; -} - - -/* +/*! + * @brief プレイヤーのテレポート先選定と移動処理 / * Teleport the player to a location up to "dis" grids away. - * + * @param dis 基本移動距離 + * @param mode オプション + * @return 実際にテレポート処理が行われたらtrue + * @details + *
  * If no such spaces are readily available, the distance may increase.
  * Try very hard to move the player at least a quarter that distance.
  *
@@ -309,31 +251,26 @@ bool cave_player_teleportable_bold(int y, int x, u32b mode)
  * candidates is selected first, which includes at least 50% of all
  * floor grids within the distance, and any single grid in this list
  * of candidates has equal possibility to be choosen as a destination.
+ * 
*/ -#define MAX_TELEPORT_DISTANCE 200 - -bool teleport_player_aux(int dis, u32b mode) +bool teleport_player_aux(POSITION dis, BIT_FLAGS mode) { int candidates_at[MAX_TELEPORT_DISTANCE + 1]; int total_candidates, cur_candidates; - int y = 0, x = 0, min, pick, i; + POSITION y = 0, x = 0; + int min, pick, i; - int left = MAX(1, px - dis); - int right = MIN(cur_wid - 2, px + dis); - int top = MAX(1, py - dis); - int bottom = MIN(cur_hgt - 2, py + dis); + int left = MAX(1, p_ptr->x - dis); + int right = MIN(cur_wid - 2, p_ptr->x + dis); + int top = MAX(1, p_ptr->y - dis); + int bottom = MIN(cur_hgt - 2, p_ptr->y + dis); if (p_ptr->wild_mode) return FALSE; if (p_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL)) { -#ifdef JP - msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª"); -#else - msg_print("A mysterious force prevents you from teleporting!"); -#endif - + msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!")); return FALSE; } @@ -356,7 +293,7 @@ bool teleport_player_aux(int dis, u32b mode) if (!cave_player_teleportable_bold(y, x, mode)) continue; /* Calculate distance */ - d = distance(py, px, y, x); + d = distance(p_ptr->y, p_ptr->x, y, x); /* Skip too far locations */ if (d > dis) continue; @@ -395,7 +332,7 @@ bool teleport_player_aux(int dis, u32b mode) if (!cave_player_teleportable_bold(y, x, mode)) continue; /* Calculate distance */ - d = distance(py, px, y, x); + d = distance(p_ptr->y, p_ptr->x, y, x); /* Skip too far locations */ if (d > dis) continue; @@ -414,27 +351,28 @@ bool teleport_player_aux(int dis, u32b mode) if (player_bold(y, x)) return FALSE; - /* Sound */ sound(SOUND_TELEPORT); #ifdef JP if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) - msg_format("¡Ø¤³¤Ã¤Á¤À¤¡¡¢%s¡Ù", player_name); + 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; } -void teleport_player(int dis, u32b mode) +/*! + * @brief プレイヤーのテレポート処理メインルーチン + * @param dis 基本移動距離 + * @param mode オプション + * @return なし + */ +void teleport_player(POSITION dis, BIT_FLAGS mode) { - int yy, xx; - - /* Save the old location */ - int oy = py; - int ox = px; + POSITION yy, xx; + POSITION oy = p_ptr->y; + POSITION ox = p_ptr->x; if (!teleport_player_aux(dis, mode)) return; @@ -443,7 +381,7 @@ void teleport_player(int dis, u32b mode) { for (yy = -1; yy < 2; yy++) { - int 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)) @@ -455,10 +393,10 @@ void teleport_player(int dis, u32b mode) * The latter limitation is to avoid * totally unkillable suckers... */ - if ((r_ptr->flags6 & RF6_TPORT) && + if ((r_ptr->a_ability_flags2 & RF6_TPORT) && !(r_ptr->flagsr & RFR_RES_TELE)) { - if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, 0L); + if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L); } } } @@ -466,13 +404,17 @@ void teleport_player(int dis, u32b mode) } -void teleport_player_away(int m_idx, int dis) +/*! + * @brief プレイヤーのテレポートアウェイ処理 / + * @param m_idx アウェイを試みたプレイヤーID + * @param dis テレポート距離 + * @return なし + */ +void teleport_player_away(MONSTER_IDX m_idx, POSITION dis) { - int yy, xx; - - /* Save the old location */ - int oy = py; - int ox = px; + POSITION yy, xx; + POSITION oy = p_ptr->y; + POSITION ox = p_ptr->x; if (!teleport_player_aux(dis, TELEPORT_PASSIVE)) return; @@ -481,7 +423,7 @@ void teleport_player_away(int m_idx, int dis) { for (yy = -1; yy < 2; yy++) { - int 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)) @@ -493,10 +435,10 @@ void teleport_player_away(int m_idx, int dis) * The latter limitation is to avoid * totally unkillable suckers... */ - if ((r_ptr->flags6 & RF6_TPORT) && + if ((r_ptr->a_ability_flags2 & RF6_TPORT) && !(r_ptr->flagsr & RFR_RES_TELE)) { - if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, 0L); + if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L); } } } @@ -504,24 +446,27 @@ void teleport_player_away(int m_idx, int dis) } -/* +/*! + * @brief プレイヤーを指定位置近辺にテレポートさせる * Teleport player to a grid near the given location - * + * @param ny 目標Y座標 + * @param nx 目標X座標 + * @param mode オプションフラグ + * @return なし + * @details + *
  * This function is slightly obsessive about correctness.
  * This function allows teleporting into vaults (!)
+ * 
*/ -void teleport_player_to(int ny, int nx, u32b mode) +void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode) { - int y, x, dis = 0, ctr = 0; + POSITION y, x; + POSITION dis = 0, ctr = 0; if (p_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL)) { -#ifdef JP - msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª"); -#else - msg_print("A mysterious force prevents you from teleporting!"); -#endif - + msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!")); return; } @@ -531,13 +476,13 @@ void teleport_player_to(int ny, int nx, u32b mode) /* Pick a nearby legal location */ while (1) { - y = rand_spread(ny, dis); - x = rand_spread(nx, dis); + y = (POSITION)rand_spread(ny, dis); + x = (POSITION)rand_spread(nx, dis); if (in_bounds(y, x)) break; } /* 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; @@ -550,34 +495,31 @@ void teleport_player_to(int ny, int nx, u32b mode) } } - /* Sound */ sound(SOUND_TELEPORT); - - /* Move the player */ (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); } -void teleport_away_followable(int m_idx) +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); - if (old_ml && (old_cdis <= MAX_SIGHT) && !world_monster && !p_ptr->inside_battle && los(py, px, oldfy, oldfx)) + if (old_ml && (old_cdis <= MAX_SIGHT) && !world_monster && !p_ptr->inside_battle && los(p_ptr->y, p_ptr->x, oldfy, oldfx)) { bool follow = FALSE; 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++) { @@ -596,20 +538,12 @@ void teleport_away_followable(int m_idx) if (follow) { -#ifdef JP - if (get_check_strict("¤Ä¤¤¤Æ¤¤¤­¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL)) -#else - if (get_check_strict("Do you follow it? ", CHECK_OKAY_CANCEL)) -#endif + if (get_check_strict(_("ついていきますか?", "Do you follow it? "), CHECK_OKAY_CANCEL)) { if (one_in_(3)) { teleport_player(200, TELEPORT_PASSIVE); -#ifdef JP - msg_print("¼ºÇÔ¡ª"); -#else - msg_print("Failed!"); -#endif + msg_print(_("失敗!", "Failed!")); } else teleport_player_to(m_ptr->fy, m_ptr->fx, 0L); p_ptr->energy_need += ENERGY_NEED(); @@ -619,23 +553,47 @@ void teleport_away_followable(int 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) - * Note: If m_idx <= 0, target is player. + * @param m_idx テレポートの対象となるモンスターID(0ならばプレイヤー) / If m_idx <= 0, target is player. + * @return なし */ -void teleport_level(int 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 */ { -#ifdef JP - strcpy(m_name, "¤¢¤Ê¤¿"); -#else - strcpy(m_name, "you"); -#endif + strcpy(m_name, _("あなた", "you")); } else /* To monster */ { @@ -650,22 +608,13 @@ void teleport_level(int m_idx) /* No effect in some case */ if (TELE_LEVEL_IS_INEFF(m_idx)) { -#ifdef JP - if (see_m) msg_print("¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£"); -#else - if (see_m) msg_print("There is no effect."); -#endif - + if (see_m) msg_print(_("効果がなかった。", "There is no effect.")); return; } if ((m_idx <= 0) && p_ptr->anti_tele) /* To player */ { -#ifdef JP - msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª"); -#else - msg_print("A mysterious force prevents you from teleporting!"); -#endif + msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!")); return; } @@ -680,10 +629,10 @@ void teleport_level(int 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); + if (see_m) msg_format("%^sは床を突き破って沈んでいく。", m_name); #else if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s"); #endif @@ -691,9 +640,9 @@ void teleport_level(int m_idx) { if (!dun_level) { - dungeon_type = p_ptr->recall_dungeon; - p_ptr->oldpy = py; - p_ptr->oldpx = px; + p_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon; + p_ptr->oldpy = p_ptr->y; + p_ptr->oldpx = p_ptr->x; } if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL); @@ -702,7 +651,7 @@ void teleport_level(int 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 @@ -716,10 +665,10 @@ void teleport_level(int 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); + if (see_m) msg_format("%^sは天井を突き破って宙へ浮いていく。", m_name); #else if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s"); #endif @@ -743,7 +692,7 @@ void teleport_level(int m_idx) else if (go_up) { #ifdef JP - if (see_m) msg_format("%^s¤ÏÅ·°æ¤òÆͤ­ÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£", m_name); + if (see_m) msg_format("%^sは天井を突き破って宙へ浮いていく。", m_name); #else if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s"); #endif @@ -764,7 +713,7 @@ void teleport_level(int m_idx) else { #ifdef JP - if (see_m) msg_format("%^s¤Ï¾²¤òÆͤ­ÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£", m_name); + if (see_m) msg_format("%^sは床を突き破って沈んでいく。", m_name); #else if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s"); #endif @@ -772,7 +721,7 @@ void teleport_level(int 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); @@ -795,7 +744,7 @@ void teleport_level(int 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); @@ -804,17 +753,23 @@ void teleport_level(int m_idx) delete_monster_idx(m_idx); } - /* Sound */ sound(SOUND_TPLEVEL); } - -int choose_dungeon(cptr note, int y, int x) +/*! + * @brief これまでに入ったダンジョンの一覧を表示し、選択させる。 + * @param note ダンジョンに施す処理記述 + * @param y コンソールY座標 + * @param x コンソールX座標 + * @return 選択されたダンジョンID + */ +DUNGEON_IDX choose_dungeon(concptr note, POSITION y, POSITION x) { - int select_dungeon; - int i, num = 0; - s16b *dun; + DUNGEON_IDX select_dungeon; + DUNGEON_IDX i; + int num = 0; + DUNGEON_IDX *dun; /* Hack -- No need to choose dungeon in some case */ if (lite_town || vanilla_town || ironman_downward) @@ -822,18 +777,14 @@ int choose_dungeon(cptr note, int y, int x) if (max_dlv[DUNGEON_ANGBAND]) return DUNGEON_ANGBAND; else { -#ifdef JP - msg_format("¤Þ¤À%s¤ËÆþ¤Ã¤¿¤³¤È¤Ï¤Ê¤¤¡£", d_name + d_info[DUNGEON_ANGBAND].name); -#else - msg_format("You haven't entered %s yet.", d_name + d_info[DUNGEON_ANGBAND].name); -#endif + msg_format(_("まだ%sに入ったことはない。", "You haven't entered %s yet."), d_name + d_info[DUNGEON_ANGBAND].name); msg_print(NULL); return 0; } } /* 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++) @@ -849,36 +800,25 @@ int choose_dungeon(cptr note, int y, int x) } else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE; -#ifdef JP - sprintf(buf," %c) %c%-12s : ºÇÂç %d ³¬", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]); -#else - sprintf(buf," %c) %c%-16s : Max level %d", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]); -#endif + sprintf(buf,_(" %c) %c%-12s : 最大 %d 階", " %c) %c%-16s : Max level %d"), + 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, (int)max_dlv[i]); prt(buf, y + num, x); dun[num++] = i; } if (!num) { -#ifdef JP - prt(" Áª¤Ù¤ë¥À¥ó¥¸¥ç¥ó¤¬¤Ê¤¤¡£", y, x); -#else - prt(" No dungeon is available.", y, x); -#endif + prt(_(" 選べるダンジョンがない。", " No dungeon is available."), y, x); } -#ifdef JP - prt(format("¤É¤Î¥À¥ó¥¸¥ç¥ó%s¤·¤Þ¤¹¤«:", note), 0, 0); -#else - prt(format("Which dungeon do you %s?: ", note), 0, 0); -#endif + prt(format(_("どのダンジョン%sしますか:", "Which dungeon do you %s?: "), note), 0, 0); while(1) { i = inkey(); 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; @@ -893,16 +833,19 @@ int choose_dungeon(cptr note, int y, int 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; } -/* +/*! + * @brief プレイヤーの帰還発動及び中止処理 / * Recall the player to town or dungeon + * @param turns 発動までのターン数 + * @return 常にTRUEを返す */ -bool recall_player(int turns) +bool recall_player(player_type *creature_ptr, TIME_EFFECT turns) { /* * TODO: Recall the player to the last @@ -910,113 +853,108 @@ bool recall_player(int turns) */ /* Ironman option */ - if (p_ptr->inside_arena || ironman_downward) + if (creature_ptr->inside_arena || ironman_downward) { -#ifdef JP -msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£"); -#else - msg_print("Nothing happens."); -#endif - + 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) { -#ifdef JP -if (get_check("¤³¤³¤ÏºÇ¿¼Åþ㳬¤è¤êÀõ¤¤³¬¤Ç¤¹¡£¤³¤Î³¬¤ËÌá¤Ã¤ÆÍè¤Þ¤¹¤«¡© ")) -#else - if (get_check("Reset recall depth? ")) -#endif + if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? "))) { - max_dlv[dungeon_type] = dun_level; + max_dlv[p_ptr->dungeon_idx] = dun_level; if (record_maxdepth) -#ifdef JP - do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "µ¢´Ô¤Î¤È¤­¤Ë"); -#else - do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "when recall from dungeon"); -#endif + 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) { - int select_dungeon; -#ifdef JP - select_dungeon = choose_dungeon("¤Ëµ¢´Ô", 2, 14); -#else - select_dungeon = choose_dungeon("recall", 2, 14); -#endif + 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; -#ifdef JP -msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤­¤¿..."); -#else - msg_print("The air about you becomes charged..."); -#endif - - p_ptr->redraw |= (PR_STATUS); + creature_ptr->word_recall = turns; + msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged...")); + creature_ptr->redraw |= (PR_STATUS); } else { - p_ptr->word_recall = 0; -#ifdef JP -msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿..."); -#else - msg_print("A tension leaves the air around you..."); -#endif - - p_ptr->redraw |= (PR_STATUS); + creature_ptr->word_recall = 0; + msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you...")); + creature_ptr->redraw |= (PR_STATUS); } 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を返す + */ bool reset_recall(void) { int select_dungeon, dummy = 0; char ppp[80]; char tmp_val[160]; -#ifdef JP - select_dungeon = choose_dungeon("¤ò¥»¥Ã¥È", 2, 14); -#else - select_dungeon = choose_dungeon("reset", 2, 14); -#endif + select_dungeon = choose_dungeon(_("をセット", "reset"), 2, 14); /* Ironman option */ if (ironman_downward) { -#ifdef JP - msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£"); -#else - msg_print("Nothing happens."); -#endif - + msg_print(_("何も起こらなかった。", "Nothing happens.")); return TRUE; } if (!select_dungeon) return FALSE; /* Prompt */ -#ifdef JP -sprintf(ppp, "²¿³¬¤Ë¥»¥Ã¥È¤·¤Þ¤¹¤« (%d-%d):", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]); -#else - sprintf(ppp, "Reset to which level (%d-%d): ", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]); -#endif - + sprintf(ppp, _("何階にセットしますか (%d-%d):", "Reset to which level (%d-%d): "), + (int)d_info[select_dungeon].mindepth, (int)max_dlv[select_dungeon]); /* Default */ - sprintf(tmp_val, "%d", MAX(dun_level, 1)); + sprintf(tmp_val, "%d", (int)MAX(dun_level, 1)); /* Ask for a level */ if (get_string(ppp, tmp_val, 10)) @@ -1034,14 +972,10 @@ sprintf(ppp, " max_dlv[select_dungeon] = dummy; if (record_maxdepth) -#ifdef JP - do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥Õ¥í¥¢¡¦¥ê¥»¥Ã¥È¤Ç"); -#else - do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "using a scroll of reset recall"); -#endif + 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 @@ -1055,18 +989,18 @@ msg_format("%s } -/* +/*! + * @brief プレイヤーの装備劣化処理 / * Apply disenchantment to the player's stuff - * - * XXX XXX XXX This function is also called from the "melee" code - * + * @param mode 最下位ビットが1ならば劣化処理が若干低減される + * @return 劣化処理に関するメッセージが発せられた場合はTRUEを返す / * Return "TRUE" if the player notices anything */ -bool apply_disenchant(int mode) +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 */ @@ -1082,7 +1016,6 @@ bool apply_disenchant(int mode) case 8: t = INVEN_FEET; break; } - /* Get the item */ o_ptr = &inventory[t]; /* No item, nothing happens */ @@ -1099,25 +1032,17 @@ bool apply_disenchant(int 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); } @@ -1147,40 +1072,36 @@ msg_format("%s(%c) 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); } - +/*! + * @brief プレイヤーの突然変異処理 + * @return なし + */ void mutate_player(void) { - int max1, cur1, max2, cur2, ii, jj, i; + BASE_STATUS max1, cur1, max2, cur2; + 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]; @@ -1192,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]; @@ -1202,8 +1123,10 @@ void mutate_player(void) } -/* - * Apply Nexus +/*! + * @brief プレイヤーの因果混乱処理 / Apply Nexus + * @param m_ptr 因果混乱をプレイヤーに与えたモンスターの情報参照ポインタ + * @return なし */ void apply_nexus(monster_type *m_ptr) { @@ -1225,12 +1148,7 @@ void apply_nexus(monster_type *m_ptr) { if (randint0(100) < p_ptr->skill_sav) { -#ifdef JP -msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª"); -#else - msg_print("You resist the effects!"); -#endif - + msg_print(_("しかし効力を跳ね返した!", "You resist the effects!")); break; } @@ -1243,21 +1161,11 @@ msg_print(" { if (randint0(100) < p_ptr->skill_sav) { -#ifdef JP -msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª"); -#else - msg_print("You resist the effects!"); -#endif - + msg_print(_("しかし効力を跳ね返した!", "You resist the effects!")); break; } -#ifdef JP -msg_print("ÂΤ¬¤Í¤¸¤ì»Ï¤á¤¿..."); -#else - msg_print("Your body starts to scramble..."); -#endif - + msg_print(_("体がねじれ始めた...", "Your body starts to scramble...")); mutate_player(); break; } @@ -1265,12 +1173,14 @@ msg_print(" } -/* +/*! + * @brief 寿命つき光源の燃素追加処理 / * Charge a lite (torch or latern) + * @return なし */ void phlogiston(void) { - int max_flog = 0; + GAME_TURN max_flog = 0; object_type * o_ptr = &inventory[INVEN_LITE]; /* It's a lamp */ @@ -1288,47 +1198,25 @@ void phlogiston(void) /* No torch to refill */ else { -#ifdef JP -msg_print("dzÁǤò¾ÃÈñ¤¹¤ë¥¢¥¤¥Æ¥à¤òÁõÈ÷¤·¤Æ¤¤¤Þ¤»¤ó¡£"); -#else - msg_print("You are not wielding anything which uses phlogiston."); -#endif - + msg_print(_("燃素を消費するアイテムを装備していません。", "You are not wielding anything which uses phlogiston.")); return; } if (o_ptr->xtra4 >= max_flog) { -#ifdef JP -msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ï¤³¤ì°Ê¾ådzÁǤòÊä½¼¤Ç¤­¤Þ¤»¤ó¡£"); -#else - msg_print("No more phlogiston can be put in this item."); -#endif - + msg_print(_("このアイテムにはこれ以上燃素を補充できません。", "No more phlogiston can be put in this item.")); return; } /* Refuel */ - o_ptr->xtra4 += (max_flog / 2); - - /* Message */ -#ifdef JP -msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ËdzÁǤòÊä½¼¤·¤¿¡£"); -#else - msg_print("You add phlogiston to your light item."); -#endif + o_ptr->xtra4 += (XTRA16)(max_flog / 2); + msg_print(_("照明用アイテムに燃素を補充した。", "You add phlogiston to your light item.")); - /* Comment */ if (o_ptr->xtra4 >= max_flog) { - o_ptr->xtra4 = max_flog; -#ifdef JP -msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ÏËþ¥¿¥ó¤Ë¤Ê¤Ã¤¿¡£"); -#else - msg_print("Your light item is full."); -#endif - + o_ptr->xtra4 = (XTRA16)max_flog; + msg_print(_("照明用アイテムは満タンになった。", "Your light item is full.")); } /* Recalculate torch */ @@ -1336,43 +1224,27 @@ msg_print(" } -/* +/*! + * @brief 武器へのエゴ付加処理 / * Brand the current weapon + * @param brand_type エゴ化ID(e_info.txtとは連動していない) + * @return なし */ void brand_weapon(int brand_type) { - int item; + 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 */ -#ifdef JP -q = "¤É¤ÎÉð´ï¤ò¶¯²½¤·¤Þ¤¹¤«? "; -s = "¶¯²½¤Ç¤­¤ëÉð´ï¤¬¤Ê¤¤¡£"; -#else - q = "Enchant which weapon? "; - s = "You have nothing to enchant."; -#endif - - 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]; - } + q = _("どの武器を強化しますか? ", "Enchant which weapon? "); + s = _("強化できる武器がない。", "You have nothing to enchant."); + 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 */ @@ -1383,10 +1255,10 @@ s = " !((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) @@ -1394,193 +1266,93 @@ s = " case 17: if (o_ptr->tval == TV_SWORD) { -#ifdef JP -act = "¤Ï±Ô¤µ¤òÁý¤·¤¿¡ª"; -#else - act = "becomes very sharp!"; -#endif + act = _("は鋭さを増した!", "becomes very sharp!"); o_ptr->name2 = EGO_SHARPNESS; - o_ptr->pval = m_bonus(5, dun_level) + 1; + o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, dun_level) + 1; if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2)) o_ptr->pval = 2; } else { -#ifdef JP -act = "¤ÏÇ˲õÎϤòÁý¤·¤¿¡ª"; -#else - act = "seems very powerful."; -#endif - + act = _("は破壊力を増した!", "seems very powerful."); o_ptr->name2 = EGO_EARTHQUAKES; - o_ptr->pval = m_bonus(3, dun_level); + o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, dun_level); } break; case 16: -#ifdef JP -act = "¤Ï¿Í´Ö¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª"; -#else - act = "seems to be looking for humans!"; -#endif - - o_ptr->name2 = EGO_SLAY_HUMAN; + act = _("は人間の血を求めている!", "seems to be looking for humans!"); + o_ptr->name2 = EGO_KILL_HUMAN; break; case 15: -#ifdef JP -act = "¤ÏÅÅ·â¤Ëʤ¤ï¤ì¤¿¡ª"; -#else - act = "covered with lightning!"; -#endif - + act = _("は電撃に覆われた!", "covered with lightning!"); o_ptr->name2 = EGO_BRAND_ELEC; break; case 14: -#ifdef JP -act = "¤Ï»À¤Ëʤ¤ï¤ì¤¿¡ª"; -#else - act = "coated with acid!"; -#endif - + act = _("は酸に覆われた!", "coated with acid!"); o_ptr->name2 = EGO_BRAND_ACID; break; case 13: -#ifdef JP -act = "¤Ï¼Ù°­¤Ê¤ë²øʪ¤òµá¤á¤Æ¤¤¤ë¡ª"; -#else - act = "seems to be looking for evil monsters!"; -#endif - - o_ptr->name2 = EGO_SLAY_EVIL; + act = _("は邪悪なる怪物を求めている!", "seems to be looking for evil monsters!"); + o_ptr->name2 = EGO_KILL_EVIL; break; case 12: -#ifdef JP -act = "¤Ï°ÛÀ¤³¦¤Î½»¿Í¤ÎÆùÂΤòµá¤á¤Æ¤¤¤ë¡ª"; -#else - act = "seems to be looking for demons!"; -#endif - - o_ptr->name2 = EGO_SLAY_DEMON; + act = _("は異世界の住人の肉体を求めている!", "seems to be looking for demons!"); + o_ptr->name2 = EGO_KILL_DEMON; break; case 11: -#ifdef JP -act = "¤Ï»Ó¤òµá¤á¤Æ¤¤¤ë¡ª"; -#else - act = "seems to be looking for undead!"; -#endif - - o_ptr->name2 = EGO_SLAY_UNDEAD; + act = _("は屍を求めている!", "seems to be looking for undead!"); + o_ptr->name2 = EGO_KILL_UNDEAD; break; case 10: -#ifdef JP -act = "¤Ïưʪ¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª"; -#else - act = "seems to be looking for animals!"; -#endif - - o_ptr->name2 = EGO_SLAY_ANIMAL; + act = _("は動物の血を求めている!", "seems to be looking for animals!"); + o_ptr->name2 = EGO_KILL_ANIMAL; break; case 9: -#ifdef JP -act = "¤Ï¥É¥é¥´¥ó¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª"; -#else - act = "seems to be looking for dragons!"; -#endif - - o_ptr->name2 = EGO_SLAY_DRAGON; + act = _("はドラゴンの血を求めている!", "seems to be looking for dragons!"); + o_ptr->name2 = EGO_KILL_DRAGON; break; case 8: -#ifdef JP -act = "¤Ï¥È¥í¥ë¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª"; -#else - act = "seems to be looking for troll!s"; -#endif - - o_ptr->name2 = EGO_SLAY_TROLL; + act = _("はトロルの血を求めている!", "seems to be looking for troll!s"); + o_ptr->name2 = EGO_KILL_TROLL; break; case 7: -#ifdef JP -act = "¤Ï¥ª¡¼¥¯¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª"; -#else - act = "seems to be looking for orcs!"; -#endif - - o_ptr->name2 = EGO_SLAY_ORC; + act = _("はオークの血を求めている!", "seems to be looking for orcs!"); + o_ptr->name2 = EGO_KILL_ORC; break; case 6: -#ifdef JP -act = "¤Ïµð¿Í¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª"; -#else - act = "seems to be looking for giants!"; -#endif - - o_ptr->name2 = EGO_SLAY_GIANT; + act = _("は巨人の血を求めている!", "seems to be looking for giants!"); + o_ptr->name2 = EGO_KILL_GIANT; break; case 5: -#ifdef JP -act = "¤ÏÈó¾ï¤ËÉÔ°ÂÄê¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡£"; -#else - act = "seems very unstable now."; -#endif - + act = _("は非常に不安定になったようだ。", "seems very unstable now."); o_ptr->name2 = EGO_TRUMP; o_ptr->pval = randint1(2); break; case 4: -#ifdef JP -act = "¤Ï·ì¤òµá¤á¤Æ¤¤¤ë¡ª"; -#else - act = "thirsts for blood!"; -#endif - + act = _("は血を求めている!", "thirsts for blood!"); o_ptr->name2 = EGO_VAMPIRIC; break; case 3: -#ifdef JP -act = "¤ÏÆǤËʤ¤ï¤ì¤¿¡£"; -#else - act = "is coated with poison."; -#endif - + act = _("は毒に覆われた。", "is coated with poison."); o_ptr->name2 = EGO_BRAND_POIS; break; case 2: -#ifdef JP -act = "¤Ï½ã¥í¥°¥ë¥¹¤Ë°û¤ß¹þ¤Þ¤ì¤¿¡£"; -#else - act = "is engulfed in raw Logrus!"; -#endif - + act = _("は純ログルスに飲み込まれた。", "is engulfed in raw Logrus!"); o_ptr->name2 = EGO_CHAOTIC; break; case 1: -#ifdef JP -act = "¤Ï±ê¤Î¥·¡¼¥ë¥É¤Ëʤ¤ï¤ì¤¿¡ª"; -#else - act = "is covered in a fiery shield!"; -#endif - + act = _("は炎のシールドに覆われた!", "is covered in a fiery shield!"); o_ptr->name2 = EGO_BRAND_FIRE; break; default: -#ifdef JP -act = "¤Ï¿¼¤¯Î䤿¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿¡ª"; -#else - act = "glows deep, icy blue!"; -#endif - + act = _("は深く冷たいブルーに輝いた!", "glows deep, icy blue!"); o_ptr->name2 = EGO_BRAND_COLD; break; } -#ifdef JP -msg_format("¤¢¤Ê¤¿¤Î%s%s", o_name, act); -#else - msg_format("Your %s %s", o_name, act); -#endif - - + msg_format(_("あなたの%s%s", "Your %s %s"), o_name, act); enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM); o_ptr->discount = 99; @@ -1590,28 +1362,25 @@ msg_format(" { if (flush_failure) flush(); -#ifdef JP -msg_print("°À­Éղä˼ºÇÔ¤·¤¿¡£"); -#else - msg_print("The Branding failed."); -#endif - + msg_print(_("属性付加に失敗した。", "The Branding failed.")); chg_virtue(V_ENCHANT, -2); } calc_android_exp(); } -/* +/*! + * @brief 虚無招来によるフロア中の全壁除去処理 / * Vanish all walls in this floor + * @return 実際に処理が反映された場合TRUE */ 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) @@ -1624,34 +1393,27 @@ 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 */ -#ifdef JP - msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name); -#else - msg_format("%^s wakes up.", m_name); -#endif + msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name); } } @@ -1663,104 +1425,97 @@ 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; } - +/*! + * @brief 虚無招来処理 / + * @return なし + */ 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[py + ddy_ddd[i]][px + 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; @@ -1789,79 +1544,58 @@ void call_the_(void) /* Prevent destruction of quest levels and town */ else if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level) { -#ifdef JP - msg_print("ÃÏÌ̤¬Íɤ줿¡£"); -#else - msg_print("The ground trembles."); -#endif + msg_print(_("地面が揺れた。", "The ground trembles.")); } else { #ifdef JP - msg_format("¤¢¤Ê¤¿¤Ï%s¤òÊɤ˶᤹¤®¤ë¾ì½ê¤Ç¾§¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª", - ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "µ§¤ê" : "¼öʸ")); - msg_print("Â礭¤ÊÇúȯ²»¤¬¤¢¤Ã¤¿¡ª"); + msg_format("あなたは%sを壁に近すぎる場所で唱えてしまった!", + ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "祈り" : "呪文")); #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)) { -#ifdef JP - if (!vanish_dungeon()) msg_print("¥À¥ó¥¸¥ç¥ó¤Ï°ì½ÖÀŤޤêÊ֤ä¿¡£"); -#else - if (!vanish_dungeon()) msg_print("The dungeon silences a moment."); -#endif + if (!vanish_dungeon()) msg_print(_("ダンジョンは一瞬静まり返った。", "The dungeon silences a moment.")); } else { - if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), FALSE)) -#ifdef JP - msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿..."); -#else - msg_print("The dungeon collapses..."); -#endif - + if (destroy_area(p_ptr->y, p_ptr->x, 15 + p_ptr->lev + randint0(11), FALSE)) + msg_print(_("ダンジョンが崩壊した...", "The dungeon collapses...")); else -#ifdef JP - msg_print("¥À¥ó¥¸¥ç¥ó¤ÏÂ礭¤¯Íɤ줿¡£"); -#else - msg_print("The dungeon trembles."); -#endif + msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles.")); } -#ifdef JP - take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1); -#else - take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "a suicidal Call the Void", -1); -#endif + take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1); } } -/* +/*! + * @brief アイテム引き寄せ処理 / * Fetch an item (teleport it right underneath the caster) + * @param dir 魔法の発動方向 + * @param wgt 許容重量 + * @param require_los 射線の通りを要求するならばTRUE + * @return なし */ -void fetch(int dir, int wgt, bool require_los) +void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) { - int ty, tx, i; - cave_type *c_ptr; - object_type *o_ptr; - char o_name[MAX_NLEN]; + POSITION ty, tx; + OBJECT_IDX i; + grid_type *g_ptr; + object_type *o_ptr; + GAME_TEXT o_name[MAX_NLEN]; /* Check to see if an object is already there */ - if (cave[py][px].o_idx) + if (grid_array[p_ptr->y][p_ptr->x].o_idx) { -#ifdef JP -msg_print("¼«Ê¬¤Î­¤Î²¼¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡£"); -#else - msg_print("You can't fetch when you're already standing on something."); -#endif - + msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something.")); return; } @@ -1871,40 +1605,25 @@ msg_print(" tx = target_col; ty = target_row; - if (distance(py, px, ty, tx) > MAX_RANGE) + if (distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) { -#ifdef JP -msg_print("¤½¤ó¤Ê¤Ë±ó¤¯¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡ª"); -#else - msg_print("You can't fetch something that far away!"); -#endif - + msg_print(_("そんなに遠くにある物は取れません!", "You can't fetch something that far away!")); 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) { -#ifdef JP -msg_print("¤½¤³¤Ë¤Ï²¿¤â¤¢¤ê¤Þ¤»¤ó¡£"); -#else - msg_print("There is no object at this place."); -#endif - + 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) { -#ifdef JP -msg_print("¥¢¥¤¥Æ¥à¤¬¥³¥ó¥È¥í¡¼¥ë¤ò³°¤ì¤ÆÍî¤Á¤¿¡£"); -#else - msg_print("The item slips from your control."); -#endif - + msg_print(_("アイテムがコントロールを外れて落ちた。", "The item slips from your control.")); return; } @@ -1913,220 +1632,171 @@ msg_print(" { if (!player_has_los_bold(ty, tx)) { -#ifdef JP - msg_print("¤½¤³¤Ï¤¢¤Ê¤¿¤Î»ë³¦¤ËÆþ¤Ã¤Æ¤¤¤Þ¤»¤ó¡£"); -#else - msg_print("You have no direct line of sight to that location."); -#endif - + msg_print(_("そこはあなたの視界に入っていません。", "You have no direct line of sight to that location.")); return; } - else if (!projectable(py, px, ty, tx)) + else if (!projectable(p_ptr->y, p_ptr->x, ty, tx)) { -#ifdef JP - msg_print("¤½¤³¤ÏÊɤθþ¤³¤¦¤Ç¤¹¡£"); -#else - msg_print("You have no direct line of sight to that location."); -#endif - + msg_print(_("そこは壁の向こうです。", "You have no direct line of sight to that location.")); return; } } } else { - /* Use a direction */ - ty = py; /* Where to drop the item */ - tx = px; - + 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(py, px, ty, tx) > MAX_RANGE) || + 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) { /* Too heavy to 'fetch' */ -#ifdef JP -msg_print("¤½¤Î¥¢¥¤¥Æ¥à¤Ï½Å²á¤®¤Þ¤¹¡£"); -#else - msg_print("The object is too heavy."); -#endif - + msg_print(_("そのアイテムは重過ぎます。", "The object is too heavy.")); return; } - i = c_ptr->o_idx; - c_ptr->o_idx = o_ptr->next_o_idx; - cave[py][px].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)py; - o_ptr->ix = (byte)px; + o_ptr->iy = p_ptr->y; + o_ptr->ix = p_ptr->x; object_desc(o_name, o_ptr, OD_NAME_ONLY); -#ifdef JP -msg_format("%^s¤¬¤¢¤Ê¤¿¤Î­¸µ¤ËÈô¤ó¤Ç¤­¤¿¡£", o_name); -#else - msg_format("%^s flies through the air to your feet.", o_name); -#endif - + msg_format(_("%^sがあなたの足元に飛んできた。", "%^s flies through the air to your feet."), o_name); - note_spot(py, px); + note_spot(p_ptr->y, p_ptr->x); p_ptr->redraw |= PR_MAP; } - +/*! + * @brief 現実変容処理 + * @return なし + */ void alter_reality(void) { /* Ironman option */ if (p_ptr->inside_arena || ironman_downward) { -#ifdef JP - msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£"); -#else - msg_print("Nothing happens."); -#endif + msg_print(_("何も起こらなかった。", "Nothing happens.")); return; } if (!p_ptr->alter_reality) { - int turns = randint0(21) + 15; + TIME_EFFECT turns = randint0(21) + 15; p_ptr->alter_reality = turns; -#ifdef JP - msg_print("²ó¤ê¤Î·Ê¿§¤¬ÊѤï¤ê»Ï¤á¤¿..."); -#else - msg_print("The view around you begins to change..."); -#endif + msg_print(_("回りの景色が変わり始めた...", "The view around you begins to change...")); p_ptr->redraw |= (PR_STATUS); } else { p_ptr->alter_reality = 0; -#ifdef JP - msg_print("·Ê¿§¤¬¸µ¤ËÌá¤Ã¤¿..."); -#else - msg_print("The view around you got back..."); -#endif - + msg_print(_("景色が元に戻った...", "The view around you got back...")); p_ptr->redraw |= (PR_STATUS); } return; } -/* +/*! + * @brief 守りのルーン設置処理 / * Leave a "glyph of warding" which prevents monster movement + * @return 実際に設置が行われた場合TRUEを返す */ bool warding_glyph(void) { - /* XXX XXX XXX */ - if (!cave_clean_bold(py, px)) + if (!cave_clean_bold(p_ptr->y, p_ptr->x)) { -#ifdef JP -msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£"); -#else - msg_print("The object resists the spell."); -#endif - + msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell.")); return FALSE; } /* Create a glyph */ - cave[py][px].info |= CAVE_OBJECT; - cave[py][px].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(py, px); - - /* Redraw */ - lite_spot(py, px); + note_spot(p_ptr->y, p_ptr->x); + lite_spot(p_ptr->y, p_ptr->x); return TRUE; } +/*! + * @brief 鏡設置処理 + * @return 実際に設置が行われた場合TRUEを返す + */ bool place_mirror(void) { - /* XXX XXX XXX */ - if (!cave_clean_bold(py, px)) + if (!cave_clean_bold(p_ptr->y, p_ptr->x)) { -#ifdef JP -msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£"); -#else - msg_print("The object resists the spell."); -#endif - + msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell.")); return FALSE; } /* Create a mirror */ - cave[py][px].info |= CAVE_OBJECT; - cave[py][px].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[py][px].info |= CAVE_GLOW; - - /* Notice */ - note_spot(py, px); - - /* Redraw */ - lite_spot(py, px); + grid_array[p_ptr->y][p_ptr->x].info |= CAVE_GLOW; - update_local_illumination(py, px); + note_spot(p_ptr->y, p_ptr->x); + lite_spot(p_ptr->y, p_ptr->x); + update_local_illumination(p_ptr->y, p_ptr->x); return TRUE; } -/* +/*! + * @brief 爆発のルーン設置処理 / * Leave an "explosive rune" which prevents monster movement + * @return 実際に設置が行われた場合TRUEを返す */ bool explosive_rune(void) { - /* XXX XXX XXX */ - if (!cave_clean_bold(py, px)) + if (!cave_clean_bold(p_ptr->y, p_ptr->x)) { -#ifdef JP -msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£"); -#else - msg_print("The object resists the spell."); -#endif - + msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell.")); return FALSE; } /* Create a glyph */ - cave[py][px].info |= CAVE_OBJECT; - cave[py][px].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(py, px); - - /* Redraw */ - lite_spot(py, px); + note_spot(p_ptr->y, p_ptr->x); + lite_spot(p_ptr->y, p_ptr->x); return TRUE; } -/* +/*! + * @brief 全所持アイテム鑑定処理 / * Identify everything being carried. * Done by a potion of "self knowledge". + * @return なし */ void identify_pack(void) { - int i; + INVENTORY_IDX i; /* Simply identify and know every item */ for (i = 0; i < INVEN_TOTAL; i++) @@ -2136,7 +1806,6 @@ void identify_pack(void) /* Skip non-objects */ if (!o_ptr->k_idx) continue; - /* Identify it */ identify_item(o_ptr); /* Auto-inscription */ @@ -2145,9 +1814,11 @@ void identify_pack(void) } -/* +/*! + * @brief 装備強化処理の失敗率定数(千分率) / * Used by the "enchant" function (chance of failure) * (modified for Zangband, we need better stuff there...) -- TY + * @return なし */ static int enchant_table[16] = { @@ -2158,15 +1829,20 @@ static int enchant_table[16] = }; -/* +/*! + * @brief 装備の解呪処理 / * Removes curses from items in inventory - * + * @param all 軽い呪いまでの解除ならば0 + * @return 解呪されたアイテムの数 + * @details + *
  * Note that Items which are "Perma-Cursed" (The One Ring,
  * The Crown of Morgoth) can NEVER be uncursed.
  *
  * Note that if "all" is FALSE, then Items which are
  * "Heavy-Cursed" (Mormegil, Calris, and Weapons of Morgul)
  * will not be uncursed.
+ * 
*/ static int remove_curse_aux(int all) { @@ -2189,93 +1865,77 @@ 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); } -/* +/*! + * @brief 装備の軽い呪い解呪処理 / * Remove most curses + * @return 解呪に成功した装備数 */ -bool remove_curse(void) +int remove_curse(void) { return (remove_curse_aux(FALSE)); } -/* +/*! + * @brief 装備の重い呪い解呪処理 / * Remove all curses + * @return 解呪に成功した装備数 */ -bool remove_all_curse(void) +int remove_all_curse(void) { return (remove_curse_aux(TRUE)); } -/* +/*! + * @brief アイテムの価値に応じた錬金術処理 / * Turns an object into gold, gain some of its value in a shop + * @return 処理が実際に行われたらTRUEを返す */ bool alchemy(void) { - int item, amt = 1; - int old_number; - long price; + OBJECT_IDX item; + int amt = 1; + ITEM_NUMBER old_number; + 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 */ -#ifdef JP -q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©"; -s = "¶â¤ËÊѤ¨¤é¤ì¤ëʪ¤¬¤¢¤ê¤Þ¤»¤ó¡£"; -#else - q = "Turn which item to gold? "; - s = "You have nothing to turn to gold."; -#endif - - 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]; - } + q = _("どのアイテムを金に変えますか?", "Turn which item to gold? "); + s = _("金に変えられる物がありません。", "You have nothing to turn to gold."); + 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) @@ -2287,8 +1947,6 @@ s = " if (amt <= 0) return FALSE; } - - /* Describe the object */ old_number = o_ptr->number; o_ptr->number = amt; object_desc(o_name, o_ptr, 0); @@ -2300,12 +1958,7 @@ s = " if (confirm_destroy || (object_value(o_ptr) > 0)) { /* Make a verification */ -#ifdef JP -sprintf(out_val, "ËÜÅö¤Ë%s¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©", o_name); -#else - sprintf(out_val, "Really turn %s to gold? ", o_name); -#endif - + sprintf(out_val, _("本当に%sを金に変えますか?", "Really turn %s to gold? "), o_name); if (!get_check(out_val)) return FALSE; } } @@ -2313,14 +1966,8 @@ sprintf(out_val, " /* Artifacts cannot be destroyed */ if (!can_player_destroy_object(o_ptr)) { - /* Message */ -#ifdef JP - msg_format("%s¤ò¶â¤ËÊѤ¨¤ë¤³¤È¤Ë¼ºÇÔ¤·¤¿¡£", o_name); -#else - msg_format("You fail to turn %s to gold!", o_name); -#endif + msg_format(_("%sを金に変えることに失敗した。", "You fail to turn %s to gold!"), o_name); - /* Done */ return FALSE; } @@ -2328,13 +1975,7 @@ sprintf(out_val, " if (price <= 0) { - /* Message */ -#ifdef JP -msg_format("%s¤ò¥Ë¥»¤Î¶â¤ËÊѤ¨¤¿¡£", o_name); -#else - msg_format("You turn %s to fool's gold.", o_name); -#endif - + msg_format(_("%sをニセの金に変えた。", "You turn %s to fool's gold."), o_name); } else { @@ -2343,20 +1984,11 @@ msg_format("%s if (amt > 1) price *= amt; if (price > 30000) price = 30000; -#ifdef JP -msg_format("%s¤ò¡ð%d ¤Î¶â¤ËÊѤ¨¤¿¡£", o_name, price); -#else - msg_format("You turn %s to %ld coins worth of gold.", o_name, price); -#endif + 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) */ @@ -2379,31 +2011,34 @@ msg_format("%s } -/* +/*! + * @brief 呪いの打ち破り処理 / * Break the curse of an item + * @param o_ptr 呪い装備情報の参照ポインタ + * @return なし */ static void break_curse(object_type *o_ptr) { if (object_is_cursed(o_ptr) && !(o_ptr->curse_flags & TRC_PERMA_CURSE) && !(o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint0(100) < 25)) { -#ifdef JP -msg_print("¤«¤±¤é¤ì¤Æ¤¤¤¿¼ö¤¤¤¬ÂǤÁÇˤé¤ì¤¿¡ª"); -#else - msg_print("The curse is broken!"); -#endif + msg_print(_("かけられていた呪いが打ち破られた!", "The curse is broken!")); o_ptr->curse_flags = 0L; - o_ptr->ident |= (IDENT_SENSE); - o_ptr->feeling = FEEL_NONE; } } -/* +/*! + * @brief 装備修正強化処理 / * Enchants a plus onto an item. -RAK- - * + * @param o_ptr 強化するアイテムの参照ポインタ + * @param n 強化基本量 + * @param eflag 強化オプション(命中/ダメージ/AC) + * @return 強化に成功した場合TRUEを返す + * @details + *
  * Revamped!  Now takes item pointer, number of times to try enchanting,
  * and a flag of what to try enchanting.  Artifacts resist enchantment
  * some of the time, and successful enchantment to at least +0 might
@@ -2415,6 +2050,7 @@ msg_print("
  *
  * Note that this function can now be used on "piles" of items, and
  * the larger the pile, the lower the chance of success.
+ * 
*/ bool enchant(object_type *o_ptr, int n, int eflag) { @@ -2423,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; @@ -2498,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(); @@ -2515,66 +2143,44 @@ bool enchant(object_type *o_ptr, int n, int eflag) } - -/* +/*! + * @brief 装備修正強化処理のメインルーチン / * Enchant an item (in the inventory or on the floor) + * @param num_hit 命中修正量 + * @param num_dam ダメージ修正量 + * @param num_ac AC修正量 + * @return 強化に成功した場合TRUEを返す + * @details * Note that "num_ac" requires armour, else weapon * Returns TRUE if attempted, FALSE if cancelled */ -bool enchant_spell(int num_hit, int num_dam, int num_ac) +bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac) { - int item; + 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 */ -#ifdef JP -q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? "; -s = "¶¯²½¤Ç¤­¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£"; -#else - q = "Enchant which item? "; - s = "You have nothing to enchant."; -#endif - - 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]; - } + q = _("どのアイテムを強化しますか? ", "Enchant which item? "); + s = _("強化できるアイテムがない。", "You have nothing to enchant."); + 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; @@ -2583,16 +2189,8 @@ msg_format("%s /* Failure */ if (!okay) { - /* Flush */ if (flush_failure) flush(); - - /* Message */ -#ifdef JP -msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£"); -#else - msg_print("The enchantment failed."); -#endif - + msg_print(_("強化に失敗した。", "The enchantment failed.")); if (one_in_(3)) chg_virtue(V_ENCHANT, -1); } else @@ -2605,80 +2203,40 @@ msg_print(" } -/* - * Check if an object is nameless weapon or armour +/*! + * @brief アーティファクト生成の巻物処理 / + * @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; -} - - bool artifact_scroll(void) { - int item; - bool okay = FALSE; - object_type *o_ptr; - char o_name[MAX_NLEN]; - cptr q, s; - - - item_tester_no_ryoute = TRUE; + OBJECT_IDX item; + 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 */ -#ifdef JP - q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? "; - s = "¶¯²½¤Ç¤­¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£"; -#else - q = "Enchant which item? "; - s = "You have nothing to enchant."; -#endif - - 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]; - } + q = _("どのアイテムを強化しますか? ", "Enchant which item? "); + s = _("強化できるアイテムがない。", "You have nothing to enchant."); + 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 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)) { #ifdef JP - msg_format("%s¤Ï´û¤ËÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Ç¤¹¡ª", o_name ); + 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; @@ -2687,7 +2245,7 @@ bool artifact_scroll(void) else if (object_is_ego(o_ptr)) { #ifdef JP - msg_format("%s¤Ï´û¤Ë̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Ç¤¹¡ª", o_name ); + msg_format("%sは既に名のあるアイテムです!", o_name ); #else msg_format("The %s %s already %s!", o_name, ((o_ptr->number > 1) ? "are" : "is"), @@ -2700,10 +2258,9 @@ bool artifact_scroll(void) else if (o_ptr->xtra3) { #ifdef JP - msg_format("%s¤Ï´û¤Ë¶¯²½¤µ¤ì¤Æ¤¤¤Þ¤¹¡ª", o_name ); + 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 } @@ -2712,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); + 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); @@ -2735,20 +2291,19 @@ bool artifact_scroll(void) /* Failure */ if (!okay) { - /* Flush */ if (flush_failure) flush(); - - /* Message */ -#ifdef JP - msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£"); -#else - msg_print("The enchantment failed."); -#endif - + msg_print(_("強化に失敗した。", "The enchantment failed.")); if (one_in_(3)) chg_virtue(V_ENCHANT, -1); } else + { + if (record_rand_art) + { + object_desc(o_name, o_ptr, OD_NAME_ONLY); + do_cmd_write_nikki(NIKKI_ART_SCROLL, 0, o_name); + } chg_virtue(V_ENCHANT, 1); + } calc_android_exp(); @@ -2757,15 +2312,17 @@ bool artifact_scroll(void) } -/* +/*! + * @brief アイテム鑑定処理 / * Identify an object + * @param o_ptr 鑑定されるアイテムの情報参照ポインタ + * @return 実際に鑑定できたらTRUEを返す */ 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) @@ -2777,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)) @@ -2807,34 +2354,23 @@ bool identify_item(object_type *o_ptr) return old_known; } - -static bool item_tester_hook_identify(object_type *o_ptr) -{ - return (bool)!object_is_known(o_ptr); -} - -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を返す + * @return 実際に鑑定を行ったならばTRUEを返す + * @details * This routine does *not* automatically combine objects. * Returns TRUE if something was identified, else FALSE. */ bool ident_spell(bool only_equip) { - int item; - object_type *o_ptr; - char o_name[MAX_NLEN]; - cptr q, s; + OBJECT_IDX item; + 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 @@ -2842,11 +2378,7 @@ bool ident_spell(bool only_equip) if (can_get_item()) { -#ifdef JP - q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? "; -#else - q = "Identify which item? "; -#endif + q = _("どのアイテムを鑑定しますか? ", "Identify which item? "); } else { @@ -2855,64 +2387,28 @@ bool ident_spell(bool only_equip) else item_tester_hook = NULL; -#ifdef JP - q = "¤¹¤Ù¤Æ´ÕÄêºÑ¤ß¤Ç¤¹¡£ "; -#else - q = "All items are identified. "; -#endif + q = _("すべて鑑定済みです。 ", "All items are identified. "); } - /* Get an item */ -#ifdef JP - s = "´ÕÄꤹ¤ë¤Ù¤­¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£"; -#else - s = "You have nothing to identify."; -#endif - - 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]; - } + s = _("鑑定するべきアイテムがない。", "You have nothing to identify."); - /* 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) { -#ifdef JP - msg_format("%^s: %s(%c)¡£", describe_use(item), o_name, index_to_label(item)); -#else - msg_format("%^s: %s (%c).", describe_use(item), o_name, index_to_label(item)); -#endif + msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(item), o_name, index_to_label(item)); } else if (item >= 0) { -#ifdef JP - msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£", o_name, index_to_label(item)); -#else - msg_format("In your pack: %s (%c).", o_name, index_to_label(item)); -#endif + msg_format(_("ザック中: %s(%c)。", "In your pack: %s (%c)."), o_name, index_to_label(item)); } else { -#ifdef JP - msg_format("¾²¾å: %s¡£", o_name); -#else - msg_format("On the ground: %s.", o_name); -#endif + msg_format(_("床上: %s。", "On the ground: %s."), o_name); } /* Auto-inscription/destroy */ @@ -2923,55 +2419,39 @@ bool ident_spell(bool only_equip) } -/* +/*! + * @brief アイテム凡庸化のメインルーチン処理 / + * Identify an object in the inventory (or on the floor) + * @param only_equip 装備品のみを対象とするならばTRUEを返す + * @return 実際に凡庸化をを行ったならばTRUEを返す + * @details + *
  * Mundanify an object in the inventory (or on the floor)
  * This routine does *not* automatically combine objects.
  * Returns TRUE if something was mundanified, else FALSE.
+ * 
*/ bool mundane_spell(bool only_equip) { - int item; - object_type *o_ptr; - cptr q, s; + OBJECT_IDX item; + 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 */ -#ifdef JP -q = "¤É¤ì¤ò»È¤¤¤Þ¤¹¤«¡©"; -s = "»È¤¨¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£"; -#else - q = "Use which item? "; - s = "You have nothing you can use."; -#endif - 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]; - } + q = _("どれを使いますか?", "Use which item? "); + s = _("使えるものがありません。", "You have nothing you can use."); - /* 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 */ -#ifdef JP - msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª"); -#else - msg_print("There is a bright flash of light!"); -#endif + msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!")); { - byte iy = o_ptr->iy; /* Y-position on map, or zero */ - byte 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) */ + POSITION iy = o_ptr->iy; /* Y-position on map, or zero */ + POSITION ix = o_ptr->ix; /* X-position on map, or zero */ + 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 */ @@ -2990,33 +2470,23 @@ s = " 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)); -} - -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を返す + * @return 実際に鑑定を行ったならばTRUEを返す + * @details * Fully "identify" an object in the inventory -BEN- * This routine returns TRUE if an item was identified. */ bool identify_fully(bool only_equip) { - int item; - object_type *o_ptr; - char o_name[MAX_NLEN]; - cptr q, s; + OBJECT_IDX item; + 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 @@ -3024,11 +2494,7 @@ bool identify_fully(bool only_equip) if (can_get_item()) { -#ifdef JP - q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò*´ÕÄê*¤·¤Þ¤¹¤«? "; -#else - q = "*Identify* which item? "; -#endif + q = _("どのアイテムを*鑑定*しますか? ", "*Identify* which item? "); } else { @@ -3037,72 +2503,32 @@ bool identify_fully(bool only_equip) else item_tester_hook = NULL; -#ifdef JP - q = "¤¹¤Ù¤Æ*´ÕÄê*ºÑ¤ß¤Ç¤¹¡£ "; -#else - q = "All items are *identified*. "; -#endif + q = _("すべて*鑑定*済みです。 ", "All items are *identified*. "); } - /* Get an item */ -#ifdef JP - s = "*´ÕÄê*¤¹¤ë¤Ù¤­¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£"; -#else - s = "You have nothing to *identify*."; -#endif - - 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]; - } + s = _("*鑑定*するべきアイテムがない。", "You have nothing to *identify*."); - /* 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) { -#ifdef JP - msg_format("%^s: %s(%c)¡£", describe_use(item), o_name, index_to_label(item)); -#else - msg_format("%^s: %s (%c).", describe_use(item), o_name, index_to_label(item)); -#endif - - + msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(item), o_name, index_to_label(item)); } else if (item >= 0) { -#ifdef JP - msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£", o_name, index_to_label(item)); -#else - msg_format("In your pack: %s (%c).", o_name, index_to_label(item)); -#endif + msg_format(_("ザック中: %s(%c)。", "In your pack: %s (%c)."), o_name, index_to_label(item)); } else { -#ifdef JP - msg_format("¾²¾å: %s¡£", o_name); -#else - msg_format("On the ground: %s.", o_name); -#endif + msg_format(_("床上: %s。", "On the ground: %s."), o_name); } /* Describe it fully */ @@ -3117,29 +2543,12 @@ bool identify_fully(bool only_equip) - -/* - * Hook for "get_item()". Determine if something is rechargable. - */ -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 魔力充填処理 / * Recharge a wand/staff/rod from the pack or on the floor. * This function has been rewritten in Oangband and ZAngband. + * @param power 充填パワー + * @return ターン消費を要する処理まで進んだらTRUEを返す * * Sorcery/Arcane -- Recharge --> recharge(plev * 4) * Chaos -- Arcane Binding --> recharge(90) @@ -3152,12 +2561,14 @@ 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) { - int item, lev; - int recharge_strength, recharge_amount; + OBJECT_IDX item; + DEPTH lev; + int recharge_strength; + TIME_EFFECT recharge_amount; object_type *o_ptr; object_kind *k_ptr; @@ -3165,34 +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 */ -#ifdef JP -q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? "; -s = "ËâÎϤò½¼Å¶¤¹¤Ù¤­¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£"; -#else - q = "Recharge which item? "; - s = "You have nothing to recharge."; -#endif - - 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]; - } + q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? "); + s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge."); - /* 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]; @@ -3205,7 +2599,7 @@ s = " 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 */ @@ -3237,12 +2631,10 @@ s = " * 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; @@ -3274,7 +2666,7 @@ s = " */ 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; } @@ -3298,12 +2690,7 @@ s = " if (object_is_fixed_artifact(o_ptr)) { object_desc(o_name, o_ptr, OD_NAME_ONLY); -#ifdef JP -msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name); -#else - msg_format("The recharging backfires - %s is completely drained!", o_name); -#endif - + msg_format(_("魔力が逆流した!%sは完全に魔力を失った。", "The recharging backfires - %s is completely drained!"), o_name); /* Artifact rods. */ if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout < 10000)) @@ -3321,7 +2708,7 @@ msg_format(" /*** 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) @@ -3372,23 +2759,14 @@ msg_format(" { if (o_ptr->tval == TV_ROD) { -#ifdef JP -msg_print("ËâÎϤ¬µÕÊ®¼Í¤·¤Æ¡¢¥í¥Ã¥É¤«¤é¤µ¤é¤ËËâÎϤòµÛ¤¤¼è¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª"); -#else - msg_print("The recharge backfires, draining the rod further!"); -#endif + msg_print(_("魔力が逆噴射して、ロッドからさらに魔力を吸い取ってしまった!", "The recharge backfires, draining the rod further!")); if (o_ptr->timeout < 10000) o_ptr->timeout = (o_ptr->timeout + 100) * 2; } else if (o_ptr->tval == TV_WAND) { -#ifdef JP -msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name); -#else - msg_format("You save your %s from destruction, but all charges are lost.", o_name); -#endif - + msg_format(_("%sは破損を免れたが、魔力が全て失われた。", "You save your %s from destruction, but all charges are lost."), o_name); o_ptr->pval = 0; } /* Staffs aren't drained. */ @@ -3398,19 +2776,9 @@ msg_format("%s if (fail_type == 2) { if (o_ptr->number > 1) -#ifdef JP -msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name); -#else - msg_format("Wild magic consumes one of your %s!", o_name); -#endif - + msg_format(_("乱暴な魔法のために%sが一本壊れた!", "Wild magic consumes one of your %s!"), o_name); else -#ifdef JP -msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name); -#else - msg_format("Wild magic consumes your %s!", o_name); -#endif - + msg_format(_("乱暴な魔法のために%sが壊れた!", "Wild magic consumes your %s!"), o_name); /* Reduce rod stack maximum timeout, drain wands. */ if (o_ptr->tval == TV_ROD) o_ptr->timeout = (o_ptr->number - 1) * k_ptr->pval; @@ -3437,20 +2805,9 @@ msg_format(" if (fail_type == 3) { if (o_ptr->number > 1) -#ifdef JP -msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name); -#else - msg_format("Wild magic consumes all your %s!", o_name); -#endif - + msg_format(_("乱暴な魔法のために%sが全て壊れた!", "Wild magic consumes all your %s!"), o_name); else -#ifdef JP -msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name); -#else - msg_format("Wild magic consumes your %s!", o_name); -#endif - - + msg_format(_("乱暴な魔法のために%sが壊れた!", "Wild magic consumes your %s!"), o_name); /* Reduce and describe inventory */ if (item >= 0) @@ -3470,11 +2827,7 @@ msg_format(" } } } - - /* 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 */ @@ -3482,91 +2835,61 @@ msg_format(" } -/* +/*! + * @brief 武器の祝福処理 / * Bless a weapon + * @return ターン消費を要する処理を行ったならばTRUEを返す */ bool bless_weapon(void) { - int item; - object_type *o_ptr; - u32b flgs[TR_FLAG_SIZE]; - char o_name[MAX_NLEN]; - cptr q, s; - - item_tester_no_ryoute = TRUE; + OBJECT_IDX item; + object_type *o_ptr; + BIT_FLAGS flgs[TR_FLAG_SIZE]; + GAME_TEXT o_name[MAX_NLEN]; + concptr q, s; /* Bless only weapons */ item_tester_hook = object_is_weapon; - /* Get an item */ -#ifdef JP -q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò½ËÊ¡¤·¤Þ¤¹¤«¡©"; -s = "½ËÊ¡¤Ç¤­¤ëÉð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£"; -#else - q = "Bless which weapon? "; - s = "You have weapon to bless."; -#endif - - 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]; - } + q = _("どのアイテムを祝福しますか?", "Bless which weapon? "); + s = _("祝福できる武器がありません。", "You have weapon to bless."); + 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)) { if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) || + have_flag(flgs, TR_ADD_L_CURSE) || + have_flag(flgs, TR_ADD_H_CURSE) || (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); } @@ -3581,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, @@ -3594,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, @@ -3610,13 +2930,7 @@ msg_format("%s else { bool dis_happened = FALSE; - -#ifdef JP -msg_print("¤½¤ÎÉð´ï¤Ï½ËÊ¡¤ò·ù¤Ã¤Æ¤¤¤ë¡ª"); -#else - msg_print("The weapon resists your blessing!"); -#endif - + msg_print(_("その武器は祝福を嫌っている!", "The weapon resists your blessing!")); /* Disenchant tohit */ if (o_ptr->to_h > 0) @@ -3647,91 +2961,58 @@ msg_print(" if (dis_happened) { -#ifdef JP -msg_print("¼þ°Ï¤¬ËÞÍǤÊÊ·°Ïµ¤¤ÇËþ¤Á¤¿..."); -#else - msg_print("There is a static feeling in the air..."); -#endif + 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; } -/* +/*! + * @brief 盾磨き処理 / * pulish shield + * @return ターン消費を要する処理を行ったならばTRUEを返す */ bool pulish_shield(void) { - int item; - object_type *o_ptr; - u32b flgs[TR_FLAG_SIZE]; - char o_name[MAX_NLEN]; - cptr q, s; + OBJECT_IDX item; + 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 */ -#ifdef JP -q = "¤É¤Î½â¤òË᤭¤Þ¤¹¤«¡©"; -s = "Ë᤯½â¤¬¤¢¤ê¤Þ¤»¤ó¡£"; -#else - q = "Pulish which weapon? "; - s = "You have weapon to pulish."; -#endif - - 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]; - } + q = _("どの盾を磨きますか?", "Pulish which weapon? "); + s = _("磨く盾がありません。", "You have weapon to pulish."); + 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); @@ -3745,12 +3026,7 @@ msg_format("%s { if (flush_failure) flush(); -#ifdef JP -msg_print("¼ºÇÔ¤·¤¿¡£"); -#else - msg_print("Failed."); -#endif - + msg_print(_("失敗した。", "Failed.")); chg_virtue(V_ENCHANT, -2); } calc_android_exp(); @@ -3759,8 +3035,16 @@ msg_print(" } -/* +/*! + * @brief 薬の破損効果処理 / * Potions "smash open" and cause an area effect when + * @param who 薬破損の主体ID(プレイヤー所持アイテムが壊れた場合0、床上のアイテムの場合モンスターID) + * @param y 破壊時のY座標 + * @param x 破壊時のX座標 + * @param k_idx 破損した薬のアイテムID + * @return 薬を浴びたモンスターが起こるならばTRUEを返す + * @details + *
  * (1) they are shattered while in the player's inventory,
  * due to cold (etc) attacks;
  * (2) they are thrown at a monster, or obstacle;
@@ -3776,8 +3060,9 @@ msg_print("
  *    y, x  --- coordinates of the potion (or player if
  *          the potion was in her inventory);
  *    o_ptr --- pointer to the potion object.
+ * 
*/ -bool potion_smash_effect(int who, int y, int x, int k_idx) +bool potion_smash_effect(MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_IDX k_idx) { int radius = 2; int dt = 0; @@ -3846,7 +3131,7 @@ bool potion_smash_effect(int who, int y, int x, int k_idx) dt = GF_DARK; angry = TRUE; break; - case SV_POTION_CONFUSION: /* Booze */ + case SV_POTION_BOOZE: /* Booze */ dt = GF_OLD_CONF; angry = TRUE; break; @@ -3910,39 +3195,36 @@ bool potion_smash_effect(int who, int y, int x, int k_idx) /* 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; } -/* +/*! + * @brief プレイヤーの全既知呪文を表示する / * Hack -- Display all known spells in a window - * - * XXX XXX XXX Need to analyze size of the window. - * - * XXX XXX XXX Need more color coding. + * return なし + * @details + * 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]; - magic_type *s_ptr; - char name[80]; - char out_val[160]; + int i, j; + TERM_LEN y, x; + int m[9]; + const magic_type *s_ptr; + 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(); @@ -3956,11 +3238,8 @@ void display_spell_list(void) (p_ptr->pclass == CLASS_MIRROR_MASTER) || (p_ptr->pclass == CLASS_FORCETRAINER)) { - int i; - int y = 1; - int x = 1; int minfail = 0; - int plev = p_ptr->lev; + PLAYER_LEVEL plev = p_ptr->lev; int chance = 0; mind_type spell; char comment[80]; @@ -3968,15 +3247,13 @@ void display_spell_list(void) int use_mind; bool use_hp = FALSE; + y = 1; + x = 1; + /* Display a list of spells */ prt("", y, x); -#ifdef JP -put_str("̾Á°", y, x + 5); -put_str("Lv MP ¼ºÎ¨ ¸ú²Ì", y, x + 35); -#else - put_str("Name", y, x + 5); - put_str("Lv Mana Fail Info", y, x + 35); -#endif + put_str(_("名前", "Name"), y, x + 5); + put_str(_("Lv MP 失率 効果", "Lv Mana Fail Info"), y, x + 35); switch(p_ptr->pclass) { @@ -4091,12 +3368,7 @@ put_str("Lv MP if (s_ptr->slevel >= 99) { /* Illegible */ -#ifdef JP -strcpy(name, "(ȽÆÉÉÔǽ)"); -#else - strcpy(name, "(illegible)"); -#endif - + strcpy(name, _("(判読不能)", "(illegible)")); /* Unusable */ a = TERM_L_DARK; @@ -4146,10 +3418,14 @@ strcpy(name, "(Ƚ } -/* +/*! + * @brief 呪文の経験値を返す / * Returns experience of a spell + * @param spell 呪文ID + * @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; @@ -4159,10 +3435,15 @@ s16b experience_of_spell(int spell, int use_realm) } -/* +/*! + * @brief 呪文の消費MPを返す / * Modify mana consumption rate using spell exp and p_ptr->dec_mana + * @param need_mana 基本消費MP + * @param spell 呪文ID + * @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 @@ -4195,11 +3476,15 @@ int mod_need_mana(int need_mana, int spell, int realm) } -/* +/*! + * @brief 呪文の失敗率修正処理1(呪い、消費魔力減少、呪文簡易化) / * Modify spell fail rate * Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell + * @param chance 修正前失敗率 + * @return 失敗率(%) + * @todo 統合を検討 */ -int mod_spell_chance_1(int chance) +PERCENTAGE mod_spell_chance_1(PERCENTAGE chance) { chance += p_ptr->to_m_chance; @@ -4213,12 +3498,18 @@ int mod_spell_chance_1(int chance) } -/* +/*! + * @brief 呪文の失敗率修正処理2(消費魔力減少、呪い、負値修正) / + * Modify spell fail rate + * Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell + * @param chance 修正前失敗率 + * @return 失敗率(%) * Modify spell fail rate (as "suffix" process) * Using p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell * 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--; @@ -4228,15 +3519,19 @@ int mod_spell_chance_2(int chance) } -/* +/*! + * @brief 呪文の失敗率計算メインルーチン / * Returns spell chance of failure for spell -RAK- + * @param spell 呪文ID + * @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; - magic_type *s_ptr; - int need_mana; - int penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4; + PERCENTAGE chance, minfail; + const magic_type *s_ptr; + MANA_POINT need_mana; + PERCENTAGE penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4; /* Paranoia -- must be literate */ @@ -4322,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--; } @@ -4332,15 +3627,20 @@ s16b spell_chance(int spell, int use_realm) } - -/* +/*! + * @brief 魔法が利用可能かどうかを返す / * Determine if a spell is "okay" for the player to cast or study * The spell must be legible, not forgotten, and also, to cast, * it must be known, and to study, it must not be known. + * @param spell 呪文ID + * @param learned 使用可能な判定ならばTRUE、学習可能かどうかの判定ならばFALSE + * @param study_pray 祈りの学習判定目的ならばTRUE + * @param use_realm 魔法領域ID + * @return 失敗率(%) */ bool spell_okay(int spell, bool learned, bool study_pray, int use_realm) { - magic_type *s_ptr; + const magic_type *s_ptr; /* Access the spell */ if (!is_magic(use_realm)) @@ -4381,53 +3681,45 @@ bool spell_okay(int spell, bool learned, bool study_pray, int use_realm) } -/* + +/*! + * @brief 呪文情報の表示処理 / * Print a list of spells (for browsing or casting or viewing) + * @param target_spell 呪文ID + * @param spells 表示するスペルID配列の参照ポインタ + * @param num 表示するスペルの数(spellsの要素数) + * @param y 表示メッセージ左上Y座標 + * @param x 表示メッセージ左上X座標 + * @param use_realm 魔法領域ID + * @return なし */ -void print_spells(int target_spell, byte *spells, int num, int y, int x, int 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; - 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]; + int i; + SPELL_IDX spell; + int exp_level, increment = 64; + const magic_type *s_ptr; + 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) -#ifdef JP -msg_print("·Ù¹ð¡ª print_spell ¤¬Îΰè¤Ê¤·¤Ë¸Æ¤Ð¤ì¤¿"); -#else - msg_print("Warning! print_spells called with null realm"); -#endif - + msg_print(_("警告! print_spell が領域なしに呼ばれた", "Warning! print_spells called with null realm")); /* Title the list */ prt("", y, x); if (use_realm == REALM_HISSATSU) -#ifdef JP - strcpy(buf," Lv MP"); -#else - strcpy(buf," Lv SP"); -#endif + strcpy(buf,_(" Lv MP", " Lv SP")); else -#ifdef JP - strcpy(buf,"½ÏÎýÅÙ Lv MP ¼ºÎ¨ ¸ú²Ì"); -#else - strcpy(buf,"Profic Lv SP Fail Effect"); -#endif + strcpy(buf,_("熟練度 Lv MP 失率 効果", "Profic Lv SP Fail Effect")); -#ifdef JP -put_str("̾Á°", y, x + 5); -put_str(buf, y, x + 29); -#else - put_str("Name", y, x + 5); + put_str(_("名前", "Name"), y, x + 5); put_str(buf, y, x + 29); -#endif if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0; else if (use_realm == p_ptr->realm1) increment = 0; @@ -4436,10 +3728,8 @@ put_str(buf, y, x + 29); /* 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]; @@ -4453,7 +3743,7 @@ put_str(buf, y, x + 29); 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); @@ -4475,11 +3765,7 @@ put_str(buf, y, x + 29); if (use_menu && target_spell) { if (i == (target_spell-1)) -#ifdef JP - strcpy(out_val, " ¡Õ "); -#else - strcpy(out_val, " > "); -#endif + strcpy(out_val, _(" 》 ", " > ")); else strcpy(out_val, " "); } @@ -4487,14 +3773,9 @@ put_str(buf, y, x + 29); /* Skip illegible spells */ if (s_ptr->slevel >= 99) { -#ifdef JP -strcat(out_val, format("%-30s", "(ȽÆÉÉÔǽ)")); -#else - strcat(out_val, format("%-30s", "(illegible)")); -#endif - - c_prt(TERM_L_DARK, out_val, y + i + 1, x); - continue; + strcat(out_val, format("%-30s", _("(判読不能)", "(illegible)"))); + c_prt(TERM_L_DARK, out_val, y + i + 1, x); + continue; } /* XXX XXX Could label spells above the players level */ @@ -4513,69 +3794,39 @@ strcat(out_val, format("%-30s", "(Ƚ { if (s_ptr->slevel > p_ptr->max_plv) { -#ifdef JP -comment = "̤ÃÎ"; -#else - comment = "unknown"; -#endif - + comment = _("未知", "unknown"); line_attr = TERM_L_BLUE; } else if (s_ptr->slevel > p_ptr->lev) { -#ifdef JP -comment = "˺µÑ"; -#else - comment = "forgotten"; -#endif - + comment = _("忘却", "forgotten"); line_attr = TERM_YELLOW; } } else if ((use_realm != p_ptr->realm1) && (use_realm != p_ptr->realm2)) { -#ifdef JP -comment = "̤ÃÎ"; -#else - comment = "unknown"; -#endif - + comment = _("未知", "unknown"); line_attr = TERM_L_BLUE; } else if ((use_realm == p_ptr->realm1) ? ((p_ptr->spell_forgotten1 & (1L << spell))) : ((p_ptr->spell_forgotten2 & (1L << spell)))) { -#ifdef JP -comment = "˺µÑ"; -#else - comment = "forgotten"; -#endif - + comment = _("忘却", "forgotten"); line_attr = TERM_YELLOW; } else if (!((use_realm == p_ptr->realm1) ? (p_ptr->spell_learned1 & (1L << spell)) : (p_ptr->spell_learned2 & (1L << spell)))) { -#ifdef JP -comment = "̤ÃÎ"; -#else - comment = "unknown"; -#endif - + comment = _("未知", "unknown"); line_attr = TERM_L_BLUE; } else if (!((use_realm == p_ptr->realm1) ? (p_ptr->spell_worked1 & (1L << spell)) : (p_ptr->spell_worked2 & (1L << spell)))) { -#ifdef JP -comment = "̤·Ð¸³"; -#else - comment = "untried"; -#endif - + comment = _("未経験", "untried"); line_attr = TERM_L_GREEN; } @@ -4601,588 +3852,27 @@ comment = "̤ } -/* - * 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. +/*! + * @brief 防具の錆止め防止処理 + * @return ターン消費を要する処理を行ったならばTRUEを返す */ -bool hates_acid(object_type *o_ptr) +bool rustproof(void) { - /* 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); - } + OBJECT_IDX item; + object_type *o_ptr; + GAME_TEXT o_name[MAX_NLEN]; + concptr q, s; - /* Staffs/Scrolls are wood/paper */ - case TV_STAFF: - case TV_SCROLL: - { - return (TRUE); - } + /* Select a piece of armour */ + item_tester_hook = object_is_armour; - /* Ouch */ - case TV_CHEST: - { - return (TRUE); - } + q = _("どの防具に錆止めをしますか?", "Rustproof which piece of armour? "); + s = _("錆止めできるものがありません。", "You have nothing to rustproof."); - /* Junk is useless */ - case TV_SKELETON: - case TV_BOTTLE: - case TV_JUNK: - { - return (TRUE); - } - } + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr) return FALSE; - return (FALSE); -} - - -/* - * Does a given object (usually) hate electricity? - */ -bool hates_elec(object_type *o_ptr) -{ - switch (o_ptr->tval) - { - case TV_RING: - case TV_WAND: - { - return (TRUE); - } - } - - return (FALSE); -} - - -/* - * Does a given object (usually) hate fire? - * 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); -} - - -/* - * Does a given object (usually) hate cold? - */ -bool hates_cold(object_type *o_ptr) -{ - switch (o_ptr->tval) - { - case TV_POTION: - case TV_FLASK: - case TV_BOTTLE: - { - return (TRUE); - } - } - - return (FALSE); -} - - -/* - * Melt something - */ -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); -} - - -/* - * Electrical damage - */ -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); -} - - -/* - * Burn something - */ -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); -} - - -/* - * Freeze things - */ -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); -} - - -/* - * Destroys a type of item on a given percent chance - * 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 */ -#ifdef JP -msg_format("%s(%c)¤¬%s²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", -#else - msg_format("%sour %s (%c) %s destroyed!", -#endif - -#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, py, px, 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); -} - - -/* - * Acid has hit the player, attempt to affect some armor. - * - * 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)) - { -#ifdef JP -msg_format("¤·¤«¤·%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª", o_name); -#else - msg_format("Your %s is unaffected!", o_name); -#endif - - - return (TRUE); - } - - /* Message */ -#ifdef JP -msg_format("%s¤¬¥À¥á¡¼¥¸¤ò¼õ¤±¤¿¡ª", o_name); -#else - msg_format("Your %s is damaged!", o_name); -#endif - - - /* 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); -} - - -/* - * Hurt the player with Acid - */ -int acid_dam(int dam, cptr kb_str, int monspell) -{ - 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 (!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(DAMAGE_ATTACK, dam, kb_str, monspell); - - /* Inventory damage */ - if (!(double_resist && p_ptr->resist_acid)) - inven_damage(set_acid_destroy, inv); - return get_damage; -} - - -/* - * Hurt the player with electricity - */ -int elec_dam(int dam, cptr kb_str, int monspell) -{ - 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 ((!(double_resist || p_ptr->resist_elec)) && - one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW()) - (void)do_dec_stat(A_DEX); - - /* Take damage */ - get_damage = take_hit(DAMAGE_ATTACK, dam, kb_str, monspell); - - /* Inventory damage */ - if (!(double_resist && p_ptr->resist_elec)) - inven_damage(set_elec_destroy, inv); - - return get_damage; -} - - -/* - * Hurt the player with Fire - */ -int fire_dam(int dam, cptr kb_str, int monspell) -{ - 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 ((!(double_resist || p_ptr->resist_fire)) && - one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW()) - (void)do_dec_stat(A_STR); - - /* Take damage */ - get_damage = take_hit(DAMAGE_ATTACK, dam, kb_str, monspell); - - /* Inventory damage */ - if (!(double_resist && p_ptr->resist_fire)) - inven_damage(set_fire_destroy, inv); - - return get_damage; -} - - -/* - * Hurt the player with Cold - */ -int cold_dam(int dam, cptr kb_str, int monspell) -{ - 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 ((!(double_resist || p_ptr->resist_cold)) && - one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW()) - (void)do_dec_stat(A_STR); - - /* Take damage */ - get_damage = take_hit(DAMAGE_ATTACK, dam, kb_str, monspell); - - /* Inventory damage */ - if (!(double_resist && p_ptr->resist_cold)) - inven_damage(set_cold_destroy, inv); - - return get_damage; -} - - -bool rustproof(void) -{ - int item; - object_type *o_ptr; - char o_name[MAX_NLEN]; - cptr q, s; - - item_tester_no_ryoute = TRUE; - /* Select a piece of armour */ - item_tester_hook = object_is_armour; - - /* Get an item */ -#ifdef JP -q = "¤É¤ÎËɶñ¤Ë»¬»ß¤á¤ò¤·¤Þ¤¹¤«¡©"; -s = "»¬»ß¤á¤Ç¤­¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£"; -#else - q = "Rustproof which piece of armour? "; - s = "You have nothing to rustproof."; -#endif - - 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]; - } - - - /* Description */ object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); add_flag(o_ptr->art_flags, TR_IGNORE_ACID); @@ -5190,41 +3880,36 @@ s = " 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; } -/* +/*! + * @brief 防具呪縛処理 / * Curse the players armor + * @return 実際に呪縛されたらTRUEを返す */ 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]; @@ -5232,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 */ @@ -5241,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 } @@ -5253,13 +3936,7 @@ msg_format("%s /* not artifact or failed save... */ else { - /* Oops */ -#ifdef JP -msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name); -#else - msg_format("A terrible black aura blasts your %s!", o_name); -#endif - + msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name); chg_virtue(V_ENCHANT, -5); /* Blast the armor */ @@ -5280,33 +3957,27 @@ msg_format(" /* 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); } return (TRUE); } - -/* +/*! + * @brief 武器呪縛処理 / * Curse the players weapon + * @param force 無条件に呪縛を行うならばTRUE + * @param o_ptr 呪縛する武器のアイテム情報参照ポインタ + * @return 実際に呪縛されたらTRUEを返す */ 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 */ @@ -5314,8 +3985,8 @@ bool curse_weapon_object(bool force, object_type *o_ptr) { /* 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 weapon", o_name); @@ -5325,12 +3996,7 @@ bool curse_weapon_object(bool force, object_type *o_ptr) /* not artifact or failed save... */ else { - /* Oops */ -#ifdef JP - if (!force) msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name); -#else - if (!force) msg_format("A terrible black aura blasts your %s!", o_name); -#endif + if (!force) msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name); chg_virtue(V_ENCHANT, -5); /* Shatter the weapon */ @@ -5351,21 +4017,20 @@ 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); } +/*! + * @brief 武器呪縛処理のメインルーチン / + * Curse the players weapon + * @param force 無条件に呪縛を行うならばTRUE + * @param slot 呪縛する武器の装備スロット + * @return 実際に呪縛されたらTRUEを返す + */ bool curse_weapon(bool force, int slot) { /* Curse the weapon */ @@ -5373,8 +4038,10 @@ bool curse_weapon(bool force, int slot) } -/* +/*! + * @brief ボルトのエゴ化処理(火炎エゴのみ) / * Enchant some bolts + * @return 常にTRUEを返す */ bool brand_bolts(void) { @@ -5398,54 +4065,41 @@ bool brand_bolts(void) /* Randomize */ if (randint0(100) < 75) continue; - /* Message */ -#ifdef JP -msg_print("¥¯¥í¥¹¥Ü¥¦¤ÎÌ𤬱ê¤Î¥ª¡¼¥é¤ËÊñ¤Þ¤ì¤¿¡ª"); -#else - msg_print("Your bolts are covered in a fiery aura!"); -#endif - + 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 */ -#ifdef JP -msg_print("±ê¤Ç¶¯²½¤¹¤ë¤Î¤Ë¼ºÇÔ¤·¤¿¡£"); -#else - msg_print("The fiery enchantment failed."); -#endif + msg_print(_("炎で強化するのに失敗した。", "The fiery enchantment failed.")); - - /* Notice */ return (TRUE); } -/* +/*! + * @brief 変身処理向けにモンスターの近隣レベル帯モンスターを返す / * Helper function -- return a "nearby" race for polymorphing - * + * @param r_idx 基準となるモンスター種族ID + * @return 変更先のモンスター種族ID + * @details * Note that this function is one of the more "dangerous" ones... */ -static s16b poly_r_idx(int r_idx) +static MONRACE_IDX poly_r_idx(MONRACE_IDX r_idx) { monster_race *r_ptr = &r_info[r_idx]; - int i, r, lev1, lev2; + int i; + MONRACE_IDX r; + 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 */ @@ -5473,29 +4127,32 @@ static s16b poly_r_idx(int r_idx) /* Use that index */ r_idx = r; - /* Done */ break; } - - /* Result */ return (r_idx); } - -bool polymorph_monster(int y, int x) +/*! + * @brief 指定座標にいるモンスターを変身させる / + * Helper function -- return a "nearby" race for polymorphing + * @param y 指定のY座標 + * @param x 指定のX座標 + * @return 実際に変身したらTRUEを返す + */ +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; - int new_r_idx; - int 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; + MONRACE_IDX new_r_idx; + MONRACE_IDX old_r_idx = m_ptr->r_idx; + 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; @@ -5506,9 +4163,9 @@ bool polymorph_monster(int y, int x) /* Handle polymorph */ if (new_r_idx != old_r_idx) { - u32b mode = 0L; + 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; @@ -5519,7 +4176,7 @@ bool polymorph_monster(int y, int 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)) @@ -5549,7 +4206,6 @@ bool polymorph_monster(int y, int 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 */ @@ -5561,13 +4217,10 @@ bool polymorph_monster(int y, int 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); } } @@ -5579,18 +4232,21 @@ bool polymorph_monster(int y, int x) return polymorphed; } - -/* +/*! + * @brief 次元の扉処理 / * Dimension Door + * @param x テレポート先のX座標 + * @param y テレポート先のY座標 + * @return 目標に指定通りテレポートできたならばTRUEを返す */ -static bool dimension_door_aux(int x, int y) +static bool dimension_door_aux(DEPTH x, DEPTH y) { - int plev = p_ptr->lev; + PLAYER_LEVEL plev = p_ptr->lev; p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L); if (!cave_player_teleportable_bold(y, x, 0L) || - (distance(y, x, py, px) > plev / 2 + 10) || + (distance(y, x, p_ptr->y, p_ptr->x) > plev / 2 + 10) || (!randint0(plev / 10 + 10))) { p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L); @@ -5609,84 +4265,71 @@ static bool dimension_door_aux(int x, int y) } -/* +/*! + * @brief 次元の扉処理のメインルーチン / * Dimension Door + * @return ターンを消費した場合TRUEを返す */ bool dimension_door(void) { - int x = 0, y = 0; + DEPTH x = 0, y = 0; /* Rerutn FALSE if cancelled */ if (!tgt_pt(&x, &y)) return FALSE; if (dimension_door_aux(x, y)) return TRUE; -#ifdef JP - msg_print("ÀºÎ¤«¤éʪ¼Á³¦¤ËÌá¤ë»þ¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¡ª"); -#else - msg_print("You fail to exit the astral plane correctly!"); -#endif + msg_print(_("精霊界から物質界に戻る時うまくいかなかった!", "You fail to exit the astral plane correctly!")); return TRUE; } -/* +/*! + * @brief 鏡抜け処理のメインルーチン / * Mirror Master's Dimension Door + * @return ターンを消費した場合TRUEを返す */ bool mirror_tunnel(void) { - int x = 0, y = 0; + POSITION x = 0, y = 0; /* Rerutn FALSE if cancelled */ if (!tgt_pt(&x, &y)) return FALSE; if (dimension_door_aux(x, y)) return TRUE; -#ifdef JP - msg_print("¶À¤ÎÀ¤³¦¤ò¤¦¤Þ¤¯Ä̤ì¤Ê¤«¤Ã¤¿¡ª"); -#else - msg_print("You fail to pass the mirror plane correctly!"); -#endif + msg_print(_("鏡の世界をうまく通れなかった!", "You fail to pass the mirror plane correctly!")); return TRUE; } - +/*! + * @brief 魔力食い処理 + * @param power 基本効力 + * @return ターンを消費した場合TRUEを返す + */ bool eat_magic(int power) { - object_type * o_ptr; + object_type *o_ptr; object_kind *k_ptr; - int lev, item; + 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 */ -#ifdef JP -q = "¤É¤Î¥¢¥¤¥Æ¥à¤«¤éËâÎϤòµÛ¼ý¤·¤Þ¤¹¤«¡©"; -s = "ËâÎϤòµÛ¼ý¤Ç¤­¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£"; -#else - q = "Drain which item? "; - s = "You have nothing to drain."; -#endif + 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; @@ -5705,12 +4348,7 @@ s = " { if (o_ptr->timeout > (o_ptr->number - 1) * k_ptr->pval) { -#ifdef JP -msg_print("½¼Å¶Ãæ¤Î¥í¥Ã¥É¤«¤éËâÎϤòµÛ¼ý¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£"); -#else - msg_print("You can't absorb energy from a discharged rod."); -#endif - + msg_print(_("充填中のロッドから魔力を吸収することはできません。", "You can't absorb energy from a discharged rod.")); } else { @@ -5745,8 +4383,6 @@ msg_print(" { object_type forge; object_type *q_ptr; - - /* Get local object */ q_ptr = &forge; /* Obtain a local object */ @@ -5763,23 +4399,12 @@ msg_print(" p_ptr->total_weight -= q_ptr->weight; item = inven_carry(q_ptr); - /* Message */ -#ifdef JP - msg_print("¾ó¤ò¤Þ¤È¤á¤Ê¤ª¤·¤¿¡£"); -#else - msg_print("You unstack your staff."); -#endif - + msg_print(_("杖をまとめなおした。", "You unstack your staff.")); } } else { -#ifdef JP -msg_print("µÛ¼ý¤Ç¤­¤ëËâÎϤ¬¤¢¤ê¤Þ¤»¤ó¡ª"); -#else - msg_print("There's no energy there to absorb!"); -#endif - + msg_print(_("吸収できる魔力がありません!", "There's no energy there to absorb!")); } if (!o_ptr->pval) o_ptr->ident |= IDENT_EMPTY; } @@ -5792,12 +4417,7 @@ msg_print(" if (object_is_fixed_artifact(o_ptr)) { object_desc(o_name, o_ptr, OD_NAME_ONLY); -#ifdef JP -msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name); -#else - msg_format("The recharging backfires - %s is completely drained!", o_name); -#endif - + msg_format(_("魔力が逆流した!%sは完全に魔力を失った。", "The recharging backfires - %s is completely drained!"), o_name); /* Artifact rods. */ if (o_ptr->tval == TV_ROD) @@ -5815,7 +4435,7 @@ msg_format(" /*** 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) @@ -5866,22 +4486,13 @@ msg_format(" { if (o_ptr->tval == TV_ROD) { -#ifdef JP -msg_print("¥í¥Ã¥É¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤÏÁ´¤Æ¼º¤Ê¤ï¤ì¤¿¡£"); -#else - msg_format("You save your rod from destruction, but all charges are lost.", o_name); -#endif - + msg_format(_("ロッドは破損を免れたが、魔力は全て失なわれた。", + "You save your rod from destruction, but all charges are lost."), o_name); o_ptr->timeout = k_ptr->pval * o_ptr->number; } else if (o_ptr->tval == TV_WAND) { -#ifdef JP -msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name); -#else - msg_format("You save your %s from destruction, but all charges are lost.", o_name); -#endif - + msg_format(_("%sは破損を免れたが、魔力が全て失われた。", "You save your %s from destruction, but all charges are lost."), o_name); o_ptr->pval = 0; } /* Staffs aren't drained. */ @@ -5892,24 +4503,16 @@ msg_format("%s { if (o_ptr->number > 1) { -#ifdef JP -msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name); -#else - msg_format("Wild magic consumes one of your %s!", o_name); -#endif - + msg_format(_("乱暴な魔法のために%sが一本壊れた!", "Wild magic consumes one of your %s!"), o_name); /* Reduce rod stack maximum timeout, drain wands. */ if (o_ptr->tval == TV_ROD) o_ptr->timeout = MIN(o_ptr->timeout, k_ptr->pval * (o_ptr->number - 1)); else if (o_ptr->tval == TV_WAND) o_ptr->pval = o_ptr->pval * (o_ptr->number - 1) / o_ptr->number; - } else -#ifdef JP -msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²¿Ëܤ«²õ¤ì¤¿¡ª", o_name); -#else - msg_format("Wild magic consumes your %s!", o_name); -#endif - + { + msg_format(_("乱暴な魔法のために%sが何本か壊れた!", "Wild magic consumes your %s!"), o_name); + } + /* Reduce and describe inventory */ if (item >= 0) { @@ -5931,20 +4534,9 @@ msg_format(" if (fail_type == 3) { if (o_ptr->number > 1) -#ifdef JP -msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name); -#else - msg_format("Wild magic consumes all your %s!", o_name); -#endif - + msg_format(_("乱暴な魔法のために%sが全て壊れた!", "Wild magic consumes all your %s!"), o_name); else -#ifdef JP -msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name); -#else - msg_format("Wild magic consumes your %s!", o_name); -#endif - - + msg_format(_("乱暴な魔法のために%sが壊れた!", "Wild magic consumes your %s!"), o_name); /* Reduce and describe inventory */ if (item >= 0) @@ -5970,120 +4562,207 @@ msg_format(" 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; } -bool summon_kin_player(int level, int y, int x, u32b mode) +/*! + * @brief 皆殺し(全方向攻撃)処理 + * @param py プレイヤーY座標 + * @param px プレイヤーX座標 + * @return なし + */ +void massacre(void) { - bool pet = (bool)(mode & PM_FORCE_PET); - if (!pet) mode |= PM_NO_PET; + 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]; + g_ptr = &grid_array[y][x]; + m_ptr = &m_list[g_ptr->m_idx]; + + /* Hack -- attack monsters */ + 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!")); - switch (p_ptr->mimic_form) + 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 { - case MIMIC_NONE: - switch (p_ptr->prace) + 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) { - 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; + msg_format(_("%sは飛ばされなかった。", "%^s was not blown away."), m_name); } - 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); + 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