Skip to content

Commit

Permalink
[Refactor] hengband#1498 Defined get_stun_mes()
Browse files Browse the repository at this point in the history
  • Loading branch information
Hourier committed Sep 18, 2021
1 parent 30e197b commit 67177d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/timed-effect/player-stun.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "timed-effect/player-stun.h"
#include "locale/language-switcher.h"

short PlayerStun::current() const
{
Expand Down Expand Up @@ -27,6 +28,22 @@ StunRank PlayerStun::get_rank(short value) const
return StunRank::NONE;
}

std::string_view PlayerStun::get_stun_mes(StunRank stun_rank) const
{
switch (stun_rank) {
case StunRank::NONE:
return "";
case StunRank::NORMAL:
return _("意識がもうろうとしてきた。", "You have been stunned.");
case StunRank::HARD:
return _("意識がひどくもうろうとしてきた。", "You have been heavily stunned.");
case StunRank::UNCONSCIOUS:
return _("頭がクラクラして意識が遠のいてきた。", "You have been knocked out.");
default:
throw("Invalid StunRank was specified!");
}
}

/*!
* @brief 朦朧ランクに応じて各種失率を上げる.
* @return 朦朧ならば15%、ひどく朦朧ならば25%.
Expand Down
3 changes: 3 additions & 0 deletions src/timed-effect/player-stun.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <string>

enum class StunRank {
NONE = 0,
NORMAL = 1,
Expand All @@ -15,6 +17,7 @@ class PlayerStun {
short current() const;
StunRank get_rank() const;
StunRank get_rank(short value) const;
std::string_view get_stun_mes(StunRank stun_rank) const;
int decrease_chance() const;
void reset();
void set(short value);
Expand Down

0 comments on commit 67177d5

Please sign in to comment.