Update to latest Arbutils.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-12-13 12:32:52 +01:00
parent ecf8582c59
commit bbb2691b91
18 changed files with 152 additions and 164 deletions

View File

@@ -83,7 +83,7 @@ float PkmnLib::Battling::DamageLibrary::GetDamageModifier(CreatureLib::Battling:
PKMN_HOOK(OverrideCriticalModifier, attack, attack, target, hitIndex, &critModifier);
mod *= critModifier;
}
Assert(attack->GetUser()->GetBattle().GetValue());
Ensure(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())) {

View File

@@ -20,9 +20,8 @@ void PkmnLib::Battling::ExperienceLibrary::HandleExperienceGain(
const std::unordered_set<ArbUt::BorrowedPtr<CreatureLib::Battling::Creature>>& opponents) const {
auto fainted = dynamic_cast<Pokemon*>(faintedMon);
AssertNotNull(fainted);
EnsureNotNull(fainted);
auto& forme = fainted->GetForme();
AssertNotNull(forme);
auto expGain = forme->GetBaseExperience();
auto level = fainted->GetLevel();

View File

@@ -7,7 +7,7 @@ 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);
Assert(target->GetBattle().HasValue());
Ensure(target->GetBattle().HasValue());
auto rand = target->GetBattle().GetValue()->GetRandom();
switch (critStage) {
case 0: return rand->Get(24) == 0;

View File

@@ -5,8 +5,6 @@
auto aggregator = source->GetScriptIterator(); \
while (aggregator.HasNext()) { \
auto next = aggregator.GetNext(); \
if (next == nullptr) \
continue; \
auto castNext = next.ForceAs<PkmnLib::Battling::PkmnScript>(); \
castNext->hookName(__VA_ARGS__); \
} \

View File

@@ -49,7 +49,6 @@ namespace PkmnLib::Battling {
err << "Invalid forme '" << _forme << "' for species '" << _forme << "'.";
throw ArbUt::Exception(err.str());
}
AssertNotNull(forme);
CreatureLib::Library::TalentIndex ability;
if (this->_ability.IsEmpty()) {
ability = forme.value()->GetRandomTalent(rand);
@@ -79,10 +78,7 @@ namespace PkmnLib::Battling {
for (size_t i = 0; i < _attacks.Count(); i++) {
auto& kv = _attacks[i];
auto move = kv.Move;
if (move != nullptr)
attacks[i] = new LearnedMove(move, kv.LearnMethod);
else
attacks[i] = nullptr;
attacks[i] = new LearnedMove(move, kv.LearnMethod);
}
auto ivs = CreatureLib::Library::ClampedStatisticSet<uint8_t, 0, 31>(_ivHp, _ivAttack, _ivDefense, _ivSpAtt,
_ivSpDef, _ivSpeed);
@@ -156,7 +152,6 @@ namespace PkmnLib::Battling {
if (_currentMove >= _library->GetSettings()->GetMaximalAttacks()) {
throw ArbUt::Exception("This pokemon already has the maximal allowed moves.");
}
Assert(v.value() != nullptr);
_attacks.Append(ToLearnMethod(v.value(), method));
return *this;
}