67 lines
2.0 KiB
C++
67 lines
2.0 KiB
C++
// Copyright (c) 2022 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#include "PokerDetermineBetterEvent.hpp"
|
|
|
|
using namespace Dawn;
|
|
|
|
PokerDetermineBetterEvent::PokerDetermineBetterEvent(VisualNovelManager *man) :
|
|
PokerGameEvent(man)
|
|
{
|
|
std::cout << "Inited determine better" << std::endl << std::endl;
|
|
}
|
|
|
|
void PokerDetermineBetterEvent::onStart(IVisualNovelEvent *previous) {
|
|
PokerGameEvent::onStart(previous);
|
|
|
|
std::cout << "better evt" << std::endl;
|
|
|
|
if(this->pokerGame->getRemainingPlayersCount() <= 1) {
|
|
this->then(this->eventEveryoneFolded);
|
|
this->eventEveryoneFolded = nullptr;
|
|
std::cout << "Everyone folded" << std::endl;
|
|
return;
|
|
}
|
|
|
|
uint8_t nextBetterIndex = this->pokerGame->getNextBetterIndex();
|
|
if(nextBetterIndex == 0xFF) {
|
|
if(this->pokerGame->getCountOfCardsToTurn() == 0xFF) {
|
|
this->then(this->eventBettingFinished);
|
|
this->eventBettingFinished = nullptr;
|
|
std::cout << "Betting Finished" << std::endl;
|
|
} else {
|
|
this->then(this->eventTurn);
|
|
this->eventTurn = nullptr;
|
|
std::cout << "Turn Time?" << std::endl;
|
|
}
|
|
return;
|
|
}
|
|
|
|
auto nextBetter = this->pokerGame->players[nextBetterIndex];
|
|
if(nextBetter->isHuman) {
|
|
this->then(this->eventHumanBet);
|
|
this->eventHumanBet = nullptr;
|
|
std::cout << "Human Better" << std::endl;
|
|
} else {
|
|
this->then(this->eventAiBet);
|
|
this->eventAiBet = nullptr;
|
|
std::cout << "AI Better" << std::endl;
|
|
}
|
|
}
|
|
|
|
bool_t PokerDetermineBetterEvent::onUpdate() {
|
|
return false;
|
|
}
|
|
|
|
void PokerDetermineBetterEvent::onEnd() {
|
|
}
|
|
|
|
PokerDetermineBetterEvent::~PokerDetermineBetterEvent() {
|
|
if(this->eventEveryoneFolded != nullptr) delete this->eventEveryoneFolded;
|
|
if(this->eventBettingFinished != nullptr) delete this->eventBettingFinished;
|
|
if(this->eventTurn != nullptr) delete this->eventTurn;
|
|
if(this->eventAiBet != nullptr) delete this->eventAiBet;
|
|
if(this->eventHumanBet != nullptr) delete this->eventHumanBet;
|
|
} |