Update to latest Arbutils.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -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); });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user