Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Supreme Ego #4524

Merged
merged 9 commits into from
Jul 11, 2022
12 changes: 12 additions & 0 deletions src/Classes/ModStore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,18 @@ function ModStoreClass:GetMultiplier(var, cfg, noMod)
end

function ModStoreClass:GetStat(stat, cfg)
if stat == "ManaReservedPercent" then
local manaBase = 0
local reservedPercentMana = 0
for _, activeSkill in ipairs(self.actor.activeSkillList) do
if (activeSkill.skillTypes[SkillType.Aura] and not activeSkill.skillFlags.disable and activeSkill.buffList and activeSkill.buffList[1] and activeSkill.buffList[1].name == cfg.skillName) then
manaBase = activeSkill.skillData["ManaReservedBase"] and activeSkill.skillData["ManaReservedBase"] or 0
reservedPercentMana = manaBase / self.actor.output["Mana"] * 100
break
end
end
return m_min(reservedPercentMana, 100) --Don't let people get more than 100% reservation for aura effect.
end
-- if ReservationEfficiency is -100, ManaUnreserved is nan which breaks everything if Arcane Cloak is enabled
if stat == "ManaUnreserved" and self.actor.output[stat] ~= self.actor.output[stat] then
-- 0% reserved = total mana
Expand Down
58 changes: 46 additions & 12 deletions src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,12 @@ function calcs.perform(env, avoidCache)
local skillModList = activeSkill.skillModList
local skillCfg = activeSkill.skillCfg
for _, buff in ipairs(activeSkill.buffList) do
--Skip adding buff if reservation exceeds maximum
for _, value in ipairs({"Mana", "Life"}) do
if activeSkill.skillData[value.."ReservedBase"] and activeSkill.skillData[value.."ReservedBase"] > env.player.output[value] then
goto disableAura
end
end
if buff.cond and not skillModList:GetCondition(buff.cond, skillCfg) then
-- Nothing!
elseif buff.enemyCond and not enemyDB:GetCondition(buff.enemyCond) then
Expand Down Expand Up @@ -1826,19 +1832,21 @@ function calcs.perform(env, avoidCache)
local srcList = new("ModList")
local inc = skillModList:Sum("INC", skillCfg, "AuraEffect", "BuffEffect", "BuffEffectOnSelf", "AuraEffectOnSelf", "AuraBuffEffect", "SkillAuraEffectOnSelf")
local more = skillModList:More(skillCfg, "AuraEffect", "BuffEffect", "BuffEffectOnSelf", "AuraEffectOnSelf", "AuraBuffEffect", "SkillAuraEffectOnSelf")
srcList:ScaleAddList(buff.modList, (1 + inc / 100) * more)
srcList:ScaleAddList(extraAuraModList, (1 + inc / 100) * more)
local mult = (1 + inc / 100) * more
srcList:ScaleAddList(buff.modList, mult)
srcList:ScaleAddList(extraAuraModList, mult)
mergeBuff(srcList, buffs, buff.name)
end
if env.minion and not (modDB:Flag(nil, "SelfAurasCannotAffectAllies") or modDB:Flag(nil, "SelfAuraSkillsCannotAffectAllies")) then
if env.minion and not (modDB:Flag(nil, "SelfAurasCannotAffectAllies") or modDB:Flag(nil, "SelfAurasOnlyAffectYou") or modDB:Flag(nil, "SelfAuraSkillsCannotAffectAllies")) then
activeSkill.minionBuffSkill = true
affectedByAura[env.minion] = true
env.minion.modDB.conditions["AffectedBy"..buff.name:gsub(" ","")] = true
local srcList = new("ModList")
local inc = skillModList:Sum("INC", skillCfg, "AuraEffect", "BuffEffect") + env.minion.modDB:Sum("INC", nil, "BuffEffectOnSelf", "AuraEffectOnSelf")
local more = skillModList:More(skillCfg, "AuraEffect", "BuffEffect") * env.minion.modDB:More(nil, "BuffEffectOnSelf", "AuraEffectOnSelf")
srcList:ScaleAddList(buff.modList, (1 + inc / 100) * more)
srcList:ScaleAddList(extraAuraModList, (1 + inc / 100) * more)
local mult = (1 + inc / 100) * more
srcList:ScaleAddList(buff.modList, mult)
srcList:ScaleAddList(extraAuraModList, mult)
mergeBuff(srcList, minionBuffs, buff.name)
end
end
Expand All @@ -1860,9 +1868,12 @@ function calcs.perform(env, avoidCache)
local srcList = new("ModList")
local mult = 1
if buff.type == "AuraDebuff" then
local inc = skillModList:Sum("INC", skillCfg, "AuraEffect", "BuffEffect", "DebuffEffect")
local more = skillModList:More(skillCfg, "AuraEffect", "BuffEffect", "DebuffEffect")
mult = (1 + inc / 100) * more
mult = 0
if not modDB:Flag(nil, "SelfAurasOnlyAffectYou") then
local inc = skillModList:Sum("INC", skillCfg, "AuraEffect", "BuffEffect", "DebuffEffect")
local more = skillModList:More(skillCfg, "AuraEffect", "BuffEffect", "DebuffEffect")
mult = (1 + inc / 100) * more
end
end
if buff.type == "Debuff" then
local inc = skillModList:Sum("INC", skillCfg, "DebuffEffect")
Expand Down Expand Up @@ -1895,13 +1906,17 @@ function calcs.perform(env, avoidCache)
if not curse.isMark then
more = more * enemyDB:More(nil, "CurseEffectOnSelf")
end
local mult = 0
if not (modDB:Flag(nil, "SelfAurasOnlyAffectYou") and activeSkill.skillTypes[SkillType.Aura]) then --If your aura only effect you blasphemy does nothing
mult = (1 + inc / 100) * more
end
if buff.type == "Curse" then
curse.modList = new("ModList")
curse.modList:ScaleAddList(buff.modList, (1 + inc / 100) * more)
curse.modList:ScaleAddList(buff.modList, mult)
else
-- Curse applies a buff; scale by curse effect, then buff effect
local temp = new("ModList")
temp:ScaleAddList(buff.modList, (1 + inc / 100) * more)
temp:ScaleAddList(buff.modList, mult)
curse.buffModList = new("ModList")
local buffInc = modDB:Sum("INC", skillCfg, "BuffEffectOnSelf")
local buffMore = modDB:More(skillCfg, "BuffEffectOnSelf")
Expand All @@ -1916,6 +1931,7 @@ function calcs.perform(env, avoidCache)
t_insert(curses, curse)
end
end
::disableAura::
end
if activeSkill.minion and activeSkill.minion.activeSkillList then
local castingMinion = activeSkill.minion
Expand Down Expand Up @@ -2102,6 +2118,23 @@ function calcs.perform(env, avoidCache)
-- Calculate curses that ignore hex limit after
if not curse.ignoreHexLimit and not curse.socketedCursesHexLimit then
local slot
local skipAddingCurse = false
-- Check if we need to disable a certain curse aura.
for _, activeSkill in ipairs(env.player.activeSkillList) do
if (activeSkill.buffList[1] and curse.name == activeSkill.buffList[1].name and activeSkill.skillTypes[SkillType.Aura]) then
if modDB:Flag(nil, "SelfAurasOnlyAffectYou") then
skipAddingCurse = true
break
end
for _, value in ipairs({"Mana", "Life"}) do
if activeSkill.skillData[value.."ReservedBase"] and activeSkill.skillData[value.."ReservedBase"] > env.player.output[value] then
skipAddingCurse = true
break
end
end
break
end
end
for i = 1, source.limit do
-- Prevent multiple marks from being considered
if curse.isMark then
Expand All @@ -2128,7 +2161,9 @@ function calcs.perform(env, avoidCache)
if curseSlots[slot] and curseSlots[slot].isMark then
markSlotted = false
end
curseSlots[slot] = curse
if skipAddingCurse == false then
curseSlots[slot] = curse
end
if curse.isMark then
markSlotted = true
end
Expand Down Expand Up @@ -2175,7 +2210,6 @@ function calcs.perform(env, avoidCache)
curseSlots[#curseSlots + 1] = curse
end
end

end
end

Expand Down
3 changes: 3 additions & 0 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ local preFlagList = {
["^guard skills [hd][ae][va][el] "] = { tag = { type = "SkillType", skillType = SkillType.Guard } },
["^nova spells [hd][ae][va][el] "] = { tag = { type = "SkillType", skillType = SkillType.Nova } },
["^area skills [hd][ae][va][el] "] = { tag = { type = "SkillType", skillType = SkillType.Area } },
["^aura skills [hd][ae][va][el] "] = { tag = { type = "SkillType", skillType = SkillType.Aura } },
["^prismatic skills [hd][ae][va][el] "] = { tag = { type = "SkillType", skillType = SkillType.RandomElement } },
["^warcry skills have "] = { tag = { type = "SkillType", skillType = SkillType.Warcry } },
["^non%-curse aura skills have "] = { tag = { type = "SkillType", skillType = SkillType.Aura }, { type = "SkillType", skillType = SkillType.AppliesCurse, neg = true } },
Expand Down Expand Up @@ -1054,6 +1055,7 @@ local modTagList = {
["per allocated mastery passive skill"] = { tag = { type = "Multiplier", var = "AllocatedMastery" } },
["per allocated notable passive skill"] = { tag = { type = "Multiplier", var = "AllocatedNotable" } },
-- Per stat
["per (%d+)%% of maximum mana they reserve"] = function(num) return { tag = { type = "PerStat", stat = "ManaReservedPercent", div = num } } end,
["per (%d+) strength"] = function(num) return { tag = { type = "PerStat", stat = "Str", div = num } } end,
["per (%d+) dexterity"] = function(num) return { tag = { type = "PerStat", stat = "Dex", div = num } } end,
["per (%d+) intelligence"] = function(num) return { tag = { type = "PerStat", stat = "Int", div = num } } end,
Expand Down Expand Up @@ -2483,6 +2485,7 @@ local specialModList = {
["onslaught"] = { flag("Condition:Onslaught") },
["unholy might"] = { flag("Condition:UnholyMight") },
["your aura buffs do not affect allies"] = { flag("SelfAurasCannotAffectAllies") },
["auras from your skills can only affect you"] = { flag("SelfAurasOnlyAffectYou") },
["aura buffs from skills have (%d+)%% increased effect on you for each herald affecting you"] = function(num) return { mod("SkillAuraEffectOnSelf", "INC", num, { type = "Multiplier", var = "Herald"}) } end,
["aura buffs from skills have (%d+)%% increased effect on you for each herald affecting you, up to (%d+)%%"] = function(num, _, limit) return {
mod("SkillAuraEffectOnSelf", "INC", num, { type = "Multiplier", var = "Herald", globalLimit = tonumber(limit), globalLimitKey = "PurposefulHarbinger" })
Expand Down