more = true;
} else {
msg_print(_("体のバランスをくずしてしまった。", "You are off-balance."));
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + 2 + randint0(2));
+ (void)BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + 2 + randint0(2));
}
return more;
player_ptr->csp = MAX(0, player_ptr->csp - cm_ptr->mana_cost);
msg_format(_("%sを集中しすぎて気を失ってしまった!", "You faint from the effort!"), cm_ptr->mind_explanation);
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + randint1(5 * oops + 1));
+ (void)BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + randint1(5 * oops + 1));
if (randint0(100) >= 50)
return;
/* Over-exert the player */
if (over_exerted) {
int oops = need_mana;
-
- /* No mana left */
player_ptr->csp = 0;
player_ptr->csp_frac = 0;
-
msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
-
- /* Hack -- Bypass free action */
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + randint1(5 * oops + 1));
-
+ (void)BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + randint1(5 * oops + 1));
switch (realm) {
case REALM_LIFE:
chg_virtue(player_ptr, V_VITALITY, -10);
case SV_FOOD_HALLUCINATION:
return !has_resist_chaos(player_ptr) && set_image(player_ptr, player_ptr->image + randint0(250) + 250);
case SV_FOOD_PARALYSIS:
- return !player_ptr->free_act && set_paralyzed(player_ptr, player_ptr->paralyzed + randint0(10) + 10);
+ return !player_ptr->free_act && bss.paralysis(player_ptr->paralyzed + randint0(10) + 10);
case SV_FOOD_WEAKNESS:
take_hit(player_ptr, DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"));
(void)do_dec_stat(player_ptr, A_STR);
}
if (player_ptr->paralyzed) {
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed - dec_count);
+ (void)bss.paralysis(player_ptr->paralyzed - dec_count);
}
if (player_ptr->confused) {
return;
default:
if (!player_ptr->free_act) {
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + randint1(em_ptr->dam));
+ (void)bss.paralysis(player_ptr->paralyzed + randint1(em_ptr->dam));
}
return;
sanity_blast(player_ptr, nullptr, false);
}
- set_paralyzed(player_ptr, player_ptr->paralyzed + ep_ptr->dam);
+ (void)BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + ep_ptr->dam);
ep_ptr->dam = 0;
}
}
if (!player_ptr->free_act) {
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + randint0(4) + 4);
+ (void)bss.paralysis(player_ptr->paralyzed + randint0(4) + 4);
}
(void)set_slow(player_ptr, player_ptr->slow + randint0(4) + 4, false);
case TRAP_SLEEP: {
msg_print(_("奇妙な白い霧に包まれた!", "A strange white mist surrounds you!"));
- if (!player_ptr->free_act) {
- msg_print(_("あなたは眠りに就いた。", "You fall asleep."));
-
- if (ironman_nightmare) {
- msg_print(_("身の毛もよだつ光景が頭に浮かんだ。", "A horrible vision enters your mind."));
+ if (player_ptr->free_act) {
+ break;
+ }
- /* Have some nightmares */
- sanity_blast(player_ptr, nullptr, false);
- }
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + randint0(10) + 5);
+ msg_print(_("あなたは眠りに就いた。", "You fall asleep."));
+ if (ironman_nightmare) {
+ msg_print(_("身の毛もよだつ光景が頭に浮かんだ。", "A horrible vision enters your mind."));
+ sanity_blast(player_ptr, nullptr, false);
}
+
+ (void)BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + randint0(10) + 5);
break;
}
player_ptr->csp = 0;
player_ptr->csp_frac = 0;
msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + randint1(5 * oops + 1));
+ (void)BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + randint1(5 * oops + 1));
chg_virtue(player_ptr, V_KNOWLEDGE, -10);
if (randint0(100) < 50) {
bool perm = (randint0(100) < 25);
player_ptr->csp = 0;
player_ptr->csp_frac = 0;
msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + randint1(5 * oops + 1));
+ (void)BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + randint1(5 * oops + 1));
chg_virtue(player_ptr, V_KNOWLEDGE, -10);
if (randint0(100) < 50) {
bool perm = (randint0(100) < 25);
return;
}
- if (!player_ptr->paralyzed && set_paralyzed(player_ptr, 3 + randint1(monap_ptr->rlev))) {
+ if (!player_ptr->paralyzed && BadStatusSetter(player_ptr).paralysis(3 + randint1(monap_ptr->rlev))) {
monap_ptr->obvious = true;
}
}
_("しかし効力を跳ね返した!", "You resist the effects!"), (bool)resist, saving_throw, TARGET_TYPE);
if (!resist && !saving_throw) {
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + randint0(4) + 4);
+ (void)BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + randint0(4) + 4);
}
update_smart_learn(player_ptr, m_idx, DRS_FREE);
case SV_POTION_SALT_WATER: {
msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!"));
-
switch (player_race_food(player_ptr)) {
case PlayerRaceFood::RATION:
case PlayerRaceFood::WATER:
BadStatusSetter bss(player_ptr);
(void)bss.poison(0);
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + 4);
+ (void)bss.paralysis(player_ptr->paralyzed + 4);
ident = true;
break;
}
break;
case SV_POTION_SLEEP:
- if (!player_ptr->free_act) {
- msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
+ if (player_ptr->free_act) {
+ break;
+ }
- if (ironman_nightmare) {
- msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
+ msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
+ if (ironman_nightmare) {
+ msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
+ sanity_blast(player_ptr, nullptr, false);
+ }
- /* Have some nightmares */
- sanity_blast(player_ptr, nullptr, false);
- }
- if (set_paralyzed(player_ptr, player_ptr->paralyzed + randint0(4) + 4)) {
- ident = true;
- }
+ if (BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + randint0(4) + 4)) {
+ ident = true;
}
- break;
+ break;
case SV_POTION_LOSE_MEMORIES:
if (!player_ptr->hold_exp && (player_ptr->exp > 0)) {
msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
if (!player_ptr->paralyzed && (randint0(100) < 10)) {
msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
disturb(player_ptr, true, true);
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + 1 + randint0(5));
+ (void)BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + 1 + randint0(5));
}
if (player_ptr->food < PY_FOOD_STARVE) {
(void)bss.confusion(player_ptr->confused + randint0(4) + 4);
}
if (!player_ptr->free_act) {
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + randint0(4) + 4);
+ (void)bss.paralysis(player_ptr->paralyzed + randint0(4) + 4);
}
if (!has_resist_chaos(player_ptr)) {
(void)set_image(player_ptr, player_ptr->image + randint0(250) + 150);
if (trap & (CHEST_PARALYZE)) {
msg_print(_("突如吹き出した黄色いガスに包み込まれた!", "A puff of yellow gas surrounds you!"));
if (!player_ptr->free_act) {
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + 10 + randint1(20));
+ (void)BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + 10 + randint1(20));
}
}
(void)set_cut(player_ptr, player_ptr->cut + 200);
else if (one_in_(4)) {
auto effects = player_ptr->effects(); // @todo paralyzed と共通化の予定あり.
+ BadStatusSetter bss(player_ptr);
if (!player_ptr->free_act) {
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + 2 + randint0(6));
+ (void)bss.paralysis(player_ptr->paralyzed + 2 + randint0(6));
} else {
(void)set_stun(player_ptr, effects->stun()->current() + 10 + randint0(100));
}
case 15:
case 19:
case 20: {
- bool is_statue = stop_ty;
+ auto is_statue = stop_ty;
is_statue |= player_ptr->free_act && (randint1(125) < player_ptr->skill_sav);
is_statue |= player_ptr->pclass == CLASS_BERSERKER;
if (!is_statue) {
msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
- if (player_ptr->free_act)
- set_paralyzed(player_ptr, player_ptr->paralyzed + randint1(3));
- else
- set_paralyzed(player_ptr, player_ptr->paralyzed + randint1(13));
+ auto turns = player_ptr->free_act ? randint1(3) : randint1(13);
+ (void)BadStatusSetter(player_ptr).paralysis(player_ptr->paralyzed + turns);
stop_ty = true;
}
- if (!one_in_(6))
+ if (!one_in_(6)) {
break;
+ }
}
/* Fall through */
case 21:
BadStatusSetter bss(player_ptr);
if (player_ptr->msp > 0) {
- if (20 <= player_ptr->csp)
+ if (20 <= player_ptr->csp) {
player_ptr->csp -= 20;
- else {
- int oops = 20 - player_ptr->csp;
-
+ } else {
+ auto oops = 20 - player_ptr->csp;
player_ptr->csp = 0;
player_ptr->csp_frac = 0;
-
msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
-
- (void)set_paralyzed(player_ptr, player_ptr->paralyzed + randint1(5 * oops + 1));
+ (void)bss.paralysis(player_ptr->paralyzed + randint1(5 * oops + 1));
(void)bss.confusion(player_ptr->confused + randint1(5 * oops + 1));
}
(void)set_image(player_ptr, 0);
(void)set_stun(player_ptr, 0);
(void)set_cut(player_ptr, 0);
- (void)set_paralyzed(player_ptr, 0);
+ (void)bss.paralysis(0);
(void)restore_all_status(player_ptr);
(void)set_shero(player_ptr, 0, true);
handle_stuff(player_ptr);
* @param v 継続時間
* @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
*/
-bool set_paralyzed(player_type *player_ptr, TIME_EFFECT v)
+bool BadStatusSetter::paralysis(TIME_EFFECT v)
{
- bool notice = false;
+ auto notice = false;
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
- if (player_ptr->is_dead)
+ if (this->player_ptr->is_dead) {
return false;
+ }
if (v) {
- if (!player_ptr->paralyzed) {
+ if (!this->player_ptr->paralyzed) {
msg_print(_("体が麻痺してしまった!", "You are paralyzed!"));
- if (player_ptr->concent)
- reset_concentration(player_ptr, true);
+ if (this->player_ptr->concent) {
+ reset_concentration(this->player_ptr, true);
+ }
- SpellHex spell_hex(player_ptr);
+ SpellHex spell_hex(this->player_ptr);
if (spell_hex.is_spelling_any()) {
(void)spell_hex.stop_all_spells();
}
- player_ptr->counter = false;
+ this->player_ptr->counter = false;
notice = true;
}
} else {
- if (player_ptr->paralyzed) {
+ if (this->player_ptr->paralyzed) {
msg_print(_("やっと動けるようになった。", "You can move again."));
notice = true;
}
}
- player_ptr->paralyzed = v;
- player_ptr->redraw |= (PR_STATUS);
-
- if (!notice)
+ this->player_ptr->paralyzed = v;
+ this->player_ptr->redraw |= PR_STATUS;
+ if (!notice) {
return false;
+ }
- if (disturb_state)
- disturb(player_ptr, false, false);
- player_ptr->redraw |= (PR_STATE);
- handle_stuff(player_ptr);
+ if (disturb_state) {
+ disturb(this->player_ptr, false, false);
+ }
+
+ this->player_ptr->redraw |= PR_STATE;
+ handle_stuff(this->player_ptr);
return true;
}
bool confusion(TIME_EFFECT v);
bool poison(TIME_EFFECT v);
bool afraidness(TIME_EFFECT v);
+ bool paralysis(TIME_EFFECT v);
private:
player_type *player_ptr;
};
-bool set_paralyzed(player_type *player_ptr, TIME_EFFECT v);
bool set_image(player_type *player_ptr, TIME_EFFECT v);
bool set_slow(player_type *player_ptr, TIME_EFFECT v, bool do_dec);
bool set_stun(player_type *player_ptr, TIME_EFFECT v);