Update to latest CreatureLib.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
c6a4c87d47
commit
330a24c493
|
@ -34,7 +34,8 @@ namespace PkmnLib::Battling {
|
||||||
|
|
||||||
void GetActiveScripts(List<CreatureLib::Battling::ScriptWrapper>& scripts) override {
|
void GetActiveScripts(List<CreatureLib::Battling::ScriptWrapper>& scripts) override {
|
||||||
CreatureLib::Battling::Battle::GetActiveScripts(scripts);
|
CreatureLib::Battling::Battle::GetActiveScripts(scripts);
|
||||||
scripts.Append(CreatureLib::Battling::ScriptWrapper(&_weatherScript));
|
scripts.Append(CreatureLib::Battling::ScriptWrapper(
|
||||||
|
CreatureLib::Battling::ScriptWrapper::FromScript(&_weatherScript)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,28 +20,6 @@ bool PkmnLib::Battling::MiscLibrary::CanFlee(CreatureLib::Battling::FleeTurnChoi
|
||||||
return CreatureLib::Battling::MiscLibrary::CanFlee(switchChoice);
|
return CreatureLib::Battling::MiscLibrary::CanFlee(switchChoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CreatureLib::Battling::LearnedAttack* replacementAttack = nullptr;
|
|
||||||
static PkmnLib::Library::MoveData* replacementMove = nullptr;
|
|
||||||
|
|
||||||
static PkmnLib::Library::MoveData* GetReplacementAttackData() {
|
|
||||||
if (replacementMove == nullptr) {
|
|
||||||
replacementMove =
|
|
||||||
new PkmnLib::Library::MoveData("struggle"_cnc, 0, PkmnLib::Library::MoveCategory::Physical, 50, 255, 10,
|
|
||||||
CreatureLib::Library::AttackTarget::Any, 0,
|
|
||||||
new CreatureLib::Library::SecondaryEffect(-1, "struggle"_cnc, {}), {});
|
|
||||||
}
|
|
||||||
return replacementMove;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CreatureLib::Battling::LearnedAttack* GetReplacementAttack() {
|
|
||||||
if (replacementAttack == nullptr) {
|
|
||||||
replacementAttack = new PkmnLib::Battling::LearnedMove(GetReplacementAttackData(),
|
|
||||||
CreatureLib::Battling::AttackLearnMethod::Unknown);
|
|
||||||
}
|
|
||||||
replacementAttack->RestoreAllUses();
|
|
||||||
return replacementAttack;
|
|
||||||
}
|
|
||||||
|
|
||||||
CreatureLib::Battling::BaseTurnChoice*
|
CreatureLib::Battling::BaseTurnChoice*
|
||||||
PkmnLib::Battling::MiscLibrary::ReplacementAttack(CreatureLib::Battling::Creature* user,
|
PkmnLib::Battling::MiscLibrary::ReplacementAttack(CreatureLib::Battling::Creature* user,
|
||||||
CreatureLib::Battling::CreatureIndex target) const {
|
CreatureLib::Battling::CreatureIndex target) const {
|
||||||
|
|
|
@ -2,10 +2,29 @@
|
||||||
#define PKMNLIB_MISCLIBRARY_HPP
|
#define PKMNLIB_MISCLIBRARY_HPP
|
||||||
|
|
||||||
#include <CreatureLib/Battling/Library/MiscLibrary.hpp>
|
#include <CreatureLib/Battling/Library/MiscLibrary.hpp>
|
||||||
|
#include "../../Library/Moves/MoveData.hpp"
|
||||||
|
#include "../Pokemon/LearnedMove.hpp"
|
||||||
|
|
||||||
namespace PkmnLib::Battling {
|
namespace PkmnLib::Battling {
|
||||||
class MiscLibrary : public CreatureLib::Battling::MiscLibrary {
|
class MiscLibrary : public CreatureLib::Battling::MiscLibrary {
|
||||||
~MiscLibrary() override = default;
|
PkmnLib::Library::MoveData* _struggleData =
|
||||||
|
new PkmnLib::Library::MoveData("struggle"_cnc, 0, PkmnLib::Library::MoveCategory::Physical, 50, 255, 10,
|
||||||
|
CreatureLib::Library::AttackTarget::Any, 0,
|
||||||
|
new CreatureLib::Library::SecondaryEffect(-1, "struggle"_cnc, {}), {});
|
||||||
|
;
|
||||||
|
CreatureLib::Battling::LearnedAttack* _struggle =
|
||||||
|
new PkmnLib::Battling::LearnedMove(_struggleData, CreatureLib::Battling::AttackLearnMethod::Unknown);
|
||||||
|
|
||||||
|
[[nodiscard]] CreatureLib::Battling::LearnedAttack* GetReplacementAttack() const {
|
||||||
|
_struggle->RestoreAllUses();
|
||||||
|
return _struggle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
~MiscLibrary() override {
|
||||||
|
delete _struggle;
|
||||||
|
delete _struggleData;
|
||||||
|
};
|
||||||
bool IsCritical(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
|
bool IsCritical(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
|
||||||
uint8_t hit) const override;
|
uint8_t hit) const override;
|
||||||
bool CanFlee(CreatureLib::Battling::FleeTurnChoice* switchChoice) const override;
|
bool CanFlee(CreatureLib::Battling::FleeTurnChoice* switchChoice) const override;
|
||||||
|
|
Loading…
Reference in New Issue