• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision85f4a06e9a352b26ddc074a0a59bab7c14d5e6bc (tree)
Time2019-02-05 00:08:07
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

[Refactor] #37353 回復処理関数を spells-status.c に移動。 / Move some healing functions to spells-status.c.

Change Summary

Incremental Difference

--- a/src/bldg.c
+++ b/src/bldg.c
@@ -27,6 +27,7 @@
2727 #include "cmd-spell.h"
2828 #include "rumor.h"
2929 #include "player-status.h"
30+#include "spells-status.h"
3031
3132 /*!
3233 * ループ中で / hack as in leave_store in store.c
--- a/src/cmd-usestaff.c
+++ b/src/cmd-usestaff.c
@@ -3,6 +3,7 @@
33 #include "spells-summon.h"
44 #include "avatar.h"
55 #include "player-status.h"
6+#include "spells-status.h"
67
78
89
--- a/src/externs.h
+++ b/src/externs.h
@@ -973,15 +973,6 @@ extern bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad);
973973 extern void cast_wonder(DIRECTION dir);
974974 extern void cast_invoke_spirits(DIRECTION dir);
975975 extern void cast_shuffle(void);
976-extern bool_hack life_stream(bool_hack message, bool_hack virtue_change);
977-extern bool_hack heroism(int base);
978-extern bool_hack berserk(int base);
979-extern bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides);
980-extern bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides);
981-extern bool_hack cure_critical_wounds(HIT_POINT pow);
982-extern bool_hack true_healing(HIT_POINT pow);
983-extern bool_hack restore_mana(bool_hack magic_eater);
984-extern bool restore_all_status(void);
985976 extern void stop_mouth(void);
986977 extern bool_hack vampirism(void);
987978 extern bool panic_hit(void);
--- a/src/mutation.c
+++ b/src/mutation.c
@@ -18,6 +18,7 @@
1818 #include "spells-summon.h"
1919 #include "avatar.h"
2020 #include "player-status.h"
21+#include "spells-status.h"
2122
2223 /*!
2324 * @brief プレイヤーに突然変異を与える
--- a/src/patron.c
+++ b/src/patron.c
@@ -11,6 +11,7 @@
1111
1212 #include "spells-summon.h"
1313 #include "spells-object.h"
14+#include "spells-status.h"
1415
1516 #ifdef JP
1617 /*!
--- a/src/player-status.c
+++ b/src/player-status.c
@@ -3,6 +3,7 @@
33
44 #include "artifact.h"
55 #include "avatar.h"
6+#include "spells-status.h"
67
78 /*
89 * Return alignment title
--- a/src/realm-arcane.c
+++ b/src/realm-arcane.c
@@ -1,6 +1,7 @@
11 #include "angband.h"
22 #include "cmd-spell.h"
33 #include "spells-summon.h"
4+#include "spells-status.h"
45 #include "projection.h"
56 #include "avatar.h"
67
--- a/src/realm-craft.c
+++ b/src/realm-craft.c
@@ -3,6 +3,7 @@
33 #include "selfinfo.h"
44 #include "projection.h"
55 #include "spells-summon.h"
6+#include "spells-status.h"
67 #include "mutation.h"
78
89
--- a/src/realm-hex.c
+++ b/src/realm-hex.c
@@ -21,6 +21,7 @@
2121 #include "object-hook.h"
2222 #include "object-curse.h"
2323 #include "projection.h"
24+#include "spells-status.h"
2425
2526 #define MAX_KEEP 4 /*!<呪術の最大詠唱数 */
2627
--- a/src/realm-life.c
+++ b/src/realm-life.c
@@ -1,6 +1,7 @@
11 #include "angband.h"
22 #include "cmd-spell.h"
33 #include "projection.h"
4+#include "spells-status.h"
45
56 /*!
67 * @brief 生命領域魔法の各処理を行う
--- a/src/realm-nature.c
+++ b/src/realm-nature.c
@@ -2,6 +2,7 @@
22 #include "cmd-spell.h"
33 #include "projection.h"
44 #include "spells-summon.h"
5+#include "spells-status.h"
56 #include "avatar.h"
67
78
--- a/src/spells-status.c
+++ b/src/spells-status.c
@@ -250,3 +250,142 @@ void roll_hitdice(SPOP_FLAGS options)
250250 }
251251 }
252252 }
253+
254+bool_hack life_stream(bool_hack message, bool_hack virtue_change)
255+{
256+ if (virtue_change)
257+ {
258+ chg_virtue(V_VITALITY, 1);
259+ chg_virtue(V_UNLIFE, -5);
260+ }
261+ if (message)
262+ {
263+ msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
264+ }
265+ restore_level();
266+ (void)set_poisoned(0);
267+ (void)set_blind(0);
268+ (void)set_confused(0);
269+ (void)set_image(0);
270+ (void)set_stun(0);
271+ (void)set_cut(0);
272+ (void)restore_all_status();
273+ (void)set_shero(0, TRUE);
274+ handle_stuff();
275+ hp_player(5000);
276+
277+ return TRUE;
278+}
279+
280+bool_hack heroism(int base)
281+{
282+ bool_hack ident = FALSE;
283+ if (set_afraid(0)) ident = TRUE;
284+ if (set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
285+ if (hp_player(10)) ident = TRUE;
286+ return ident;
287+}
288+
289+bool_hack berserk(int base)
290+{
291+ bool_hack ident = FALSE;
292+ if (set_afraid(0)) ident = TRUE;
293+ if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
294+ if (hp_player(30)) ident = TRUE;
295+ return ident;
296+}
297+
298+bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
299+{
300+ bool_hack ident = FALSE;
301+ if (hp_player(damroll(dice, sides))) ident = TRUE;
302+ if (set_blind(0)) ident = TRUE;
303+ if (set_cut(p_ptr->cut - 10)) ident = TRUE;
304+ if (set_shero(0, TRUE)) ident = TRUE;
305+ return ident;
306+}
307+
308+bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
309+{
310+ bool_hack ident = FALSE;
311+ if (hp_player(damroll(dice, sides))) ident = TRUE;
312+ if (set_blind(0)) ident = TRUE;
313+ if (set_confused(0)) ident = TRUE;
314+ if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
315+ if (set_shero(0, TRUE)) ident = TRUE;
316+ return ident;
317+}
318+
319+bool_hack cure_critical_wounds(HIT_POINT pow)
320+{
321+ bool_hack ident = FALSE;
322+ if (hp_player(pow)) ident = TRUE;
323+ if (set_blind(0)) ident = TRUE;
324+ if (set_confused(0)) ident = TRUE;
325+ if (set_poisoned(0)) ident = TRUE;
326+ if (set_stun(0)) ident = TRUE;
327+ if (set_cut(0)) ident = TRUE;
328+ if (set_shero(0, TRUE)) ident = TRUE;
329+ return ident;
330+}
331+
332+bool_hack true_healing(HIT_POINT pow)
333+{
334+ bool_hack ident = FALSE;
335+ if (hp_player(pow)) ident = TRUE;
336+ if (set_blind(0)) ident = TRUE;
337+ if (set_confused(0)) ident = TRUE;
338+ if (set_poisoned(0)) ident = TRUE;
339+ if (set_stun(0)) ident = TRUE;
340+ if (set_cut(0)) ident = TRUE;
341+ if (set_image(0)) ident = TRUE;
342+ return ident;
343+}
344+
345+bool_hack restore_mana(bool_hack magic_eater)
346+{
347+ bool_hack ident = FALSE;
348+
349+ if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
350+ {
351+ int i;
352+ for (i = 0; i < EATER_EXT * 2; i++)
353+ {
354+ p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
355+ if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i] * EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i] * EATER_CHARGE;
356+ }
357+ for (; i < EATER_EXT * 3; i++)
358+ {
359+ KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
360+ p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_ROD_CHARGE / 3)*k_info[k_idx].pval;
361+ if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
362+ }
363+ msg_print(_("頭がハッキリとした。", "You feel your head clear."));
364+ p_ptr->window |= (PW_PLAYER);
365+ ident = TRUE;
366+ }
367+ else if (p_ptr->csp < p_ptr->msp)
368+ {
369+ p_ptr->csp = p_ptr->msp;
370+ p_ptr->csp_frac = 0;
371+ msg_print(_("頭がハッキリとした。", "You feel your head clear."));
372+ p_ptr->redraw |= (PR_MANA);
373+ p_ptr->window |= (PW_PLAYER);
374+ p_ptr->window |= (PW_SPELL);
375+ ident = TRUE;
376+ }
377+
378+ return ident;
379+}
380+
381+bool restore_all_status(void)
382+{
383+ bool ident = FALSE;
384+ if (do_res_stat(A_STR)) ident = TRUE;
385+ if (do_res_stat(A_INT)) ident = TRUE;
386+ if (do_res_stat(A_WIS)) ident = TRUE;
387+ if (do_res_stat(A_DEX)) ident = TRUE;
388+ if (do_res_stat(A_CON)) ident = TRUE;
389+ if (do_res_stat(A_CHR)) ident = TRUE;
390+ return ident;
391+}
--- a/src/spells-status.h
+++ b/src/spells-status.h
@@ -13,4 +13,13 @@ extern bool clone_monster(DIRECTION dir);
1313 extern void stop_singing(void);
1414 extern bool time_walk(player_type *creature_ptr);
1515 extern void roll_hitdice(SPOP_FLAGS options);
16+extern bool_hack life_stream(bool_hack message, bool_hack virtue_change);
17+extern bool_hack heroism(int base);
18+extern bool_hack berserk(int base);
19+extern bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides);
20+extern bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides);
21+extern bool_hack cure_critical_wounds(HIT_POINT pow);
22+extern bool_hack true_healing(HIT_POINT pow);
23+extern bool_hack restore_mana(bool_hack magic_eater);
24+extern bool restore_all_status(void);
1625
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -4645,145 +4645,6 @@ void cast_shuffle(void)
46454645 }
46464646 }
46474647
4648-bool_hack life_stream(bool_hack message, bool_hack virtue_change)
4649-{
4650- if(virtue_change)
4651- {
4652- chg_virtue(V_VITALITY, 1);
4653- chg_virtue(V_UNLIFE, -5);
4654- }
4655- if(message)
4656- {
4657- msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4658- }
4659- restore_level();
4660- (void)set_poisoned(0);
4661- (void)set_blind(0);
4662- (void)set_confused(0);
4663- (void)set_image(0);
4664- (void)set_stun(0);
4665- (void)set_cut(0);
4666- (void)restore_all_status();
4667- (void)set_shero(0, TRUE);
4668- handle_stuff();
4669- hp_player(5000);
4670-
4671- return TRUE;
4672-}
4673-
4674-bool_hack heroism(int base)
4675-{
4676- bool_hack ident = FALSE;
4677- if(set_afraid(0)) ident = TRUE;
4678- if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4679- if(hp_player(10)) ident = TRUE;
4680- return ident;
4681-}
4682-
4683-bool_hack berserk(int base)
4684-{
4685- bool_hack ident = FALSE;
4686- if (set_afraid(0)) ident = TRUE;
4687- if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4688- if (hp_player(30)) ident = TRUE;
4689- return ident;
4690-}
4691-
4692-bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
4693-{
4694- bool_hack ident = FALSE;
4695- if (hp_player(damroll(dice, sides))) ident = TRUE;
4696- if (set_blind(0)) ident = TRUE;
4697- if (set_cut(p_ptr->cut - 10)) ident = TRUE;
4698- if (set_shero(0, TRUE)) ident = TRUE;
4699- return ident;
4700-}
4701-
4702-bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
4703-{
4704- bool_hack ident = FALSE;
4705- if (hp_player(damroll(dice, sides))) ident = TRUE;
4706- if (set_blind(0)) ident = TRUE;
4707- if (set_confused(0)) ident = TRUE;
4708- if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
4709- if (set_shero(0, TRUE)) ident = TRUE;
4710- return ident;
4711-}
4712-
4713-bool_hack cure_critical_wounds(HIT_POINT pow)
4714-{
4715- bool_hack ident = FALSE;
4716- if (hp_player(pow)) ident = TRUE;
4717- if (set_blind(0)) ident = TRUE;
4718- if (set_confused(0)) ident = TRUE;
4719- if (set_poisoned(0)) ident = TRUE;
4720- if (set_stun(0)) ident = TRUE;
4721- if (set_cut(0)) ident = TRUE;
4722- if (set_shero(0, TRUE)) ident = TRUE;
4723- return ident;
4724-}
4725-
4726-bool_hack true_healing(HIT_POINT pow)
4727-{
4728- bool_hack ident = FALSE;
4729- if (hp_player(pow)) ident = TRUE;
4730- if (set_blind(0)) ident = TRUE;
4731- if (set_confused(0)) ident = TRUE;
4732- if (set_poisoned(0)) ident = TRUE;
4733- if (set_stun(0)) ident = TRUE;
4734- if (set_cut(0)) ident = TRUE;
4735- if (set_image(0)) ident = TRUE;
4736- return ident;
4737-}
4738-
4739-bool_hack restore_mana(bool_hack magic_eater)
4740-{
4741- bool_hack ident = FALSE;
4742-
4743- if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
4744- {
4745- int i;
4746- for (i = 0; i < EATER_EXT * 2; i++)
4747- {
4748- p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
4749- if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i] * EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i] * EATER_CHARGE;
4750- }
4751- for (; i < EATER_EXT * 3; i++)
4752- {
4753- KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
4754- p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_ROD_CHARGE / 3)*k_info[k_idx].pval;
4755- if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
4756- }
4757- msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4758- p_ptr->window |= (PW_PLAYER);
4759- ident = TRUE;
4760- }
4761- else if (p_ptr->csp < p_ptr->msp)
4762- {
4763- p_ptr->csp = p_ptr->msp;
4764- p_ptr->csp_frac = 0;
4765- msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4766- p_ptr->redraw |= (PR_MANA);
4767- p_ptr->window |= (PW_PLAYER);
4768- p_ptr->window |= (PW_SPELL);
4769- ident = TRUE;
4770- }
4771-
4772- return ident;
4773-}
4774-
4775-bool restore_all_status(void)
4776-{
4777- bool ident = FALSE;
4778- if (do_res_stat(A_STR)) ident = TRUE;
4779- if (do_res_stat(A_INT)) ident = TRUE;
4780- if (do_res_stat(A_WIS)) ident = TRUE;
4781- if (do_res_stat(A_DEX)) ident = TRUE;
4782- if (do_res_stat(A_CON)) ident = TRUE;
4783- if (do_res_stat(A_CHR)) ident = TRUE;
4784- return ident;
4785-}
4786-
47874648 /*!
47884649 * @brief 口を使う継続的な処理を中断する
47894650 * @return なし
Show on old repository browser