* </pre>
*/
-
#include "angband.h"
#include "trap.h"
-/*!
- * @brief プレイヤーからモンスターへの射撃命中判定 /
- * Determine if the player "hits" a monster (normal combat).
- * @param chance 基本命中値
- * @param m_ptr モンスターの構造体参照ポインタ
- * @param vis 目標を視界に捕らえているならばTRUEを指定
- * @param o_name メッセージ表示時のモンスター名
- * @return 命中と判定された場合TRUEを返す
- * @note Always miss 5%, always hit 5%, otherwise random.
- */
-bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name)
-{
- int k, ac;
- monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Percentile dice */
- k = randint1(100);
-
- /* Snipers with high-concentration reduce instant miss percentage.*/
- k += p_ptr->concent;
-
- /* Hack -- Instant miss or hit */
- if (k <= 5) return (FALSE);
- if (k > 95) return (TRUE);
-
- if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
- if (one_in_(20)) return (FALSE);
-
- /* Never hit */
- if (chance <= 0) return (FALSE);
-
- ac = r_ptr->ac;
- if (p_ptr->concent)
- {
- ac *= (8 - p_ptr->concent);
- ac /= 8;
- }
-
- if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) ac *= 3;
-
- /* Invisible monsters are harder to hit */
- if (!vis) chance = (chance + 1) / 2;
-
- /* Power competes against armor */
- if (randint0(chance) < (ac * 3 / 4))
- {
- if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr))
- {
- char m_name[80];
-
- /* Extract monster name */
- monster_desc(m_name, m_ptr, 0);
- msg_format(_("%sは%sを斬り捨てた!", "%s cuts down %s!"), m_name, o_name);
- }
- return (FALSE);
- }
-
- /* Assume hit */
- return (TRUE);
-}
-
-
-
-
-/*!
- * @brief プレイヤーからモンスターへの射撃クリティカル判定 /
- * Critical hits (from objects thrown by player) Factor in item weight, total plusses, and player level.
- * @param weight 矢弾の重量
- * @param plus_ammo 矢弾の命中修正
- * @param plus_bow 弓の命中修正
- * @param dam 現在算出中のダメージ値
- * @return クリティカル修正が入ったダメージ値
- */
-HIT_POINT critical_shot(int weight, int plus_ammo, int plus_bow, HIT_POINT dam)
-{
- int i, k;
- object_type *j_ptr = &inventory[INVEN_BOW];
-
- /* Extract "shot" power */
- i = p_ptr->to_h_b + plus_ammo;
-
- if (p_ptr->tval_ammo == TV_BOLT)
- i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
- else
- i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
-
-
- /* Snipers can shot more critically with crossbows */
- if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
- if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
-
- /* Good bow makes more critical */
- i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
-
- /* Critical hit */
- if (randint1(10000) <= i)
- {
- k = weight * randint1(500);
-
- if (k < 900)
- {
- msg_print(_("手ごたえがあった!", "It was a good hit!"));
- dam += (dam / 2);
- }
- else if (k < 1350)
- {
- msg_print(_("かなりの手ごたえがあった!", "It was a great hit!"));
- dam *= 2;
- }
- else
- {
- msg_print(_("会心の一撃だ!", "It was a superb hit!"));
- dam *= 3;
- }
- }
-
- return (dam);
-}
-
-
-
-
/*!
* @brief プレイヤー攻撃の種族スレイング倍率計算
* Note that most brands and slays are x3, except Slay Animal (x2),\n
* Slay Evil (x2), and Kill dragon (x5).\n
*/
-s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, BIT_FLAGS mode, bool thrown)
+HIT_POINT tot_dam_aux(object_type *o_ptr, HIT_POINT tdam, monster_type *m_ptr, BIT_FLAGS mode, bool thrown)
{
MULTIPLY mult = 10;
/* Pick a trap */
disclose_grid(y, x);
- /* Message */
msg_print(_("トラップを発見した。", "You have found a trap."));
/* Disturb */
/* Secret door */
if (is_hidden_door(c_ptr))
{
- /* Message */
msg_print(_("隠しドアを発見した。", "You have found a secret door."));
/* Disclose */
/* Identify once */
if (!object_is_known(o_ptr))
{
- /* Message */
msg_print(_("箱に仕掛けられたトラップを発見した!", "You have discovered a trap on the chest!"));
/* Know the trap */
* Add the given dungeon object to the character's inventory.\n
* Delete the object afterwards.\n
*/
-void py_pickup_aux(int o_idx)
+void py_pickup_aux(OBJECT_IDX o_idx)
{
- int slot;
+ INVENTORY_IDX slot;
#ifdef JP
char o_name[MAX_NLEN];
/* Describe the object */
object_desc(o_name, o_ptr, 0);
- /* Message */
#ifdef JP
if ((o_ptr->name1 == ART_CRIMSON) && (p_ptr->pseikaku == SEIKAKU_COMBAT))
{
{
cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
- s16b this_o_idx, next_o_idx = 0;
+ OBJECT_IDX this_o_idx, next_o_idx = 0;
char o_name[MAX_NLEN];
/* Recenter the map around the player */
verify_panel();
- /* Update stuff */
p_ptr->update |= (PU_MONSTERS);
/* Redraw map */
p_ptr->redraw |= (PR_MAP);
- /* Window stuff */
p_ptr->window |= (PW_OVERHEAD);
/* Handle stuff */
/* Delete the gold */
delete_object_idx(this_o_idx);
- /* Message */
msg_format(_(" $%ld の価値がある%sを見つけた。", "You collect %ld gold pieces worth of %s."),
(long)value, o_name);
/* Redraw gold */
p_ptr->redraw |= (PR_GOLD);
- /* Window stuff */
p_ptr->window |= (PW_PLAYER);
}
* @param n_x プレイヤーの移動先X座標
* @return 移動処理が可能である場合(可能な場合に選択した場合)TRUEを返す。
*/
-bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
+bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
{
feature_type *cur_f_ptr = &f_info[cave[c_y][c_x].feat];
feature_type *new_f_ptr = &f_info[cave[n_y][n_x].feat];
* @param mpe_mode 移動オプションフラグ
* @return プレイヤーが死亡やフロア離脱を行わず、実際に移動が可能ならばTRUEを返す。
*/
-bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
+bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
{
cave_type *c_ptr = &cave[ny][nx];
feature_type *f_ptr = &f_info[c_ptr->feat];
p_ptr->redraw |= (PR_MAP);
}
- /* Update stuff */
p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE);
- /* Window stuff */
p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
/* Remove "unsafe" flag */
/* Hidden trap */
if (c_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
{
- /* Message */
msg_print(_("トラップだ!", "You found a trap!"));
/* Pick a trap */
else if (!p_can_enter && !p_can_kill_walls)
{
/* Feature code (applying "mimic" field) */
- s16b feat = get_feat_mimic(c_ptr);
+ FEAT_IDX feat = get_feat_mimic(c_ptr);
feature_type *mimic_f_ptr = &f_info[feat];
cptr name = f_name + mimic_f_ptr->name;
/* Disturb the player */
disturb(0, 1);
- /* Sound */
if (!boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) sound(SOUND_HITWALL);
}
p_ptr->update |= (PU_FLOW);
}
- /* Sound */
/* sound(SOUND_WALK); */
#ifdef ALLOW_EASY_DISARM /* TNB */
* @param x 移動元のX座標
* @return 移動先が既知の壁ならばTRUE
*/
-static int see_wall(int dir, int y, int x)
+static bool see_wall(DIRECTION dir, POSITION y, POSITION x)
{
- cave_type *c_ptr;
+ cave_type *c_ptr;
/* Get the new location */
y += ddy[dir];
* @param x 移動元のX座標
* @return 移動先が未知の地形ならばTRUE
*/
-static int see_nothing(int dir, int y, int x)
+static bool see_nothing(DIRECTION dir, POSITION y, POSITION x)
{
/* Get the new location */
y += ddy[dir];
* \#x\# \@x\#\n
* \@\@p. p\n
*/
-static void run_init(int dir)
+static void run_init(DIRECTION dir)
{
int row, col, deepleft, deepright;
int i, shortleft, shortright;
int i, max, inv;
int option = 0, option2 = 0;
cave_type *c_ptr;
- s16b feat;
+ FEAT_IDX feat;
feature_type *f_ptr;
/* Where we came from */
/* Look at every newly adjacent square. */
for (i = -max; i <= max; i++)
{
- s16b this_o_idx, next_o_idx = 0;
+ OBJECT_IDX this_o_idx, next_o_idx = 0;
/* New direction */
new_dir = cycle[chome[prev_dir] + i];
* @param dir 移動を試みる方向ID
* @return なし
*/
-void run_step(int dir)
+void run_step(DIRECTION dir)
{
/* Start running */
if (dir)
{
sound(SOUND_HITWALL);
- /* Message */
msg_print(_("その方向には走れません。", "You cannot run in that direction."));
/* Disturb */
disturb(0, 0);
- /* Done */
return;
}
/* Disturb */
disturb(0, 0);
- /* Done */
return;
}
}
* @brief トラベル機能の判定処理 /
* Test for traveling
* @param prev_dir 前回移動を行った元の方角ID
- * @return なし
+ * @return 次の方向
*/
-static int travel_test(int prev_dir)
+static DIRECTION travel_test(DIRECTION prev_dir)
{
int new_dir = 0;
int i, max;
for (i = -max; i <= max; i++)
{
/* New direction */
- int dir = cycle[chome[prev_dir] + i];
+ DIRECTION dir = cycle[chome[prev_dir] + i];
/* New location */
int row = p_ptr->y + ddy[dir];