Update to latest CreatureLib.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-04-23 23:31:17 +02:00
parent c6a4c87d47
commit 330a24c493
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
3 changed files with 23 additions and 25 deletions

View File

@ -34,7 +34,8 @@ namespace PkmnLib::Battling {
void GetActiveScripts(List<CreatureLib::Battling::ScriptWrapper>& scripts) override {
CreatureLib::Battling::Battle::GetActiveScripts(scripts);
scripts.Append(CreatureLib::Battling::ScriptWrapper(&_weatherScript));
scripts.Append(CreatureLib::Battling::ScriptWrapper(
CreatureLib::Battling::ScriptWrapper::FromScript(&_weatherScript)));
}
};
}

View File

@ -20,28 +20,6 @@ bool PkmnLib::Battling::MiscLibrary::CanFlee(CreatureLib::Battling::FleeTurnChoi
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*
PkmnLib::Battling::MiscLibrary::ReplacementAttack(CreatureLib::Battling::Creature* user,
CreatureLib::Battling::CreatureIndex target) const {

View File

@ -2,10 +2,29 @@
#define PKMNLIB_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 {
~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,
uint8_t hit) const override;
bool CanFlee(CreatureLib::Battling::FleeTurnChoice* switchChoice) const override;