Update to latest Arbutils.
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
2020-12-13 12:15:40 +01:00
parent 2055837980
commit e642f374b9
25 changed files with 69 additions and 120 deletions

View File

@@ -9,7 +9,6 @@ using namespace CreatureLib::Battling;
const ArbUt::BorrowedPtr<const BattleLibrary>& Battle::GetLibrary() const noexcept { return _library; }
bool Battle::CanUse(const ArbUt::BorrowedPtr<BaseTurnChoice>& choice) {
AssertNotNull(choice)
if (choice->GetKind() == TurnChoiceKind::Attack) {
// HOOK: change number of uses needed.
return choice.ForceAs<AttackTurnChoice>()->GetAttack()->GetRemainingUses() >= 1;
@@ -18,10 +17,10 @@ bool Battle::CanUse(const ArbUt::BorrowedPtr<BaseTurnChoice>& choice) {
}
bool Battle::TrySetChoice(BaseTurnChoice* choice) {
AssertNotNull(choice)
EnsureNotNull(choice)
if (!CanUse(choice))
return false;
Assert(choice->GetUser()->GetBattleSide().HasValue())
Ensure(choice->GetUser()->GetBattleSide().HasValue())
choice->GetUser()->GetBattleSide().GetValue()->SetChoice(choice);
CheckChoicesSetAndRun();
return true;
@@ -51,7 +50,7 @@ void Battle::CheckChoicesSetAndRun() {
try {
for (auto side : _sides) {
for (auto choice : side->GetChoices()) {
AssertNotNull(choice)
EnsureNotNull(choice)
if (choice->GetKind() == TurnChoiceKind::Attack) {
auto attack = std::static_pointer_cast<AttackTurnChoice>(choice);
uint8_t uses = 1;
@@ -99,7 +98,6 @@ ArbUt::BorrowedPtr<ChoiceQueue> Battle::GetCurrentTurnQueue() const noexcept { r
BattleRandom* Battle::GetRandom() noexcept { return &_random; }
bool Battle::CreatureInField(ArbUt::BorrowedPtr<Creature> creature) const {
AssertNotNull(creature)
return std::any_of(_sides.begin(), _sides.end(), [creature](auto c) { return c->CreatureOnSide(creature); });
}