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

@@ -19,8 +19,6 @@ namespace CreatureLib::Battling {
if (_attackScript != nullptr)
return;
auto user = GetUser();
if (user == nullptr)
return;
auto battle = user->GetBattle();
if (battle.HasValue()) {
if (_attack->GetAttack()->HasSecondaryEffect()) {
@@ -38,20 +36,13 @@ namespace CreatureLib::Battling {
public:
AttackTurnChoice(Creature* user, const ArbUt::BorrowedPtr<LearnedAttack>& attack, const CreatureIndex& target)
: BaseTurnChoice(user), _attack(attack), _target(target) {
#ifndef TESTS_BUILD
AssertNotNull(user)
AssertNotNull(attack)
#endif
EnsureNotNull(user)
ResolveScript();
_priority = _attack->GetAttack()->GetPriority();
}
AttackTurnChoice(Creature* user, const ArbUt::BorrowedPtr<LearnedAttack>& attack, const CreatureIndex& target,
Script* script)
: BaseTurnChoice(user), _attack(attack), _target(target), _attackScript(script) {
#ifndef TESTS_BUILD
AssertNotNull(user)
AssertNotNull(attack)
#endif
_priority = _attack->GetAttack()->GetPriority();
}
@@ -68,18 +59,13 @@ namespace CreatureLib::Battling {
const std::unique_ptr<Script>& GetAttackScript() const noexcept { return _attackScript; }
size_t ScriptCount() const override {
if (_user == nullptr) {
return 1;
}
return 1 + GetUser()->ScriptCount();
}
protected:
void GetActiveScripts(ArbUt::List<ScriptWrapper>& scripts) override {
scripts.Append(ScriptWrapper::FromScript(&_attackScript));
if (_user != nullptr) {
GetUser()->GetActiveScripts(scripts);
}
GetUser()->GetActiveScripts(scripts);
}
};
}