Skip to content

Commit 2a8b40a

Browse files
github-actions[bot]LocalIdentityLocalIdentity
authored
[pob1-port] Add support enemy minions (#1583)
* Apply changes from PathOfBuildingCommunity/PathOfBuilding#9302 * Fix merge conflicts --------- Co-authored-by: LocalIdentity <[email protected]> Co-authored-by: LocalIdentity <[email protected]>
1 parent 40264b3 commit 2a8b40a

File tree

2 files changed

+39
-13
lines changed

2 files changed

+39
-13
lines changed

src/Modules/CalcActiveSkill.lua

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -786,10 +786,16 @@ function calcs.buildActiveSkillModList(env, activeSkill)
786786
local minion = { }
787787
activeSkill.minion = minion
788788
skillFlags.haveMinion = true
789-
minion.parent = env.player
790-
minion.enemy = env.enemy
791789
minion.type = minionType
792790
minion.minionData = env.data.minions[minionType]
791+
minion.hostile = minion.minionData and minion.minionData.hostile or false
792+
if minion.hostile then
793+
minion.parent = env.enemy
794+
minion.enemy = env.player
795+
else
796+
minion.parent = env.player
797+
minion.enemy = env.enemy
798+
end
793799
minion.level = activeSkill.skillData.minionLevelIsEnemyLevel and env.enemyLevel or
794800
activeSkill.skillData.minionLevelIsTriggeredSkillLevel and activeEffect.srcInstance.supportEffect and activeEffect.srcInstance.supportEffect.activeSkillLevel and data.minionLevelTable[activeEffect.srcInstance.supportEffect.activeSkillLevel] or
795801
activeSkill.skillData.minionLevelIsPlayerLevel and (m_min(env.build and env.build.characterLevel or activeSkill.skillData.minionLevel or activeEffect.grantedEffectLevel.levelRequirement, activeSkill.skillData.minionLevelIsPlayerLevel)) or
@@ -799,8 +805,14 @@ function calcs.buildActiveSkillModList(env, activeSkill)
799805
minion.itemList = { }
800806
minion.uses = activeGrantedEffect.minionUses
801807
minion.lifeTable = env.data.monsterAllyLifeTable
808+
if minion.minionData.hostile then
809+
minion.lifeTable = env.data.monsterLifeTable
810+
else
811+
minion.lifeTable = env.data.monsterAllyLifeTable
812+
end
802813
local attackTime = minion.minionData.attackTime
803-
local damage = (isSpectre and env.data.monsterDamageTable[minion.level] or env.data.monsterAllyDamageTable[minion.level]) * minion.minionData.damage
814+
local damageTable = (isSpectre or minion.minionData.hostile) and env.data.monsterDamageTable or env.data.monsterAllyDamageTable
815+
local damage = damageTable[minion.level] * minion.minionData.damage
804816
if not minion.minionData.baseDamageIgnoresAttackSpeed then -- minions with this flag do not factor attack time into their base damage
805817
damage = damage * attackTime
806818
end

src/Modules/CalcPerform.lua

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,11 @@ function calcs.perform(env, skipEHP)
906906
env.minion.output = output.Minion
907907
env.minion.modDB.multipliers["Level"] = env.minion.level
908908
calcs.initModDB(env, env.minion.modDB)
909-
env.minion.modDB:NewMod("Life", "BASE", m_floor(env.minion.lifeTable[env.minion.level] * env.minion.minionData.life), "Base")
909+
local baseLife = env.minion.lifeTable[env.minion.level] * env.minion.minionData.life
910+
if env.minion.hostile then
911+
baseLife = baseLife * (env.data.mapLevelLifeMult[env.enemyLevel] or 1)
912+
end
913+
env.minion.modDB:NewMod("Life", "BASE", m_floor(baseLife), "Base")
910914
if env.minion.minionData.energyShield then
911915
env.minion.modDB:NewMod("LifeConvertToEnergyShield", "BASE", env.minion.minionData.energyShield * 100, "Base")
912916
end
@@ -1491,14 +1495,24 @@ function calcs.perform(env, skipEHP)
14911495
-- Calculate attributes
14921496
doActorAttribsConditions(env, env.player)
14931497
if env.minion then
1494-
for _, value in ipairs(env.player.mainSkill.skillModList:List(env.player.mainSkill.skillCfg, "MinionModifier")) do
1495-
if not value.type or env.minion.type == value.type then
1496-
env.minion.modDB:AddMod(value.mod)
1498+
if env.minion.hostile then
1499+
for _, value in ipairs(env.modDB:Tabulate(nil, nil, "EnemyModifier")) do
1500+
local mod = value.value and value.value.mod
1501+
if mod then
1502+
local copy = copyTable(mod, true)
1503+
env.minion.modDB:AddMod(modLib.setSource(copy, mod.source or value.mod.source))
1504+
end
14971505
end
1498-
end
1499-
for _, name in ipairs(env.minion.modDB:List(nil, "Keystone")) do
1500-
if env.spec.tree.keystoneMap[name] then
1501-
env.minion.modDB:AddList(env.spec.tree.keystoneMap[name].modList)
1506+
else
1507+
for _, value in ipairs(env.player.mainSkill.skillModList:List(env.player.mainSkill.skillCfg, "MinionModifier")) do
1508+
if not value.type or env.minion.type == value.type then
1509+
env.minion.modDB:AddMod(value.mod)
1510+
end
1511+
end
1512+
for _, name in ipairs(env.minion.modDB:List(nil, "Keystone")) do
1513+
if env.spec.tree.keystoneMap[name] then
1514+
env.minion.modDB:AddList(env.spec.tree.keystoneMap[name].modList)
1515+
end
15021516
end
15031517
end
15041518
doActorAttribsConditions(env, env.minion)
@@ -1755,7 +1769,7 @@ function calcs.perform(env, skipEHP)
17551769
buffs[buff.name].notBuff = true
17561770
end
17571771
end
1758-
if env.minion and (buff.applyMinions or buff.applyAllies or skillModList:Flag(nil, "BuffAppliesToAllies") and not env.minion.modDB:Flag(nil, "HiddenMonster")) then
1772+
if env.minion and not env.minion.hostile and (buff.applyMinions or buff.applyAllies or skillModList:Flag(nil, "BuffAppliesToAllies") and not env.minion.modDB:Flag(nil, "HiddenMonster")) then
17591773
activeSkill.minionBuffSkill = true
17601774
env.minion.modDB.conditions["AffectedBy"..buff.name:gsub(" ","")] = true
17611775
local srcList = new("ModList")
@@ -1900,7 +1914,7 @@ function calcs.perform(env, skipEHP)
19001914
end
19011915
end
19021916
if not (modDB:Flag(nil, "SelfAurasCannotAffectAllies") or modDB:Flag(nil, "SelfAurasOnlyAffectYou") or modDB:Flag(nil, "SelfAuraSkillsCannotAffectAllies")) then
1903-
if env.minion and not env.minion.modDB:Flag(nil, "HiddenMonster") then
1917+
if env.minion and (not env.minion.hostile or modDB:Flag(nil, "AurasAffectEnemies")) and not env.minion.modDB:Flag(nil, "HiddenMonster") then
19041918
local inc = skillModList:Sum("INC", skillCfg, "AuraEffect", "BuffEffect") + env.minion.modDB:Sum("INC", skillCfg, "BuffEffectOnSelf", "AuraEffectOnSelf")
19051919
local more = skillModList:More(skillCfg, "AuraEffect", "BuffEffect") * env.minion.modDB:More(skillCfg, "BuffEffectOnSelf", "AuraEffectOnSelf") * calcLib.mod(skillModList, skillCfg, "Magnitude")
19061920
local mult = (1 + inc / 100) * more

0 commit comments

Comments
 (0)