• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision207f76b730ea517407a9219dcd26edf4f06a061b (tree)
Time2019-01-07 22:47:44
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

[Refactor] #37359 アーティファクト抑制処理再実装中。 / Reimplementing artifact suppression.

Change Summary

Incremental Difference

--- a/src/artifact.c
+++ b/src/artifact.c
@@ -15,8 +15,7 @@
1515 #include "object-curse.h"
1616
1717 static bool suppression_evil_dam(object_type *o_ptr);
18-static int weakening_artifact(object_type *o_ptr);
19-
18+static bool weakening_artifact(object_type *o_ptr);
2019
2120
2221 /*!
@@ -1326,13 +1325,13 @@ static void random_slay(object_type *o_ptr)
13261325 break;
13271326 case 3:
13281327 case 4:
1329- if (one_in_(4))
1328+ if (one_in_(8))
13301329 {
13311330 add_flag(o_ptr->art_flags, TR_KILL_EVIL);
13321331 }
13331332 else
13341333 {
1335- add_flag(o_ptr->art_flags, TR_SLAY_EVIL);
1334+ add_flag(o_ptr->art_flags, TR_SLAY_EVIL);
13361335 }
13371336 if (!o_ptr->artifact_bias && one_in_(2))
13381337 o_ptr->artifact_bias = BIAS_LAW;
@@ -1900,14 +1899,6 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
19001899
19011900 if (has_pval)
19021901 {
1903-#if 0
1904- add_flag(o_ptr->art_flags, TR_SHOW_MODS);
1905-
1906- /* This one commented out by gw's request... */
1907- if (!a_scroll)
1908- add_flag(o_ptr->art_flags, TR_HIDE_TYPE);
1909-#endif
1910-
19111902 if (have_flag(o_ptr->art_flags, TR_BLOWS))
19121903 {
19131904 o_ptr->pval = randint1(2);
@@ -1960,14 +1951,14 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
19601951 while ((o_ptr->to_d+o_ptr->to_h) > 20)
19611952 {
19621953 if (one_in_(o_ptr->to_d) && one_in_(o_ptr->to_h)) break;
1963- o_ptr->to_d -= (s16b)randint0(3);
1964- o_ptr->to_h -= (s16b)randint0(3);
1954+ o_ptr->to_d -= (HIT_POINT)randint0(3);
1955+ o_ptr->to_h -= (HIT_PROB)randint0(3);
19651956 }
19661957 while ((o_ptr->to_d+o_ptr->to_h) > 10)
19671958 {
19681959 if (one_in_(o_ptr->to_d) || one_in_(o_ptr->to_h)) break;
1969- o_ptr->to_d -= (s16b)randint0(3);
1970- o_ptr->to_h -= (s16b)randint0(3);
1960+ o_ptr->to_d -= (HIT_POINT)randint0(3);
1961+ o_ptr->to_h -= (HIT_PROB)randint0(3);
19711962 }
19721963 }
19731964
@@ -2015,14 +2006,10 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
20152006 else power_level = 3;
20162007 }
20172008
2018- /* 平均対邪ダメージが一定以上なら11/12(WEIRD_LUCK)でダメージ抑制処理を行う */
2019- if(suppression_evil_dam(o_ptr) && !one_in_(WEIRD_LUCK) && object_is_weapon(o_ptr))
2009+ /* ダメージ抑制処理を行う */
2010+ while (suppression_evil_dam(o_ptr) && !one_in_(SWORDFISH_LUCK));
20202011 {
2021- msg_format_wizard(CHEAT_OBJECT, "アーティファクトの抑制処理を行います。");
2022- do
2023- {
2024- if (weakening_artifact(o_ptr) == 0) break;
2025- } while (suppression_evil_dam(o_ptr));
2012+ weakening_artifact(o_ptr);
20262013 }
20272014
20282015 if (a_scroll)
@@ -2262,7 +2249,7 @@ bool create_named_art(ARTIFACT_IDX a_idx, POSITION y, POSITION x)
22622249 {
22632250 object_type forge;
22642251 object_type *q_ptr;
2265- IDX i;
2252+ KIND_OBJECT_IDX i;
22662253
22672254 artifact_type *a_ptr = &a_info[a_idx];
22682255 q_ptr = &forge;
@@ -2279,7 +2266,7 @@ bool create_named_art(ARTIFACT_IDX a_idx, POSITION y, POSITION x)
22792266 object_prep(q_ptr, i);
22802267
22812268 /* Save the name */
2282- q_ptr->name1 = (byte_hack)a_idx;
2269+ q_ptr->name1 = a_idx;
22832270
22842271 /* Extract the fields */
22852272 q_ptr->pval = a_ptr->pval;
@@ -2306,7 +2293,7 @@ bool create_named_art(ARTIFACT_IDX a_idx, POSITION y, POSITION x)
23062293 }
23072294
23082295 /*対邪平均ダメージの計算処理*/
2309-int calc_arm_avgdamage(object_type *o_ptr)
2296+HIT_POINT calc_arm_avgdamage(object_type *o_ptr)
23102297 {
23112298 BIT_FLAGS flgs[TR_FLAG_SIZE];
23122299 object_flags(o_ptr, flgs);
@@ -2342,7 +2329,7 @@ int calc_arm_avgdamage(object_type *o_ptr)
23422329
23432330 msg_format_wizard(CHEAT_OBJECT,"素:%d> 対邪:%d> 理力:%d> 切:%d> 最終:%d", base, s_evil, forced, vorpal, dam);
23442331
2345- return(dam);
2332+ return dam;
23462333 }
23472334
23482335 static bool suppression_evil_dam(object_type *o_ptr)
@@ -2391,13 +2378,13 @@ static bool suppression_evil_dam(object_type *o_ptr)
23912378 return FALSE;
23922379 }
23932380
2394-static int weakening_artifact(object_type *o_ptr)
2381+static bool weakening_artifact(object_type *o_ptr)
23952382 {
2396- KIND_OBJECT_IDX k_idx = lookup_kind(o_ptr->sval, o_ptr->tval);
2397- object_kind *k_ptr = &k_info[k_idx];
2383+ KIND_OBJECT_IDX k_idx = lookup_kind(o_ptr->sval, o_ptr->tval);
2384+ object_kind *k_ptr = &k_info[k_idx];
23982385
2399- if ((k_ptr->dd < o_ptr->dd) || (k_ptr->ds < o_ptr->ds))
2400- {
2386+ if ((k_ptr->dd < o_ptr->dd) || (k_ptr->ds < o_ptr->ds))
2387+ {
24012388 DICE_NUMBER pre_dd = o_ptr->dd;
24022389 DICE_SID pre_ds = o_ptr->ds;
24032390
@@ -2410,12 +2397,12 @@ static int weakening_artifact(object_type *o_ptr)
24102397 o_ptr->ds--;
24112398 }
24122399
2413- msg_format_wizard(CHEAT_OBJECT,
2400+ msg_format_wizard(CHEAT_OBJECT,
24142401 _("ダイスが抑制されました。%dd%d -> %dd%d", "Dice Supress %dd%d -> %dd%d"),
24152402 pre_dd, pre_ds, o_ptr->dd, o_ptr->ds);
24162403 return 1;
24172404 }
2418-
2405+
24192406 if (o_ptr->to_d > 10)
24202407 {
24212408 HIT_POINT pre_damage = o_ptr->to_d;
@@ -2431,6 +2418,6 @@ static int weakening_artifact(object_type *o_ptr)
24312418 pre_damage, o_ptr->to_d);
24322419
24332420 return 1;
2434- }
2435- return 0;
2421+ }
2422+ return 0;
24362423 }
\ No newline at end of file
--- a/src/gamevalue.h
+++ b/src/gamevalue.h
@@ -109,6 +109,7 @@
109109 #define TABLE_NAME 20 /*!< ランダムアーティファクトに漢字銘をつける確率(正確には TABLE_NAME - SINDARIN_NAME %)となる */
110110 #define A_CURSED 13 /*!< 1/nの確率で生成の巻物以外のランダムアーティファクトが呪いつきになる。 */
111111 #define WEIRD_LUCK 12 /*!< 1/nの確率でrandom_resistance()の処理中バイアス外の耐性がつき、create_artifactで4を超えるpvalが許可される。*/
112+#define SWORDFISH_LUCK 6 /*!< 1/nの確率で一定以上のスレイダメージを超える武器のスレイ喪失が回避される。 */
112113 #define BIAS_LUCK 20 /*!< 1/nの確率でrandom_resistance()で付加する元素耐性が免疫になる */
113114 #define IM_LUCK 7 /*!< 1/nの確率でrandom_resistance()で複数免疫の除去処理が免除される */
114115
Show on old repository browser