feat(combat): PlayCard 타겟 몬스터 공격 + 사망 처리/연출
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1339,7 +1339,7 @@ end
|
|||||||
self.Energy = self.Energy - c.cost
|
self.Energy = self.Energy - c.cost
|
||||||
if c.kind == "Attack" then
|
if c.kind == "Attack" then
|
||||||
if c.damage ~= nil then
|
if c.damage ~= nil then
|
||||||
self:DealDamageToEnemy(c.damage)
|
self:DealDamageToTarget(c.damage)
|
||||||
end
|
end
|
||||||
self:ApplyRelics("cardPlayed")
|
self:ApplyRelics("cardPlayed")
|
||||||
elseif c.kind == "Skill" then
|
elseif c.kind == "Skill" then
|
||||||
@@ -1354,16 +1354,43 @@ self:RenderPiles()
|
|||||||
self:RenderCombat()
|
self:RenderCombat()
|
||||||
self:CheckCombatEnd()`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
|
self:CheckCombatEnd()`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
|
||||||
method('Toast', `log(message)`, [{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'message' }]),
|
method('Toast', `log(message)`, [{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'message' }]),
|
||||||
method('DealDamageToEnemy', `local dmg = amount
|
method('DealDamageToTarget', `local m = self.Monsters[self.TargetIndex]
|
||||||
if self.EnemyBlock > 0 then
|
if m == nil or m.alive ~= true then
|
||||||
local absorbed = math.min(self.EnemyBlock, dmg)
|
m = nil
|
||||||
self.EnemyBlock = self.EnemyBlock - absorbed
|
for i = 1, #self.Monsters do
|
||||||
|
if self.Monsters[i].alive == true then m = self.Monsters[i]; self.TargetIndex = i; break end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if m == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local dmg = amount
|
||||||
|
if m.block > 0 then
|
||||||
|
local absorbed = math.min(m.block, dmg)
|
||||||
|
m.block = m.block - absorbed
|
||||||
dmg = dmg - absorbed
|
dmg = dmg - absorbed
|
||||||
end
|
end
|
||||||
self.EnemyHp = self.EnemyHp - dmg
|
m.hp = m.hp - dmg
|
||||||
if self.EnemyHp < 0 then
|
if m.hp <= 0 then
|
||||||
self.EnemyHp = 0
|
m.hp = 0
|
||||||
|
self:KillMonster(m.slot)
|
||||||
end`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' }]),
|
end`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' }]),
|
||||||
|
method('KillMonster', `local m = self.Monsters[slot]
|
||||||
|
if m == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
m.alive = false
|
||||||
|
if m.entity ~= nil and isvalid(m.entity) then
|
||||||
|
if m.entity.StateComponent ~= nil then
|
||||||
|
m.entity.StateComponent:ChangeState("DEAD")
|
||||||
|
end
|
||||||
|
local ent = m.entity
|
||||||
|
_TimerService:SetTimerOnce(function() if isvalid(ent) then ent:SetVisible(false) end end, 0.6)
|
||||||
|
end
|
||||||
|
self:SetEntityEnabled("/ui/DefaultGroup/CombatHud/MonsterSlot" .. tostring(slot), false)
|
||||||
|
for i = 1, #self.Monsters do
|
||||||
|
if self.Monsters[i].alive == true then self.TargetIndex = i; break end
|
||||||
|
end`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
|
||||||
method('DealDamageToPlayer', `local dmg = amount
|
method('DealDamageToPlayer', `local dmg = amount
|
||||||
if self.PlayerBlock > 0 then
|
if self.PlayerBlock > 0 then
|
||||||
local absorbed = math.min(self.PlayerBlock, dmg)
|
local absorbed = math.min(self.PlayerBlock, dmg)
|
||||||
|
|||||||
Reference in New Issue
Block a user