Added layout for CreatureParty
This commit is contained in:
parent
aa356d74d7
commit
3b685ae782
|
@ -66,7 +66,6 @@ void TurnHandler::ExecuteAttackChoice(AttackTurnChoice *choice) {
|
|||
auto target = choice->GetUser()->GetBattle()->GetTarget(choice->GetTarget());
|
||||
std::vector<Creature*> targets = {target};
|
||||
|
||||
//TODO: Set ExecutingAttack data
|
||||
auto attack = new ExecutingAttack(targets, 1, choice->GetUser(), choice->GetAttack(), choice->GetAttackScript());
|
||||
bool prevented = false;
|
||||
HOOK(PreventAttack, attack, attack, prevented);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "CreatureParty.hpp"
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef CREATURELIB_CREATUREPARTY_HPP
|
||||
#define CREATURELIB_CREATUREPARTY_HPP
|
||||
|
||||
#include <array>
|
||||
#include "Creature.hpp"
|
||||
|
||||
namespace CreatureLib::Battling{
|
||||
template <int max>
|
||||
class CreatureParty {
|
||||
std::array<Creature*, max> _party;
|
||||
|
||||
public:
|
||||
CreatureParty(std::array<Creature*, max> party) : _party(party){
|
||||
}
|
||||
|
||||
Creature* GetAtIndex(int index) const{
|
||||
return _party[index];
|
||||
}
|
||||
|
||||
void Switch(int a, int b){
|
||||
auto ca = _party[a];
|
||||
_party[a] = _party[b];
|
||||
_party[b] = ca;
|
||||
}
|
||||
|
||||
bool HasAvailableCreatures() const{
|
||||
for (Creature* c: _party){
|
||||
if (c == nullptr) continue;
|
||||
if (c->IsFainted()) continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //CREATURELIB_CREATUREPARTY_HPP
|
Loading…
Reference in New Issue