OSDN Git Service

Merge remote-tracking branch 'remotes/origin/feature/Refactor-Monster-Alpha5' into...
[hengband/hengband.git] / src / market / building-craft-armor.c
1 #include "io/input-key-acceptor.h"
2 #include "market/building-craft-armor.h"
3 #include "market/building-util.h"
4 #include "term/screen-processor.h"
5 #include "util/buffer-shaper.h"
6
7 /*!
8  * @brief ACから回避率、ダメージ減少率を計算し表示する。 / Evaluate AC
9  * @details
10  * Calculate and display the dodge-rate and the protection-rate
11  * based on AC
12  * @param iAC プレイヤーのAC。
13  * @return 常にTRUEを返す。
14  */
15 bool eval_ac(ARMOUR_CLASS iAC)
16 {
17     const GAME_TEXT memo[] = _("ダメージ軽減率とは、敵の攻撃が当たった時そのダメージを\n"
18                           "何パーセント軽減するかを示します。\n"
19                           "ダメージ軽減は通常の直接攻撃(種類が「攻撃する」と「粉砕する」の物)\n"
20                           "に対してのみ効果があります。\n \n"
21                           "敵のレベルとは、その敵が通常何階に現れるかを示します。\n \n"
22                           "回避率は敵の直接攻撃を何パーセントの確率で避けるかを示し、\n"
23                           "敵のレベルとあなたのACによって決定されます。\n \n"
24                           "ダメージ期待値とは、敵の100ポイントの通常攻撃に対し、\n"
25                           "回避率とダメージ軽減率を考慮したダメージの期待値を示します。\n",
26         "'Protection Rate' means how much damage is reduced by your armor.\n"
27         "Note that the Protection rate is effective only against normal "
28         "'attack' and 'shatter' type melee attacks, "
29         "and has no effect against any other types such as 'poison'.\n \n"
30         "'Dodge Rate' indicates the success rate on dodging the "
31         "monster's melee attacks.  "
32         "It is depend on the level of the monster and your AC.\n \n"
33         "'Average Damage' indicates the expected amount of damage "
34         "when you are attacked by normal melee attacks with power=100.");
35
36     int protection;
37     TERM_LEN col, row = 2;
38     DEPTH lvl;
39     char buf[80 * 20], *t;
40
41     if (iAC < 0)
42         iAC = 0;
43
44     protection = 100 * MIN(iAC, 150) / 250;
45     screen_save();
46     clear_bldg(0, 22);
47
48     put_str(format(_("あなたの現在のAC: %3d", "Your current AC : %3d"), iAC), row++, 0);
49     put_str(format(_("ダメージ軽減率  : %3d%%", "Protection rate : %3d%%"), protection), row++, 0);
50     row++;
51
52     put_str(_("敵のレベル      :", "Level of Monster:"), row + 0, 0);
53     put_str(_("回避率          :", "Dodge Rate      :"), row + 1, 0);
54     put_str(_("ダメージ期待値  :", "Average Damage  :"), row + 2, 0);
55
56     for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5) {
57         int quality = 60 + lvl * 3; /* attack quality with power 60 */
58         int dodge; /* 回避率(%) */
59         int average; /* ダメージ期待値 */
60
61         put_str(format("%3d", lvl), row + 0, col);
62
63         /* 回避率を計算 */
64         dodge = 5 + (MIN(100, 100 * (iAC * 3 / 4) / quality) * 9 + 5) / 10;
65         put_str(format("%3d%%", dodge), row + 1, col);
66
67         /* 100点の攻撃に対してのダメージ期待値を計算 */
68         average = (100 - dodge) * (100 - protection) / 100;
69         put_str(format("%3d", average), row + 2, col);
70     }
71
72     shape_buffer(memo, 70, buf, sizeof(buf));
73     for (t = buf; t[0]; t += strlen(t) + 1)
74         put_str(t, (row++) + 4, 4);
75
76     prt(_("現在のあなたの装備からすると、あなたの防御力はこれくらいです:", "Defense abilities from your current Armor Class are evaluated below."), 0, 0);
77
78     flush();
79     (void)inkey();
80     screen_load();
81
82     return TRUE;
83 }