OSDN Git Service

b5f59cab6801337016b7ecab8162f21100776289
[hengbandforosx/hengbandosx.git] / src / specific-object / bloody-moon.cpp
1 #include "specific-object/bloody-moon.h"
2 #include "artifact/fixed-art-types.h"
3 #include "core/player-update-types.h"
4 #include "object-enchant/object-boost.h"
5 #include "object-enchant/tr-types.h"
6 #include "racial/racial-android.h"
7 #include "system/artifact-type-definition.h"
8 #include "system/object-type-definition.h"
9 #include "system/player-type-definition.h"
10 #include "util/bit-flags-calculator.h"
11 #include "view/display-messages.h"
12
13 /*!
14  * @brief 固定アーティファクト『ブラッディムーン』の特性を変更する。
15  * @details スレイ2d2種、及びone_resistance()による耐性1d2種、pval2種を得る。
16  * @param o_ptr 対象のオブジェクト構造体 (ブラッディムーン)のポインタ
17  */
18 void get_bloody_moon_flags(object_type *o_ptr)
19 {
20     o_ptr->art_flags = a_info[ART_BLOOD].flags;
21
22     int dummy = randint1(2) + randint1(2);
23     for (int i = 0; i < dummy; i++) {
24         int flag = randint0(26);
25         if (flag >= 20)
26             o_ptr->art_flags.set(TR_KILL_UNDEAD + flag - 20);
27         else if (flag == 19)
28             o_ptr->art_flags.set(TR_KILL_ANIMAL);
29         else if (flag == 18)
30             o_ptr->art_flags.set(TR_SLAY_HUMAN);
31         else
32             o_ptr->art_flags.set(TR_CHAOTIC + flag);
33     }
34
35     dummy = randint1(2);
36     for (int i = 0; i < dummy; i++)
37         one_resistance(o_ptr);
38
39     for (int i = 0; i < 2; i++) {
40         int tmp = randint0(11);
41         if (tmp < A_MAX)
42             o_ptr->art_flags.set(TR_STR + tmp);
43         else
44             o_ptr->art_flags.set(TR_STEALTH + tmp - 6);
45     }
46 }
47
48 /*!
49  * @brief Let's dance a RONDO!!
50  * @param player_ptr プレイヤーへの参照ポインタ
51  * @param o_ptr ブラッディ・ムーンへの参照ポインタ
52  * @return オブジェクト情報に異常がない限りTRUE
53  */
54 bool activate_bloody_moon(player_type *player_ptr, object_type *o_ptr)
55 {
56     if (o_ptr->name1 != ART_BLOOD)
57         return false;
58
59     msg_print(_("鎌が明るく輝いた...", "Your scythe glows brightly!"));
60     get_bloody_moon_flags(o_ptr);
61     if (player_ptr->prace == PlayerRaceType::ANDROID)
62         calc_android_exp(player_ptr);
63
64     player_ptr->update |= PU_BONUS | PU_HP;
65     return true;
66 }