CreatureLib/src/Battling/Models/BattleParty.hpp

46 lines
1.4 KiB
C++
Raw Normal View History

#ifndef CREATURELIB_BATTLEPARTY_HPP
#define CREATURELIB_BATTLEPARTY_HPP
2020-03-22 12:42:26 +00:00
#include <Arbutils/Assert.hpp>
#include <Arbutils/Collections/List.hpp>
#include "CreatureIndex.hpp"
#include "CreatureParty.hpp"
namespace CreatureLib::Battling {
class BattleParty {
CreatureParty* _party;
2020-05-26 16:31:06 +00:00
ArbUt::List<CreatureIndex> _responsibleIndices;
public:
2020-05-26 16:31:06 +00:00
BattleParty(CreatureParty* party, const ArbUt::List<CreatureIndex>& responsibleIndices)
2020-03-22 12:42:26 +00:00
: _party(party), _responsibleIndices(responsibleIndices) {
AssertNotNull(_party)
}
inline CreatureParty* GetParty() const { return _party; }
2020-05-26 16:31:06 +00:00
inline const ArbUt::List<CreatureIndex>& GetResponsibleIndices() const { return _responsibleIndices; }
inline bool IsResponsibleForIndex(const CreatureIndex& index) const {
return _responsibleIndices.Contains(index);
}
bool IsResponsibleForIndex(uint8_t side, uint8_t index) const;
inline bool HasCreaturesNotInField() const {
2020-05-31 17:04:40 +00:00
auto& p = _party->GetParty();
for (const auto& creature : p) {
if (creature == nullptr)
continue;
if (creature->IsFainted())
continue;
if (creature->IsOnBattleField())
continue;
return true;
}
return false;
}
};
}
#endif // CREATURELIB_BATTLEPARTY_HPP