Use GetUseAttack for executingmove
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-05-13 13:25:08 +02:00
parent d8eac290cf
commit 59a092a06e
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 6 additions and 3 deletions

View File

@ -30,7 +30,7 @@ uint8_t PkmnLib::Battling::DamageLibrary::GetBasePower(CreatureLib::Battling::Ex
[[maybe_unused]] CreatureLib::Battling::Creature* target,
[[maybe_unused]] uint8_t hitIndex,
[[maybe_unused]] const HitData& hitData) const {
auto bp = attack->GetAttack()->GetAttack()->GetBasePower();
auto bp = attack->GetUseAttack()->GetBasePower();
// HOOK: modify base power.
return bp;
}
@ -41,8 +41,7 @@ float PkmnLib::Battling::DamageLibrary::GetStatModifier(CreatureLib::Battling::E
// HOOK: allow overriding for which users stat we use.
CreatureLib::Library::Statistic offensiveStat;
CreatureLib::Library::Statistic defensiveStat;
auto learnedMove = attack->GetAttack().ForceAs<LearnedMove>();
auto moveData = learnedMove->GetMoveData();
auto moveData = attack->GetUseAttack().ForceAs<const Library::MoveData>();
if (moveData->GetCategory() == Library::MoveCategory::Physical) {
offensiveStat = Library::Statistic::PhysicalAttack;
defensiveStat = Library::Statistic::PhysicalDefense;

View File

@ -8,6 +8,7 @@ void RegisterExecutingAttack::Register(asIScriptEngine* engine) {
}
BORROWED_PTR_GETTER_FUNC(CreatureLib::Battling::ExecutingAttack, CreatureLib::Battling::Creature, GetUser);
BORROWED_PTR_GETTER_FUNC(CreatureLib::Battling::ExecutingAttack, CreatureLib::Battling::LearnedAttack, GetAttack);
BORROWED_PTR_GETTER_FUNC(CreatureLib::Battling::ExecutingAttack, const CreatureLib::Library::AttackData, GetUseAttack);
static CreatureLib::Battling::ExecutingAttack::HitData*
GetHitDataWrapper(CreatureLib::Battling::ExecutingAttack* obj, CreatureLib::Battling::Creature* c, uint8_t hit) {
return &obj->GetHitData(c, hit);
@ -60,4 +61,7 @@ void RegisterExecutingAttack::RegisterExecutingAttackType(asIScriptEngine* engin
r = engine->RegisterObjectMethod("ExecutingMove", "LearnedMove@ get_Move() const property",
asFUNCTION(GetAttackWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("ExecutingMove", "MoveData@ get_UseMove() const property",
asFUNCTION(GetUseAttackWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
}