26 lines
988 B
C++
26 lines
988 B
C++
|
#ifndef CREATURELIB_BATTLERESULT_HPP
|
||
|
#define CREATURELIB_BATTLERESULT_HPP
|
||
|
|
||
|
#include <cstdint>
|
||
|
namespace CreatureLib::Battling {
|
||
|
class BattleResult {
|
||
|
bool _conclusiveResult;
|
||
|
uint8_t _winningSide;
|
||
|
|
||
|
BattleResult(bool conclusiveResult, uint8_t winningSide)
|
||
|
: _conclusiveResult(conclusiveResult), _winningSide(winningSide) {}
|
||
|
|
||
|
public:
|
||
|
static BattleResult Inconclusive() { return BattleResult(false, 0); }
|
||
|
static BattleResult Conclusive(uint8_t winner) { return BattleResult(true, winner); }
|
||
|
static BattleResult Empty() { return BattleResult(false, 0); }
|
||
|
|
||
|
/// Whether or not the battle has ended with a conclusive result.
|
||
|
bool IsConclusiveResult() const { return _conclusiveResult; }
|
||
|
/// Get the index of the side that has won the battle. Only valid if the battle has a conclusive result.
|
||
|
uint8_t GetWinningSide() const { return _winningSide; }
|
||
|
};
|
||
|
}
|
||
|
|
||
|
#endif // CREATURELIB_BATTLERESULT_HPP
|