Skip to content

Commit

Permalink
[Refactor] hengband#1498 Defined decrease_chance()
Browse files Browse the repository at this point in the history
  • Loading branch information
Hourier committed Sep 18, 2021
1 parent e49bae2 commit ee70bdc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/timed-effect/player-stun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,29 @@ StunRank PlayerStun::get_rank(short value) const
return StunRank::NONE;
}

/*!
* @brief 朦朧ランクに応じて各種失率を上げる.
* @return 朦朧ならば15%、ひどく朦朧ならば25%.
* @details
* 意識不明瞭ならばそもそも動けないのでこのメソッドを通らない.
* しかし今後の拡張を考慮して100%としておく.
*/
int PlayerStun::decrease_chance() const
{
switch (this->get_rank()) {
case StunRank::NONE:
return 0;
case StunRank::NORMAL:
return 15;
case StunRank::HARD:
return 25;
case StunRank::UNCONSCIOUS:
return 100;
default:
throw("Invalid stun rank is specified!");
}
}

void PlayerStun::set(short value)
{
}
1 change: 1 addition & 0 deletions src/timed-effect/player-stun.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class PlayerStun {
short current() const;
StunRank get_rank() const;
StunRank get_rank(short value) const;
int decrease_chance() const;
void set(short value);

private:
Expand Down

0 comments on commit ee70bdc

Please sign in to comment.