Adds creature Switch event.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define CREATURELIB_EVENTDATA_HPP
|
||||
|
||||
#include <Arbutils/Memory/BorrowedPtr.hpp>
|
||||
#include "../Models/CreatureIndex.hpp"
|
||||
#include "../Models/DamageSource.hpp"
|
||||
#include "EventDataKind.hpp"
|
||||
|
||||
@@ -54,6 +55,18 @@ namespace CreatureLib::Battling {
|
||||
const ArbUt::BorrowedPtr<Creature>& GetCreature() const noexcept { return _creature; }
|
||||
};
|
||||
|
||||
class SwitchEvent : public EventData {
|
||||
CreatureIndex _index;
|
||||
ArbUt::BorrowedPtr<Creature> _newCreature;
|
||||
|
||||
public:
|
||||
SwitchEvent(const CreatureIndex& index, const ArbUt::BorrowedPtr<Creature>& newCreature)
|
||||
: _index(index), _newCreature(newCreature) {}
|
||||
EventDataKind GetKind() const noexcept override { return EventDataKind ::Switch; }
|
||||
const CreatureIndex& GetIndex() const noexcept { return _index; }
|
||||
const ArbUt::BorrowedPtr<Creature>& GetNewCreature() const noexcept { return _newCreature; }
|
||||
};
|
||||
|
||||
class DisplayTextEvent : public EventData {
|
||||
const ArbUt::StringView _text;
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include <Arbutils/Enum.hpp>
|
||||
|
||||
namespace CreatureLib::Battling {
|
||||
ENUM(EventDataKind, uint8_t, Damage, Heal, Faint, DisplayText)
|
||||
|
||||
ENUM(EventDataKind, uint8_t, Damage, Heal, Faint, Switch, DisplayText)
|
||||
}
|
||||
|
||||
#endif // CREATURELIB_EVENTDATAKIND_HPP
|
||||
|
||||
Reference in New Issue
Block a user