Pass ExecutingAttack for target as pointer instead of reference.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
252be18630
commit
579ee82f02
|
@ -3,7 +3,7 @@
|
||||||
using namespace CreatureLib::Battling;
|
using namespace CreatureLib::Battling;
|
||||||
int DamageLibrary::GetDamage(ExecutingAttack* attack, Creature* target, uint8_t hitIndex) const {
|
int DamageLibrary::GetDamage(ExecutingAttack* attack, 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
|
||||||
|
@ -22,7 +22,7 @@ int DamageLibrary::GetBasePower(ExecutingAttack* attack, Creature* target, uint8
|
||||||
float DamageLibrary::GetStatModifier(ExecutingAttack* attack, Creature* target, uint8_t hitIndex) const {
|
float DamageLibrary::GetStatModifier(ExecutingAttack* attack, Creature* target, 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);
|
||||||
Core::Statistic offensiveStat;
|
Core::Statistic offensiveStat;
|
||||||
Core::Statistic defensiveStat;
|
Core::Statistic defensiveStat;
|
||||||
if (attack->GetAttack()->GetAttack()->GetCategory() == Library::AttackCategory::Physical) {
|
if (attack->GetAttack()->GetAttack()->GetCategory() == Library::AttackCategory::Physical) {
|
||||||
|
@ -57,7 +57,7 @@ float DamageLibrary::GetStatModifier(ExecutingAttack* attack, Creature* target,
|
||||||
|
|
||||||
float DamageLibrary::GetDamageModifier(ExecutingAttack* attack, Creature* target, uint8_t hitIndex) const {
|
float DamageLibrary::GetDamageModifier(ExecutingAttack* attack, Creature* target, 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;
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace CreatureLib::Battling {
|
||||||
|
|
||||||
virtual ~ExecutingAttack() { delete _script; };
|
virtual ~ExecutingAttack() { delete _script; };
|
||||||
|
|
||||||
TargetData& GetAttackDataForTarget(Creature* creature) { return _targets[creature]; }
|
TargetData* GetAttackDataForTarget(Creature* creature) { return &_targets[creature]; }
|
||||||
|
|
||||||
bool IsCreatureTarget(Creature* creature) { return _targets.find(creature) != _targets.end(); }
|
bool IsCreatureTarget(Creature* creature) { return _targets.find(creature) != _targets.end(); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue