Skip to content

Commit

Permalink
[3.25] Vaal Pact implementation (#7732)
Browse files Browse the repository at this point in the history
* Vaal Pact implementation

* disable UsingLifeFlask condition

* Fix non-instant sources of leech being disabled

---------

Co-authored-by: LocalIdentity <localidentity2@gmail.com>
  • Loading branch information
Nostrademous and LocalIdentity authored Jul 21, 2024
1 parent 694ff6f commit 75b4e82
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
23 changes: 13 additions & 10 deletions src/Modules/CalcDefence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1005,14 +1005,12 @@ function calcs.defence(env, actor)
"Total: "..output.SpellDodgeChance+output.SpellDodgeChanceOverCap.."%",
}
end

-- Gain on Block
output.LifeOnBlock = modDB:Sum("BASE", nil, "LifeOnBlock")
output.ManaOnBlock = modDB:Sum("BASE", nil, "ManaOnBlock")
output.EnergyShieldOnBlock = modDB:Sum("BASE", nil, "EnergyShieldOnBlock")

-- Recovery modifiers
output.LifeRecoveryRateMod = calcLib.mod(modDB, nil, "LifeRecoveryRate")
output.LifeRecoveryRateMod = 1
if not modDB:Flag(nil, "CannotRecoverLifeOutsideLeech") then
output.LifeRecoveryRateMod = calcLib.mod(modDB, nil, "LifeRecoveryRate")
end
output.ManaRecoveryRateMod = calcLib.mod(modDB, nil, "ManaRecoveryRate")
output.EnergyShieldRecoveryRateMod = calcLib.mod(modDB, nil, "EnergyShieldRecoveryRate")

Expand Down Expand Up @@ -1131,7 +1129,7 @@ function calcs.defence(env, actor)
end

-- Energy Shield Recharge
output.EnergyShieldRechargeAppliesToLife = modDB:Flag(nil, "EnergyShieldRechargeAppliesToLife")
output.EnergyShieldRechargeAppliesToLife = modDB:Flag(nil, "EnergyShieldRechargeAppliesToLife") and not modDB:Flag(nil, "CannotRecoverLifeOutsideLeech")
output.EnergyShieldRechargeAppliesToEnergyShield = not (modDB:Flag(nil, "NoEnergyShieldRecharge") or modDB:Flag(nil, "CannotGainEnergyShield") or output.EnergyShieldRechargeAppliesToLife)

if output.EnergyShieldRechargeAppliesToLife or output.EnergyShieldRechargeAppliesToEnergyShield then
Expand Down Expand Up @@ -1288,13 +1286,18 @@ function calcs.defence(env, actor)
end

-- recovery on block, needs to be after primary defences
output.LifeOnBlock = modDB:Sum("BASE", nil, "LifeOnBlock")
output.LifeOnBlock = 0
output.LifeOnSuppress = 0
if not modDB:Flag(nil, "CannotRecoverLifeOutsideLeech") then
output.LifeOnBlock = modDB:Sum("BASE", nil, "LifeOnBlock")
output.LifeOnSuppress = modDB:Sum("BASE", nil, "LifeOnSuppress")
end

output.ManaOnBlock = modDB:Sum("BASE", nil, "ManaOnBlock")

output.EnergyShieldOnBlock = modDB:Sum("BASE", nil, "EnergyShieldOnBlock")
output.EnergyShieldOnSpellBlock = modDB:Sum("BASE", nil, "EnergyShieldOnSpellBlock")

output.EnergyShieldOnSuppress = modDB:Sum("BASE", nil, "EnergyShieldOnSuppress")
output.LifeOnSuppress = modDB:Sum("BASE", nil, "LifeOnSuppress")

