CreatureLib/src/Battling/Models/Battle.cpp

22 lines
722 B
C++
Raw Normal View History

2019-10-17 12:33:25 +00:00
#include "Battle.hpp"
#include "../TurnChoices/AttackTurnChoice.hpp"
2019-10-17 12:33:25 +00:00
const CreatureLib::Battling::BattleLibrary *CreatureLib::Battling::Battle::GetLibrary() const {
return _library;
}
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;
}