fix bug
This commit is contained in:
parent
fcb6ce89a4
commit
9f3c17b405
|
@ -1475,12 +1475,13 @@ function Room:damage(damageStruct)
|
||||||
assert(type(damageStruct.to) == "number")
|
assert(type(damageStruct.to) == "number")
|
||||||
|
|
||||||
local stages = {
|
local stages = {
|
||||||
[fk.PreDamage] = damageStruct.from,
|
{fk.PreDamage, damageStruct.from},
|
||||||
[fk.DamageCaused] = damageStruct.from,
|
{fk.DamageCaused, damageStruct.from},
|
||||||
[fk.DamageInflicted] = damageStruct.to,
|
{fk.DamageInflicted, damageStruct.to},
|
||||||
}
|
}
|
||||||
|
|
||||||
for event, playerId in ipairs(stages) do
|
for _, struct in ipairs(stages) do
|
||||||
|
local event, playerId = table.unpack(struct)
|
||||||
local player = playerId and self:getPlayerById(playerId) or nil
|
local player = playerId and self:getPlayerById(playerId) or nil
|
||||||
if self.logic:trigger(event, player, damageStruct) or damageStruct.damage < 1 then
|
if self.logic:trigger(event, player, damageStruct) or damageStruct.damage < 1 then
|
||||||
return false
|
return false
|
||||||
|
@ -1500,12 +1501,13 @@ function Room:damage(damageStruct)
|
||||||
end
|
end
|
||||||
|
|
||||||
stages = {
|
stages = {
|
||||||
[fk.Damage] = damageStruct.from,
|
{fk.Damage, damageStruct.from},
|
||||||
[fk.Damaged] = damageStruct.to,
|
{fk.Damaged, damageStruct.to},
|
||||||
[fk.DamageFinished] = damageStruct.from,
|
{fk.DamageFinished, damageStruct.from},
|
||||||
}
|
}
|
||||||
|
|
||||||
for event, playerId in ipairs(stages) do
|
for _, struct in ipairs(stages) do
|
||||||
|
local event, playerId = table.unpack(struct)
|
||||||
local player = playerId and self:getPlayerById(playerId) or nil
|
local player = playerId and self:getPlayerById(playerId) or nil
|
||||||
self.logic:trigger(event, player, damageStruct)
|
self.logic:trigger(event, player, damageStruct)
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,22 +21,22 @@ local fankui = fk.CreateTriggerSkill{
|
||||||
events = {fk.Damaged},
|
events = {fk.Damaged},
|
||||||
frequency = Skill.NotFrequent,
|
frequency = Skill.NotFrequent,
|
||||||
can_trigger = function(self, event, target, player, data)
|
can_trigger = function(self, event, target, player, data)
|
||||||
return target:hasSkill(self.name)
|
local room = target.room
|
||||||
|
local from = room:getPlayerById(data.from)
|
||||||
|
return from ~= nil and
|
||||||
|
target == player and
|
||||||
|
target:hasSkill(self.name)
|
||||||
end,
|
end,
|
||||||
on_trigger = function(self, event, target, player, data)
|
on_trigger = function(self, event, target, player, data)
|
||||||
local damage = data.damage
|
|
||||||
local room = player.room
|
local room = player.room
|
||||||
local from = room:getPlayerById(damage.from)
|
local from = room:getPlayerById(data.from)
|
||||||
if event == fk.Damaged then
|
if (not from) or from:isNude() then return false end
|
||||||
if from:isNude() then return false end
|
if room:askForSkillInvoke(player, self.name) then
|
||||||
if room:askForSkillInvoke(target, self.name) then
|
local card = room:askForCardChosen(player, from, "he", self.name)
|
||||||
local card = room:askForCardChosen(target, from, "he", self.name)
|
room:obtainCard(player.id, card, false, fk.ReasonPrey)
|
||||||
room:obtainCard(target.id, card, false, fk.ReasonPrey)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
local simayi = General:new(extension, "simayi", "wei", 3)
|
local simayi = General:new(extension, "simayi", "wei", 3)
|
||||||
simayi:addSkill(fankui)
|
simayi:addSkill(fankui)
|
||||||
Fk:loadTranslationTable{
|
Fk:loadTranslationTable{
|
||||||
|
|
Loading…
Reference in New Issue