1 #include "lore/lore-calculator.h"
2 #include "monster-race/race-flags1.h"
3 #include "mspell/monster-spell.h"
4 #include "mspell/mspell-damage-calculator.h"
8 * @param base_damage 固定値
10 * @param dice_side ダイス面
11 * @param dice_mult ダイス倍率
12 * @param dice_div ダイス除数
13 * @param msg 文字列を格納するポインタ
16 void dice_to_string(int base_damage, int dice_num, int dice_side, int dice_mult, int dice_div, char *msg)
18 char base[80] = "", dice[80] = "", mult[80] = "";
21 sprintf(msg, "%d", base_damage);
26 sprintf(base, "%d+", base_damage);
29 sprintf(dice, "d%d", dice_side);
31 sprintf(dice, "%dd%d", dice_num, dice_side);
33 if (dice_mult != 1 || dice_div != 1) {
35 sprintf(mult, "*%d", dice_mult);
37 sprintf(mult, "*(%d/%d)", dice_mult, dice_div);
40 sprintf(msg, "%s%s%s", base, dice, mult);
44 * @brief モンスターのAC情報を得ることができるかを返す / Determine if the "armor" is known
45 * @param r_idx モンスターの種族ID
46 * @return 敵のACを知る条件が満たされているならTRUEを返す
48 * The higher the level, the fewer kills needed.
50 bool know_armour(MONRACE_IDX r_idx)
52 monster_race *r_ptr = &r_info[r_idx];
53 DEPTH level = r_ptr->level;
54 MONSTER_NUMBER kills = r_ptr->r_tkills;
56 bool known = (r_ptr->r_cast_spell == MAX_UCHAR) ? TRUE : FALSE;
58 if (cheat_know || known)
60 if (kills > 304 / (4 + level))
62 if (!(r_ptr->flags1 & RF1_UNIQUE))
64 if (kills > 304 / (38 + (5 * level) / 4))
70 * @brief モンスターの打撃威力を知ることができるかどうかを返す
71 * Determine if the "damage" of the given attack is known
72 * @param r_idx モンスターの種族ID
74 * @return 敵のダメージダイスを知る条件が満たされているならTRUEを返す
77 * the higher the level of the monster, the fewer the attacks you need,
78 * the more damage an attack does, the more attacks you need
81 bool know_damage(MONRACE_IDX r_idx, int i)
83 monster_race *r_ptr = &r_info[r_idx];
84 DEPTH level = r_ptr->level;
85 s32b a = r_ptr->r_blows[i];
87 s32b d1 = r_ptr->blow[i].d_dice;
88 s32b d2 = r_ptr->blow[i].d_side;
91 if (d >= ((4 + level) * MAX_UCHAR) / 80)
92 d = ((4 + level) * MAX_UCHAR - 1) / 80;
93 if ((4 + level) * a > 80 * d)
95 if (!(r_ptr->flags1 & RF1_UNIQUE))
97 if ((4 + level) * (2 * a) > 80 * d)
104 * @brief 文字列にモンスターの攻撃力を加える
105 * @param r_idx モンスターの種族ID
106 * @param SPELL_NUM 呪文番号
108 * @param tmp 返すメッセージを格納する配列
111 void set_damage(player_type *player_ptr, MONRACE_IDX r_idx, monster_spell_type ms_type, char *msg, char *tmp)
113 int base_damage = monspell_race_damage(player_ptr, ms_type, r_idx, BASE_DAM);
114 int dice_num = monspell_race_damage(player_ptr, ms_type, r_idx, DICE_NUM);
115 int dice_side = monspell_race_damage(player_ptr, ms_type, r_idx, DICE_SIDE);
116 int dice_mult = monspell_race_damage(player_ptr, ms_type, r_idx, DICE_MULT);
117 int dice_div = monspell_race_damage(player_ptr, ms_type, r_idx, DICE_DIV);
118 char dmg_str[80], dice_str[80];
119 dice_to_string(base_damage, dice_num, dice_side, dice_mult, dice_div, dmg_str);
120 sprintf(dice_str, "(%s)", dmg_str);
122 if (know_armour(r_idx))
123 sprintf(tmp, msg, dice_str);
125 sprintf(tmp, msg, "");
128 void set_drop_flags(lore_type *lore_ptr)
130 if (!lore_ptr->know_everything)
133 lore_ptr->drop_gold = lore_ptr->drop_item = (((lore_ptr->r_ptr->flags1 & RF1_DROP_4D2) ? 8 : 0) + ((lore_ptr->r_ptr->flags1 & RF1_DROP_3D2) ? 6 : 0)
134 + ((lore_ptr->r_ptr->flags1 & RF1_DROP_2D2) ? 4 : 0) + ((lore_ptr->r_ptr->flags1 & RF1_DROP_1D2) ? 2 : 0)
135 + ((lore_ptr->r_ptr->flags1 & RF1_DROP_90) ? 1 : 0) + ((lore_ptr->r_ptr->flags1 & RF1_DROP_60) ? 1 : 0));
137 if (lore_ptr->r_ptr->flags1 & RF1_ONLY_GOLD)
138 lore_ptr->drop_item = 0;
140 if (lore_ptr->r_ptr->flags1 & RF1_ONLY_ITEM)
141 lore_ptr->drop_gold = 0;
143 lore_ptr->flags1 = lore_ptr->r_ptr->flags1;
144 lore_ptr->flags2 = lore_ptr->r_ptr->flags2;
145 lore_ptr->flags3 = lore_ptr->r_ptr->flags3;
146 lore_ptr->flags4 = lore_ptr->r_ptr->flags4;
147 lore_ptr->a_ability_flags1 = lore_ptr->r_ptr->a_ability_flags1;
148 lore_ptr->a_ability_flags2 = lore_ptr->r_ptr->a_ability_flags2;
149 lore_ptr->flagsr = lore_ptr->r_ptr->flagsr;