1 #ifndef CORE_PEOPLEMON_OWNEDMOVE_HPP
2 #define CORE_PEOPLEMON_OWNEDMOVE_HPP
4 #include <BLIB/Serialization.hpp>
64 if (!IdSerializer::serialize(output, v.
id))
return false;
65 if (!output.write<std::uint8_t>(v.
curPP))
return false;
66 if (!output.write<std::uint8_t>(v.
maxPP))
return false;
71 if (!IdSerializer::deserialize(input, v.
id))
return false;
73 if (!input.read<std::uint8_t>(t))
return false;
75 if (!input.read<std::uint8_t>(t))
return false;
81 return IdSerializer::size(v.
id) +
sizeof(std::uint8_t) * 2;
88 struct SerializableObject<
core::pplmn::OwnedMove> :
public SerializableObjectBase {
92 SerializableField<1, Move, Id>
id;
93 SerializableField<2, Move, unsigned int>
curPP;
94 SerializableField<3, Move, unsigned int>
maxPP;
97 : SerializableObjectBase(
"OwnedMove")
98 , id(
"id", *this, &
Move::id, SerializableFieldBase::Required{})
99 , curPP(
"pp", *this, &
Move::curPP, SerializableFieldBase::Required{})
100 , maxPP(
"maxPP", *this, &
Move::maxPP, SerializableFieldBase::Required{}) {}
Core classes and functionality for both the editor and game.
bl::serial::json::Serializer< Player > Serializer
Represents a move owned by a peoplemon.
void restorePP(int pp)
Restores some pp to the move.
unsigned int maxPP
The pp to restore to. Increased max pp is stored here.
unsigned int curPP
The current pp of the move.
OwnedMove()
Creates an empty Unknown move with 0 pp.
MoveId id
The id of the move.
static bool serialize(OutputStream &output, const OwnedMove &v)
static bool deserialize(InputStream &input, OwnedMove &v)
Serializer< core::pplmn::MoveId > IdSerializer
static std::size_t size(const OwnedMove &v)
SerializableField< 2, Move, unsigned int > curPP
SerializableField< 1, Move, Id > id
SerializableField< 3, Move, unsigned int > maxPP