OSDN Git Service

#37353 狂戦士化の効果をberserk()にまとめる。
authorDeskull <deskull@users.sourceforge.jp>
Fri, 28 Sep 2018 11:32:44 +0000 (20:32 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Fri, 28 Sep 2018 11:32:44 +0000 (20:32 +0900)
Integrate effect of heroism to berserk().

src/artifact.c
src/cmd-activate.c
src/cmd-quaff.c
src/effects.c
src/externs.h
src/mutation.c
src/racial.c
src/realm-craft.c
src/realm-death.c
src/spells2.c

index 3f8f3ef..37f82a2 100644 (file)
@@ -2307,6 +2307,7 @@ bool create_named_art(int a_idx, int y, int x)
        /* Drop the artifact from heaven */
        return drop_near(q_ptr, -1, y, x) ? TRUE : FALSE;
 }
+
 /*対邪平均ダメージの計算処理*/
 int calc_arm_avgdamage(object_type *o_ptr)
 {
index f6b8476..9df9853 100644 (file)
@@ -1167,12 +1167,7 @@ bool activate_artifact(object_type *o_ptr)
 
        case ACT_BERSERK:
        {
-               (void)set_afraid(0);
-               (void)set_shero(randint1(25) + 25, FALSE);
-               /* (void)set_afraid(0);
-               (void)set_hero(randint1(50) + 50, FALSE);
-               (void)set_blessed(randint1(50) + 50, FALSE);
-               o_ptr->timeout = 100 + randint1(100); */
+               (void)berserk(randint1(25) + 25);
                break;
        }
 
index f4fb7da..c56e1fe 100644 (file)
@@ -329,9 +329,7 @@ void do_cmd_quaff_potion_aux(int item)
                        break;\r
 \r
                case SV_POTION_BESERK_STRENGTH:\r
-                       if (set_afraid(0)) ident = TRUE;\r
-                       if (set_shero(p_ptr->shero + randint1(25) + 25, FALSE)) ident = TRUE;\r
-                       if (hp_player(30)) ident = TRUE;\r
+                       ident = berserk(randint1(25) + 25);\r
                        break;\r
 \r
                case SV_POTION_CURE_LIGHT:\r
index 8bb17b8..122351d 100644 (file)
@@ -1282,8 +1282,8 @@ bool set_hero(TIME_EFFECT v, bool do_dec)
 
 /*!
  * @brief 狂戦士化の継続時間をセットする / Set "p_ptr->shero", notice observable changes
- * @param v 継続時間
- * @param do_dec 現在の継続時間より長い値のみ上書きする
+ * @param v 継続時間/ 0ならば無条件にリセット
+ * @param do_dec FALSEの場合現在の継続時間より長い値のみ上書きする
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
 bool set_shero(TIME_EFFECT v, bool do_dec)
index bebb593..40eab3a 100644 (file)
@@ -1173,6 +1173,7 @@ extern void cast_invoke_spirits(int dir);
 extern void cast_shuffle(void);
 extern bool_hack life_stream(bool_hack message, bool_hack virtue);
 extern bool_hack heroism(int base);
+extern bool_hack berserk(int base);
 extern bool_hack cure_light_wounds(int dice, int sides);
 extern bool_hack cure_serious_wounds(int dice, int sides);
 extern bool_hack cure_critical_wounds(HIT_POINT pow);
index 44845c7..d161953 100644 (file)
@@ -2320,9 +2320,7 @@ bool mutation_power_aux(u32b power)
                        break;
 
                case MUT1_BERSERK:
-                       (void)set_shero(randint1(25) + 25, FALSE);
-                       (void)hp_player(30);
-                       (void)set_afraid(0);
+                       (void)berserk(randint1(25) + 25);
                        break;
 
                case MUT1_POLYMORPH:
index 46f7511..cd6ab9f 100644 (file)
@@ -1317,9 +1317,7 @@ static bool cmd_racial_power_aux(s32b command)
 
                case RACE_HALF_TROLL:
                        msg_print(_("うがぁぁ!", "RAAAGH!"));
-                       (void)set_afraid(0);
-                       (void)set_shero(10 + randint1(plev), FALSE);
-                       (void)hp_player(30);
+                       (void)berserk(10 + randint1(plev));
                        break;
 
                case RACE_AMBERITE:
@@ -1340,9 +1338,7 @@ static bool cmd_racial_power_aux(s32b command)
 
                case RACE_BARBARIAN:
                        msg_print(_("うぉぉおお!", "Raaagh!"));
-                       (void)set_afraid(0);
-                       (void)set_shero(10 + randint1(plev), FALSE);
-                       (void)hp_player(30);
+                       (void)berserk(10 + randint1(plev));
                        break;
 
                case RACE_HALF_OGRE:
index c768d91..29aca14 100644 (file)
@@ -208,9 +208,7 @@ cptr do_craft_spell(SPELL_IDX spell, BIT_FLAGS mode)
 \r
                        if (cast)\r
                        {\r
-                               set_shero(randint1(base) + base, FALSE);\r
-                               hp_player(30);\r
-                               set_afraid(0);\r
+                               (void)berserk(base + randint1(base));\r
                        }\r
                }\r
                break;\r
index 3a93d7b..cef8d87 100644 (file)
@@ -370,9 +370,7 @@ cptr do_death_spell(SPELL_IDX spell, BIT_FLAGS mode)
 \r
                        if (cast)\r
                        {\r
-                               set_shero(randint1(base) + base, FALSE);\r
-                               hp_player(30);\r
-                               set_afraid(0);\r
+                               (void)berserk(base + randint1(base));\r
                        }\r
                }\r
                break;\r
@@ -426,9 +424,7 @@ cptr do_death_spell(SPELL_IDX spell, BIT_FLAGS mode)
 \r
                        if (cast)\r
                        {\r
-                               set_shero(randint1(25) + 25, FALSE);\r
-                               hp_player(30);\r
-                               set_afraid(0);\r
+                               (void)berserk(b_base + randint1(b_base));\r
                                set_fast(randint1(sp_sides) + sp_base, FALSE);\r
                        }\r
                }\r
index 43f710d..0a7ceec 100644 (file)
@@ -5010,6 +5010,15 @@ bool_hack heroism(int base)
        return ident;
 }
 
+bool_hack berserk(int base)
+{
+       bool_hack ident = FALSE;
+       if (set_afraid(0)) ident = TRUE;
+       if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
+       if (hp_player(30)) ident = TRUE;
+       return ident;
+}
+
 bool_hack cure_light_wounds(int dice, int sides)
 {
        bool_hack ident = FALSE;