-- damage avoidances
output.specificTypeAvoidance = false
Expand Down
4 changes: 2 additions & 2 deletions src/Modules/CalcOffence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3223,7 +3223,7 @@ function calcs.offence(env, actor, activeSkill)
output.EnergyShieldOnHit = 0
output.ManaOnHit = 0
else
output.LifeOnHit = not skillModList:Flag(cfg, "CannotGainLife") and (skillModList:Sum("BASE", cfg, "LifeOnHit") + enemyDB:Sum("BASE", cfg, "SelfLifeOnHit")) or 0
output.LifeOnHit = not skillModList:Flag(cfg, "CannotGainLife") and not skillModList:Flag(cfg, "CannotRecoverLifeOutsideLeech") and (skillModList:Sum("BASE", cfg, "LifeOnHit") + enemyDB:Sum("BASE", cfg, "SelfLifeOnHit")) or 0
output.EnergyShieldOnHit = not skillModList:Flag(cfg, "CannotGainEnergyShield") and (skillModList:Sum("BASE", cfg, "EnergyShieldOnHit") + enemyDB:Sum("BASE", cfg, "SelfEnergyShieldOnHit")) or 0
output.ManaOnHit = not skillModList:Flag(cfg, "CannotGainMana") and (skillModList:Sum("BASE", cfg, "ManaOnHit") + enemyDB:Sum("BASE", cfg, "SelfManaOnHit")) or 0
end
Expand All @@ -3237,7 +3237,7 @@ function calcs.offence(env, actor, activeSkill)
output.EnergyShieldOnKill = 0
output.ManaOnKill = 0
else
output.LifeOnKill = not skillModList:Flag(cfg, "CannotGainLife") and (m_floor(skillModList:Sum("BASE", cfg, "LifeOnKill"))) or 0
output.LifeOnKill = not skillModList:Flag(cfg, "CannotGainLife") and not skillModList:Flag(cfg, "CannotRecoverLifeOutsideLeech") and (m_floor(skillModList:Sum("BASE", cfg, "LifeOnKill"))) or 0
output.EnergyShieldOnKill = not skillModList:Flag(cfg, "CannotGainEnergyShield") and (m_floor(skillModList:Sum("BASE", cfg, "EnergyShieldOnKill"))) or 0
output.ManaOnKill = not skillModList:Flag(cfg, "CannotGainMana") and (m_floor(skillModList:Sum("BASE", cfg, "ManaOnKill"))) or 0
end
Expand Down
4 changes: 2 additions & 2 deletions src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1447,15 +1447,15 @@ function calcs.perform(env, skipEHP)
flaskBuffsPerBaseNonPlayer[item.baseName] = flaskBuffsPerBaseNonPlayer[item.baseName] or {}
flaskConditions["UsingFlask"] = true
flaskConditions["Using"..item.baseName:gsub("%s+", "")] = true
if item.base.flask.life then
if item.base.flask.life and not modDB:Flag(nil, "CannotRecoverLifeOutsideLeech") then
flaskConditions["UsingLifeFlask"] = true
end
if item.base.flask.mana then
flaskConditions["UsingManaFlask"] = true
end

if onlyRecovery then
if item.base.flask.life then
if item.base.flask.life and not modDB:Flag(nil, "CannotRecoverLifeOutsideLeech") then
calcFlaskMods(item, "LifeFlask", calcFlaskRecovery("Life", item), {})
end
if item.base.flask.mana then
Expand Down
5 changes: 5 additions & 0 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2711,6 +2711,7 @@ local specialModList = {
["attacks with this weapon deal double damage to chilled enemies"] = { mod("DoubleDamageChance", "BASE", 100, nil, ModFlag.Hit, { type = "Condition", var = "{Hand}Attack" }, { type = "SkillType", skillType = SkillType.Attack }, { type = "ActorCondition", actor = "enemy", var = "Chilled" }) },
["life leech from hits with this weapon applies instantly"] = { mod("InstantLifeLeech", "BASE", 100, { type = "Condition", var = "{Hand}Attack" }) },
["life leech from hits with this weapon is instant"] = { mod("InstantLifeLeech", "BASE", 100, { type = "Condition", var = "{Hand}Attack" }) },
["life leech from melee damage is instant"] = { mod("InstantLifeLeech", "BASE", 100, nil, ModFlag.Melee) },
["gain life from leech instantly from hits with this weapon"] = { mod("InstantLifeLeech", "BASE", 100, { type = "Condition", var = "{Hand}Attack" }, { type = "SkillType", skillType = SkillType.Attack }) },
["(%d+)%% of leech from hits with this weapon is instant per enemy power"] = function(num) return { mod("InstantLifeLeech", "BASE", num, nil, ModFlag.Hit, { type = "Condition", var = "{Hand}Attack" }, { type = "SkillType", skillType = SkillType.Attack }, { type = "Multiplier", var = "EnemyPower"}) } end,
["instant recovery"] = { mod("FlaskInstantRecovery", "BASE", 100) },
Expand Down Expand Up @@ -4085,6 +4086,10 @@ local specialModList = {
["cannot gain energy shield"] = { flag("CannotGainEnergyShield") },
["cannot gain life"] = { flag("CannotGainLife") },
["cannot gain mana"] = { flag("CannotGainMana") },
["cannot recover life other than from leech"] = {
flag("CannotRecoverLifeOutsideLeech"),
flag("NoLifeRegen"),
},
["cannot gain energy shield during f?l?a?s?k? ?effect"] = { flag("CannotGainEnergyShield", { type = "Condition", var = "UsingFlask" }) },
["cannot gain life during f?l?a?s?k? ?effect"] = { flag("CannotGainLife", { type = "Condition", var = "UsingFlask" }) },
["cannot gain mana during f?l?a?s?k? ?effect"] = { flag("CannotGainMana", { type = "Condition", var = "UsingFlask" }) },
Expand Down

0 comments on commit 75b4e82

Please sign in to comment.