*/
#include "angband.h"
-#include "cmd-activate.h"
-
-static int suppression_evil_dam(object_type *o_ptr);
-static int weakening_artifact(object_type *o_ptr);
-
-
-/* Chance of using syllables to form the name instead of the "template" files */
-#define SINDARIN_NAME 10 /*!< ランダムアーティファクトにシンダリン銘をつける確率 */
-#define TABLE_NAME 20 /*!< ランダムアーティファクトに漢字銘をつける確率(正確には TABLE_NAME - SINDARIN_NAME %)となる */
-#define A_CURSED 13 /*!< 1/nの確率で生成の巻物以外のランダムアーティファクトが呪いつきになる。 */
-#define WEIRD_LUCK 12 /*!< 1/nの確率でrandom_resistance()の処理中バイアス外の耐性がつき、create_artifactで4を超えるpvalが許可される。*/
-#define BIAS_LUCK 20 /*!< 1/nの確率でrandom_resistance()で付加する元素耐性が免疫になる */
-#define IM_LUCK 7 /*!< 1/nの確率でrandom_resistance()で複数免疫の除去処理が免除される */
-/*! @note
- * Bias luck needs to be higher than weird luck,
- * since it is usually tested several times...
- */
+#include "avatar.h"
+#include "cmd-activate.h"
+#include "object-curse.h"
+#include "artifact.h"
-#define ACTIVATION_CHANCE 3 /*!< 1/nの確率でランダムアーティファクトに発動が付加される。ただし防具はさらに1/2 */
+static bool has_extreme_damage_rate(object_type *o_ptr);
+static bool weakening_artifact(object_type *o_ptr);
/*!
break;
case 3:
case 4:
- if (one_in_(4))
+ if (one_in_(8))
{
add_flag(o_ptr->art_flags, TR_KILL_EVIL);
}
else
{
- add_flag(o_ptr->art_flags, TR_SLAY_EVIL);
+ add_flag(o_ptr->art_flags, TR_SLAY_EVIL);
}
if (!o_ptr->artifact_bias && one_in_(2))
o_ptr->artifact_bias = BIAS_LAW;
*/
static void get_random_name(object_type *o_ptr, char *return_name, bool armour, int power)
{
- int prob = randint1(100);
+ PERCENTAGE prob = randint1(100);
if (prob <= SINDARIN_NAME)
{
}
else
{
- cptr filename;
+ concptr filename;
switch (armour)
{
*/
bool create_artifact(object_type *o_ptr, bool a_scroll)
{
- char new_name[1024];
- int has_pval = 0;
+ GAME_TEXT new_name[1024];
+ PARAMETER_VALUE has_pval = 0;
int powers = randint1(5) + 1;
int max_powers;
int max_type = (object_is_weapon_ammo(o_ptr) ? 7 : 5);
if (has_pval)
{
-#if 0
- add_flag(o_ptr->art_flags, TR_SHOW_MODS);
-
- /* This one commented out by gw's request... */
- if (!a_scroll)
- add_flag(o_ptr->art_flags, TR_HIDE_TYPE);
-#endif
-
if (have_flag(o_ptr->art_flags, TR_BLOWS))
{
o_ptr->pval = randint1(2);
while ((o_ptr->to_d+o_ptr->to_h) > 20)
{
if (one_in_(o_ptr->to_d) && one_in_(o_ptr->to_h)) break;
- o_ptr->to_d -= (s16b)randint0(3);
- o_ptr->to_h -= (s16b)randint0(3);
+ o_ptr->to_d -= (HIT_POINT)randint0(3);
+ o_ptr->to_h -= (HIT_PROB)randint0(3);
}
while ((o_ptr->to_d+o_ptr->to_h) > 10)
{
if (one_in_(o_ptr->to_d) || one_in_(o_ptr->to_h)) break;
- o_ptr->to_d -= (s16b)randint0(3);
- o_ptr->to_h -= (s16b)randint0(3);
+ o_ptr->to_d -= (HIT_POINT)randint0(3);
+ o_ptr->to_h -= (HIT_PROB)randint0(3);
}
}
else power_level = 3;
}
- /* 平均対邪ダメージが一定以上なら11/12(WEIRD_LUCK)でダメージ抑制処理を行う */
- if(suppression_evil_dam(o_ptr) && !one_in_(WEIRD_LUCK) && object_is_weapon(o_ptr))
+ /* ダメージ抑制処理を行う */
+ while (has_extreme_damage_rate(o_ptr) && !one_in_(SWORDFISH_LUCK))
{
- msg_format_wizard(CHEAT_OBJECT, "アーティファクトの抑制処理を行います。");
- do
- {
- if (weakening_artifact(o_ptr) == 0) break;
- } while (suppression_evil_dam(o_ptr));
+ weakening_artifact(o_ptr);
}
if (a_scroll)
{
- char dummy_name[80] = "";
- cptr ask_msg = _("このアーティファクトを何と名付けますか?", "What do you want to call the artifact? ");
+ GAME_TEXT dummy_name[MAX_NLEN] = "";
+ concptr ask_msg = _("このアーティファクトを何と名付けますか?", "What do you want to call the artifact? ");
- /* Identify it fully */
object_aware(o_ptr);
object_known(o_ptr);
msg_format_wizard(CHEAT_OBJECT, _("パワー %d で 価値%ld のランダムアーティファクト生成 バイアスは「%s」",
"Random artifact generated - Power:%d Value:%d Bias:%s."), max_powers, total_flags, artifact_bias_name[o_ptr->artifact_bias]);
- /* Window stuff */
p_ptr->window |= (PW_INVEN | PW_EQUIP);
return TRUE;
* 仮に2個以上存在可能かつ装備品以外の固定アーティファクトが作成されれば
* drop_near()関数の返り値は信用できなくなる.
*/
-bool create_named_art(int a_idx, int y, int x)
+bool create_named_art(ARTIFACT_IDX a_idx, POSITION y, POSITION x)
{
object_type forge;
object_type *q_ptr;
- IDX i;
+ KIND_OBJECT_IDX i;
artifact_type *a_ptr = &a_info[a_idx];
-
- /* Get local object */
q_ptr = &forge;
/* Ignore "empty" artifacts */
/* Acquire the "kind" index */
i = lookup_kind(a_ptr->tval, a_ptr->sval);
- /* Oops */
if (!i) return FALSE;
/* Create the artifact */
object_prep(q_ptr, i);
/* Save the name */
- q_ptr->name1 = (byte_hack)a_idx;
+ q_ptr->name1 = a_idx;
/* Extract the fields */
q_ptr->pval = a_ptr->pval;
/* Drop the artifact from heaven */
return drop_near(q_ptr, -1, y, x) ? TRUE : FALSE;
}
+
/*対邪平均ダメージの計算処理*/
-int calc_arm_avgdamage(object_type *o_ptr)
+HIT_POINT calc_arm_avgdamage(object_type *o_ptr)
{
- u32b flgs[TR_FLAG_SIZE];
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
object_flags(o_ptr, flgs);
HIT_POINT dam, base, s_evil, forced, vorpal;
- dam = base = s_evil = forced = vorpal = 0;
-
+ s_evil = forced = vorpal = 0;
dam = base = (o_ptr->dd * o_ptr->ds + o_ptr->dd) / 2;
if(have_flag(flgs, TR_KILL_EVIL))
dam = dam + o_ptr->to_d;
- msg_format_wizard(CHEAT_OBJECT,"素:%d> 対邪:%d> 理力:%d> 切:%d> 最終:%d",
- base, s_evil, forced, vorpal, dam);
+ msg_format_wizard(CHEAT_OBJECT,"素:%d> 対邪:%d> 理力:%d> 切:%d> 最終:%d", base, s_evil, forced, vorpal, dam);
- return(dam);
+ return dam;
}
-static int suppression_evil_dam(object_type *o_ptr)
+static bool has_extreme_damage_rate(object_type *o_ptr)
{
- int num = FALSE;
- u32b flgs[TR_FLAG_SIZE];
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
object_flags(o_ptr, flgs);
if (have_flag(flgs, TR_VAMPIRIC))
{
if(have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 1) && (calc_arm_avgdamage(o_ptr) > 52))
{
- num = TRUE;
+ return TRUE;
}
else if(have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 2) && (calc_arm_avgdamage(o_ptr) > 43))
{
- num = TRUE;
+ return TRUE;
}
else if( have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 3) && (calc_arm_avgdamage(o_ptr) > 33))
{
- num = TRUE;
+ return TRUE;
}
else if (calc_arm_avgdamage(o_ptr) > 63)
{
- num = TRUE;
+ return TRUE;
}
}
else
{
if (have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 1) && (calc_arm_avgdamage(o_ptr) > 65))
{
- num = TRUE;
+ return TRUE;
}
else if (have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 2) && (calc_arm_avgdamage(o_ptr) > 52))
{
- num = TRUE;
+ return TRUE;
}
else if (have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 3) && (calc_arm_avgdamage(o_ptr) > 40))
{
- num = TRUE;
+ return TRUE;
}
else if (calc_arm_avgdamage(o_ptr) > 75)
{
- num = TRUE;
+ return TRUE;
}
}
- return(num);
+ return FALSE;
}
-static int weakening_artifact(object_type *o_ptr)
+static bool weakening_artifact(object_type *o_ptr)
{
- KIND_OBJECT_IDX k_idx = lookup_kind(o_ptr->sval, o_ptr->tval);
- object_kind *k_ptr = &k_info[k_idx];
-
- if ((k_ptr->dd < o_ptr->dd) || (k_ptr->ds < o_ptr->ds))
- {
- int pre_dd = o_ptr->dd;
- int pre_ds = o_ptr->ds;
-
- if (o_ptr->dd > o_ptr->ds)
- {
- o_ptr->dd--;
- }
- else
- {
- o_ptr->ds--;
- }
+ KIND_OBJECT_IDX k_idx = lookup_kind(o_ptr->tval, o_ptr->sval);
+ object_kind *k_ptr = &k_info[k_idx];
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
+ object_flags(o_ptr, flgs);
- msg_format_wizard(CHEAT_OBJECT,
- _("ダイスが抑制されました。%dd%d -> %dd%d", "Dice Supress %dd%d -> %dd%d"),
- pre_dd, pre_ds, o_ptr->dd, o_ptr->ds);
- return 1;
+ if (have_flag(flgs, TR_KILL_EVIL))
+ {
+ remove_flag(o_ptr->art_flags, TR_KILL_EVIL);
+ add_flag(o_ptr->art_flags, TR_SLAY_EVIL);
+ return TRUE;
}
-
- if (o_ptr->to_d > 10)
+ else if (k_ptr->dd < o_ptr->dd)
+ {
+ o_ptr->dd--;
+ return TRUE;
+ }
+ else if (k_ptr->ds < o_ptr->ds)
+ {
+ o_ptr->ds--;
+ return TRUE;
+ }
+ else if (o_ptr->to_d > 10)
{
- int pre_damage = o_ptr->to_d;
-
o_ptr->to_d = o_ptr->to_d - damroll(1, 6);
if (o_ptr->to_d < 10)
{
o_ptr->to_d = 10;
}
-
- msg_format_wizard(CHEAT_OBJECT,
- _("ダメージ修正が抑制されました。 %d -> %d", "Plus-Damage Supress %d -> %d"),
- pre_damage, o_ptr->to_d);
-
- return 1;
- }
- return 0;
+ return TRUE;
+ }
+ return FALSE;
}
\ No newline at end of file