Implemented and fixed all code required to run at least a single turn.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-12-05 12:56:41 +01:00
parent 5d6ac316eb
commit 6f32d1245b
17 changed files with 171 additions and 58 deletions

View File

@@ -50,11 +50,12 @@ void Battle::CheckChoicesSetAndRun() {
side->ResetChoices();
}
TurnOrdering::OrderChoices(choices, _random);
auto choiceQueue = new ChoiceQueue(choices);
this->_currentTurnQueue = choiceQueue;
TurnHandler::RunTurn(this, choiceQueue);
if (choiceQueue->HasCompletedQueue)
_currentTurnQueue = nullptr;
this->_currentTurnQueue = new ChoiceQueue(choices);
TurnHandler::RunTurn(this, this->_currentTurnQueue);
if (this->_currentTurnQueue->HasCompletedQueue) {
delete this->_currentTurnQueue;
this->_currentTurnQueue = nullptr;
}
}
ChoiceQueue* Battle::GetCurrentTurnQueue() const { return _currentTurnQueue; }
@@ -85,3 +86,7 @@ void Battle::FillRecall(uint8_t side, uint8_t, Creature* c) {
}
void Battle::GetActiveScripts(std::vector<ScriptWrapper>& scripts) { scripts.emplace_back(&_volatile); }
void Battle::SwitchCreature(uint8_t sideIndex, uint8_t index, Creature* c) {
auto side = this->_sides[sideIndex];
side->SetCreature(c, index);
}