Adds function to learn move.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
b32639cc1a
commit
021b3a4802
|
@ -136,6 +136,15 @@ class BattleFunctions {
|
|||
return b;
|
||||
}
|
||||
|
||||
static void LearnMove(PkmnLib::Battling::Pokemon* user, const ArbUt::StringView& moveName) {
|
||||
auto move = Globals::Library.GetValue()->GetMoveLibrary()->TryGet(moveName);
|
||||
if (!move.has_value()) {
|
||||
THROW("Unknown move: " << moveName);
|
||||
}
|
||||
user->AddAttack(
|
||||
new PkmnLib::Battling::LearnedMove(move.value(), CreatureLib::Battling::AttackLearnMethod::Unknown));
|
||||
}
|
||||
|
||||
public:
|
||||
static void Register(AngelScriptResolver* scriptResolver) {
|
||||
auto engine = scriptResolver->GetBuilder().GetEngine();
|
||||
|
@ -152,6 +161,8 @@ public:
|
|||
asFUNCTION(UseMove), asCALL_CDECL_OBJFIRST) >= 0);
|
||||
Ensure(engine->RegisterObjectMethod("Pokemon", "bool PassTurn()", asFUNCTION(PassTurn),
|
||||
asCALL_CDECL_OBJFIRST) >= 0);
|
||||
Ensure(engine->RegisterObjectMethod("Pokemon", "bool LearnMove(const constString&in move)",
|
||||
asFUNCTION(LearnMove), asCALL_CDECL_OBJFIRST) >= 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue