OSDN Git Service

[Refactor] #37353 コメント整理。 / Refactor comments.
[hengband/hengband.git] / src / melee1.c
index 0d9637f..70bac3f 100644 (file)
  */
 
 #include "angband.h"
+#include "artifact.h"
 #include "cmd-pet.h"
 #include "player-damage.h"
 #include "monsterrace-hook.h"
 #include "melee.h"
+#include "projection.h"
+#include "monster-status.h"
+#include "avatar.h"
+#include "player-status.h"
 
 
 
@@ -183,7 +188,7 @@ static int check_hit(int power, DEPTH level, int stun)
 }
 
 /*! モンスターの侮辱行為メッセージテーブル / Hack -- possible "insult" messages */
-static cptr desc_insult[] =
+static concptr desc_insult[] =
 {
 #ifdef JP
        "があなたを侮辱した!",
@@ -212,7 +217,7 @@ static cptr desc_insult[] =
 };
 
 /*! マゴットのぼやきメッセージテーブル / Hack -- possible "insult" messages */
-static cptr desc_moan[] =
+static concptr desc_moan[] =
 {
 #ifdef JP
        "は何かを悲しんでいるようだ。",
@@ -240,7 +245,7 @@ static cptr desc_moan[] =
 * @return なし
 */
 static void touch_zap_player_aux(monster_type *m_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag,
-       HIT_POINT(*dam_func)(HIT_POINT dam, cptr kb_str, int monspell, bool aura), cptr message)
+       HIT_POINT(*dam_func)(HIT_POINT dam, concptr kb_str, int monspell, bool aura), concptr message)
 {
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
@@ -299,7 +304,7 @@ static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
 
        int             dice_num, dice_side;
 
-       cptr            atk_desc;
+       concptr            atk_desc;
 
        switch (attack)
        {
@@ -461,7 +466,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b
        {
        case CLASS_ROGUE:
        case CLASS_NINJA:
-               if (buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand])
+               if (has_melee_weapon(INVEN_RARM + hand) && !p_ptr->icky_wield[hand])
                {
                        int tmp = p_ptr->lev * 6 + (p_ptr->skill_stl + 10) * 4;
                        if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
@@ -932,7 +937,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b
                                }
                                else k = 1;
                        }
-                       else if ((p_ptr->pclass == CLASS_NINJA) && buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand] && ((p_ptr->cur_lite <= 0) || one_in_(7)))
+                       else if ((p_ptr->pclass == CLASS_NINJA) && has_melee_weapon(INVEN_RARM + hand) && !p_ptr->icky_wield[hand] && ((p_ptr->cur_lite <= 0) || one_in_(7)))
                        {
                                int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
                                if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
@@ -1187,8 +1192,6 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b
 
                                msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
                                msg_print(_("振り回した大鎌が自分自身に返ってきた!", "Your scythe returns to you!"));
-
-                               /* Extract the flags */
                                object_flags(o_ptr, flgs_aux);
 
                                k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
@@ -1442,8 +1445,8 @@ bool py_attack(POSITION y, POSITION x, BIT_FLAGS mode)
 
                if (cur < max)
                {
-                       int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
-                       int targetlevel = r_ptr->level;
+                       DEPTH ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
+                       DEPTH targetlevel = r_ptr->level;
                        int inc = 0;
 
                        if ((cur / 200 - 5) < targetlevel)
@@ -1459,7 +1462,6 @@ bool py_attack(POSITION y, POSITION x, BIT_FLAGS mode)
                        }
 
                        p_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
-
                        p_ptr->update |= (PU_BONUS);
                }
        }
@@ -1572,7 +1574,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
                HIT_POINT power = 0;
                HIT_POINT damage = 0;
 
-               cptr act = NULL;
+               concptr act = NULL;
 
                /* Extract the attack infomation */
                int effect = r_ptr->blow[ap_cnt].effect;
@@ -1997,7 +1999,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
                                                if (apply_disenchant(0))
                                                {
                                                        /* Hack -- Update AC */
-                                                       handle_stuff();
+                                                       update_creature(p_ptr);
                                                        obvious = TRUE;
                                                }
                                        }
@@ -2152,7 +2154,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
                                        /* Find an item */
                                        for (k = 0; k < 10; k++)
                                        {
-                                               s16b o_idx;
+                                               OBJECT_IDX o_idx;
 
                                                /* Pick an item */
                                                i = (INVENTORY_IDX)randint0(INVEN_PACK);
@@ -2184,11 +2186,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
                                                if (o_idx)
                                                {
                                                        object_type *j_ptr;
-
-                                                       /* Get new object */
                                                        j_ptr = &o_list[o_idx];
-
-                                                       /* Copy object */
                                                        object_copy(j_ptr, o_ptr);
 
                                                        /* Modify number */
@@ -2305,7 +2303,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
                                        obvious = TRUE;
                                        msg_print(_("酸を浴びせられた!", "You are covered in acid!"));
                                        get_damage += acid_dam(damage, ddesc, -1, FALSE);
-                                       handle_stuff();
+                                       update_creature(p_ptr);
                                        update_smart_learn(m_idx, DRS_ACID);
                                        break;
                                }
@@ -2690,7 +2688,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
                                                        {
                                                                msg_print(_("あなたは以前ほど力強くなくなってしまった...。", "You're not as powerful as you used to be..."));
 
-                                                               for (k = 0; k < 6; k++)
+                                                               for (k = 0; k < A_MAX; k++)
                                                                {
                                                                        p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
                                                                        if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
@@ -3210,6 +3208,33 @@ bool make_attack_normal(MONSTER_IDX m_idx)
 #endif
 
                                }
+
+                               /* Gain shield experience */
+                               if (object_is_armour(&inventory[INVEN_RARM]) || object_is_armour(&inventory[INVEN_LARM]))
+                               {
+                                       int cur = p_ptr->skill_exp[GINOU_SHIELD];
+                                       int max = s_info[p_ptr->pclass].s_max[GINOU_SHIELD];
+
+                                       if (cur < max)
+                                       {
+                                               DEPTH targetlevel = r_ptr->level;
+                                               int inc = 0;
+
+
+                                               /* Extra experience */
+                                               if ((cur / 100) < targetlevel)
+                                               {
+                                                       if ((cur / 100 + 15) < targetlevel)
+                                                               inc += 1 + (targetlevel - (cur / 100 + 15));
+                                                       else
+                                                               inc += 1;
+                                               }
+
+                                               p_ptr->skill_exp[GINOU_SHIELD] = MIN(max, cur + inc);
+                                               p_ptr->update |= (PU_BONUS);
+                                       }
+                               }
+
                                damage = 0;
 
                                break;