HousePet wrote:
For number 2:
Ice Core is using the updated functionality that was added later to avoid all the messy and easy to break with typos system used by Body of Fire.
You can either convert Body of Fire to the new system by copying Ice Core, or just add in the new lines to the activate and deactivate to Body of Fire.
Thanks, that was very helpful. Copying over wasn't working for me so I eventually just added the new lines.
Does anyone understand explosion expert? It's very convoluted.
Full code :
Code:
getRadius = function(self, t) return math.max(1, math.floor(self:combatTalentScale(t, 2, 6, 0.5, 0, 0, true))) end,
minmax = function(self, t, grids)
local theoretical_nb = (2 * t.getRadius(self, t) + 1)^1.94 -- Maximum grids hit vs. talent level
if grids then
local lostgrids = math.max(theoretical_nb - grids, 0)
local mult = math.max(0,math.log10(lostgrids)) / (6 - math.min(self:getTalentLevel(self.T_EXPLOSION_EXPERT), 5))
print("Adjusting explosion damage to account for ", lostgrids, " lost tiles => ", mult * 100)
return mult
else
local min = 1
local min = (math.log10(min) / (6 - math.min(self:getTalentLevel(t), 5)))
local max = theoretical_nb
local max = (math.log10(max) / (6 - math.min(self:getTalentLevel(t), 5)))
return min, max
end
end,
Parts I'm curious about :
Quote:
getRadius = function(self, t) return math.max(1, math.floor(self:combatTalentScale(t, 2, 6, 0.5, 0, 0, true))) end,
What is the point of the initial 1 in math.max(
1, math.floor), and similarly, what do the last few numbers represent in combatTalentScale(t, 2, 6, 0.5, 0, 0, true))) ? I can tell that t is talent level, 2 is ithe initial bonus, 6 is the max bonus, and I'm guessing 0.5 is the increment amount per talent level. So what are the 0, 0, true for? (This is commented on other similar talents, but I didn't see any with this many numbers that were documented). I know that at the end of the day, this is going to return 6 at most, but I'm still puzzled by the rest of it.
The other part of the code I'm unsure of :
Code:
local theoretical_nb = (2 * t.getRadius(self, t) + 1)^1.94 -- Maximum grids hit vs. talent level
if grids then
What does if grids refer to? Does it mean if grids exist? Normally in a if statement there's a condition like if grids>0, instead it's just "if grids".
Possibly relevant sections from Throw bomb:
Code:
if self:knowTalent(self.T_EXPLOSION_EXPERT) then
local nb = 0
local grids = self:project(tg, x, y, function(tx, ty) end)
if grids then for px, ys in pairs(grids or {}) do for py, _ in pairs(ys) do nb = nb + 1 end end end
if nb > 0 then
dam = dam + dam * self:callTalent(self.T_EXPLOSION_EXPERT, "minmax", nb)
end
end
Only place in throw bomb/explosion expert I could find grids defined :
Code:
local grids = self:project(tg, x, y, function(tx, ty)
local d = dam
local target = game.level.map(tx, ty, Map.ACTOR)
-- Protect yourself
if tx == self.x and ty == self.y then
d = dam * (1 - prot)
-- Protect the golem
elseif golem and tx == golem.x and ty == golem.y then
d = dam * (1 - prot)
if self:isTalentActive(self.T_FROST_INFUSION) and self:knowTalent(self.T_ICE_ARMOUR) then
self:callTalent(self.T_ICE_ARMOUR, "applyEffect", golem)
elseif self:isTalentActive(self.T_ACID_INFUSION) and self:knowTalent(self.T_CAUSTIC_GOLEM) then
self:callTalent(self.T_CAUSTIC_GOLEM, "applyEffect", golem)
elseif self:isTalentActive(self.T_LIGHTNING_INFUSION) and self:knowTalent(self.T_DYNAMIC_RECHARGE) then
self:callTalent(self.T_DYNAMIC_RECHARGE, "applyEffect", golem)
end
else -- reduced damage to friendly npcs (could make random chance like friendlyfire instead)
if target and self:reactionToward(target) >= 0 then d = dam * (1 - prot) end
end
if d <= 0 then return end
-- local target = game.level.map(tx, ty, Map.ACTOR)
dam_done = dam_done + DamageType:get(damtype).projector(self, tx, ty, damtype, d, tmp)
if ammo.alchemist_bomb and ammo.alchemist_bomb.splash then
DamageType:get(DamageType[ammo.alchemist_bomb.splash.type]).projector(self, tx, ty, DamageType[ammo.alchemist_bomb.splash.type], ammo.alchemist_bomb.splash.dam)
end
if not target then return end
if ammo.alchemist_bomb and ammo.alchemist_bomb.stun and rng.percent(ammo.alchemist_bomb.stun.chance) and target:canBe("stun") then
target:setEffect(target.EFF_STUNNED, ammo.alchemist_bomb.stun.dur, {apply_power=self:combatSpellpower()})
end
if ammo.alchemist_bomb and ammo.alchemist_bomb.daze and rng.percent(ammo.alchemist_bomb.daze.chance) and target:canBe("stun") then
target:setEffect(target.EFF_DAZED, ammo.alchemist_bomb.daze.dur, {apply_power=self:combatSpellpower()})
end
end)