PkmnLib/src/Battling/Pokemon/PokemonParty.hpp

34 lines
1.2 KiB
C++

#ifndef PKMNLIB_POKEMONPARTY_HPP
#define PKMNLIB_POKEMONPARTY_HPP
#include <CreatureLib/Battling/Models/CreatureParty.hpp>
#include "Pokemon.hpp"
namespace PkmnLib::Battling {
class PokemonParty : public CreatureLib::Battling::CreatureParty {
public:
PokemonParty(ArbUt::List<CreatureLib::Battling::Creature * nullable> party)
: CreatureLib::Battling::CreatureParty(std::move(party)) {}
PokemonParty(std::initializer_list<CreatureLib::Battling::Creature * nullable> party)
: CreatureLib::Battling::CreatureParty(party) {}
PokemonParty(size_t size) : CreatureLib::Battling::CreatureParty(size) {}
ArbUt::OptionalBorrowedPtr<Pokemon> GetAtIndex(size_t index) const {
return CreatureLib::Battling::CreatureParty::GetAtIndex(index).As<Pokemon>();
}
CreatureParty* non_null 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;
}
};
}
#endif // PKMNLIB_POKEMONPARTY_HPP