#include "artifact.h"
#include "avatar.h"
#include "player-status.h"
+#include "monster.h"
/*!
/* Process "Escape" */
if (command_new == ESCAPE)
{
- int wid, hgt;
+ TERM_LEN wid, hgt;
Term_get_size(&wid, &hgt);
{
char out_val[160];
-
/* Note that we are in "equipment" mode */
command_wrk = TRUE;
/* Process "Escape" */
if (command_new == ESCAPE)
{
- int wid, hgt;
+ TERM_LEN wid, hgt;
Term_get_size(&wid, &hgt);
if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
{
- char dummy[MAX_NLEN+80];
+ char dummy[MAX_NLEN+100];
object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-#ifdef JP
- sprintf(dummy, "%sを装備すると吸血鬼になります。よろしいですか?", o_name);
-#else
- msg_format("%s will transforms you into a vampire permanently when equiped.", o_name);
- sprintf(dummy, "Do you become a vampire?");
-#endif
+ sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
+ "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
if (!get_check(dummy)) return;
}
o_ptr->ident |= (IDENT_SENSE);
}
- /* The Stone Mask make the player turn into a vampire! */
+ /* The Stone Mask make the player current_world_ptr->game_turn into a vampire! */
if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
{
/* Turn into a vampire */
else
{
msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
- p_ptr->energy_use = 50;
+ take_turn(p_ptr, 50);
return;
}
}
- p_ptr->energy_use = 50;
+ take_turn(p_ptr, 50);
/* Take off the item */
(void)inven_takeoff(item, 255);
return;
}
-
- /* See how many items */
if (o_ptr->number > 1)
{
- /* Get a quantity */
amt = get_quantity(NULL, o_ptr->number);
-
- /* Allow user abort */
if (amt <= 0) return;
}
- p_ptr->energy_use = 50;
+ take_turn(p_ptr, 50);
/* Drop (some of) the item */
inven_drop(item, amt);
} /* while (TRUE) */
}
- /* See how many items */
if (o_ptr->number > 1)
{
- /* Get a quantity */
amt = get_quantity(NULL, o_ptr->number);
-
- /* Allow user abort */
if (amt <= 0) return;
}
o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
if (!o_ptr) return;
- p_ptr->energy_use = 50;
+ take_turn(p_ptr, 50);
/* Access the lantern */
j_ptr = &inventory[INVEN_LITE];
floor_item_optimize(0 - item);
}
- /* Recalculate torch */
p_ptr->update |= (PU_TORCH);
}
-
-/*!
- * @brief オブジェクトが松明に束ねられるかどうかを判定する
- * An "item_tester_hook" for refilling torches
- * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
- * @return オブジェクトが松明に束ねられるならばTRUEを返す
- */
-static bool item_tester_refill_torch(object_type *o_ptr)
-{
- /* Torches are okay */
- if ((o_ptr->tval == TV_LITE) &&
- (o_ptr->sval == SV_LITE_TORCH)) return (TRUE);
-
- /* Assume not okay */
- return (FALSE);
-}
-
-
/*!
* @brief 松明を束ねるコマンドのメインルーチン
* Refuel the players torch (from the pack or floor)
concptr q, s;
/* Restrict the choices */
- item_tester_hook = item_tester_refill_torch;
+ item_tester_hook = object_can_refill_torch;
q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
s = _("他に松明がない。", "You have no extra torches.");
o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
if (!o_ptr) return;
- p_ptr->energy_use = 50;
+ take_turn(p_ptr, 50);
/* Access the primary torch */
j_ptr = &inventory[INVEN_LITE];
floor_item_optimize(0 - item);
}
- /* Recalculate torch */
p_ptr->update |= (PU_TORCH);
}
}
-
-/*!
- * @brief モンスター種族情報を特定の基準によりソートするための比較処理
- * Sorting hook -- Comp function -- see below
- * @param u モンスター種族情報の入れるポインタ
- * @param v 条件基準ID
- * @param a 比較するモンスター種族のID1
- * @param b 比較するモンスター種族のID2
- * @return 2の方が大きければTRUEを返す
- * We use "u" to point to array of monster indexes,
- * and "v" to select the type of sorting to perform on "u".
- */
-bool ang_sort_comp_hook(vptr u, vptr v, int a, int b)
-{
- u16b *who = (u16b*)(u);
- u16b *why = (u16b*)(v);
-
- int w1 = who[a];
- int w2 = who[b];
-
- int z1, z2;
-
- /* Sort by player kills */
- if (*why >= 4)
- {
- /* Extract player kills */
- z1 = r_info[w1].r_pkills;
- z2 = r_info[w2].r_pkills;
-
- /* Compare player kills */
- if (z1 < z2) return (TRUE);
- if (z1 > z2) return (FALSE);
- }
-
-
- /* Sort by total kills */
- if (*why >= 3)
- {
- /* Extract total kills */
- z1 = r_info[w1].r_tkills;
- z2 = r_info[w2].r_tkills;
-
- /* Compare total kills */
- if (z1 < z2) return (TRUE);
- if (z1 > z2) return (FALSE);
- }
-
-
- /* Sort by monster level */
- if (*why >= 2)
- {
- /* Extract levels */
- z1 = r_info[w1].level;
- z2 = r_info[w2].level;
-
- /* Compare levels */
- if (z1 < z2) return (TRUE);
- if (z1 > z2) return (FALSE);
- }
-
-
- /* Sort by monster experience */
- if (*why >= 1)
- {
- /* Extract experience */
- z1 = r_info[w1].mexp;
- z2 = r_info[w2].mexp;
-
- /* Compare experience */
- if (z1 < z2) return (TRUE);
- if (z1 > z2) return (FALSE);
- }
-
-
- /* Compare indexes */
- return (w1 <= w2);
-}
-
-
-/*!
- * @brief モンスター種族情報を特定の基準によりソートするためのスワップ処理
- * Sorting hook -- Swap function -- see below
- * @param u モンスター種族情報の入れるポインタ
- * @param v 未使用
- * @param a スワップするモンスター種族のID1
- * @param b スワップするモンスター種族のID2
- * @return なし
- * @details
- * We use "u" to point to array of monster indexes,
- * and "v" to select the type of sorting to perform.
- */
-void ang_sort_swap_hook(vptr u, vptr v, int a, int b)
-{
- u16b *who = (u16b*)(u);
- u16b holder;
-
- /* Unused */
- (void)v;
-
- /* Swap */
- holder = who[a];
- who[a] = who[b];
- who[b] = holder;
-}
-
-
-
/*!
* @brief モンスターの思い出を見るコマンドのメインルーチン
* Identify a character, allow recall of monsters
/* Nothing to recall */
if (!n)
{
- /* Free the "who" array */
- C_KILL(who, max_r_idx, IDX);
-
+ C_KILL(who, max_r_idx, MONRACE_IDX);
return;
}
why = 2;
- /* Select the sort method */
- ang_sort_comp = ang_sort_comp_hook;
- ang_sort_swap = ang_sort_swap_hook;
-
/* Sort the array */
- ang_sort(who, &why, n);
+ ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
/* Sort by kills (and level) */
if (query == 'k')
/* Catch "escape" */
if (query != 'y')
{
- /* Free the "who" array */
- C_KILL(who, max_r_idx, IDX);
-
+ C_KILL(who, max_r_idx, MONRACE_IDX);
return;
}
/* Sort if needed */
if (why == 4)
{
- /* Select the sort method */
- ang_sort_comp = ang_sort_comp_hook;
- ang_sort_swap = ang_sort_swap_hook;
-
- /* Sort the array */
- ang_sort(who, &why, n);
+ ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
}
case TV_ARROW:
case TV_BOLT:
{
- exe_fire(item, &inventory[INVEN_BOW]);
+ exe_fire(item, &inventory[INVEN_BOW], SP_NONE);
break;
}