#include "status/base-status.h"
#include "status/buff-setter.h"
#include "system/player-type-definition.h"
+#include "timed-effect/player-blindness.h"
#include "timed-effect/player-confusion.h"
#include "timed-effect/player-cut.h"
+#include "timed-effect/player-deceleration.h"
#include "timed-effect/player-fear.h"
#include "timed-effect/player-hallucination.h"
#include "timed-effect/player-paralysis.h"
+#include "timed-effect/player-poison.h"
#include "timed-effect/player-stun.h"
#include "timed-effect/timed-effects.h"
#include "view/display-messages.h"
return false;
}
- PlayerRace pr(player_ptr);
+ PlayerRace pr(this->player_ptr);
+ const auto blindness = this->player_ptr->effects()->blindness();
+ const auto is_blind = blindness->is_blind();
if (v > 0) {
- if (!this->player_ptr->blind) {
+ if (!is_blind) {
if (pr.equals(PlayerRaceType::ANDROID)) {
msg_print(_("センサーをやられた!", "The sensor broke!"));
} else {
chg_virtue(this->player_ptr, V_ENLIGHTEN, -1);
}
} else {
- if (this->player_ptr->blind) {
+ if (is_blind) {
if (pr.equals(PlayerRaceType::ANDROID)) {
msg_print(_("センサーが復旧した。", "The sensor has been restored."));
} else {
}
}
- this->player_ptr->blind = v;
+ blindness->set(v);
this->player_ptr->redraw |= PR_STATUS;
if (!notice) {
return false;
bool BadStatusSetter::mod_blindness(const TIME_EFFECT tmp_v)
{
- return this->blindness(this->player_ptr->blind + tmp_v);
+ return this->blindness(this->player_ptr->effects()->blindness()->current() + tmp_v);
}
/*!
* @param v 継続時間
* @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
*/
-bool BadStatusSetter::poison(const TIME_EFFECT tmp_v)
+bool BadStatusSetter::set_poison(const TIME_EFFECT tmp_v)
{
auto notice = false;
auto v = std::clamp<short>(tmp_v, 0, 10000);
return false;
}
+ const auto player_poison = this->player_ptr->effects()->poison();
+ const auto is_poisoned = player_poison->is_poisoned();
if (v > 0) {
- if (!this->player_ptr->poisoned) {
+ if (!is_poisoned) {
msg_print(_("毒に侵されてしまった!", "You are poisoned!"));
notice = true;
}
} else {
- if (this->player_ptr->poisoned) {
+ if (is_poisoned) {
msg_print(_("やっと毒の痛みがなくなった。", "You are no longer poisoned."));
notice = true;
}
}
- this->player_ptr->poisoned = v;
+ player_poison->set(v);
this->player_ptr->redraw |= PR_STATUS;
if (!notice) {
return false;
bool BadStatusSetter::mod_poison(const TIME_EFFECT tmp_v)
{
- return this->poison(this->player_ptr->poisoned + tmp_v);
+ return this->set_poison(this->player_ptr->effects()->poison()->current() + tmp_v);
}
/*!
* @param do_dec 現在の継続時間より長い値のみ上書きする
* @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
*/
-bool BadStatusSetter::slowness(const TIME_EFFECT tmp_v, bool do_dec)
+bool BadStatusSetter::set_deceleration(const TIME_EFFECT tmp_v, bool do_dec)
{
auto notice = false;
auto v = std::clamp<short>(tmp_v, 0, 10000);
return false;
}
+ auto deceleration = this->player_ptr->effects()->deceleration();
+ auto is_slow = deceleration->is_slow();
if (v > 0) {
- if (this->player_ptr->slow && !do_dec) {
- if (this->player_ptr->slow > v) {
+ if (is_slow && !do_dec) {
+ if (deceleration->current() > v) {
return false;
}
- } else if (!this->player_ptr->slow) {
+ } else if (!is_slow) {
msg_print(_("体の動きが遅くなってしまった!", "You feel yourself moving slower!"));
notice = true;
}
} else {
- if (this->player_ptr->slow) {
+ if (is_slow) {
msg_print(_("動きの遅さがなくなったようだ。", "You feel yourself speed up."));
notice = true;
}
}
- this->player_ptr->slow = v;
+ deceleration->set(v);
if (!notice) {
return false;
}
return true;
}
-bool BadStatusSetter::mod_slowness(const TIME_EFFECT tmp_v, bool do_dec)
+bool BadStatusSetter::mod_deceleration(const TIME_EFFECT tmp_v, bool do_dec)
{
- return this->slowness(this->player_ptr->slow + tmp_v, do_dec);
+ return this->set_deceleration(this->player_ptr->effects()->deceleration()->current() + tmp_v, do_dec);
}
/*!