Simplify check whether mon is on battle field.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-06-05 14:35:23 +02:00
parent 44de4a0799
commit f463ba8496
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ void TurnHandler::ExecuteChoice(ArbUt::BorrowedPtr<BaseTurnChoice> choice) {
auto battle = user->GetBattle(); auto battle = user->GetBattle();
AssertNotNull(battle) AssertNotNull(battle)
// If the user is not in the field, we don't want to execute its choice. // If the user is not in the field, we don't want to execute its choice.
if (!battle->CreatureInField(user)) { if (!user->IsOnBattleField()) {
return; return;
} }
// If the choice is not valid, we don't want to execute it. // If the choice is not valid, we don't want to execute it.

View File

@ -102,10 +102,10 @@ namespace CreatureLib::Battling {
void SetBattleData(ArbUt::BorrowedPtr<Battle> battle, ArbUt::BorrowedPtr<BattleSide> side); void SetBattleData(ArbUt::BorrowedPtr<Battle> battle, ArbUt::BorrowedPtr<BattleSide> side);
const ArbUt::BorrowedPtr<Battle>& GetBattle() const; const ArbUt::BorrowedPtr<Battle>& GetBattle() const;
const ArbUt::BorrowedPtr<BattleSide>& GetBattleSide() const; const ArbUt::BorrowedPtr<BattleSide>& GetBattleSide() const;
void SetOnBattleField(bool value) { _onBattleField = value; } inline void SetOnBattleField(bool value) { _onBattleField = value; }
bool IsOnBattleField() const { return _onBattleField; } inline bool IsOnBattleField() const { return _onBattleField; }
const std::string& GetNickname() const noexcept { return _nickname; } inline const std::string& GetNickname() const noexcept { return _nickname; }
const ArbUt::CaseInsensitiveConstString& GetActiveTalent() const; const ArbUt::CaseInsensitiveConstString& GetActiveTalent() const;
[[nodiscard]] bool IsFainted() const noexcept; [[nodiscard]] bool IsFainted() const noexcept;