*/
bool BadStatusSetter::stun(const TIME_EFFECT tmp_v)
{
- auto notice = false;
auto v = std::clamp<short>(tmp_v, 0, 10000);
if (this->player_ptr->is_dead) {
return false;
v = 0;
}
- 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) {
- this->process_stun_status(new_aux, v);
- notice = true;
- } else if (new_aux < old_aux) {
- this->clear_head(new_aux);
- notice = true;
- }
-
- player_stun->set(v);
+ auto notice = this->process_stun_effect(v);
+ this->player_ptr->effects()->stun()->set(v);
if (!notice) {
return false;
}
return true;
}
+bool BadStatusSetter::process_stun_effect(const short v)
+{
+ auto old_aux = this->player_ptr->effects()->stun()->get_rank();
+ auto new_aux = PlayerStun::get_rank(v);
+ if (new_aux > old_aux) {
+ this->process_stun_status(new_aux, v);
+ return true;
+ }
+
+ if (new_aux < old_aux) {
+ this->clear_head(new_aux);
+ return true;
+ }
+
+ return false;
+}
+
void BadStatusSetter::process_stun_status(const PlayerStunRank new_aux, const short v)
{
auto stun_mes = PlayerStun::get_stun_mes(new_aux);
private:
player_type *player_ptr;
+ bool process_stun_effect(const short v);
void process_stun_status(const PlayerStunRank new_aux, const short v);
void clear_head(const PlayerStunRank new_aux);
void decrease_int_wis(const short v);