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
e7667cec22
commit
df802b561a
|
@ -3,8 +3,8 @@
|
||||||
uint32_t PkmnLib::Battling::DamageLibrary::GetDamage(CreatureLib::Battling::ExecutingAttack* attack,
|
uint32_t PkmnLib::Battling::DamageLibrary::GetDamage(CreatureLib::Battling::ExecutingAttack* attack,
|
||||||
CreatureLib::Battling::Creature* target, uint8_t hitIndex) const {
|
CreatureLib::Battling::Creature* target, uint8_t hitIndex) const {
|
||||||
auto levelMod = static_cast<float>(2 * attack->GetUser()->GetLevel());
|
auto levelMod = static_cast<float>(2 * attack->GetUser()->GetLevel());
|
||||||
auto hit = attack->GetAttackDataForTarget(target)->GetHit(hitIndex);
|
auto hit = attack->GetAttackDataForTarget(target).GetHit(hitIndex);
|
||||||
auto bp = hit->GetBasePower();
|
auto bp = hit.GetBasePower();
|
||||||
auto statMod = GetStatModifier(attack, target, hitIndex);
|
auto statMod = GetStatModifier(attack, target, hitIndex);
|
||||||
// HOOK: Modify stat modifier
|
// HOOK: Modify stat modifier
|
||||||
int damage = static_cast<int>((((levelMod * static_cast<float>(bp) * statMod) / 50) + 2) *
|
int damage = static_cast<int>((((levelMod * static_cast<float>(bp) * statMod) / 50) + 2) *
|
||||||
|
@ -23,10 +23,10 @@ float PkmnLib::Battling::DamageLibrary::GetStatModifier(CreatureLib::Battling::E
|
||||||
uint8_t hitIndex) const {
|
uint8_t hitIndex) const {
|
||||||
auto user = attack->GetUser();
|
auto user = attack->GetUser();
|
||||||
// HOOK: allow overriding for which users stat we use.
|
// HOOK: allow overriding for which users stat we use.
|
||||||
auto hit = attack->GetAttackDataForTarget(target)->GetHit(hitIndex);
|
auto hit = attack->GetAttackDataForTarget(target).GetHit(hitIndex);
|
||||||
CreatureLib::Library::Statistic offensiveStat;
|
CreatureLib::Library::Statistic offensiveStat;
|
||||||
CreatureLib::Library::Statistic defensiveStat;
|
CreatureLib::Library::Statistic defensiveStat;
|
||||||
auto learnedMove = dynamic_cast<LearnedMove*>(attack->GetAttack());
|
auto learnedMove = static_cast<LearnedMove*>(attack->GetAttack());
|
||||||
auto moveData = learnedMove->GetMoveData();
|
auto moveData = learnedMove->GetMoveData();
|
||||||
if (moveData->GetCategory() == Library::MoveCategory::Physical) {
|
if (moveData->GetCategory() == Library::MoveCategory::Physical) {
|
||||||
offensiveStat = Library::Statistic::PhysicalAttack;
|
offensiveStat = Library::Statistic::PhysicalAttack;
|
||||||
|
@ -36,9 +36,9 @@ float PkmnLib::Battling::DamageLibrary::GetStatModifier(CreatureLib::Battling::E
|
||||||
defensiveStat = Library::Statistic::SpecialDefense;
|
defensiveStat = Library::Statistic::SpecialDefense;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bypassDefensive = hit->IsCritical() && target->GetStatBoost(defensiveStat) > 0;
|
auto bypassDefensive = hit.IsCritical() && target->GetStatBoost(defensiveStat) > 0;
|
||||||
// HOOK: allow bypassing defensive stat modifiers.
|
// HOOK: allow bypassing defensive stat modifiers.
|
||||||
auto bypassOffensive = hit->IsCritical() && user->GetStatBoost(offensiveStat) < 0;
|
auto bypassOffensive = hit.IsCritical() && user->GetStatBoost(offensiveStat) < 0;
|
||||||
// HOOK: Allow bypassing offensive stat modifiers.
|
// HOOK: Allow bypassing offensive stat modifiers.
|
||||||
|
|
||||||
float offensiveValue;
|
float offensiveValue;
|
||||||
|
@ -61,8 +61,8 @@ float PkmnLib::Battling::DamageLibrary::GetDamageModifier(CreatureLib::Battling:
|
||||||
CreatureLib::Battling::Creature* target,
|
CreatureLib::Battling::Creature* target,
|
||||||
uint8_t hitIndex) const {
|
uint8_t hitIndex) const {
|
||||||
float mod = 1;
|
float mod = 1;
|
||||||
auto hit = attack->GetAttackDataForTarget(target)->GetHit(hitIndex);
|
auto hit = attack->GetAttackDataForTarget(target).GetHit(hitIndex);
|
||||||
mod *= hit->GetEffectiveness();
|
mod *= hit.GetEffectiveness();
|
||||||
// HOOK: Modify damage modifier.
|
// HOOK: Modify damage modifier.
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue