Skip to content

Commit

Permalink
[Refactor] hengband#1498 Defined decrease_damage() in PlayerStun
Browse files Browse the repository at this point in the history
  • Loading branch information
Hourier committed Sep 18, 2021
1 parent b02c802 commit 14ab2ad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/timed-effect/player-stun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ int PlayerStun::decrease_chance() const
}
}

/*!
* @brief 朦朧ランクに応じてダメージ量 or 命中率を下げる.
* @return 朦朧ならば5、ひどく朦朧ならば20.
* @details
* 呼び出し元で減算しているのでこのメソッドでは正値.
* 意識不明瞭ならばそもそも動けないのでこのメソッドを通らない.
* しかし今後の拡張を考慮して100としておく.
*/
short PlayerStun::decrease_damage() const
{
switch (this->get_rank()) {
case StunRank::NONE:
return 0;
case StunRank::NORMAL:
return 5;
case StunRank::HARD:
return 20;
case StunRank::UNCONSCIOUS:
return 100;
default:
throw("Invalid stun rank is specified!");
}
}

bool PlayerStun::is_stunned() const
{
return this->get_rank() > StunRank::NONE;
Expand Down
1 change: 1 addition & 0 deletions src/timed-effect/player-stun.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PlayerStun {
StunRank get_rank(short value) const;
std::string_view get_stun_mes(StunRank stun_rank) const;
int decrease_chance() const;
short decrease_damage() const;
bool is_stunned() const;
void reset();
void set(short value);
Expand Down

0 comments on commit 14ab2ad

Please sign in to comment.