• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisione38008b01f92a07e3b70724590c7dd49f02b7f22 (tree)
Time2019-02-25 22:31:30
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 某露出狂のアレを cosmic_cast_off() に分離。 / Separate cosmic_cast_off().

Change Summary

Incremental Difference

--- a/src/cmd-activate.c
+++ b/src/cmd-activate.c
@@ -1710,53 +1710,9 @@ bool activate_artifact(object_type *o_ptr)
17101710 break;
17111711 }
17121712
1713-
1714- /* Unique activation */
17151713 case ACT_CAST_OFF:
1716- {
1717- INVENTORY_IDX inv;
1718- int t;
1719- OBJECT_IDX o_idx;
1720- GAME_TEXT o_name[MAX_NLEN];
1721- object_type forge;
1722-
1723- /* Cast off activated item */
1724- for (inv = INVEN_RARM; inv <= INVEN_FEET; inv++)
1725- {
1726- if (o_ptr == &inventory[inv]) break;
1727- }
1728-
1729- /* Paranoia */
1730- if (inv > INVEN_FEET) return FALSE;
1731-
1732- object_copy(&forge, o_ptr);
1733- inven_item_increase(inv, (0 - o_ptr->number));
1734- inven_item_optimize(inv);
1735- o_idx = drop_near(&forge, 0, p_ptr->y, p_ptr->x);
1736- o_ptr = &o_list[o_idx];
1737-
1738- object_desc(o_name, o_ptr, OD_NAME_ONLY);
1739- msg_format(_("%sを脱ぎ捨てた。", "You cast off %s."), o_name);
1740-
1741- /* Get effects */
1742- msg_print(_("「燃え上がれ俺の小宇宙!」", "You say, 'Burn up my cosmo!"));
1743- t = 20 + randint1(20);
1744- (void)set_blind(p_ptr->blind + t);
1745- (void)set_afraid(0);
1746- (void)set_tim_esp(p_ptr->tim_esp + t, FALSE);
1747- (void)set_tim_regen(p_ptr->tim_regen + t, FALSE);
1748- (void)set_hero(p_ptr->hero + t, FALSE);
1749- (void)set_blessed(p_ptr->blessed + t, FALSE);
1750- (void)set_fast(p_ptr->fast + t, FALSE);
1751- (void)set_shero(p_ptr->shero + t, FALSE);
1752- if (p_ptr->pclass == CLASS_FORCETRAINER)
1753- {
1754- P_PTR_KI = plev * 5 + 190;
1755- msg_print(_("気が爆発寸前になった。", "Your force are immediatly before explosion."));
1756- }
1757-
1714+ cosmic_cast_off(p_ptr, o_ptr);
17581715 break;
1759- }
17601716
17611717 case ACT_FALLING_STAR:
17621718 {
--- a/src/spells-status.c
+++ b/src/spells-status.c
@@ -417,3 +417,50 @@ bool fishing(player_type *creature_ptr)
417417 creature_ptr->redraw |= (PR_STATE);
418418 return TRUE;
419419 }
420+
421+
422+bool cosmic_cast_off(player_type *creature_ptr, object_type *o_ptr)
423+{
424+ INVENTORY_IDX inv;
425+ int t;
426+ OBJECT_IDX o_idx;
427+ GAME_TEXT o_name[MAX_NLEN];
428+ object_type forge;
429+
430+ /* Cast off activated item */
431+ for (inv = INVEN_RARM; inv <= INVEN_FEET; inv++)
432+ {
433+ if (o_ptr == &inventory[inv]) break;
434+ }
435+
436+ /* Paranoia */
437+ if (inv > INVEN_FEET) return FALSE;
438+
439+ object_copy(&forge, o_ptr);
440+ inven_item_increase(inv, (0 - o_ptr->number));
441+ inven_item_optimize(inv);
442+ o_idx = drop_near(&forge, 0, creature_ptr->y, creature_ptr->x);
443+ o_ptr = &o_list[o_idx];
444+
445+ object_desc(o_name, o_ptr, OD_NAME_ONLY);
446+ msg_format(_("%sを脱ぎ捨てた。", "You cast off %s."), o_name);
447+
448+ /* Get effects */
449+ msg_print(_("「燃え上がれ俺の小宇宙!」", "You say, 'Burn up my cosmo!"));
450+ t = 20 + randint1(20);
451+ (void)set_blind(creature_ptr->blind + t);
452+ (void)set_afraid(0);
453+ (void)set_tim_esp(creature_ptr->tim_esp + t, FALSE);
454+ (void)set_tim_regen(creature_ptr->tim_regen + t, FALSE);
455+ (void)set_hero(creature_ptr->hero + t, FALSE);
456+ (void)set_blessed(creature_ptr->blessed + t, FALSE);
457+ (void)set_fast(creature_ptr->fast + t, FALSE);
458+ (void)set_shero(creature_ptr->shero + t, FALSE);
459+ if (creature_ptr->pclass == CLASS_FORCETRAINER)
460+ {
461+ P_PTR_KI = creature_ptr->lev * 5 + 190;
462+ msg_print(_("気が爆発寸前になった。", "Your force are immediatly before explosion."));
463+ }
464+
465+ return TRUE;
466+}
--- a/src/spells-status.h
+++ b/src/spells-status.h
@@ -24,4 +24,5 @@ extern bool_hack restore_mana(bool_hack magic_eater);
2424 extern bool restore_all_status(void);
2525
2626 extern bool fishing(player_type *creature_ptr);
27+extern bool cosmic_cast_off(player_type *creature_ptr, object_type *o_ptr);
2728
Show on old repository browser