OSDN Git Service

[Refactor] #40635 Separated market/building-initializer.c/h from init.c/h
[hengband/hengband.git] / src / object-activation / activation-resistance.c
1 #include "object-activation/activation-resistance.h"
2 #include "core/hp-mp-processor.h"
3 #include "spell-kind/spells-launcher.h"
4 #include "spell/spell-types.h"
5 #include "status/bad-status-setter.h"
6 #include "status/buff-setter.h"
7 #include "status/element-resistance.h"
8 #include "status/temporary-resistance.h"
9 #include "sv-definition/sv-ring-types.h"
10 #include "system/object-type-definition.h"
11 #include "target/target-getter.h"
12 #include "view/display-messages.h"
13
14 bool activate_resistance_elements(player_type *user_ptr)
15 {
16     msg_print(_("\97l\81X\82È\90F\82É\8bP\82¢\82Ä\82¢\82é...", "It glows many colours..."));
17     (void)set_oppose_acid(user_ptr, randint1(40) + 40, FALSE);
18     (void)set_oppose_elec(user_ptr, randint1(40) + 40, FALSE);
19     (void)set_oppose_fire(user_ptr, randint1(40) + 40, FALSE);
20     (void)set_oppose_cold(user_ptr, randint1(40) + 40, FALSE);
21     (void)set_oppose_pois(user_ptr, randint1(40) + 40, FALSE);
22     return TRUE;
23 }
24
25 /*!
26  * @brief \83A\83V\83b\83h\81E\83{\81[\83\8b\82ð\95ú\82¿\81A\8dX\82É\8e_\91Ï\90«\82ð\93¾\82é
27  * @param user_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
28  * @param o_ptr \94­\93®\91Î\8fÛ\83A\83C\83e\83\80\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
29  * @param name \83A\83C\83e\83\80\96¼
30  * @return \83{\81[\83\8b\82ð\93\96\82Ä\82ç\82ê\82é\82È\82ç\82ÎTRUE
31  */
32 bool activate_resistance_acid(player_type *user_ptr, object_type *o_ptr, concptr name)
33 {
34     msg_format(_("%s\82ª\8d\95\82­\8bP\82¢\82½...", "The %s grows black."), name);
35     if ((o_ptr->tval != TV_RING) || (o_ptr->sval != SV_RING_ACID))
36         return TRUE;
37
38     DIRECTION dir;
39     if (!get_aim_dir(user_ptr, &dir))
40         return FALSE;
41
42     (void)fire_ball(user_ptr, GF_ACID, dir, 100, 2);
43     (void)set_oppose_acid(user_ptr, randint1(20) + 20, FALSE);
44     return TRUE;
45 }
46
47 /*!
48  * @brief \83T\83\93\83_\81[\81E\83{\81[\83\8b\82ð\95ú\82¿\81A\8dX\82É\93d\8c\82\91Ï\90«\82ð\93¾\82é
49  * @param user_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
50  * @param o_ptr \94­\93®\91Î\8fÛ\83A\83C\83e\83\80\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
51  * @param name \83A\83C\83e\83\80\96¼
52  * @return \83{\81[\83\8b\82ð\93\96\82Ä\82ç\82ê\82é\82È\82ç\82ÎTRUE
53  */
54 bool activate_resistance_elec(player_type *user_ptr, object_type *o_ptr, concptr name)
55 {
56     msg_format(_("%s\82ª\90Â\82­\8bP\82¢\82½...", "The %s grows blue."), name);
57     if ((o_ptr->tval != TV_RING) || (o_ptr->sval != SV_RING_ELEC))
58         return TRUE;
59
60     DIRECTION dir;
61     if (!get_aim_dir(user_ptr, &dir))
62         return FALSE;
63
64     (void)fire_ball(user_ptr, GF_ELEC, dir, 100, 2);
65     (void)set_oppose_elec(user_ptr, randint1(20) + 20, FALSE);
66     return TRUE;
67 }
68
69 /*!
70  * @brief \83t\83@\83C\83A\81E\83{\81[\83\8b\82ð\95ú\82¿\81A\8dX\82É\89Î\89\8a\91Ï\90«\82ð\93¾\82é
71  * @param user_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
72  * @param o_ptr \94­\93®\91Î\8fÛ\83A\83C\83e\83\80\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
73  * @param name \83A\83C\83e\83\80\96¼
74  * @return \83{\81[\83\8b\82ð\93\96\82Ä\82ç\82ê\82é\82È\82ç\82ÎTRUE
75  */
76 bool activate_resistance_fire(player_type *user_ptr, object_type *o_ptr, concptr name)
77 {
78     msg_format(_("%s\82ª\90Ô\82­\8bP\82¢\82½...", "The %s grows red."), name);
79     if ((o_ptr->tval != TV_RING) || (o_ptr->sval != SV_RING_FLAMES))
80         return TRUE;
81
82     DIRECTION dir;
83     if (!get_aim_dir(user_ptr, &dir))
84         return FALSE;
85
86     (void)fire_ball(user_ptr, GF_FIRE, dir, 100, 2);
87     (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
88     return TRUE;
89 }
90
91 /*!
92  * @brief \83A\83C\83X\81E\83{\81[\83\8b\82ð\95ú\82¿\81A\8dX\82É\97â\8bC\91Ï\90«\82ð\93¾\82é
93  * @param user_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
94  * @param o_ptr \94­\93®\91Î\8fÛ\83A\83C\83e\83\80\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
95  * @param name \83A\83C\83e\83\80\96¼
96  * @return \83{\81[\83\8b\82ð\93\96\82Ä\82ç\82ê\82é\82È\82ç\82ÎTRUE
97  */
98 bool activate_resistance_cold(player_type *user_ptr, object_type *o_ptr, concptr name)
99 {
100     msg_format(_("%s\82ª\94\92\82­\8bP\82¢\82½...", "The %s grows white."), name);
101     if ((o_ptr->tval != TV_RING) || (o_ptr->sval != SV_RING_ICE))
102         return TRUE;
103
104     DIRECTION dir;
105     if (!get_aim_dir(user_ptr, &dir))
106         return FALSE;
107
108     (void)fire_ball(user_ptr, GF_COLD, dir, 100, 2);
109     (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
110     return TRUE;
111 }
112
113 /*!
114  * todo \89½\82©\92Ç\89Á\8cø\89Ê\82ª\97~\82µ\82¢
115  * @brief \93Å\91Ï\90«\82ð\93¾\82é
116  * @param user_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
117  * @param name \83A\83C\83e\83\80\96¼
118  * @return \8fí\82ÉTRUE
119  */
120 bool activate_resistance_pois(player_type *user_ptr, concptr name)
121 {
122     msg_format(_("%s\82ª\97Î\82É\8bP\82¢\82½...", "The %s grows green."), name);
123     (void)set_oppose_pois(user_ptr, randint1(20) + 20, FALSE);
124     return TRUE;
125 }
126
127 bool activate_ultimate_resistance(player_type *user_ptr)
128 {
129     TIME_EFFECT v = randint1(25) + 25;
130     (void)set_afraid(user_ptr, 0);
131     (void)set_hero(user_ptr, v, FALSE);
132     (void)hp_player(user_ptr, 10);
133     (void)set_blessed(user_ptr, v, FALSE);
134     (void)set_oppose_acid(user_ptr, v, FALSE);
135     (void)set_oppose_elec(user_ptr, v, FALSE);
136     (void)set_oppose_fire(user_ptr, v, FALSE);
137     (void)set_oppose_cold(user_ptr, v, FALSE);
138     (void)set_oppose_pois(user_ptr, v, FALSE);
139     (void)set_ultimate_res(user_ptr, v, FALSE);
140     return TRUE;
141 }