Supports cloning battles for AI purposes.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user