Update to newest version of PkmnLib, parse move target for moves.
This commit is contained in:
parent
a9fb8e2a38
commit
1b45735326
|
@ -26,4 +26,4 @@ class PkmnLibConan(ConanFile):
|
||||||
self.copy("*.dll", "bin", "bin")
|
self.copy("*.dll", "bin", "bin")
|
||||||
|
|
||||||
def requirements(self):
|
def requirements(self):
|
||||||
self.requires("PkmnLib/4ee5a14b4c58b97fa511aad4be7cc0cb039bc634@pkmnlib/master")
|
self.requires("PkmnLib/c91b1b09061f8e063aa37afe9ac2465479683f8e@pkmnlib/master")
|
||||||
|
|
|
@ -50,10 +50,17 @@ PkmnLib::Library::MoveLibrary* BuildMoves::Build(const std::string& path,
|
||||||
auto category = ParseCategory(_category.get<std::string>());
|
auto category = ParseCategory(_category.get<std::string>());
|
||||||
if (static_cast<int>(category) == 255)
|
if (static_cast<int>(category) == 255)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
auto move = new PkmnLib::Library::MoveData(_name.get<std::string>(), type, category, _power.get<uint8_t>(),
|
CreatureLib::Library::AttackTarget target;
|
||||||
_accuracy.get<uint8_t>(), _pp.get<uint8_t>(),
|
try {
|
||||||
CreatureLib::Library::AttackTarget::Any, _priority.get<int8_t>(),
|
target = CreatureLib::Library::AttackTargetHelper::Parse(_target.get<std::string>(), true);
|
||||||
_flags.get<std::unordered_set<std::string>>());
|
} catch (const CreatureException& e) {
|
||||||
|
std::cout << "Invalid target: '" << _target.get<std::string>() << "' for move with name '"
|
||||||
|
<< _name.get<std::string>() << "'\n";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
auto move = new PkmnLib::Library::MoveData(
|
||||||
|
_name.get<std::string>(), type, category, _power.get<uint8_t>(), _accuracy.get<uint8_t>(),
|
||||||
|
_pp.get<uint8_t>(), target, _priority.get<int8_t>(), _flags.get<std::unordered_set<std::string>>());
|
||||||
|
|
||||||
lib->LoadAttack(move->GetName(), move);
|
lib->LoadAttack(move->GetName(), move);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,16 +66,16 @@ PkmnLib::Library::NatureLibrary* BuildNatures::Build(const std::string& path) {
|
||||||
|
|
||||||
auto parsedIncreased = ParseStatistic(increasedStat);
|
auto parsedIncreased = ParseStatistic(increasedStat);
|
||||||
float increasedModifier = 1.1;
|
float increasedModifier = 1.1;
|
||||||
if (parsedIncreased == 254)
|
if (static_cast<int>(parsedIncreased) == 254)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (parsedIncreased == 255)
|
if (static_cast<int>(parsedIncreased) == 255)
|
||||||
increasedModifier = 1.0;
|
increasedModifier = 1.0;
|
||||||
|
|
||||||
auto parsedDecreased = ParseStatistic(decreasedStat);
|
auto parsedDecreased = ParseStatistic(decreasedStat);
|
||||||
float decreasedModifier = 0.9;
|
float decreasedModifier = 0.9;
|
||||||
if (parsedDecreased == 254)
|
if (static_cast<int>(parsedDecreased) == 254)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (parsedDecreased == 255)
|
if (static_cast<int>(parsedDecreased) == 255)
|
||||||
decreasedModifier = 1.0;
|
decreasedModifier = 1.0;
|
||||||
|
|
||||||
std::cout << "Registered nature with name '" << natureName << "'.\n";
|
std::cout << "Registered nature with name '" << natureName << "'.\n";
|
||||||
|
|
Loading…
Reference in New Issue