• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisiondbc702b6334b6b6a260bdff6385935f44650a131 (tree)
Time2019-02-25 00:12:53
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 知識の石の処理を perilous_secrets() に分離。 / Separate Stone of Lore to perilous_secrets().

Change Summary

Incremental Difference

--- a/src/cmd-activate.c
+++ b/src/cmd-activate.c
@@ -1738,45 +1738,9 @@ bool activate_artifact(object_type *o_ptr)
17381738 }
17391739
17401740 case ACT_LORE:
1741- {
17421741 msg_print(_("石が隠された秘密を写し出した...", "The stone reveals hidden mysteries..."));
1743- if (!ident_spell(FALSE)) return FALSE;
1744-
1745- if (mp_ptr->spell_book)
1746- {
1747- /* Sufficient mana */
1748- if (20 <= p_ptr->csp)
1749- {
1750- /* Use some mana */
1751- p_ptr->csp -= 20;
1752- }
1753-
1754- /* Over-exert the player */
1755- else
1756- {
1757- int oops = 20 - p_ptr->csp;
1758-
1759- /* No mana left */
1760- p_ptr->csp = 0;
1761- p_ptr->csp_frac = 0;
1762-
1763- msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
1764- /* Hack -- Bypass free action */
1765- (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
1766-
1767- /* Confusing. */
1768- (void)set_confused(p_ptr->confused + randint1(5 * oops + 1));
1769- }
1770- p_ptr->redraw |= (PR_MANA);
1771- }
1772- take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
1773- /* Confusing. */
1774- if (one_in_(5)) (void)set_confused(p_ptr->confused + randint1(10));
1775-
1776- /* Exercise a little care... */
1777- if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
1742+ if(!perilous_secrets(p_ptr)) return FALSE;
17781743 break;
1779- }
17801744
17811745 case ACT_SHIKOFUMI:
17821746 {
--- a/src/spells-object.c
+++ b/src/spells-object.c
@@ -796,3 +796,44 @@ bool brand_bolts(void)
796796 return (TRUE);
797797 }
798798
799+
800+bool perilous_secrets(player_type *creature_ptr)
801+{
802+ if (!ident_spell(FALSE)) return FALSE;
803+
804+ if (mp_ptr->spell_book)
805+ {
806+ /* Sufficient mana */
807+ if (20 <= p_ptr->csp)
808+ {
809+ /* Use some mana */
810+ p_ptr->csp -= 20;
811+ }
812+
813+ /* Over-exert the player */
814+ else
815+ {
816+ int oops = 20 - p_ptr->csp;
817+
818+ /* No mana left */
819+ p_ptr->csp = 0;
820+ p_ptr->csp_frac = 0;
821+
822+ msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
823+ /* Hack -- Bypass free action */
824+ (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
825+
826+ /* Confusing. */
827+ (void)set_confused(p_ptr->confused + randint1(5 * oops + 1));
828+ }
829+ p_ptr->redraw |= (PR_MANA);
830+ }
831+ take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
832+ /* Confusing. */
833+ if (one_in_(5)) (void)set_confused(p_ptr->confused + randint1(10));
834+
835+ /* Exercise a little care... */
836+ if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
837+ return TRUE;
838+
839+}
\ No newline at end of file
--- a/src/spells-object.h
+++ b/src/spells-object.h
@@ -10,3 +10,4 @@ extern bool curse_weapon_object(bool force, object_type *o_ptr);
1010 extern bool curse_weapon(bool force, int slot);
1111 extern bool rustproof(void);
1212 extern bool brand_bolts(void);
13+extern bool perilous_secrets(player_type *creature_ptr);
Show on old repository browser