Skip to content
Snippets Groups Projects
Commit 8b8bea61 authored by Chris Davidson's avatar Chris Davidson
Browse files

Add a combat_precomputed_x property for all of the powers, Accuracy, and...

Add a combat_precomputed_x property for all of the powers, Accuracy, and Defense that lets you set them to a fixed value

This is mostly to make it easy for pets to inherit a snapshot of their summoner's stats at cast without fancy function capture and such.

Ideally we would just add the summoner's raw power to the summon, but at present there is no way to calculate raw power without information loss.
parent c1b55ef0
No related branches found
No related tags found
1 merge request!6091.6.6 misc2.21.14
......@@ -1246,6 +1246,7 @@ end
--- Gets the defense ranged
function _M:combatDefense(fake, add)
if self.combat_precomputed_defense then return self.combat_precomputed_defense end
local base_defense = self:combatDefenseBase(true)
if not fake then base_defense = self:combatDefenseBase() end
local d = math.max(0, base_defense + (add or 0))
......@@ -1255,6 +1256,7 @@ end
--- Gets the defense ranged
function _M:combatDefenseRanged(fake, add)
if self.combat_precomputed_defense then return self.combat_precomputed_defense end
local base_defense = self:combatDefenseBase(true)
if not fake then base_defense = self:combatDefenseBase() end
local d = math.max(0, base_defense + (self.combat_def_ranged or 0) + (add or 0))
......@@ -1341,6 +1343,7 @@ function _M:combatAttackBase(weapon, ammo)
return atk
end
function _M:combatAttack(weapon, ammo)
if self.combat_precomputed_accuracy then return self.combat_precomputed_accuracy end
local stats
if self:attr("use_psi_combat") then stats = (self:getCun(100, true) - 10) * (0.6 + self:callTalent(self.T_RESONANT_FOCUS, "bonus")/100)
elseif weapon and weapon.wil_attack then stats = self:getWil(100, true) - 10
......@@ -1357,6 +1360,7 @@ function _M:combatAttack(weapon, ammo)
end
function _M:combatAttackRanged(weapon, ammo)
if self.combat_precomputed_accuracy then return self.combat_precomputed_accuracy end
local stats
if self:attr("use_psi_combat") then stats = (self:getCun(100, true) - 10) * (0.6 + self:callTalent(self.T_RESONANT_FOCUS, "bonus")/100)
elseif weapon and weapon.wil_attack then stats = self:getWil(100, true) - 10
......@@ -1689,6 +1693,7 @@ function _M:combatDamagePower(weapon_combat, add)
end
function _M:combatPhysicalpower(mod, weapon, add)
if self.combat_precomputed_physpower then return self.combat_precomputed_physpower end
mod = mod or 1
add = add or 0
......@@ -1744,6 +1749,7 @@ end
--- Gets spellpower
function _M:combatSpellpower(mod, add)
if self.combat_precomputed_spellpower then return self.combat_precomputed_spellpower end
mod = mod or 1
add = add or 0
......@@ -2059,6 +2065,8 @@ end
--- Gets mindpower
function _M:combatMindpower(mod, add)
if self.combat_precomputed_mindpower then return self.combat_precomputed_mindpower end
mod = mod or 1
add = add or 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment