Update to new Arbutils memory model.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-12-12 14:25:27 +01:00
parent b6a5e41b51
commit 53bd6e7a94
19 changed files with 87 additions and 74 deletions

View File

@@ -83,7 +83,8 @@ float PkmnLib::Battling::DamageLibrary::GetDamageModifier(CreatureLib::Battling:
PKMN_HOOK(OverrideCriticalModifier, attack, attack, target, hitIndex, &critModifier);
mod *= critModifier;
}
float randPercentage = 85 + attack->GetUser()->GetBattle()->GetRandom()->Get(0, 16);
Assert(attack->GetUser()->GetBattle().GetValue());
float randPercentage = 85 + attack->GetUser()->GetBattle().GetValue()->GetRandom()->Get(0, 16);
mod *= randPercentage / 100.0;
if (attack->GetUser()->HasType(hitData.GetType())) {
float stabModifier = 1.5;

View File

@@ -36,12 +36,12 @@ void PkmnLib::Battling::ExperienceLibrary::HandleExperienceGain(
}
auto battle = fainted->GetBattle();
if (battle == nullptr) {
if (!battle.HasValue()) {
return;
}
std::unordered_set<CreatureLib::Battling::Creature*> shareExperience;
for (const auto& party : battle->GetParties()) {
for (const auto& party : battle.GetValue()->GetParties()) {
for (const auto& mon : party->GetParty()->GetParty()) {
if (mon == nullptr)
continue;

View File

@@ -7,7 +7,8 @@ bool PkmnLib::Battling::MiscLibrary::IsCritical(CreatureLib::Battling::Executing
CreatureLib::Battling::Creature* target, uint8_t hit) const {
uint8_t critStage = 0;
PKMN_HOOK(ModifyCriticalStage, attack, attack, target, hit, &critStage);
auto rand = target->GetBattle()->GetRandom();
Assert(target->GetBattle().HasValue());
auto rand = target->GetBattle().GetValue()->GetRandom();
switch (critStage) {
case 0: return rand->Get(24) == 0;
case 1: return rand->Get(8) == 0;