feat(motion): 전투 모션 — 공격·피격·독뎀 (배포 퀄리티 P12) #47
@@ -995,7 +995,7 @@
|
||||
"Name": null
|
||||
},
|
||||
"Arguments": [],
|
||||
"Code": "self.Monsters = {}\nlocal g = \"combat\"\nlocal node = self.MapNodes[self.CurrentNodeId]\nif node ~= nil and node.type ~= nil then g = node.type end\nlocal pmap = \"\"\nlocal lp = _UserService.LocalPlayer\nif lp ~= nil and lp.CurrentMapName ~= nil then pmap = lp.CurrentMapName end\nlocal reg = self.Registered or {}\nfor i = 1, #reg do\n\tif reg[i].entity ~= nil and isvalid(reg[i].entity) then\n\t\treg[i].entity:SetVisible(false)\n\tend\nend\nlocal list = {}\nfor i = 1, #reg do\n\tlocal r = reg[i]\n\tif r.entity ~= nil and isvalid(r.entity) and r.group == g and (r.map == nil or r.map == \"\" or pmap == \"\" or r.map == pmap) then\n\t\tlocal x = 0\n\t\tif r.entity.TransformComponent ~= nil then\n\t\t\tx = r.entity.TransformComponent.WorldPosition.x\n\t\tend\n\t\ttable.insert(list, { entity = r.entity, enemyId = r.enemyId, x = x })\n\tend\nend\ntable.sort(list, function(a, b) return a.x < b.x end)\nlocal mult = 1 + (self.Floor - 1) * 0.6\nif g == \"elite\" or g == \"boss\" then\n\tmult = mult + self:AscEliteBonus()\nend\nlocal n = #list\nif n > 4 then n = 4 end\nfor i = 1, n do\n\tlocal item = list[i]\n\tlocal e = self.Enemies[item.enemyId]\n\tif e == nil then e = { name = item.enemyId, maxHp = 10, intents = { { kind = \"Attack\", value = 5 } } } end\n\tlocal intents = {}\n\tfor k = 1, #e.intents do\n\t\tlocal v = e.intents[k].value\n\t\tif e.intents[k].kind == \"Attack\" then\n\t\t\tv = math.floor(v * mult * self:AscAtkMult())\n\t\telseif e.intents[k].kind ~= \"Debuff\" then\n\t\t\tv = math.floor(v * mult)\n\t\tend\n\t\tintents[k] = { kind = e.intents[k].kind, value = v, effect = e.intents[k].effect }\n\tend\n\tlocal maxHp = math.floor(e.maxHp * mult * self:AscHpMult())\n\tself.Monsters[i] = { entity = item.entity, enemyId = item.enemyId, name = e.name,\n\t\thp = maxHp, maxHp = maxHp, block = 0, str = 0, weak = 0, vuln = 0, poison = 0,\n\t\tintents = intents, intentIdx = 1, alive = true, slot = i }\n\tself:ReviveMonsterEntity(item.entity)\n\tself:PositionMonsterSlot(i)\nend\nself.TargetIndex = 1",
|
||||
"Code": "self.Monsters = {}\nlocal g = \"combat\"\nlocal node = self.MapNodes[self.CurrentNodeId]\nif node ~= nil and node.type ~= nil then g = node.type end\nlocal pmap = \"\"\nlocal lp = _UserService.LocalPlayer\nif lp ~= nil and lp.CurrentMapName ~= nil then pmap = lp.CurrentMapName end\nlocal reg = self.Registered or {}\nfor i = 1, #reg do\n\tif reg[i].entity ~= nil and isvalid(reg[i].entity) then\n\t\treg[i].entity:SetVisible(false)\n\tend\nend\nlocal list = {}\nfor i = 1, #reg do\n\tlocal r = reg[i]\n\tif r.entity ~= nil and isvalid(r.entity) and r.group == g and (r.map == nil or r.map == \"\" or pmap == \"\" or r.map == pmap) then\n\t\tlocal x = 0\n\t\tif r.entity.TransformComponent ~= nil then\n\t\t\tx = r.entity.TransformComponent.WorldPosition.x\n\t\tend\n\t\ttable.insert(list, { entity = r.entity, enemyId = r.enemyId, x = x })\n\tend\nend\ntable.sort(list, function(a, b) return a.x < b.x end)\nlocal mult = 1 + (self.Floor - 1) * 0.6\nif g == \"elite\" or g == \"boss\" then\n\tmult = mult + self:AscEliteBonus()\nend\nlocal n = #list\nif n > 4 then n = 4 end\nfor i = 1, n do\n\tlocal item = list[i]\n\tlocal e = self.Enemies[item.enemyId]\n\tif e == nil then e = { name = item.enemyId, maxHp = 10, intents = { { kind = \"Attack\", value = 5 } } } end\n\tlocal intents = {}\n\tfor k = 1, #e.intents do\n\t\tlocal v = e.intents[k].value\n\t\tif e.intents[k].kind == \"Attack\" then\n\t\t\tv = math.floor(v * mult * self:AscAtkMult())\n\t\telseif e.intents[k].kind ~= \"Debuff\" then\n\t\t\tv = math.floor(v * mult)\n\t\tend\n\t\tintents[k] = { kind = e.intents[k].kind, value = v, effect = e.intents[k].effect }\n\tend\n\tlocal maxHp = math.floor(e.maxHp * mult * self:AscHpMult())\n\tlocal hitClip = nil\n\tlocal standClip = nil\n\tif item.entity.StateAnimationComponent ~= nil then\n\t\tpcall(function()\n\t\t\thitClip = item.entity.StateAnimationComponent.ActionSheet[\"hit\"]\n\t\t\tstandClip = item.entity.StateAnimationComponent.ActionSheet[\"stand\"]\n\t\tend)\n\tend\n\tself.Monsters[i] = { entity = item.entity, enemyId = item.enemyId, name = e.name,\n\t\thp = maxHp, maxHp = maxHp, block = 0, str = 0, weak = 0, vuln = 0, poison = 0,\n\t\thitClip = hitClip, standClip = standClip, motionBusy = false,\n\t\tintents = intents, intentIdx = 1, alive = true, slot = i }\n\tself:ReviveMonsterEntity(item.entity)\n\tself:PositionMonsterSlot(i)\nend\nself.TargetIndex = 1",
|
||||
"Scope": 2,
|
||||
"ExecSpace": 6,
|
||||
"Attributes": [],
|
||||
@@ -1515,7 +1515,7 @@
|
||||
"Name": "slot"
|
||||
}
|
||||
],
|
||||
"Code": "if self.CombatOver == true or self.FxBusy == true or self.TurnBusy == true then\n\treturn\nend\nif self.Hand == nil then\n\treturn\nend\nlocal cardId = self.Hand[slot]\nif cardId == nil then\n\treturn\nend\nlocal c = self.Cards[cardId]\nif c == nil then\n\treturn\nend\nif self.Energy < c.cost then\n\tself:Toast(\"에너지가 부족합니다\")\n\treturn\nend\nself.Energy = self.Energy - c.cost\nif c.kind == \"Attack\" then\n\tif c.damage ~= nil then\n\t\tlocal total = 0\n\t\tlocal hitN = c.hits or 1\n\t\tfor h = 1, hitN do\n\t\t\ttotal = total + self:CalcPlayerAttack(c.damage)\n\t\tend\n\t\tif c.aoe == true then\n\t\t\tself:PlayAoeFx(c.image, total)\n\t\telse\n\t\t\tself:PlayAttackFx(self.TargetIndex, c.image, total, c.pierce == true)\n\t\tend\n\tend\n\tif c.block ~= nil then\n\t\tself.PlayerBlock = self.PlayerBlock + c.block\n\tend\n\tself:ApplyRelics(\"cardPlayed\")\nelseif c.kind == \"Skill\" then\n\tif c.block ~= nil then\n\t\tself.PlayerBlock = self.PlayerBlock + c.block\n\tend\nelseif c.kind == \"Power\" then\n\tif c.powerEffect ~= nil 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.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.weak ~= nil or c.vuln ~= nil or c.poison ~= nil then\n\tlocal tm = self.Monsters[self.TargetIndex]\n\tif tm ~= nil and tm.alive == true then\n\t\tif c.weak ~= nil then tm.weak = tm.weak + c.weak end\n\t\tif c.poison ~= nil then tm.poison = (tm.poison or 0) + c.poison end\n\t\tif c.vuln ~= nil then\n\t\t\ttm.vuln = tm.vuln + c.vuln\n\t\t\tif self:HasRelic(\"championBelt\") then\n\t\t\t\ttm.weak = tm.weak + 1\n\t\t\tend\n\t\tend\n\tend\nend\ntable.remove(self.Hand, slot)\nif c.kind ~= \"Power\" then\n\ttable.insert(self.DiscardPile, cardId)\nend\nif c.draw ~= nil then\n\tself:DrawCards(c.draw)\nend\nself:RenderHand(false)\nself:RenderPiles()\nself:RenderCombat()\nself:CheckCombatEnd()",
|
||||
"Code": "if self.CombatOver == true or self.FxBusy == true or self.TurnBusy == true then\n\treturn\nend\nif self.Hand == nil then\n\treturn\nend\nlocal cardId = self.Hand[slot]\nif cardId == nil then\n\treturn\nend\nlocal c = self.Cards[cardId]\nif c == nil then\n\treturn\nend\nif self.Energy < c.cost then\n\tself:Toast(\"에너지가 부족합니다\")\n\treturn\nend\nself.Energy = self.Energy - c.cost\nif c.kind == \"Attack\" then\n\tif c.damage ~= nil then\n\t\tself:PlayerAttackMotion()\n\t\tlocal total = 0\n\t\tlocal hitN = c.hits or 1\n\t\tfor h = 1, hitN do\n\t\t\ttotal = total + self:CalcPlayerAttack(c.damage)\n\t\tend\n\t\tif c.aoe == true then\n\t\t\tself:PlayAoeFx(c.image, total)\n\t\telse\n\t\t\tself:PlayAttackFx(self.TargetIndex, c.image, total, c.pierce == true)\n\t\tend\n\tend\n\tif c.block ~= nil then\n\t\tself.PlayerBlock = self.PlayerBlock + c.block\n\tend\n\tself:ApplyRelics(\"cardPlayed\")\nelseif c.kind == \"Skill\" then\n\tif c.block ~= nil then\n\t\tself.PlayerBlock = self.PlayerBlock + c.block\n\tend\nelseif c.kind == \"Power\" then\n\tif c.powerEffect ~= nil 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.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.weak ~= nil or c.vuln ~= nil or c.poison ~= nil then\n\tlocal tm = self.Monsters[self.TargetIndex]\n\tif tm ~= nil and tm.alive == true then\n\t\tif c.weak ~= nil then tm.weak = tm.weak + c.weak end\n\t\tif c.poison ~= nil then tm.poison = (tm.poison or 0) + c.poison end\n\t\tif c.vuln ~= nil then\n\t\t\ttm.vuln = tm.vuln + c.vuln\n\t\t\tif self:HasRelic(\"championBelt\") then\n\t\t\t\ttm.weak = tm.weak + 1\n\t\t\tend\n\t\tend\n\tend\nend\ntable.remove(self.Hand, slot)\nif c.kind ~= \"Power\" then\n\ttable.insert(self.DiscardPile, cardId)\nend\nif c.draw ~= nil then\n\tself:DrawCards(c.draw)\nend\nself:RenderHand(false)\nself:RenderPiles()\nself:RenderCombat()\nself:CheckCombatEnd()",
|
||||
"Scope": 2,
|
||||
"ExecSpace": 6,
|
||||
"Attributes": [],
|
||||
@@ -1681,7 +1681,7 @@
|
||||
"Name": "pierce"
|
||||
}
|
||||
],
|
||||
"Code": "local m = self.Monsters[self.TargetIndex]\nif m == nil or m.alive ~= true then\n\tm = nil\n\tfor i = 1, #self.Monsters do\n\t\tif self.Monsters[i].alive == true then m = self.Monsters[i]; self.TargetIndex = i; break end\n\tend\nend\nif m == nil then\n\treturn\nend\nlocal dmg = amount\nif m.vuln > 0 then\n\tdmg = math.floor(dmg * 1.5)\nend\nif m.block > 0 and pierce ~= true then\n\tlocal absorbed = math.min(m.block, dmg)\n\tm.block = m.block - absorbed\n\tdmg = dmg - absorbed\nend\nm.hp = m.hp - dmg\nif m.hp <= 0 then\n\tm.hp = 0\n\tself:KillMonster(m.slot)\nend",
|
||||
"Code": "local m = self.Monsters[self.TargetIndex]\nif m == nil or m.alive ~= true then\n\tm = nil\n\tfor i = 1, #self.Monsters do\n\t\tif self.Monsters[i].alive == true then m = self.Monsters[i]; self.TargetIndex = i; break end\n\tend\nend\nif m == nil then\n\treturn\nend\nlocal dmg = amount\nif m.vuln > 0 then\n\tdmg = math.floor(dmg * 1.5)\nend\nif m.block > 0 and pierce ~= true then\n\tlocal absorbed = math.min(m.block, dmg)\n\tm.block = m.block - absorbed\n\tdmg = dmg - absorbed\nend\nm.hp = m.hp - dmg\nself:MonsterHitMotion(m.slot)\nif m.hp <= 0 then\n\tm.hp = 0\n\tself:KillMonster(m.slot)\nend",
|
||||
"Scope": 2,
|
||||
"ExecSpace": 6,
|
||||
"Attributes": [],
|
||||
@@ -1755,7 +1755,7 @@
|
||||
"Name": "damage"
|
||||
}
|
||||
],
|
||||
"Code": "self.FxBusy = true\nlocal fx = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/CombatHud/SkillFx\")\nif fx ~= nil then\n\tif fx.SpriteGUIRendererComponent ~= nil and image ~= nil and image ~= \"\" then\n\t\tfx.SpriteGUIRendererComponent.ImageRUID = image\n\tend\n\tif fx.UITransformComponent ~= nil then\n\t\tfx.UITransformComponent.anchoredPosition = Vector2(300, 60)\n\tend\n\tfx.Enable = true\nend\n_TimerService:SetTimerOnce(function()\n\tif fx ~= nil then fx.Enable = false end\n\tself.FxBusy = false\n\tfor i = 1, #self.Monsters do\n\t\tlocal m = self.Monsters[i]\n\t\tif m ~= nil and m.alive == true then\n\t\t\tlocal dmg = damage\n\t\t\tif m.vuln > 0 then\n\t\t\t\tdmg = math.floor(dmg * 1.5)\n\t\t\tend\n\t\t\tif m.block > 0 then\n\t\t\t\tlocal absorbed = math.min(m.block, dmg)\n\t\t\t\tm.block = m.block - absorbed\n\t\t\t\tdmg = dmg - absorbed\n\t\t\tend\n\t\t\tm.hp = m.hp - dmg\n\t\t\tself:ShowDmgPop(i, dmg)\n\t\t\tif m.hp <= 0 then\n\t\t\t\tm.hp = 0\n\t\t\t\tself:KillMonster(m.slot)\n\t\t\tend\n\t\tend\n\tend\n\tself:RenderCombat()\n\tself:CheckCombatEnd()\nend, 0.35)",
|
||||
"Code": "self.FxBusy = true\nlocal fx = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/CombatHud/SkillFx\")\nif fx ~= nil then\n\tif fx.SpriteGUIRendererComponent ~= nil and image ~= nil and image ~= \"\" then\n\t\tfx.SpriteGUIRendererComponent.ImageRUID = image\n\tend\n\tif fx.UITransformComponent ~= nil then\n\t\tfx.UITransformComponent.anchoredPosition = Vector2(300, 60)\n\tend\n\tfx.Enable = true\nend\n_TimerService:SetTimerOnce(function()\n\tif fx ~= nil then fx.Enable = false end\n\tself.FxBusy = false\n\tfor i = 1, #self.Monsters do\n\t\tlocal m = self.Monsters[i]\n\t\tif m ~= nil and m.alive == true then\n\t\t\tlocal dmg = damage\n\t\t\tif m.vuln > 0 then\n\t\t\t\tdmg = math.floor(dmg * 1.5)\n\t\t\tend\n\t\t\tif m.block > 0 then\n\t\t\t\tlocal absorbed = math.min(m.block, dmg)\n\t\t\t\tm.block = m.block - absorbed\n\t\t\t\tdmg = dmg - absorbed\n\t\t\tend\n\t\t\tm.hp = m.hp - dmg\n\t\t\tself:ShowDmgPop(i, dmg)\n\t\t\tself:MonsterHitMotion(i)\n\t\t\tif m.hp <= 0 then\n\t\t\t\tm.hp = 0\n\t\t\t\tself:KillMonster(m.slot)\n\t\t\tend\n\t\tend\n\tend\n\tself:RenderCombat()\n\tself:CheckCombatEnd()\nend, 0.35)",
|
||||
"Scope": 2,
|
||||
"ExecSpace": 6,
|
||||
"Attributes": [],
|
||||
@@ -1808,7 +1808,7 @@
|
||||
"Name": "attackerSlot"
|
||||
}
|
||||
],
|
||||
"Code": "local dmg = amount\nif self.PlayerBlock > 0 then\n\tlocal absorbed = math.min(self.PlayerBlock, dmg)\n\tself.PlayerBlock = self.PlayerBlock - absorbed\n\tdmg = dmg - absorbed\nend\nif dmg > 0 then\n\tself.PlayerHp = self.PlayerHp - dmg\n\tif self:HasRelic(\"bronzeScales\") and attackerSlot ~= nil and attackerSlot > 0 then\n\t\tlocal am = self.Monsters[attackerSlot]\n\t\tif am ~= nil and am.alive == true then\n\t\t\tam.hp = am.hp - 3\n\t\t\tif am.hp <= 0 then\n\t\t\t\tam.hp = 0\n\t\t\t\tself:KillMonster(am.slot)\n\t\t\tend\n\t\tend\n\tend\n\tif self:HasRelic(\"selfFormingClay\") then\n\t\tself.ClayBlockNext = self.ClayBlockNext + 3\n\tend\n\tif self:HasRelic(\"centennialPuzzle\") and self.FirstHpLossDone == false then\n\t\tself.FirstHpLossDone = true\n\t\tself:DrawCards(3)\n\t\tself:RenderHand(false)\n\tend\nend\nif self.PlayerHp < 0 then\n\tself.PlayerHp = 0\nend",
|
||||
"Code": "local dmg = amount\nif self.PlayerBlock > 0 then\n\tlocal absorbed = math.min(self.PlayerBlock, dmg)\n\tself.PlayerBlock = self.PlayerBlock - absorbed\n\tdmg = dmg - absorbed\nend\nif dmg > 0 then\n\tself.PlayerHp = self.PlayerHp - dmg\n\tif self:HasRelic(\"bronzeScales\") and attackerSlot ~= nil and attackerSlot > 0 then\n\t\tlocal am = self.Monsters[attackerSlot]\n\t\tif am ~= nil and am.alive == true then\n\t\t\tam.hp = am.hp - 3\n\t\t\tself:MonsterHitMotion(am.slot)\n\t\t\tif am.hp <= 0 then\n\t\t\t\tam.hp = 0\n\t\t\t\tself:KillMonster(am.slot)\n\t\t\tend\n\t\tend\n\tend\n\tif self:HasRelic(\"selfFormingClay\") then\n\t\tself.ClayBlockNext = self.ClayBlockNext + 3\n\tend\n\tif self:HasRelic(\"centennialPuzzle\") and self.FirstHpLossDone == false then\n\t\tself.FirstHpLossDone = true\n\t\tself:DrawCards(3)\n\t\tself:RenderHand(false)\n\tend\nend\nif self.PlayerHp < 0 then\n\tself.PlayerHp = 0\nend",
|
||||
"Scope": 2,
|
||||
"ExecSpace": 6,
|
||||
"Attributes": [],
|
||||
@@ -1846,7 +1846,7 @@
|
||||
"Name": "fromIndex"
|
||||
}
|
||||
],
|
||||
"Code": "local idx = 0\nfor i = fromIndex, #self.Monsters do\n\tif self.Monsters[i].alive == true then idx = i; break end\nend\nif idx == 0 or self.PlayerHp <= 0 then\n\tself:FinishEnemyTurn()\n\treturn\nend\nlocal m = self.Monsters[idx]\nlocal base = \"/ui/DefaultGroup/CombatHud/MonsterSlot\" .. tostring(idx)\nself:SetEntityEnabled(base .. \"/ActFrame\", true)\n_TimerService:SetTimerOnce(function()\n\tif m.poison ~= nil and m.poison > 0 then\n\t\tm.hp = m.hp - m.poison\n\t\tself:ShowDmgPop(idx, m.poison)\n\t\tm.poison = m.poison - 1\n\t\tif m.hp <= 0 then\n\t\t\tm.hp = 0\n\t\t\tself:KillMonster(m.slot)\n\t\t\tself:RenderCombat()\n\t\t\tself:SetEntityEnabled(base .. \"/ActFrame\", false)\n\t\t\t_TimerService:SetTimerOnce(function() self:EnemyActStep(idx + 1) end, 0.15)\n\t\t\treturn\n\t\tend\n\tend\n\tm.block = 0\n\tlocal intent = m.intents[m.intentIdx]\n\tif intent ~= nil then\n\t\tif intent.kind == \"Attack\" then\n\t\t\tlocal atk = intent.value + m.str\n\t\t\tif m.weak > 0 then\n\t\t\t\tatk = math.floor(atk * 0.75)\n\t\t\tend\n\t\t\tif self.PlayerVuln > 0 then\n\t\t\t\tatk = math.floor(atk * 1.5)\n\t\t\tend\n\t\t\tlocal before = self.PlayerHp\n\t\t\tself:DealDamageToPlayer(atk, idx)\n\t\t\tself:ShowPlayerDmgPop(before - self.PlayerHp)\n\t\telseif intent.kind == \"Defend\" then\n\t\t\tm.block = m.block + intent.value\n\t\telseif intent.kind == \"Debuff\" then\n\t\t\tif intent.effect == \"weak\" then\n\t\t\t\tself.PlayerWeak = self.PlayerWeak + intent.value\n\t\t\telseif intent.effect == \"vuln\" then\n\t\t\t\tself.PlayerVuln = self.PlayerVuln + intent.value\n\t\t\tend\n\t\tend\n\tend\n\tm.intentIdx = m.intentIdx + 1\n\tif m.intentIdx > #m.intents then\n\t\tm.intentIdx = 1\n\tend\n\tif m.weak > 0 then m.weak = m.weak - 1 end\n\tif m.vuln > 0 then m.vuln = m.vuln - 1 end\n\tself:RenderCombat()\n\tself:SetEntityEnabled(base .. \"/ActFrame\", false)\n\t_TimerService:SetTimerOnce(function() self:EnemyActStep(idx + 1) end, 0.15)\nend, 0.45)",
|
||||
"Code": "local idx = 0\nfor i = fromIndex, #self.Monsters do\n\tif self.Monsters[i].alive == true then idx = i; break end\nend\nif idx == 0 or self.PlayerHp <= 0 then\n\tself:FinishEnemyTurn()\n\treturn\nend\nlocal m = self.Monsters[idx]\nlocal base = \"/ui/DefaultGroup/CombatHud/MonsterSlot\" .. tostring(idx)\nself:SetEntityEnabled(base .. \"/ActFrame\", true)\n_TimerService:SetTimerOnce(function()\n\tif m.poison ~= nil and m.poison > 0 then\n\t\tm.hp = m.hp - m.poison\n\t\tself:ShowDmgPop(idx, m.poison)\n\t\tself:MonsterHitMotion(idx)\n\t\tm.poison = m.poison - 1\n\t\tif m.hp <= 0 then\n\t\t\tm.hp = 0\n\t\t\tself:KillMonster(m.slot)\n\t\t\tself:RenderCombat()\n\t\t\tself:SetEntityEnabled(base .. \"/ActFrame\", false)\n\t\t\t_TimerService:SetTimerOnce(function() self:EnemyActStep(idx + 1) end, 0.15)\n\t\t\treturn\n\t\tend\n\tend\n\tm.block = 0\n\tlocal intent = m.intents[m.intentIdx]\n\tif intent ~= nil then\n\t\tif intent.kind == \"Attack\" then\n\t\t\tself:MonsterLunge(idx)\n\t\t\tlocal atk = intent.value + m.str\n\t\t\tif m.weak > 0 then\n\t\t\t\tatk = math.floor(atk * 0.75)\n\t\t\tend\n\t\t\tif self.PlayerVuln > 0 then\n\t\t\t\tatk = math.floor(atk * 1.5)\n\t\t\tend\n\t\t\tlocal before = self.PlayerHp\n\t\t\tself:DealDamageToPlayer(atk, idx)\n\t\t\tself:ShowPlayerDmgPop(before - self.PlayerHp)\n\t\t\tself:PlayerHitMotion()\n\t\telseif intent.kind == \"Defend\" then\n\t\t\tm.block = m.block + intent.value\n\t\telseif intent.kind == \"Debuff\" then\n\t\t\tif intent.effect == \"weak\" then\n\t\t\t\tself.PlayerWeak = self.PlayerWeak + intent.value\n\t\t\telseif intent.effect == \"vuln\" then\n\t\t\t\tself.PlayerVuln = self.PlayerVuln + intent.value\n\t\t\tend\n\t\tend\n\tend\n\tm.intentIdx = m.intentIdx + 1\n\tif m.intentIdx > #m.intents then\n\t\tm.intentIdx = 1\n\tend\n\tif m.weak > 0 then m.weak = m.weak - 1 end\n\tif m.vuln > 0 then m.vuln = m.vuln - 1 end\n\tself:RenderCombat()\n\tself:SetEntityEnabled(base .. \"/ActFrame\", false)\n\t_TimerService:SetTimerOnce(function() self:EnemyActStep(idx + 1) end, 0.15)\nend, 0.45)",
|
||||
"Scope": 2,
|
||||
"ExecSpace": 6,
|
||||
"Attributes": [],
|
||||
@@ -2161,6 +2161,82 @@
|
||||
"Attributes": [],
|
||||
"Name": "ShowPlayerDmgPop"
|
||||
},
|
||||
{
|
||||
"Return": {
|
||||
"Type": "void",
|
||||
"DefaultValue": null,
|
||||
"SyncDirection": 0,
|
||||
"Attributes": [],
|
||||
"Name": null
|
||||
},
|
||||
"Arguments": [],
|
||||
"Code": "local lp = _UserService.LocalPlayer\nif lp == nil or lp.StateComponent == nil then\n\treturn\nend\npcall(function() lp.StateComponent:ChangeState(\"ATTACK\") end)\n_TimerService:SetTimerOnce(function()\n\tif lp ~= nil and isvalid(lp) and lp.StateComponent ~= nil then\n\t\tpcall(function() lp.StateComponent:ChangeState(\"IDLE\") end)\n\tend\nend, 0.5)",
|
||||
"Scope": 2,
|
||||
"ExecSpace": 6,
|
||||
"Attributes": [],
|
||||
"Name": "PlayerAttackMotion"
|
||||
},
|
||||
{
|
||||
"Return": {
|
||||
"Type": "void",
|
||||
"DefaultValue": null,
|
||||
"SyncDirection": 0,
|
||||
"Attributes": [],
|
||||
"Name": null
|
||||
},
|
||||
"Arguments": [],
|
||||
"Code": "local lp = _UserService.LocalPlayer\nif lp == nil then\n\treturn\nend\nif lp.StateComponent ~= nil then\n\tpcall(function() lp.StateComponent:ChangeState(\"HIT\") end)\nend\nlocal tr = lp.TransformComponent\nif tr == nil then\n\treturn\nend\nlocal p = tr.Position\ntr.Position = Vector3(p.x - 0.15, p.y, p.z)\n_TimerService:SetTimerOnce(function()\n\tif lp ~= nil and isvalid(lp) and lp.TransformComponent ~= nil then\n\t\tlp.TransformComponent.Position = Vector3(p.x, p.y, p.z)\n\tend\nend, 0.15)",
|
||||
"Scope": 2,
|
||||
"ExecSpace": 6,
|
||||
"Attributes": [],
|
||||
"Name": "PlayerHitMotion"
|
||||
},
|
||||
{
|
||||
"Return": {
|
||||
"Type": "void",
|
||||
"DefaultValue": null,
|
||||
"SyncDirection": 0,
|
||||
"Attributes": [],
|
||||
"Name": null
|
||||
},
|
||||
"Arguments": [
|
||||
{
|
||||
"Type": "number",
|
||||
"DefaultValue": null,
|
||||
"SyncDirection": 0,
|
||||
"Attributes": [],
|
||||
"Name": "idx"
|
||||
}
|
||||
],
|
||||
"Code": "local m = self.Monsters[idx]\nif m == nil or m.alive ~= true or m.entity == nil or not isvalid(m.entity) then\n\treturn\nend\nif m.motionBusy == true then\n\treturn\nend\nm.motionBusy = true\nlocal e = m.entity\nlocal tr = e.TransformComponent\nif tr == nil then\n\tm.motionBusy = false\n\treturn\nend\nlocal p = tr.Position\ntr.Position = Vector3(p.x - 0.35, p.y, p.z)\n_TimerService:SetTimerOnce(function()\n\tif isvalid(e) and e.TransformComponent ~= nil then\n\t\te.TransformComponent.Position = Vector3(p.x, p.y, p.z)\n\tend\n\tm.motionBusy = false\nend, 0.18)",
|
||||
"Scope": 2,
|
||||
"ExecSpace": 6,
|
||||
"Attributes": [],
|
||||
"Name": "MonsterLunge"
|
||||
},
|
||||
{
|
||||
"Return": {
|
||||
"Type": "void",
|
||||
"DefaultValue": null,
|
||||
"SyncDirection": 0,
|
||||
"Attributes": [],
|
||||
"Name": null
|
||||
},
|
||||
"Arguments": [
|
||||
{
|
||||
"Type": "number",
|
||||
"DefaultValue": null,
|
||||
"SyncDirection": 0,
|
||||
"Attributes": [],
|
||||
"Name": "slot"
|
||||
}
|
||||
],
|
||||
"Code": "local m = self.Monsters[slot]\nif m == nil or m.alive ~= true or m.entity == nil or not isvalid(m.entity) then\n\treturn\nend\nlocal e = m.entity\nif m.hitClip ~= nil and e.SpriteRendererComponent ~= nil then\n\te.SpriteRendererComponent.SpriteRUID = m.hitClip\n\t_TimerService:SetTimerOnce(function()\n\t\tif isvalid(e) and e.SpriteRendererComponent ~= nil and m.alive == true and m.standClip ~= nil then\n\t\t\te.SpriteRendererComponent.SpriteRUID = m.standClip\n\t\tend\n\tend, 0.5)\nelse\n\tif m.motionBusy == true then\n\t\treturn\n\tend\n\tm.motionBusy = true\n\tlocal tr = e.TransformComponent\n\tif tr == nil then\n\t\tm.motionBusy = false\n\t\treturn\n\tend\n\tlocal p = tr.Position\n\tlocal seq = { 0.12, -0.12, 0 }\n\tfor i = 1, #seq do\n\t\tlocal dx = seq[i]\n\t\t_TimerService:SetTimerOnce(function()\n\t\t\tif isvalid(e) and e.TransformComponent ~= nil then\n\t\t\t\te.TransformComponent.Position = Vector3(p.x + dx, p.y, p.z)\n\t\t\tend\n\t\t\tif i == #seq then\n\t\t\t\tm.motionBusy = false\n\t\t\tend\n\t\tend, 0.06 * i)\n\tend\nend",
|
||||
"Scope": 2,
|
||||
"ExecSpace": 6,
|
||||
"Attributes": [],
|
||||
"Name": "MonsterHitMotion"
|
||||
},
|
||||
{
|
||||
"Return": {
|
||||
"Type": "void",
|
||||
|
||||
@@ -2760,8 +2760,17 @@ for i = 1, n do
|
||||
intents[k] = { kind = e.intents[k].kind, value = v, effect = e.intents[k].effect }
|
||||
end
|
||||
local maxHp = math.floor(e.maxHp * mult * self:AscHpMult())
|
||||
local hitClip = nil
|
||||
local standClip = nil
|
||||
if item.entity.StateAnimationComponent ~= nil then
|
||||
pcall(function()
|
||||
hitClip = item.entity.StateAnimationComponent.ActionSheet["hit"]
|
||||
standClip = item.entity.StateAnimationComponent.ActionSheet["stand"]
|
||||
end)
|
||||
end
|
||||
self.Monsters[i] = { entity = item.entity, enemyId = item.enemyId, name = e.name,
|
||||
hp = maxHp, maxHp = maxHp, block = 0, str = 0, weak = 0, vuln = 0, poison = 0,
|
||||
hitClip = hitClip, standClip = standClip, motionBusy = false,
|
||||
intents = intents, intentIdx = 1, alive = true, slot = i }
|
||||
self:ReviveMonsterEntity(item.entity)
|
||||
self:PositionMonsterSlot(i)
|
||||
@@ -3241,6 +3250,7 @@ end
|
||||
self.Energy = self.Energy - c.cost
|
||||
if c.kind == "Attack" then
|
||||
if c.damage ~= nil then
|
||||
self:PlayerAttackMotion()
|
||||
local total = 0
|
||||
local hitN = c.hits or 1
|
||||
for h = 1, hitN do
|
||||
@@ -3391,6 +3401,7 @@ if m.block > 0 and pierce ~= true then
|
||||
dmg = dmg - absorbed
|
||||
end
|
||||
m.hp = m.hp - dmg
|
||||
self:MonsterHitMotion(m.slot)
|
||||
if m.hp <= 0 then
|
||||
m.hp = 0
|
||||
self:KillMonster(m.slot)
|
||||
@@ -3464,6 +3475,7 @@ _TimerService:SetTimerOnce(function()
|
||||
end
|
||||
m.hp = m.hp - dmg
|
||||
self:ShowDmgPop(i, dmg)
|
||||
self:MonsterHitMotion(i)
|
||||
if m.hp <= 0 then
|
||||
m.hp = 0
|
||||
self:KillMonster(m.slot)
|
||||
@@ -3501,6 +3513,7 @@ if dmg > 0 then
|
||||
local am = self.Monsters[attackerSlot]
|
||||
if am ~= nil and am.alive == true then
|
||||
am.hp = am.hp - 3
|
||||
self:MonsterHitMotion(am.slot)
|
||||
if am.hp <= 0 then
|
||||
am.hp = 0
|
||||
self:KillMonster(am.slot)
|
||||
@@ -3539,6 +3552,7 @@ _TimerService:SetTimerOnce(function()
|
||||
if m.poison ~= nil and m.poison > 0 then
|
||||
m.hp = m.hp - m.poison
|
||||
self:ShowDmgPop(idx, m.poison)
|
||||
self:MonsterHitMotion(idx)
|
||||
m.poison = m.poison - 1
|
||||
if m.hp <= 0 then
|
||||
m.hp = 0
|
||||
@@ -3553,6 +3567,7 @@ _TimerService:SetTimerOnce(function()
|
||||
local intent = m.intents[m.intentIdx]
|
||||
if intent ~= nil then
|
||||
if intent.kind == "Attack" then
|
||||
self:MonsterLunge(idx)
|
||||
local atk = intent.value + m.str
|
||||
if m.weak > 0 then
|
||||
atk = math.floor(atk * 0.75)
|
||||
@@ -3563,6 +3578,7 @@ _TimerService:SetTimerOnce(function()
|
||||
local before = self.PlayerHp
|
||||
self:DealDamageToPlayer(atk, idx)
|
||||
self:ShowPlayerDmgPop(before - self.PlayerHp)
|
||||
self:PlayerHitMotion()
|
||||
elseif intent.kind == "Defend" then
|
||||
m.block = m.block + intent.value
|
||||
elseif intent.kind == "Debuff" then
|
||||
@@ -3829,6 +3845,92 @@ else
|
||||
end
|
||||
self:SetEntityEnabled(base, true)
|
||||
_TimerService:SetTimerOnce(function() self:SetEntityEnabled(base, false) end, 0.6)`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' }]),
|
||||
method('PlayerAttackMotion', `local lp = _UserService.LocalPlayer
|
||||
if lp == nil or lp.StateComponent == nil then
|
||||
return
|
||||
end
|
||||
pcall(function() lp.StateComponent:ChangeState("ATTACK") end)
|
||||
_TimerService:SetTimerOnce(function()
|
||||
if lp ~= nil and isvalid(lp) and lp.StateComponent ~= nil then
|
||||
pcall(function() lp.StateComponent:ChangeState("IDLE") end)
|
||||
end
|
||||
end, 0.5)`),
|
||||
method('PlayerHitMotion', `local lp = _UserService.LocalPlayer
|
||||
if lp == nil then
|
||||
return
|
||||
end
|
||||
if lp.StateComponent ~= nil then
|
||||
pcall(function() lp.StateComponent:ChangeState("HIT") end)
|
||||
end
|
||||
local tr = lp.TransformComponent
|
||||
if tr == nil then
|
||||
return
|
||||
end
|
||||
local p = tr.Position
|
||||
tr.Position = Vector3(p.x - 0.15, p.y, p.z)
|
||||
_TimerService:SetTimerOnce(function()
|
||||
if lp ~= nil and isvalid(lp) and lp.TransformComponent ~= nil then
|
||||
lp.TransformComponent.Position = Vector3(p.x, p.y, p.z)
|
||||
end
|
||||
end, 0.15)`),
|
||||
method('MonsterLunge', `local m = self.Monsters[idx]
|
||||
if m == nil or m.alive ~= true or m.entity == nil or not isvalid(m.entity) then
|
||||
return
|
||||
end
|
||||
if m.motionBusy == true then
|
||||
return
|
||||
end
|
||||
m.motionBusy = true
|
||||
local e = m.entity
|
||||
local tr = e.TransformComponent
|
||||
if tr == nil then
|
||||
m.motionBusy = false
|
||||
return
|
||||
end
|
||||
local p = tr.Position
|
||||
tr.Position = Vector3(p.x - 0.35, p.y, p.z)
|
||||
_TimerService:SetTimerOnce(function()
|
||||
if isvalid(e) and e.TransformComponent ~= nil then
|
||||
e.TransformComponent.Position = Vector3(p.x, p.y, p.z)
|
||||
end
|
||||
m.motionBusy = false
|
||||
end, 0.18)`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'idx' }]),
|
||||
method('MonsterHitMotion', `local m = self.Monsters[slot]
|
||||
if m == nil or m.alive ~= true or m.entity == nil or not isvalid(m.entity) then
|
||||
return
|
||||
end
|
||||
local e = m.entity
|
||||
if m.hitClip ~= nil and e.SpriteRendererComponent ~= nil then
|
||||
e.SpriteRendererComponent.SpriteRUID = m.hitClip
|
||||
_TimerService:SetTimerOnce(function()
|
||||
if isvalid(e) and e.SpriteRendererComponent ~= nil and m.alive == true and m.standClip ~= nil then
|
||||
e.SpriteRendererComponent.SpriteRUID = m.standClip
|
||||
end
|
||||
end, 0.5)
|
||||
else
|
||||
if m.motionBusy == true then
|
||||
return
|
||||
end
|
||||
m.motionBusy = true
|
||||
local tr = e.TransformComponent
|
||||
if tr == nil then
|
||||
m.motionBusy = false
|
||||
return
|
||||
end
|
||||
local p = tr.Position
|
||||
local seq = { 0.12, -0.12, 0 }
|
||||
for i = 1, #seq do
|
||||
local dx = seq[i]
|
||||
_TimerService:SetTimerOnce(function()
|
||||
if isvalid(e) and e.TransformComponent ~= nil then
|
||||
e.TransformComponent.Position = Vector3(p.x + dx, p.y, p.z)
|
||||
end
|
||||
if i == #seq then
|
||||
m.motionBusy = false
|
||||
end
|
||||
end, 0.06 * i)
|
||||
end
|
||||
end`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
|
||||
method('SetHpBar', `local e = _EntityService:GetEntityByPath(path)
|
||||
if e == nil or e.UITransformComponent == nil then
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user