Supports cloning battles for AI purposes.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-04-11 16:27:21 +02:00
parent 14016837d9
commit a88719e2b3
8 changed files with 129 additions and 6 deletions

View File

@@ -10,10 +10,23 @@ namespace PkmnLib::Battling {
: CreatureLib::Battling::CreatureParty(std::move(party)) {}
PokemonParty(std::initializer_list<CreatureLib::Battling::Creature*> party)
: CreatureLib::Battling::CreatureParty(party) {}
PokemonParty(size_t size) : CreatureLib::Battling::CreatureParty(size) {}
ArbUt::OptionalBorrowedPtr<Pokemon> GetAtIndex(int index) const {
return CreatureLib::Battling::CreatureParty::GetAtIndex(index).As<Pokemon>();
}
CreatureParty* Clone() const override {
auto party = new PokemonParty(GetParty().Count());
auto i = 0;
for (auto c : GetParty()) {
if (c != nullptr) {
party->SwapInto(i, c->Clone());
i++;
}
}
return party;
}
};
}