2019-10-17 12:33:25 +00:00
|
|
|
#include "Battle.hpp"
|
2019-10-29 10:19:25 +00:00
|
|
|
#include "../TurnChoices/AttackTurnChoice.hpp"
|
2019-10-17 12:33:25 +00:00
|
|
|
|
|
|
|
const CreatureLib::Battling::BattleLibrary *CreatureLib::Battling::Battle::GetLibrary() const {
|
|
|
|
return _library;
|
|
|
|
}
|
2019-10-29 10:19:25 +00:00
|
|
|
|
|
|
|
bool CreatureLib::Battling::Battle::CanUse(CreatureLib::Battling::BaseTurnChoice *choice) {
|
|
|
|
if (choice->GetKind() == TurnChoiceKind::Attack)
|
|
|
|
//HOOK: change number of uses needed.
|
|
|
|
return static_cast<AttackTurnChoice*>(choice)->GetAttack()->GetRemainingUses() > 1;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CreatureLib::Battling::Battle::TrySetChoice(CreatureLib::Battling::BaseTurnChoice *choice) {
|
|
|
|
if (!CanUse(choice))
|
|
|
|
return false;
|
|
|
|
choice->GetUser()->GetBattleSide()->SetChoice(choice);
|
|
|
|
return true;
|
|
|
|
}
|