So I would suggest to automatically replace an existing shield if:
1/ the duration of the old shield is not longer than the duration of the arcane shield (3 or 4 if Shielding is maxed)
2/ the present power of the old shield is <= (power of the new arcane shield)
3/ the max power of the old shield is <= 2 * (power of the new shield) (in case the player wants to refill it with Aegis).
There can some more sophisticated way to deal with that, taking into account aegis/Shielding boost and the actual aegis/Aegis refill value, but this method is simple and catches all the small shields (and the user always as the option to previously cancel its present shield).
Here is the code to insert in mod/class/Actor.lua
Code: Select all
if self:attr("arcane_shield") and value > 0 then
local eff = self:hasEffect(self.EFF_DAMAGE_SHIELD)
if not eff or (
eff
and (eff.dur <= 3 + self.shield_dur)
and (100 * self.damage_shield_absorb <= value * self.arcane_shield)
and (50 * self.damage_shield_absorb_max <= value * self.arcane_shield)
) then
self:setEffect(self.EFF_DAMAGE_SHIELD, 3, {power=value * self.arcane_shield / 100})
end
end