auto effects = player_ptr->effects();
if (snipe_type == SP_FINAL) {
msg_print(_("射撃の反動が体を襲った。", "The weapon's recoil stuns you. "));
- (void)set_slow(player_ptr, player_ptr->slow + randint0(7) + 7, false);
+ BadStatusSetter bss(player_ptr);
+ (void)bss.slowness(player_ptr->slow + randint0(7) + 7, false);
(void)set_stun(player_ptr, effects->stun()->current() + randint1(25));
}
}
break;
case SV_STAFF_SLOWNESS: {
- if (set_slow(player_ptr, player_ptr->slow + randint1(30) + 15, false))
+ if (bss.slowness(player_ptr->slow + randint1(30) + 15, false))
ident = true;
break;
}
}
if (player_ptr->slow) {
- (void)set_slow(player_ptr, player_ptr->slow - dec_count, true);
+ (void)bss.slowness(player_ptr->slow - dec_count, true);
}
if (player_ptr->protevil) {
void effect_player_old_slow(player_type *player_ptr)
{
- if (player_ptr->blind)
+ if (player_ptr->blind) {
msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
+ }
- (void)set_slow(player_ptr, player_ptr->slow + randint0(4) + 4, false);
+ (void)BadStatusSetter(player_ptr).slowness(player_ptr->slow + randint0(4) + 4, false);
}
void effect_player_old_sleep(player_type *player_ptr, effect_player_type *ep_ptr)
void effect_player_inertial(player_type *player_ptr, effect_player_type *ep_ptr)
{
- if (player_ptr->blind)
+ if (player_ptr->blind) {
msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
- if (!check_multishadow(player_ptr))
- (void)set_slow(player_ptr, player_ptr->slow + randint0(4) + 4, false);
+ }
+
+ if (!check_multishadow(player_ptr)) {
+ (void)BadStatusSetter(player_ptr).slowness(player_ptr->slow + randint0(4) + 4, false);
+ }
ep_ptr->get_damage = take_hit(player_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer);
}
if (!check_multishadow(player_ptr)) {
teleport_player(player_ptr, 5, TELEPORT_PASSIVE);
- if (!player_ptr->levitation)
- (void)set_slow(player_ptr, player_ptr->slow + randint0(4) + 4, false);
+ BadStatusSetter bss(player_ptr);
+ if (!player_ptr->levitation) {
+ (void)bss.slowness(player_ptr->slow + randint0(4) + 4, false);
+ }
+
if (!(has_resist_sound(player_ptr) || player_ptr->levitation)) {
int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
(void)set_stun(player_ptr, player_ptr->effects()->stun()->current() + plus_stun);
void effect_player_void(player_type *player_ptr, effect_player_type *ep_ptr)
{
- if (player_ptr->blind)
- msg_print(_("何かに身体が引っ張りこまれる!", "Something absorbs you!"));
- else
- msg_print(_("周辺の空間が歪んだ。", "Sight warps around you."));
-
- if (!check_multishadow(player_ptr)) {
- if (!player_ptr->levitation && !player_ptr->anti_tele)
- (void)set_slow(player_ptr, player_ptr->slow + randint0(4) + 4, false);
+ auto effect_mes = player_ptr->blind ? _("何かに身体が引っ張りこまれる!", "Something absorbs you!")
+ : _("周辺の空間が歪んだ。", "Sight warps around you.");
+ msg_print(effect_mes);
+ if (!check_multishadow(player_ptr) && !player_ptr->levitation && !player_ptr->anti_tele) {
+ (void)BadStatusSetter(player_ptr).slowness(player_ptr->slow + randint0(4) + 4, false);
}
ep_ptr->dam = ep_ptr->dam * calc_void_damage_rate(player_ptr, CALC_RAND) / 100;
-
if (!player_ptr->levitation || one_in_(13)) {
inventory_damage(player_ptr, BreakerCold(), 2);
}
}
if (!player_ptr->levitation) {
- (void)set_slow(player_ptr, player_ptr->slow + randint0(4) + 4, false);
+ (void)bss.slowness(player_ptr->slow + randint0(4) + 4, false);
}
if (player_ptr->blind) {
}
msg_print(_("深淵から何かがあなたを覗き込んでいる!", "Something gazes you from abyss!"));
-
if (!has_resist_chaos(player_ptr)) {
(void)bss.hallucination(player_ptr->hallucinated + randint1(10));
}
(void)bss.paralysis(player_ptr->paralyzed + randint0(4) + 4);
}
- (void)set_slow(player_ptr, player_ptr->slow + randint0(4) + 4, false);
+ (void)bss.slowness(player_ptr->slow + randint0(4) + 4, false);
while (randint0(100 + ep_ptr->rlev / 2) > (MAX(5, player_ptr->skill_sav)))
(void)do_dec_stat(player_ptr, A_INT);
static void hit_trap_slow(player_type *player_ptr)
{
if (hit_trap_dart(player_ptr)) {
- set_slow(player_ptr, player_ptr->slow + randint0(20) + 20, false);
+ (void)BadStatusSetter(player_ptr).slowness(player_ptr->slow + randint0(20) + 20, false);
}
}
if (player_ptr->is_dead || check_multishadow(player_ptr))
return;
- if (set_slow(player_ptr, (player_ptr->slow + 4 + randint0(monap_ptr->rlev / 10)), false))
+ if (BadStatusSetter(player_ptr).slowness(player_ptr->slow + 4 + randint0(monap_ptr->rlev / 10), false))
monap_ptr->obvious = true;
}
{
(void)set_fast(player_ptr, 0, true);
set_lightspeed(player_ptr, 0, true);
- (void)set_slow(player_ptr, 0, true);
+ (void)BadStatusSetter(player_ptr).slowness(0, true);
(void)set_shield(player_ptr, 0, true);
(void)set_blessed(player_ptr, 0, true);
(void)set_tsuyoshi(player_ptr, 0, true);
_("しかし効力を跳ね返した!", "You resist the effects!"), resist, saving_throw, TARGET_TYPE);
if (!resist && !saving_throw) {
- (void)set_slow(player_ptr, player_ptr->slow + randint0(4) + 4, false);
+ (void)BadStatusSetter(player_ptr).slowness(player_ptr->slow + randint0(4) + 4, false);
}
update_smart_learn(player_ptr, m_idx, DRS_FREE);
disturb(player_ptr, false, true);
if (one_in_(2)) {
msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
-
if (player_ptr->fast > 0) {
set_fast(player_ptr, 0, true);
} else {
- set_slow(player_ptr, randint1(30) + 10, false);
+ (void)bss.slowness(randint1(30) + 10, false);
}
} else {
msg_print(_("精力的になった気がする。", "You feel more energetic."));
-
if (player_ptr->slow > 0) {
- set_slow(player_ptr, 0, true);
+ (void)bss.slowness(0, true);
} else {
set_fast(player_ptr, randint1(30) + 10, false);
}
break;
case SV_POTION_SLOWNESS:
- if (set_slow(player_ptr, randint1(25) + 15, false))
+ if (BadStatusSetter(player_ptr).slowness(randint1(25) + 15, false))
ident = true;
break;
* @param do_dec 現在の継続時間より長い値のみ上書きする
* @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
*/
-bool set_slow(player_type *player_ptr, TIME_EFFECT v, bool do_dec)
+bool BadStatusSetter::slowness(TIME_EFFECT v, bool do_dec)
{
bool 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->slow && !do_dec) {
- if (player_ptr->slow > v)
+ if (this->player_ptr->slow && !do_dec) {
+ if (this->player_ptr->slow > v) {
return false;
- } else if (!player_ptr->slow) {
+ }
+ } else if (!this->player_ptr->slow) {
msg_print(_("体の動きが遅くなってしまった!", "You feel yourself moving slower!"));
notice = true;
}
} else {
- if (player_ptr->slow) {
+ if (this->player_ptr->slow) {
msg_print(_("動きの遅さがなくなったようだ。", "You feel yourself speed up."));
notice = true;
}
}
- player_ptr->slow = v;
- if (!notice)
+ this->player_ptr->slow = v;
+ if (!notice) {
return false;
+ }
- if (disturb_state)
- disturb(player_ptr, false, false);
- player_ptr->update |= (PU_BONUS);
- handle_stuff(player_ptr);
+ if (disturb_state) {
+ disturb(this->player_ptr, false, false);
+ }
+
+ this->player_ptr->update |= PU_BONUS;
+ handle_stuff(this->player_ptr);
return true;
}
bool afraidness(TIME_EFFECT v);
bool paralysis(TIME_EFFECT v);
bool hallucination(TIME_EFFECT v);
+ bool slowness(TIME_EFFECT v, bool do_dec);
private:
player_type *player_ptr;
};
-bool set_slow(player_type *player_ptr, TIME_EFFECT v, bool do_dec);
bool set_stun(player_type *player_ptr, TIME_EFFECT v);
bool set_cut(player_type *player_ptr, TIME_EFFECT v);