From d78049182b60a2fba03ff4deaff9751f6ebd0d92 Mon Sep 17 00:00:00 2001 From: gahusb Date: Mon, 29 Jun 2026 20:45:03 +0900 Subject: [PATCH] =?UTF-8?q?fix(deck):=20DealDamageToAllMonsters=EB=A5=BC?= =?UTF-8?q?=20isAttack=20=EB=A7=A4=EA=B0=9C=EB=B3=80=EC=88=98=ED=99=94=20(?= =?UTF-8?q?=EB=B2=84=EC=8A=A4=ED=8A=B8=20=ED=8F=89=EB=A9=B4=ED=99=94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DealDamageToAllMonsters는 AoE 공격(취약 1.5x·attackPoison 적용)과 Outbreak 독 버스트(평면 피해) 두 용도로 공유되는데, 취약을 항상 적용해 버스트가 취약 대상에 과다 피해를 줬다(JS 미러는 버스트를 평면 applyDamage로 처리 — Lua만 발산). 또한 직전 커밋에서 추가한 attackPoison도 버스트에 적용돼, Envenom+Outbreak 동시 활성 시 버스트→attackPoison→독 적용→또 버스트의 재귀 위험이 있었다. isAttack 매개변수를 추가해 취약·attackPoison을 공격일 때만 적용: AoE 공격(ResolveCardEffects)은 true, 버스트는 미전달(평면). JS의 dealToTarget(취약+attackPoison) vs 버스트(평면) 분리와 일치. 산출물 재생성 포함. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01UUvHKjrt8jqLzDeCsRRGmj --- RootDesk/MyDesk/SlayDeckController.codeblock | 11 +++++++++-- tools/deck/cb/combat.mjs | 11 +++++++---- tools/deck/cb/hand.mjs | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/RootDesk/MyDesk/SlayDeckController.codeblock b/RootDesk/MyDesk/SlayDeckController.codeblock index 469f033..73aed22 100644 --- a/RootDesk/MyDesk/SlayDeckController.codeblock +++ b/RootDesk/MyDesk/SlayDeckController.codeblock @@ -3013,7 +3013,7 @@ "Name": "energySpent" } ], - "Code": "if c == nil then\n\treturn\nend\nif c.blockGainMultiplier ~= nil and c.blockGainMultiplier > 0 then\n\tself.BlockGainMultiplier = (self.BlockGainMultiplier or 1) * c.blockGainMultiplier\nend\nif c.nextSkillCostZero == true then\n\tself.NextSkillCostZero = true\nend\nif c.nextSkillRepeatCount ~= nil and c.nextSkillRepeatCount > 0 then\n\tself.NextSkillRepeatCount = (self.NextSkillRepeatCount or 0) + c.nextSkillRepeatCount\nend\nif c.skillCostReductionThisTurn ~= nil and c.skillCostReductionThisTurn > 0 then\n\tself.SkillCostReductionThisTurn = (self.SkillCostReductionThisTurn or 0) + c.skillCostReductionThisTurn\nend\nif c.handCostZeroThisTurn == true then\n\tself.HandCostZeroThisTurn = true\nend\nif c.drawDisabledThisTurn == true then\n\tself.DrawDisabledThisTurn = true\nend\nif c.drawDamage ~= nil and c.drawDamage > 0 and c.kind ~= \"Power\" then\n\tself.DrawDamageThisTurn = (self.DrawDamageThisTurn or 0) + c.drawDamage\nend\nif c.drawPoison ~= nil and c.drawPoison > 0 and c.kind ~= \"Power\" then\n\tself.DrawPoisonThisTurn = (self.DrawPoisonThisTurn or 0) + c.drawPoison\nend\nif c.shivAoe == true and c.kind ~= \"Power\" then\n\tself.ShivAoeThisCombat = true\nend\nif c.skillSlyOnPlay == true and c.kind == \"Skill\" then\n\tif self.SkillSlyOnPlayCards == nil then\n\t\tself.SkillSlyOnPlayCards = {}\n\tend\n\tself.SkillSlyOnPlayCards[cardId] = true\nend\nif c.turnHandSlyCount ~= nil and c.turnHandSlyCount > 0 then\n\tif self.TurnSkillSlyCards == nil then\n\t\tself.TurnSkillSlyCards = {}\n\tend\n\tlocal picked = 0\n\tif self.Hand ~= nil then\n\t\tfor i = 1, #self.Hand do\n\t\t\tlocal hid = self.Hand[i]\n\t\t\tif hid ~= nil and hid ~= cardId then\n\t\t\t\tlocal hc = self.Cards[hid]\n\t\t\t\tif hc ~= nil and hc.kind == \"Skill\" and self.TurnSkillSlyCards[hid] ~= true and self.SkillSlyOnPlayCards[hid] ~= true and hc.sly ~= true then\n\t\t\t\t\tself.TurnSkillSlyCards[hid] = true\n\t\t\t\t\tpicked = picked + 1\n\t\t\t\t\tif picked >= c.turnHandSlyCount then\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend\nlocal xEnergy = energySpent or 0\nlocal weakAmount = c.weak or 0\nlocal vulnAmount = c.vuln or 0\nlocal poisonAmount = c.poison or 0\nif c.xWeakPerEnergy ~= nil and c.xWeakPerEnergy > 0 then\n\tweakAmount = weakAmount + xEnergy * c.xWeakPerEnergy\nend\nif c.kind == \"Attack\" then\n\tif c.damage ~= nil or c.xDamagePerEnergy ~= nil then\n\t\tself:PlayerAttackMotion()\n\t\tlocal baseDmg = self:AttackBaseForCard(slot, c)\n\t\tself.ActiveAttackDamageVsWeakMultiplier = c.attackDamageVsWeakMultiplier or 1\n\t\tif c.xDamagePerEnergy ~= nil and c.xDamagePerEnergy > 0 then\n\t\t\tbaseDmg = xEnergy * c.xDamagePerEnergy\n\t\tend\n\t\tlocal total = 0\n\t\tlocal hitN = c.hits or 1\n\t\tif c.otherHandAtLeast ~= nil and c.bonusHitsWhenOtherHandAtLeast ~= nil then\n\t\t\tlocal otherHand = 0\n\t\t\tif self.Hand ~= nil then\n\t\t\t\totherHand = #self.Hand - 1\n\t\t\t\tif otherHand < 0 then otherHand = 0 end\n\t\t\tend\n\t\t\tif otherHand >= c.otherHandAtLeast then\n\t\t\t\thitN = hitN + c.bonusHitsWhenOtherHandAtLeast\n\t\t\tend\n\t\tend\n\t\tfor h = 1, hitN do\n\t\t\ttotal = total + self:CalcPlayerAttack(baseDmg)\n\t\tend\n\t\tlocal useAoe = c.aoe == true\n\t\tif c.class == \"shiv\" and (self.ShivAoeThisCombat == true or self:HasPowerField(\"shivAoe\") == true) then\n\t\t\tuseAoe = true\n\t\tend\n\t\tif c.class == \"shiv\" and self.ShivFirstDamageBonusUsed ~= true and self:HasPowerField(\"firstShivDamageBonus\") == true then\n\t\t\tself.ShivFirstDamageBonusUsed = true\n\t\tend\n\t\tlocal function countAliveMonsters()\n\t\t\tlocal n = 0\n\t\t\tif self.Monsters ~= nil then\n\t\t\t\tfor mi = 1, #self.Monsters do\n\t\t\t\t\tlocal om = self.Monsters[mi]\n\t\t\t\t\tif om ~= nil and om.alive == true then n = n + 1 end\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn n\n\t\tend\n\t\tlocal function randomAliveMonsterIndex()\n\t\t\tlocal alive = {}\n\t\t\tif self.Monsters ~= nil then\n\t\t\t\tfor mi = 1, #self.Monsters do\n\t\t\t\t\tlocal om = self.Monsters[mi]\n\t\t\t\t\tif om ~= nil and om.alive == true then\n\t\t\t\t\t\ttable.insert(alive, mi)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif #alive <= 0 then\n\t\t\t\treturn 0\n\t\t\tend\n\t\t\treturn alive[math.random(1, #alive)]\n\t\tend\n\t\tlocal function resolveAttackRound()\n\t\t\tlocal roundKilled = false\n\t\t\tif useAoe == true then\n\t\t\t\tlocal killed = self:DealDamageToAllMonsters(total)\n\t\t\t\tif killed == true then roundKilled = true end\n\t\t\telseif c.randomTargetEachHit == true then\n\t\t\t\tfor h = 1, hitN do\n\t\t\t\t\tlocal targetIdx = randomAliveMonsterIndex()\n\t\t\t\t\tif targetIdx ~= nil and targetIdx > 0 then\n\t\t\t\t\t\tlocal prev = self.TargetIndex\n\t\t\t\t\t\tself.TargetIndex = targetIdx\n\t\t\t\t\t\tlocal killed = self:DealDamageToTarget(total / hitN, c.pierce == true)\n\t\t\t\t\t\tself.TargetIndex = prev\n\t\t\t\t\t\tif killed == true then roundKilled = true end\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tlocal killed = self:DealDamageToTarget(total, c.pierce == true)\n\t\t\t\tif killed == true then roundKilled = true end\n\t\t\tend\n\t\t\treturn roundKilled\n\t\tend\n\t\tlocal totalDamage = 0\n\t\tlocal roundKilled = false\n\t\trepeat\n\t\t\troundKilled = resolveAttackRound()\n\t\t\ttotalDamage = totalDamage + total\n\t\tuntil c.repeatOnKill ~= true or roundKilled ~= true or countAliveMonsters() <= 0\n\t\tself.DamageDealtThisTurn = (self.DamageDealtThisTurn or 0) + totalDamage\n\tend\n\tif c.block ~= nil then\n\t\tself:AddCardBlock(c.block)\n\tend\n\tif free ~= true then\n\t\tself:ApplyRelics(\"cardPlayed\")\n\tend\nelseif c.kind == \"Skill\" then\n\tif c.block ~= nil then\n\t\tself:AddCardBlock(c.block)\n\tend\nelseif c.kind == \"Power\" then\n\tif free ~= true then\n\t\ttable.insert(self.PlayerPowers, cardId)\n\tend\nend\nif c.strength ~= nil then\n\tself.PlayerStr = self.PlayerStr + c.strength\nend\nif c.dex ~= nil then\n\tself.PlayerDex = self.PlayerDex + c.dex\nend\nif c.thorns ~= nil then\n\tself.PlayerThorns = self.PlayerThorns + c.thorns\nend\nif c.selfVuln ~= nil then\n\tself.PlayerVuln = self.PlayerVuln + c.selfVuln\nend\nif c.heal ~= nil then\n\tself.PlayerHp = math.min(self.PlayerHp + c.heal, self.PlayerMaxHp)\nend\nif c.gainEnergy ~= nil and c.gainEnergy ~= 0 then\n\tself.Energy = self.Energy + c.gainEnergy\nend\nif c.intangible ~= nil and c.intangible > 0 then\n\tself.PlayerIntangible = (self.PlayerIntangible or 0) + c.intangible\nend\nself.TurnCardsPlayedThisTurn = (self.TurnCardsPlayedThisTurn or 0) + 1\nif c.blockPerDamageDealtThisTurn ~= nil and c.blockPerDamageDealtThisTurn > 0 then\n\tself:AddCardBlock((self.DamageDealtThisTurn or 0) * c.blockPerDamageDealtThisTurn)\nend\nself:QueueNextTurnEffects(c)\nif c.combatCostReductionOnPlay ~= nil and c.combatCostReductionOnPlay > 0 then\n\tif self.CombatCardCostReduction == nil then\n\t\tself.CombatCardCostReduction = {}\n\tend\n\tself.CombatCardCostReduction[cardId] = (self.CombatCardCostReduction[cardId] or 0) + c.combatCostReductionOnPlay\nend\nif c.weak ~= nil or c.vuln ~= nil or c.poison ~= nil or c.xWeakPerEnergy ~= nil or c.affectsAllEnemies == true or c.removeEnemyBlock == true or c.removeEnemyArtifact == true or (c.enemyStrengthLossThisTurn ~= nil and c.enemyStrengthLossThisTurn > 0) then\n\tlocal tm = self.Monsters[self.TargetIndex]\n\tif tm == nil or tm.alive ~= true then\n\t\tfor i = 1, #self.Monsters do\n\t\t\tif self.Monsters[i].alive == true then tm = self.Monsters[i]; self.TargetIndex = i; break end\n\t\tend\n\tend\n\tlocal targets = {}\n\tif c.affectsAllEnemies == true and self.Monsters ~= nil then\n\t\tfor mi = 1, #self.Monsters do\n\t\t\tlocal om = self.Monsters[mi]\n\t\t\tif om ~= nil and om.alive == true then\n\t\t\t\ttable.insert(targets, om)\n\t\t\tend\n\t\tend\n\telseif tm ~= nil and tm.alive == true then\n\t\ttable.insert(targets, tm)\n\tend\n\tif c.enemyStrengthLossThisTurn ~= nil and c.enemyStrengthLossThisTurn > 0 then\n\t\tself.EnemyStrengthLossThisTurn = (self.EnemyStrengthLossThisTurn or 0) + c.enemyStrengthLossThisTurn\n\tend\n\tfor ti = 1, #targets do\n\t\tlocal target = targets[ti]\n\t\tif target ~= nil and target.alive == true then\n\t\t\tif c.removeEnemyBlock == true then\n\t\t\t\ttarget.block = 0\n\t\t\tend\n\t\t\tif c.removeEnemyArtifact == true then\n\t\t\t\ttarget.artifact = 0\n\t\t\tend\n\t\t\tif weakAmount ~= nil and weakAmount > 0 then\n\t\t\t\tif target.artifact ~= nil and target.artifact > 0 then\n\t\t\t\t\ttarget.artifact = target.artifact - 1\n\t\t\t\telse\n\t\t\t\t\ttarget.weak = target.weak + weakAmount\n\t\t\t\tend\n\t\t\tend\n\t\t\tif poisonAmount ~= nil and poisonAmount > 0 then\n\t\t\t\tif c.poisonIfTargetPoisoned ~= true or (target.poison ~= nil and target.poison > 0) then\n\t\t\t\t\tlocal poisonHits = c.poisonHits or 1\n\t\t\t\t\tfor pi = 1, poisonHits do\n\t\t\t\t\t\tlocal target2 = target\n\t\t\t\t\t\tif c.poisonRandomTargets == true and self.Monsters ~= nil then\n\t\t\t\t\t\t\tlocal alive = {}\n\t\t\t\t\t\t\tfor mi = 1, #self.Monsters do\n\t\t\t\t\t\t\t\tlocal om = self.Monsters[mi]\n\t\t\t\t\t\t\t\tif om ~= nil and om.alive == true then\n\t\t\t\t\t\t\t\t\ttable.insert(alive, om)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif #alive > 0 then\n\t\t\t\t\t\t\t\ttarget2 = alive[math.random(#alive)]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif target2 ~= nil and target2.alive == true then\n\t\t\t\t\t\t\tself:ApplyPoisonToMonster(target2, poisonAmount)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif vulnAmount ~= nil and vulnAmount > 0 then\n\t\t\t\tif target.artifact ~= nil and target.artifact > 0 then\n\t\t\t\t\ttarget.artifact = target.artifact - 1\n\t\t\t\telse\n\t\t\t\t\ttarget.vuln = target.vuln + vulnAmount\n\t\t\t\t\tif self:HasRelic(\"championBelt\") then\n\t\t\t\t\t\ttarget.weak = target.weak + 1\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend\nlocal drawnCards = {}\nif c.draw ~= nil then\n\tdrawnCards = self:DrawCards(c.draw, true) or {}\nend\nif c.drawUntilHandSize ~= nil and c.drawUntilHandSize > 0 then\n\tlocal currentHand = 0\n\tif self.Hand ~= nil then\n\t\tcurrentHand = #self.Hand\n\t\tif slot ~= nil and slot > 0 and self.Hand[slot] == cardId then\n\t\t\tcurrentHand = currentHand - 1\n\t\tend\n\tend\n\tlocal need = c.drawUntilHandSize - currentHand\n\tif need > 0 then\n\t\tlocal moreDrawnCards = self:DrawCards(need, true) or {}\n\t\tfor i = 1, #moreDrawnCards do\n\t\t\ttable.insert(drawnCards, moreDrawnCards[i])\n\t\tend\n\tend\nend\nif c.drawSkillBlock ~= nil and c.drawSkillBlock > 0 then\n\tfor i = 1, #drawnCards do\n\t\tlocal drawnCard = self.Cards[drawnCards[i]]\n\t\tif drawnCard ~= nil and drawnCard.kind == \"Skill\" then\n\t\t\tself:AddCardBlock(c.drawSkillBlock)\n\t\tend\n\tend\nend\nif c.addShiv ~= nil and c.discard == nil and c.discardAll ~= true then\n\tself:AddCardsToHand(\"Shiv\", c.addShiv)\nend", + "Code": "if c == nil then\n\treturn\nend\nif c.blockGainMultiplier ~= nil and c.blockGainMultiplier > 0 then\n\tself.BlockGainMultiplier = (self.BlockGainMultiplier or 1) * c.blockGainMultiplier\nend\nif c.nextSkillCostZero == true then\n\tself.NextSkillCostZero = true\nend\nif c.nextSkillRepeatCount ~= nil and c.nextSkillRepeatCount > 0 then\n\tself.NextSkillRepeatCount = (self.NextSkillRepeatCount or 0) + c.nextSkillRepeatCount\nend\nif c.skillCostReductionThisTurn ~= nil and c.skillCostReductionThisTurn > 0 then\n\tself.SkillCostReductionThisTurn = (self.SkillCostReductionThisTurn or 0) + c.skillCostReductionThisTurn\nend\nif c.handCostZeroThisTurn == true then\n\tself.HandCostZeroThisTurn = true\nend\nif c.drawDisabledThisTurn == true then\n\tself.DrawDisabledThisTurn = true\nend\nif c.drawDamage ~= nil and c.drawDamage > 0 and c.kind ~= \"Power\" then\n\tself.DrawDamageThisTurn = (self.DrawDamageThisTurn or 0) + c.drawDamage\nend\nif c.drawPoison ~= nil and c.drawPoison > 0 and c.kind ~= \"Power\" then\n\tself.DrawPoisonThisTurn = (self.DrawPoisonThisTurn or 0) + c.drawPoison\nend\nif c.shivAoe == true and c.kind ~= \"Power\" then\n\tself.ShivAoeThisCombat = true\nend\nif c.skillSlyOnPlay == true and c.kind == \"Skill\" then\n\tif self.SkillSlyOnPlayCards == nil then\n\t\tself.SkillSlyOnPlayCards = {}\n\tend\n\tself.SkillSlyOnPlayCards[cardId] = true\nend\nif c.turnHandSlyCount ~= nil and c.turnHandSlyCount > 0 then\n\tif self.TurnSkillSlyCards == nil then\n\t\tself.TurnSkillSlyCards = {}\n\tend\n\tlocal picked = 0\n\tif self.Hand ~= nil then\n\t\tfor i = 1, #self.Hand do\n\t\t\tlocal hid = self.Hand[i]\n\t\t\tif hid ~= nil and hid ~= cardId then\n\t\t\t\tlocal hc = self.Cards[hid]\n\t\t\t\tif hc ~= nil and hc.kind == \"Skill\" and self.TurnSkillSlyCards[hid] ~= true and self.SkillSlyOnPlayCards[hid] ~= true and hc.sly ~= true then\n\t\t\t\t\tself.TurnSkillSlyCards[hid] = true\n\t\t\t\t\tpicked = picked + 1\n\t\t\t\t\tif picked >= c.turnHandSlyCount then\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend\nlocal xEnergy = energySpent or 0\nlocal weakAmount = c.weak or 0\nlocal vulnAmount = c.vuln or 0\nlocal poisonAmount = c.poison or 0\nif c.xWeakPerEnergy ~= nil and c.xWeakPerEnergy > 0 then\n\tweakAmount = weakAmount + xEnergy * c.xWeakPerEnergy\nend\nif c.kind == \"Attack\" then\n\tif c.damage ~= nil or c.xDamagePerEnergy ~= nil then\n\t\tself:PlayerAttackMotion()\n\t\tlocal baseDmg = self:AttackBaseForCard(slot, c)\n\t\tself.ActiveAttackDamageVsWeakMultiplier = c.attackDamageVsWeakMultiplier or 1\n\t\tif c.xDamagePerEnergy ~= nil and c.xDamagePerEnergy > 0 then\n\t\t\tbaseDmg = xEnergy * c.xDamagePerEnergy\n\t\tend\n\t\tlocal total = 0\n\t\tlocal hitN = c.hits or 1\n\t\tif c.otherHandAtLeast ~= nil and c.bonusHitsWhenOtherHandAtLeast ~= nil then\n\t\t\tlocal otherHand = 0\n\t\t\tif self.Hand ~= nil then\n\t\t\t\totherHand = #self.Hand - 1\n\t\t\t\tif otherHand < 0 then otherHand = 0 end\n\t\t\tend\n\t\t\tif otherHand >= c.otherHandAtLeast then\n\t\t\t\thitN = hitN + c.bonusHitsWhenOtherHandAtLeast\n\t\t\tend\n\t\tend\n\t\tfor h = 1, hitN do\n\t\t\ttotal = total + self:CalcPlayerAttack(baseDmg)\n\t\tend\n\t\tlocal useAoe = c.aoe == true\n\t\tif c.class == \"shiv\" and (self.ShivAoeThisCombat == true or self:HasPowerField(\"shivAoe\") == true) then\n\t\t\tuseAoe = true\n\t\tend\n\t\tif c.class == \"shiv\" and self.ShivFirstDamageBonusUsed ~= true and self:HasPowerField(\"firstShivDamageBonus\") == true then\n\t\t\tself.ShivFirstDamageBonusUsed = true\n\t\tend\n\t\tlocal function countAliveMonsters()\n\t\t\tlocal n = 0\n\t\t\tif self.Monsters ~= nil then\n\t\t\t\tfor mi = 1, #self.Monsters do\n\t\t\t\t\tlocal om = self.Monsters[mi]\n\t\t\t\t\tif om ~= nil and om.alive == true then n = n + 1 end\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn n\n\t\tend\n\t\tlocal function randomAliveMonsterIndex()\n\t\t\tlocal alive = {}\n\t\t\tif self.Monsters ~= nil then\n\t\t\t\tfor mi = 1, #self.Monsters do\n\t\t\t\t\tlocal om = self.Monsters[mi]\n\t\t\t\t\tif om ~= nil and om.alive == true then\n\t\t\t\t\t\ttable.insert(alive, mi)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif #alive <= 0 then\n\t\t\t\treturn 0\n\t\t\tend\n\t\t\treturn alive[math.random(1, #alive)]\n\t\tend\n\t\tlocal function resolveAttackRound()\n\t\t\tlocal roundKilled = false\n\t\t\tif useAoe == true then\n\t\t\t\tlocal killed = self:DealDamageToAllMonsters(total, true)\n\t\t\t\tif killed == true then roundKilled = true end\n\t\t\telseif c.randomTargetEachHit == true then\n\t\t\t\tfor h = 1, hitN do\n\t\t\t\t\tlocal targetIdx = randomAliveMonsterIndex()\n\t\t\t\t\tif targetIdx ~= nil and targetIdx > 0 then\n\t\t\t\t\t\tlocal prev = self.TargetIndex\n\t\t\t\t\t\tself.TargetIndex = targetIdx\n\t\t\t\t\t\tlocal killed = self:DealDamageToTarget(total / hitN, c.pierce == true)\n\t\t\t\t\t\tself.TargetIndex = prev\n\t\t\t\t\t\tif killed == true then roundKilled = true end\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tlocal killed = self:DealDamageToTarget(total, c.pierce == true)\n\t\t\t\tif killed == true then roundKilled = true end\n\t\t\tend\n\t\t\treturn roundKilled\n\t\tend\n\t\tlocal totalDamage = 0\n\t\tlocal roundKilled = false\n\t\trepeat\n\t\t\troundKilled = resolveAttackRound()\n\t\t\ttotalDamage = totalDamage + total\n\t\tuntil c.repeatOnKill ~= true or roundKilled ~= true or countAliveMonsters() <= 0\n\t\tself.DamageDealtThisTurn = (self.DamageDealtThisTurn or 0) + totalDamage\n\tend\n\tif c.block ~= nil then\n\t\tself:AddCardBlock(c.block)\n\tend\n\tif free ~= true then\n\t\tself:ApplyRelics(\"cardPlayed\")\n\tend\nelseif c.kind == \"Skill\" then\n\tif c.block ~= nil then\n\t\tself:AddCardBlock(c.block)\n\tend\nelseif c.kind == \"Power\" then\n\tif free ~= true then\n\t\ttable.insert(self.PlayerPowers, cardId)\n\tend\nend\nif c.strength ~= nil then\n\tself.PlayerStr = self.PlayerStr + c.strength\nend\nif c.dex ~= nil then\n\tself.PlayerDex = self.PlayerDex + c.dex\nend\nif c.thorns ~= nil then\n\tself.PlayerThorns = self.PlayerThorns + c.thorns\nend\nif c.selfVuln ~= nil then\n\tself.PlayerVuln = self.PlayerVuln + c.selfVuln\nend\nif c.heal ~= nil then\n\tself.PlayerHp = math.min(self.PlayerHp + c.heal, self.PlayerMaxHp)\nend\nif c.gainEnergy ~= nil and c.gainEnergy ~= 0 then\n\tself.Energy = self.Energy + c.gainEnergy\nend\nif c.intangible ~= nil and c.intangible > 0 then\n\tself.PlayerIntangible = (self.PlayerIntangible or 0) + c.intangible\nend\nself.TurnCardsPlayedThisTurn = (self.TurnCardsPlayedThisTurn or 0) + 1\nif c.blockPerDamageDealtThisTurn ~= nil and c.blockPerDamageDealtThisTurn > 0 then\n\tself:AddCardBlock((self.DamageDealtThisTurn or 0) * c.blockPerDamageDealtThisTurn)\nend\nself:QueueNextTurnEffects(c)\nif c.combatCostReductionOnPlay ~= nil and c.combatCostReductionOnPlay > 0 then\n\tif self.CombatCardCostReduction == nil then\n\t\tself.CombatCardCostReduction = {}\n\tend\n\tself.CombatCardCostReduction[cardId] = (self.CombatCardCostReduction[cardId] or 0) + c.combatCostReductionOnPlay\nend\nif c.weak ~= nil or c.vuln ~= nil or c.poison ~= nil or c.xWeakPerEnergy ~= nil or c.affectsAllEnemies == true or c.removeEnemyBlock == true or c.removeEnemyArtifact == true or (c.enemyStrengthLossThisTurn ~= nil and c.enemyStrengthLossThisTurn > 0) then\n\tlocal tm = self.Monsters[self.TargetIndex]\n\tif tm == nil or tm.alive ~= true then\n\t\tfor i = 1, #self.Monsters do\n\t\t\tif self.Monsters[i].alive == true then tm = self.Monsters[i]; self.TargetIndex = i; break end\n\t\tend\n\tend\n\tlocal targets = {}\n\tif c.affectsAllEnemies == true and self.Monsters ~= nil then\n\t\tfor mi = 1, #self.Monsters do\n\t\t\tlocal om = self.Monsters[mi]\n\t\t\tif om ~= nil and om.alive == true then\n\t\t\t\ttable.insert(targets, om)\n\t\t\tend\n\t\tend\n\telseif tm ~= nil and tm.alive == true then\n\t\ttable.insert(targets, tm)\n\tend\n\tif c.enemyStrengthLossThisTurn ~= nil and c.enemyStrengthLossThisTurn > 0 then\n\t\tself.EnemyStrengthLossThisTurn = (self.EnemyStrengthLossThisTurn or 0) + c.enemyStrengthLossThisTurn\n\tend\n\tfor ti = 1, #targets do\n\t\tlocal target = targets[ti]\n\t\tif target ~= nil and target.alive == true then\n\t\t\tif c.removeEnemyBlock == true then\n\t\t\t\ttarget.block = 0\n\t\t\tend\n\t\t\tif c.removeEnemyArtifact == true then\n\t\t\t\ttarget.artifact = 0\n\t\t\tend\n\t\t\tif weakAmount ~= nil and weakAmount > 0 then\n\t\t\t\tif target.artifact ~= nil and target.artifact > 0 then\n\t\t\t\t\ttarget.artifact = target.artifact - 1\n\t\t\t\telse\n\t\t\t\t\ttarget.weak = target.weak + weakAmount\n\t\t\t\tend\n\t\t\tend\n\t\t\tif poisonAmount ~= nil and poisonAmount > 0 then\n\t\t\t\tif c.poisonIfTargetPoisoned ~= true or (target.poison ~= nil and target.poison > 0) then\n\t\t\t\t\tlocal poisonHits = c.poisonHits or 1\n\t\t\t\t\tfor pi = 1, poisonHits do\n\t\t\t\t\t\tlocal target2 = target\n\t\t\t\t\t\tif c.poisonRandomTargets == true and self.Monsters ~= nil then\n\t\t\t\t\t\t\tlocal alive = {}\n\t\t\t\t\t\t\tfor mi = 1, #self.Monsters do\n\t\t\t\t\t\t\t\tlocal om = self.Monsters[mi]\n\t\t\t\t\t\t\t\tif om ~= nil and om.alive == true then\n\t\t\t\t\t\t\t\t\ttable.insert(alive, om)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif #alive > 0 then\n\t\t\t\t\t\t\t\ttarget2 = alive[math.random(#alive)]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif target2 ~= nil and target2.alive == true then\n\t\t\t\t\t\t\tself:ApplyPoisonToMonster(target2, poisonAmount)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif vulnAmount ~= nil and vulnAmount > 0 then\n\t\t\t\tif target.artifact ~= nil and target.artifact > 0 then\n\t\t\t\t\ttarget.artifact = target.artifact - 1\n\t\t\t\telse\n\t\t\t\t\ttarget.vuln = target.vuln + vulnAmount\n\t\t\t\t\tif self:HasRelic(\"championBelt\") then\n\t\t\t\t\t\ttarget.weak = target.weak + 1\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend\nlocal drawnCards = {}\nif c.draw ~= nil then\n\tdrawnCards = self:DrawCards(c.draw, true) or {}\nend\nif c.drawUntilHandSize ~= nil and c.drawUntilHandSize > 0 then\n\tlocal currentHand = 0\n\tif self.Hand ~= nil then\n\t\tcurrentHand = #self.Hand\n\t\tif slot ~= nil and slot > 0 and self.Hand[slot] == cardId then\n\t\t\tcurrentHand = currentHand - 1\n\t\tend\n\tend\n\tlocal need = c.drawUntilHandSize - currentHand\n\tif need > 0 then\n\t\tlocal moreDrawnCards = self:DrawCards(need, true) or {}\n\t\tfor i = 1, #moreDrawnCards do\n\t\t\ttable.insert(drawnCards, moreDrawnCards[i])\n\t\tend\n\tend\nend\nif c.drawSkillBlock ~= nil and c.drawSkillBlock > 0 then\n\tfor i = 1, #drawnCards do\n\t\tlocal drawnCard = self.Cards[drawnCards[i]]\n\t\tif drawnCard ~= nil and drawnCard.kind == \"Skill\" then\n\t\t\tself:AddCardBlock(c.drawSkillBlock)\n\t\tend\n\tend\nend\nif c.addShiv ~= nil and c.discard == nil and c.discardAll ~= true then\n\tself:AddCardsToHand(\"Shiv\", c.addShiv)\nend", "Scope": 2, "ExecSpace": 6, "Attributes": [], @@ -3664,9 +3664,16 @@ "SyncDirection": 0, "Attributes": [], "Name": "amount" + }, + { + "Type": "boolean", + "DefaultValue": null, + "SyncDirection": 0, + "Attributes": [], + "Name": "isAttack" } ], - "Code": "if self.Monsters == nil then\n\treturn false\nend\nlocal killCount = 0\nfor i = 1, #self.Monsters do\n\tlocal m = self.Monsters[i]\n\tif m ~= nil and m.alive == true then\n\t\tlocal dmg = amount\n\t\tif m.vuln > 0 then\n\t\t\tdmg = math.floor(dmg * 1.5)\n\t\tend\n\t\tif m.block > 0 then\n\t\t\tlocal absorbed = math.min(m.block, dmg)\n\t\t\tm.block = m.block - absorbed\n\t\t\tdmg = dmg - absorbed\n\t\tend\n\t\tm.hp = m.hp - dmg\n\t\tif dmg > 0 then\n\t\t\tself.DamageDealtThisTurn = (self.DamageDealtThisTurn or 0) + dmg\n\t\t\tlocal poison = self:AddPowerFieldTotal(\"attackPoison\")\n\t\t\tif poison ~= nil and poison > 0 then\n\t\t\t\tself:ApplyPoisonToMonster(m, poison)\n\t\t\tend\n\t\tend\n\t\tself:ShowDmgPop(i, dmg)\n\t\tself:MonsterHitMotion(i)\n\t\tif m.hp <= 0 then\n\t\t\tm.hp = 0\n\t\t\tself:KillMonster(m.slot)\n\t\t\tkillCount = killCount + 1\n\t\tend\n\tend\nend\nif killCount > 0 and self.ActiveKillReward ~= nil and self.ActiveKillReward > 0 then\n\tself.BonusRewardScreens = (self.BonusRewardScreens or 0) + (killCount * self.ActiveKillReward)\nend\nself:RenderCombat()\nself:CheckCombatEnd()\nreturn killCount > 0", + "Code": "if self.Monsters == nil then\n\treturn false\nend\nlocal killCount = 0\nfor i = 1, #self.Monsters do\n\tlocal m = self.Monsters[i]\n\tif m ~= nil and m.alive == true then\n\t\tlocal dmg = amount\n\t\tif isAttack == true and m.vuln > 0 then\n\t\t\tdmg = math.floor(dmg * 1.5)\n\t\tend\n\t\tif m.block > 0 then\n\t\t\tlocal absorbed = math.min(m.block, dmg)\n\t\t\tm.block = m.block - absorbed\n\t\t\tdmg = dmg - absorbed\n\t\tend\n\t\tm.hp = m.hp - dmg\n\t\tif dmg > 0 then\n\t\t\tself.DamageDealtThisTurn = (self.DamageDealtThisTurn or 0) + dmg\n\t\t\tif isAttack == true then\n\t\t\t\tlocal poison = self:AddPowerFieldTotal(\"attackPoison\")\n\t\t\t\tif poison ~= nil and poison > 0 then\n\t\t\t\t\tself:ApplyPoisonToMonster(m, poison)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tself:ShowDmgPop(i, dmg)\n\t\tself:MonsterHitMotion(i)\n\t\tif m.hp <= 0 then\n\t\t\tm.hp = 0\n\t\t\tself:KillMonster(m.slot)\n\t\t\tkillCount = killCount + 1\n\t\tend\n\tend\nend\nif killCount > 0 and self.ActiveKillReward ~= nil and self.ActiveKillReward > 0 then\n\tself.BonusRewardScreens = (self.BonusRewardScreens or 0) + (killCount * self.ActiveKillReward)\nend\nself:RenderCombat()\nself:CheckCombatEnd()\nreturn killCount > 0", "Scope": 2, "ExecSpace": 6, "Attributes": [], diff --git a/tools/deck/cb/combat.mjs b/tools/deck/cb/combat.mjs index a08a301..91c0abd 100644 --- a/tools/deck/cb/combat.mjs +++ b/tools/deck/cb/combat.mjs @@ -381,7 +381,7 @@ for i = 1, #self.Monsters do local m = self.Monsters[i] if m ~= nil and m.alive == true then local dmg = amount - if m.vuln > 0 then + if isAttack == true and m.vuln > 0 then dmg = math.floor(dmg * 1.5) end if m.block > 0 then @@ -392,9 +392,11 @@ for i = 1, #self.Monsters do m.hp = m.hp - dmg if dmg > 0 then self.DamageDealtThisTurn = (self.DamageDealtThisTurn or 0) + dmg - local poison = self:AddPowerFieldTotal("attackPoison") - if poison ~= nil and poison > 0 then - self:ApplyPoisonToMonster(m, poison) + if isAttack == true then + local poison = self:AddPowerFieldTotal("attackPoison") + if poison ~= nil and poison > 0 then + self:ApplyPoisonToMonster(m, poison) + end end end self:ShowDmgPop(i, dmg) @@ -413,6 +415,7 @@ self:RenderCombat() self:CheckCombatEnd() return killCount > 0`, [ { Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' }, + { Type: 'boolean', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'isAttack' }, ], 0, 'boolean'), method('PlayAttackFx', `local m = self.Monsters[targetIndex] if m == nil or m.alive ~= true or m.entity == nil or not isvalid(m.entity) then diff --git a/tools/deck/cb/hand.mjs b/tools/deck/cb/hand.mjs index b3c9ffd..e5b8c0c 100644 --- a/tools/deck/cb/hand.mjs +++ b/tools/deck/cb/hand.mjs @@ -542,7 +542,7 @@ if c.kind == "Attack" then local function resolveAttackRound() local roundKilled = false if useAoe == true then - local killed = self:DealDamageToAllMonsters(total) + local killed = self:DealDamageToAllMonsters(total, true) if killed == true then roundKilled = true end elseif c.randomTargetEachHit == true then for h = 1, hitN do