case RF_ABILITY::HEAL:
msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
(void)hp_player(player_ptr, bmc_ptr->plev * 4);
- (void)set_stun(player_ptr, 0);
+ (void)BadStatusSetter(player_ptr).stun(0);
(void)set_cut(player_ptr, 0);
return true;
case RF_ABILITY::INVULNER:
case RF_ABILITY::HEAL:
msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
(void)hp_player(player_ptr, plev * 6);
- (void)set_stun(player_ptr, 0);
+ (void)BadStatusSetter(player_ptr).stun(0);
(void)set_cut(player_ptr, 0);
break;
case RF_ABILITY::INVULNER:
}
if (cm_ptr->b < 90) {
- set_stun(player_ptr, player_ptr->effects()->stun()->current() + randint1(8));
+ (void)bss.stun(player_ptr->effects()->stun()->current() + randint1(8));
return;
}
msg_print(_("射撃の反動が体を襲った。", "The weapon's recoil stuns you. "));
BadStatusSetter bss(player_ptr);
(void)bss.slowness(player_ptr->slow + randint0(7) + 7, false);
- (void)set_stun(player_ptr, effects->stun()->current() + randint1(25));
+ (void)bss.stun(effects->stun()->current() + randint1(25));
}
}
auto player_stun = effects->stun();
if (player_stun->is_stunned()) {
int adjust = adj_con_fix[player_ptr->stat_index[A_CON]] + 1;
- (void)set_stun(player_ptr, player_stun->current() - adjust);
+ (void)bss.stun(player_stun->current() - adjust);
}
if (player_ptr->cut) {
BadStatusSetter bss(player_ptr);
switch (randint1(4)) {
case 1:
- set_stun(player_ptr, player_ptr->effects()->stun()->current() + em_ptr->dam / 2);
+ (void)bss.stun(player_ptr->effects()->stun()->current() + em_ptr->dam / 2);
return;
case 2:
(void)bss.confusion(player_ptr->confused + em_ptr->dam / 2);
(void)bss.confusion(player_ptr->confused + 3 + randint1(em_ptr->dam));
return;
case 2:
- set_stun(player_ptr, player_ptr->effects()->stun()->current() + randint1(em_ptr->dam));
+ (void)bss.stun(player_ptr->effects()->stun()->current() + randint1(em_ptr->dam));
return;
case 3:
if (any_bits(em_ptr->r_ptr->flags3, RF3_NO_FEAR)) {
if (!has_resist_sound(player_ptr) && !check_multishadow(player_ptr)) {
int plus_stun = (randint1((ep_ptr->dam > 40) ? 35 : (ep_ptr->dam * 3 / 4 + 5)));
- (void)set_stun(player_ptr, player_ptr->effects()->stun()->current() + plus_stun);
+ (void)BadStatusSetter(player_ptr).stun(player_ptr->effects()->stun()->current() + plus_stun);
}
if (!(has_resist_fire(player_ptr) || is_oppose_fire(player_ptr) || has_immune_fire(player_ptr)))
BadStatusSetter bss(player_ptr);
if (!check_multishadow(player_ptr)) {
if (!has_resist_sound(player_ptr) && !has_res_water) {
- set_stun(player_ptr, player_ptr->effects()->stun()->current() + randint1(40));
+ (void)bss.stun(player_ptr->effects()->stun()->current() + randint1(40));
}
+
if (!has_resist_conf(player_ptr) && !has_res_water) {
(void)bss.confusion(player_ptr->confused + randint1(5) + 5);
}
if (!has_resist_sound(player_ptr) && !check_multishadow(player_ptr)) {
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)BadStatusSetter(player_ptr).stun(player_ptr->effects()->stun()->current() + plus_stun);
}
if (!has_resist_sound(player_ptr) || one_in_(13))
if (player_ptr->blind)
msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
if (!has_resist_sound(player_ptr) && !check_multishadow(player_ptr)) {
- (void)set_stun(player_ptr, player_ptr->effects()->stun()->current() + randint1(20));
+ (void)BadStatusSetter(player_ptr).stun(player_ptr->effects()->stun()->current() + randint1(20));
}
ep_ptr->get_damage = take_hit(player_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer);
if (player_ptr->blind)
msg_print(_("爆発があった!", "There is an explosion!"));
if (!has_resist_sound(player_ptr) && !check_multishadow(player_ptr)) {
- (void)set_stun(player_ptr, player_ptr->effects()->stun()->current() + randint1(20));
+ (void)BadStatusSetter(player_ptr).stun(player_ptr->effects()->stun()->current() + randint1(20));
}
ep_ptr->dam = ep_ptr->dam * calc_rocket_damage_rate(player_ptr, CALC_RAND) / 100;
void effect_player_gravity(player_type *player_ptr, effect_player_type *ep_ptr)
{
- if (player_ptr->blind)
+ if (player_ptr->blind) {
msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
+ }
+
msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
if (!check_multishadow(player_ptr)) {
}
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);
+ auto plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
+ (void)bss.stun(player_ptr->effects()->stun()->current() + plus_stun);
}
}
ep_ptr->dam = ep_ptr->dam * calc_gravity_damage_rate(player_ptr, CALC_RAND) / 100;
-
if (!player_ptr->levitation || one_in_(13)) {
inventory_damage(player_ptr, BreakerCold(), 2);
}
void effect_player_icee(player_type *player_ptr, effect_player_type *ep_ptr)
{
- if (player_ptr->blind)
+ if (player_ptr->blind) {
msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
+ }
ep_ptr->get_damage = cold_dam(player_ptr, ep_ptr->dam, ep_ptr->killer, false);
- if (check_multishadow(player_ptr))
+ if (check_multishadow(player_ptr)) {
return;
+ }
+ BadStatusSetter bss(player_ptr);
if (!has_resist_shard(player_ptr)) {
(void)set_cut(player_ptr, player_ptr->cut + damroll(5, 8));
}
if (!has_resist_sound(player_ptr)) {
- (void)set_stun(player_ptr, player_ptr->effects()->stun()->current() + randint1(15));
+ (void)bss.stun(player_ptr->effects()->stun()->current() + randint1(15));
}
if ((!(has_resist_cold(player_ptr) || is_oppose_cold(player_ptr))) || one_in_(12)) {
case ADRENALINE_CHANNELING: {
BadStatusSetter bss(player_ptr);
(void)bss.afraidness(0);
- set_stun(player_ptr, 0);
+ (void)bss.stun(0);
if (!is_fast(player_ptr) || !is_hero(player_ptr)) {
hp_player(player_ptr, plev);
}
}
if (stun_plus > 0) {
- (void)set_stun(player_ptr, player_ptr->effects()->stun()->current() + stun_plus);
+ (void)BadStatusSetter(player_ptr).stun(player_ptr->effects()->stun()->current() + stun_plus);
}
}
}
auto *r_ptr = &r_info[monap_ptr->m_ptr->r_idx];
- if (set_stun(player_ptr, player_ptr->effects()->stun()->current() + 10 + randint1(r_ptr->level / 4)))
+ auto current_stun = player_ptr->effects()->stun()->current();
+ if (BadStatusSetter(player_ptr).stun(current_stun + 10 + randint1(r_ptr->level / 4))) {
monap_ptr->obvious = true;
+ }
}
/*!
{
msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!"));
take_hit(player_ptr, DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"));
- (void)set_stun(player_ptr, player_ptr->effects()->stun()->current() + 75);
+ BadStatusSetter bss(player_ptr);
+ (void)bss.stun(player_ptr->effects()->stun()->current() + 75);
(void)set_cut(player_ptr, player_ptr->cut + 5000);
return true;
}
BadStatusSetter bss(player_ptr);
set_cut(player_ptr, 0);
(void)bss.poison(0);
- set_stun(player_ptr, 0);
+ (void)bss.stun(0);
}
break;
hp_player(player_ptr, heal);
(void)bss.afraidness(0);
(void)bss.poison(0);
- set_stun(player_ptr, 0);
+ (void)bss.stun(0);
set_cut(player_ptr, 0);
}
break;
}
- case 28:
- if (name)
+ case 28: {
+ if (name) {
return _("ヤヴァンナの助け", "Relief of Yavanna");
- if (desc)
+ }
+
+ if (desc) {
return _("強力な回復の歌で、負傷と朦朧状態も全快する。", "Powerful healing song. Also completely heals cuts and being stunned.");
+ }
- /* Stop singing before start another */
- if (cast || fail)
+ if (cast || fail) {
stop_singing(player_ptr);
+ }
if (cast) {
msg_print(_("歌を通して体に活気が戻ってきた...", "Life flows through you as you sing the song..."));
start_singing(player_ptr, spell, MUSIC_H_LIFE);
}
- {
- DICE_NUMBER dice = 15;
- DICE_SID sides = 10;
-
- if (info)
- return info_heal(dice, sides, 0);
+ auto dice = 15;
+ auto sides = 10;
+ if (info) {
+ return info_heal(dice, sides, 0);
+ }
- if (cont) {
- hp_player(player_ptr, damroll(dice, sides));
- set_stun(player_ptr, 0);
- set_cut(player_ptr, 0);
- }
+ if (cont) {
+ hp_player(player_ptr, damroll(dice, sides));
+ BadStatusSetter bss(player_ptr);
+ (void)bss.stun(0);
+ set_cut(player_ptr, 0);
}
break;
-
+ }
case 29:
if (name)
return _("再生の歌", "Goddess's rebirth");
if (!player_ptr->free_act) {
(void)bss.paralysis(player_ptr->paralyzed + 2 + randint0(6));
} else {
- (void)set_stun(player_ptr, effects->stun()->current() + 10 + randint0(100));
+ (void)bss.stun(effects->stun()->current() + 10 + randint0(100));
}
} else if (one_in_(3))
apply_disenchant(player_ptr, 0);
} else {
auto effects = player_ptr->effects();
auto stun_value = effects->stun()->current();
+ BadStatusSetter bss(player_ptr);
switch (randint1(3)) {
case 1: {
msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
case 2: {
msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
damage = damroll(10, 4);
- (void)set_stun(player_ptr, stun_value + randint1(50));
+ (void)bss.stun(stun_value + randint1(50));
break;
}
case 3: {
msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
damage = damroll(10, 4);
- (void)set_stun(player_ptr, stun_value + randint1(50));
+ (void)bss.stun(stun_value + randint1(50));
break;
}
}
if (hp_player(player_ptr, 50))
ident = true;
- if (set_stun(player_ptr, 0))
+ if (bss.stun(0))
ident = true;
if (set_cut(player_ptr, 0))
(void)bss.blindness(0);
(void)bss.confusion(0);
(void)bss.hallucination(0);
- (void)set_stun(player_ptr, 0);
+ (void)bss.stun(0);
(void)set_cut(player_ptr, 0);
(void)bss.paralysis(0);
(void)restore_all_status(player_ptr);
ident = true;
}
- if (set_stun(player_ptr, 0)) {
+ if (bss.stun(0)) {
ident = true;
}
ident = true;
}
- if (set_stun(player_ptr, 0)) {
+ if (bss.stun(0)) {
ident = true;
}
* @details
* Note the special code to only notice "range" changes.
*/
-bool set_stun(player_type *player_ptr, TIME_EFFECT v)
+bool BadStatusSetter::stun(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 (PlayerRace(player_ptr).equals(player_race_type::GOLEM) || PlayerClass(player_ptr).can_resist_stun())
+ }
+
+ if (PlayerRace(this->player_ptr).equals(player_race_type::GOLEM) || PlayerClass(this->player_ptr).can_resist_stun()) {
v = 0;
+ }
- auto player_stun = player_ptr->effects()->stun();
+ auto player_stun = this->player_ptr->effects()->stun();
auto old_aux = player_stun->get_rank();
auto new_aux = PlayerStun::get_rank(v);
if (new_aux > old_aux) {
msg_print(stun_mes.data());
if (randint1(1000) < v || one_in_(16)) {
msg_print(_("割れるような頭痛がする。", "A vicious blow hits your head."));
-
if (one_in_(3)) {
- if (!has_sustain_int(player_ptr))
- (void)do_dec_stat(player_ptr, A_INT);
- if (!has_sustain_wis(player_ptr))
- (void)do_dec_stat(player_ptr, A_WIS);
+ if (!has_sustain_int(this->player_ptr))
+ (void)do_dec_stat(this->player_ptr, A_INT);
+ if (!has_sustain_wis(this->player_ptr))
+ (void)do_dec_stat(this->player_ptr, A_WIS);
} else if (one_in_(2)) {
- if (!has_sustain_int(player_ptr))
- (void)do_dec_stat(player_ptr, A_INT);
+ if (!has_sustain_int(this->player_ptr))
+ (void)do_dec_stat(this->player_ptr, A_INT);
} else {
- if (!has_sustain_wis(player_ptr))
- (void)do_dec_stat(player_ptr, A_WIS);
+ if (!has_sustain_wis(this->player_ptr))
+ (void)do_dec_stat(this->player_ptr, A_WIS);
}
}
- if (player_ptr->special_defense & KATA_MASK) {
+ if (this->player_ptr->special_defense & KATA_MASK) {
msg_print(_("型が崩れた。", "You lose your stance."));
- player_ptr->special_defense &= ~(KATA_MASK);
- player_ptr->update |= (PU_BONUS);
- player_ptr->update |= (PU_MONSTERS);
- player_ptr->redraw |= (PR_STATE);
- player_ptr->redraw |= (PR_STATUS);
- player_ptr->action = ACTION_NONE;
+ this->player_ptr->special_defense &= ~(KATA_MASK);
+ this->player_ptr->update |= (PU_BONUS);
+ this->player_ptr->update |= (PU_MONSTERS);
+ this->player_ptr->redraw |= (PR_STATE);
+ this->player_ptr->redraw |= (PR_STATUS);
+ this->player_ptr->action = ACTION_NONE;
}
- 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();
}
} else if (new_aux < old_aux) {
if (new_aux == PlayerStunRank::NONE) {
msg_print(_("やっと朦朧状態から回復した。", "You are no longer stunned."));
- if (disturb_state)
- disturb(player_ptr, false, false);
+ if (disturb_state) {
+ disturb(this->player_ptr, false, false);
+ }
}
notice = true;
}
if (disturb_state) {
- disturb(player_ptr, false, false);
+ disturb(this->player_ptr, false, false);
}
- player_ptr->update |= PU_BONUS;
- player_ptr->redraw |= PR_STUN;
- handle_stuff(player_ptr);
+ this->player_ptr->update |= PU_BONUS;
+ this->player_ptr->redraw |= PR_STUN;
+ handle_stuff(this->player_ptr);
return true;
}
bool paralysis(TIME_EFFECT v);
bool hallucination(TIME_EFFECT v);
bool slowness(TIME_EFFECT v, bool do_dec);
+ bool stun(TIME_EFFECT v);
private:
player_type *player_ptr;
};
-bool set_stun(player_type *player_ptr, TIME_EFFECT v);
bool set_cut(player_type *player_ptr, TIME_EFFECT v);