11 std::string convPath(
const std::string& src) {
17 : sourceFile(std::move(data.sourceFile))
18 , _name(std::move(data.name))
19 , loseDialog(std::move(data.lostBattleLine))
20 , visionRange(data.visionRange)
21 , peoplemon(std::move(data.peoplemon))
22 , _items(std::move(data.items))
25 if (!beforeBattle.
load(convPath(data.prebattleConversation))) {
26 BL_LOG_ERROR <<
"Failed to load trainer before battle conversation: "
27 << data.prebattleConversation;
28 #ifdef PEOPLEMON_DEBUG
32 if (!afterBattle.
load(convPath(data.postBattleConversation))) {
33 BL_LOG_ERROR <<
"Failed to load trainer after battle conversation: "
34 << data.postBattleConversation;
35 #ifdef PEOPLEMON_DEBUG
53 const std::vector<pplmn::OwnedPeoplemon>&
Trainer::team()
const {
return peoplemon; }
Core classes and functionality for both the editor and game.
Trainer(file::Trainer &&trainer)
Construct a new Trainer component.
const std::string & loseBattleDialog() const
Dialog line said in battle screen when battle is lost.
const std::string & name() const
The name of the NPC.
bool defeated() const
Returns whether or not this trainer was defeated.
const file::Conversation & beforeBattleConversation() const
The conversation before battle is entered.
std::uint8_t range() const
Returns how far the trainer can see in tiles.
const std::vector< item::Id > & items() const
Returns the items the trainer has.
const std::string & file() const
Returns the file the trainer was spawned from.
const file::Conversation & afterBattleConversation() const
The conversation used after battle if interacted again.
const std::vector< pplmn::OwnedPeoplemon > & team() const
Returns the team of peoplemon the trainer has.
void setDefeated()
Marks this trainer as defeated.
std::uint8_t basePayout() const
Returns the base payout of the trainer.
Stores a conversation that an NPC or trainer can have with the player.
bool load(const std::string &file)
Loads the conversation from the given file.
static Conversation makeLoadError(const std::string &filename)
Helper function to create a conversation that reports an error if in debug mode.
Static data for trainers in the world.
static const std::string & ConversationPath()