• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision3dfe418125308fcc609f09b39ba3452af391e6c9 (tree)
Time2019-02-19 23:49:43
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

[Refactor] #37353 プレイヤーによる血の呪いの様々処理を blood_curse_to_enemy() へ分離。 / Separate various effect of blood curse by player to blood_curse_to_enemy().

Change Summary

Incremental Difference

--- a/src/externs.h
+++ b/src/externs.h
@@ -1041,6 +1041,7 @@ extern bool eat_lock(void);
10411041 extern bool shock_power(void);
10421042 extern bool booze(player_type *creature_ptr);
10431043 extern bool detonation(player_type *creature_ptr);
1044+extern void blood_curse_to_enemy(MONSTER_IDX m_idx);
10441045
10451046
10461047 /* bldg.c */
--- a/src/spells1.c
+++ b/src/spells1.c
@@ -1240,9 +1240,6 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P
12401240 /* Assume a default death */
12411241 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
12421242
1243- POSITION ty = m_ptr->fy;
1244- POSITION tx = m_ptr->fx;
1245-
12461243 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
12471244
12481245 /* Nobody here */
@@ -3944,90 +3941,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P
39443941
39453942 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
39463943 {
3947- int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3948- int count = 0;
3949- do
3950- {
3951- switch (randint1(28))
3952- {
3953- case 1: case 2:
3954- if (!count)
3955- {
3956- msg_print(_("地面が揺れた...", "The ground trembles..."));
3957- earthquake(ty, tx, 4 + randint0(4));
3958- if (!one_in_(6)) break;
3959- }
3960- case 3: case 4: case 5: case 6:
3961- if (!count)
3962- {
3963- int extra_dam = damroll(10, 10);
3964- msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3965-
3966- project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
3967- if (!one_in_(6)) break;
3968- }
3969- case 7: case 8:
3970- if (!count)
3971- {
3972- msg_print(_("空間が歪んだ!", "Space warps about you!"));
3973-
3974- if (m_ptr->r_idx) teleport_away(g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
3975- if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
3976- if (!one_in_(6)) break;
3977- }
3978- case 9: case 10: case 11:
3979- msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3980- project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
3981- if (!one_in_(6)) break;
3982- case 12: case 13: case 14: case 15: case 16:
3983- aggravate_monsters(0);
3984- if (!one_in_(6)) break;
3985- case 17: case 18:
3986- count += activate_hi_summon(ty, tx, TRUE);
3987- if (!one_in_(6)) break;
3988- case 19: case 20: case 21: case 22:
3989- {
3990- bool pet = !one_in_(3);
3991- BIT_FLAGS mode = PM_ALLOW_GROUP;
3992-
3993- if (pet) mode |= PM_FORCE_PET;
3994- else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
3995-
3996- count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode, '\0');
3997- if (!one_in_(6)) break;
3998- }
3999- case 23: case 24: case 25:
4000- if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4001- msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4002-
4003- if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4004- else lose_exp(p_ptr->exp / 16);
4005- if (!one_in_(6)) break;
4006- case 26: case 27: case 28:
4007- {
4008- int i = 0;
4009- if (one_in_(13))
4010- {
4011- while (i < A_MAX)
4012- {
4013- do
4014- {
4015- (void)do_dec_stat(i);
4016- }
4017- while (one_in_(2));
4018-
4019- i++;
4020- }
4021- }
4022- else
4023- {
4024- (void)do_dec_stat(randint0(6));
4025- }
4026- break;
4027- }
4028- }
4029- }
4030- while (one_in_(5));
3944+ blood_curse_to_enemy(who);
40313945 }
40323946
40333947 if (p_ptr->inside_battle)
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -4534,4 +4534,92 @@ bool detonation(player_type *creature_ptr)
45344534 (void)set_stun(creature_ptr->stun + 75);
45354535 (void)set_cut(creature_ptr->cut + 5000);
45364536 return TRUE;
4537+}
4538+
4539+void blood_curse_to_enemy(MONSTER_IDX m_idx)
4540+{
4541+ monster_type *m_ptr = &m_list[m_idx];
4542+ grid_type *g_ptr = &grid_array[m_ptr->fy][m_ptr->fx];
4543+ BIT_FLAGS curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4544+ int count = 0;
4545+ do
4546+ {
4547+ switch (randint1(28))
4548+ {
4549+ case 1: case 2:
4550+ if (!count)
4551+ {
4552+ msg_print(_("地面が揺れた...", "The ground trembles..."));
4553+ earthquake(m_ptr->fy, m_ptr->fx, 4 + randint0(4));
4554+ if (!one_in_(6)) break;
4555+ }
4556+ case 3: case 4: case 5: case 6:
4557+ if (!count)
4558+ {
4559+ int extra_dam = damroll(10, 10);
4560+ msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4561+
4562+ project(0, 8, m_ptr->fy, m_ptr->fx, extra_dam, GF_MANA, curse_flg, -1);
4563+ if (!one_in_(6)) break;
4564+ }
4565+ case 7: case 8:
4566+ if (!count)
4567+ {
4568+ msg_print(_("空間が歪んだ!", "Space warps about you!"));
4569+
4570+ if (m_ptr->r_idx) teleport_away(g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4571+ if (one_in_(13)) count += activate_hi_summon(m_ptr->fy, m_ptr->fx, TRUE);
4572+ if (!one_in_(6)) break;
4573+ }
4574+ case 9: case 10: case 11:
4575+ msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4576+ project(0, 7, m_ptr->fy, m_ptr->fx, 50, GF_DISINTEGRATE, curse_flg, -1);
4577+ if (!one_in_(6)) break;
4578+ case 12: case 13: case 14: case 15: case 16:
4579+ aggravate_monsters(0);
4580+ if (!one_in_(6)) break;
4581+ case 17: case 18:
4582+ count += activate_hi_summon(m_ptr->fy, m_ptr->fx, TRUE);
4583+ if (!one_in_(6)) break;
4584+ case 19: case 20: case 21: case 22:
4585+ {
4586+ bool pet = !one_in_(3);
4587+ BIT_FLAGS mode = PM_ALLOW_GROUP;
4588+
4589+ if (pet) mode |= PM_FORCE_PET;
4590+ else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4591+
4592+ count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level), 0, mode, '\0');
4593+ if (!one_in_(6)) break;
4594+ }
4595+ case 23: case 24: case 25:
4596+ if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4597+ msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4598+
4599+ if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4600+ else lose_exp(p_ptr->exp / 16);
4601+ if (!one_in_(6)) break;
4602+ case 26: case 27: case 28:
4603+ {
4604+ int i = 0;
4605+ if (one_in_(13))
4606+ {
4607+ while (i < A_MAX)
4608+ {
4609+ do
4610+ {
4611+ (void)do_dec_stat(i);
4612+ } while (one_in_(2));
4613+
4614+ i++;
4615+ }
4616+ }
4617+ else
4618+ {
4619+ (void)do_dec_stat(randint0(6));
4620+ }
4621+ break;
4622+ }
4623+ }
4624+ } while (one_in_(5));
45374625 }
\ No newline at end of file
Show on old repository browser