feat(combat): EnemyTurn 생존 몬스터 각자 행동
This commit is contained in:
@@ -1401,19 +1401,24 @@ self.PlayerHp = self.PlayerHp - dmg
|
|||||||
if self.PlayerHp < 0 then
|
if self.PlayerHp < 0 then
|
||||||
self.PlayerHp = 0
|
self.PlayerHp = 0
|
||||||
end`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' }]),
|
end`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' }]),
|
||||||
method('EnemyTurn', `self.EnemyBlock = 0
|
method('EnemyTurn', `for i = 1, #self.Monsters do
|
||||||
local intent = self.EnemyIntents[self.EnemyIntentIndex]
|
local m = self.Monsters[i]
|
||||||
if intent ~= nil then
|
if m.alive == true then
|
||||||
if intent.kind == "Attack" then
|
m.block = 0
|
||||||
self:DealDamageToPlayer(intent.value)
|
local intent = m.intents[m.intentIdx]
|
||||||
elseif intent.kind == "Defend" then
|
if intent ~= nil then
|
||||||
self.EnemyBlock = self.EnemyBlock + intent.value
|
if intent.kind == "Attack" then
|
||||||
|
self:DealDamageToPlayer(intent.value)
|
||||||
|
elseif intent.kind == "Defend" then
|
||||||
|
m.block = m.block + intent.value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
m.intentIdx = m.intentIdx + 1
|
||||||
|
if m.intentIdx > #m.intents then
|
||||||
|
m.intentIdx = 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.EnemyIntentIndex = self.EnemyIntentIndex + 1
|
|
||||||
if self.EnemyIntentIndex > #self.EnemyIntents then
|
|
||||||
self.EnemyIntentIndex = 1
|
|
||||||
end
|
|
||||||
self:RenderCombat()`),
|
self:RenderCombat()`),
|
||||||
method('CheckCombatEnd', `if self.EnemyHp <= 0 then
|
method('CheckCombatEnd', `if self.EnemyHp <= 0 then
|
||||||
self.CombatOver = true
|
self.CombatOver = true
|
||||||
|
|||||||
Reference in New Issue
Block a user