Check if the user is usable when we set the choice
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-05-15 11:24:21 +02:00
parent f13b78e297
commit dcf6b20e65
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 3 additions and 0 deletions

View File

@ -10,6 +10,9 @@ using namespace CreatureLib::Battling;
const ArbUt::BorrowedPtr<const BattleLibrary>& Battle::GetLibrary() const noexcept { return _library; } const ArbUt::BorrowedPtr<const BattleLibrary>& Battle::GetLibrary() const noexcept { return _library; }
bool Battle::CanUse(const ArbUt::BorrowedPtr<BaseTurnChoice>& choice) { bool Battle::CanUse(const ArbUt::BorrowedPtr<BaseTurnChoice>& choice) {
if (!choice->GetUser()->IsUsable()) {
return false;
}
if (choice->GetKind() == TurnChoiceKind::Attack) { if (choice->GetKind() == TurnChoiceKind::Attack) {
auto attack = choice.ForceAs<AttackTurnChoice>(); auto attack = choice.ForceAs<AttackTurnChoice>();
// HOOK: change number of uses needed. // HOOK: change number of uses needed.