比如这是英魂的lua
newyinghunCard = sgs.CreateSkillCard{
name = "newyinghunCard",
target_fixed = false,
will_throw = true,
on_effect = function(self, effect)
local source = effect.from
local dest = effect.to
local x = source:getLostHp() + 1
local room = source:getRoom()
local good = false
if x == 1 then
dest:drawCards(1)
room:askForDiscard(dest, self:objectName(), 1, 1, false, true);
good = true
else
local choice = room:askForChoice(source, self:objectName(), "d1tx+dxt1")
if choice == "d1tx" then
dest:drawCards(1)
x = math.min(x, dest:getCardCount(true))
room:askForDiscard(dest, self:objectName(), x, x, false, true)
good = false
else
dest:drawCards(x)
room:askForDiscard(dest, self:objectName(), 1, 1, false, true)
good = true
end
end
if good then
room:setEmotion(dest, "good")
else
room:setEmotion(dest, "bad")
end
end
}
newyinghunVS = sgs.CreateViewAsSkill{
name = "newyinghun",
n = 0,
view_as = function(self, cards)
return newyinghunCard:clone()
end,
enabled_at_play = function(self, player)
return false
end,
enabled_at_response = function(self, player, pattern)
return pattern == "@@newyinghun"
end
}
newyinghun = sgs.CreateTriggerSkill{
name = "newyinghun",
frequency = sgs.Skill_NotFrequent,
events = {sgs.EventPhaseStart},
view_as_skill = newyinghunVS,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
room:askForUseCard(player, "@@newyinghun", "@yinghun")
return false
end,
can_trigger = function(self, target)
if target then
if target:isAlive() and target:hasSkill(self:objectName()) then
if target:getPhase() == sgs.Player_Start then
return true
end
end
end
return false
end
}
newyinghunCard = sgs.CreateSkillCard{
name = "newyinghunCard",
target_fixed = false,
will_throw = true,
on_effect = function(self, effect)
local source = effect.from
local dest = effect.to
local x = source:getLostHp() + 1
local room = source:getRoom()
local good = false
if x == 1 then
dest:drawCards(1)
room:askForDiscard(dest, self:objectName(), 1, 1, false, true);
good = true
else
local choice = room:askForChoice(source, self:objectName(), "d1tx+dxt1")
if choice == "d1tx" then
dest:drawCards(1)
x = math.min(x, dest:getCardCount(true))
room:askForDiscard(dest, self:objectName(), x, x, false, true)
good = false
else
dest:drawCards(x)
room:askForDiscard(dest, self:objectName(), 1, 1, false, true)
good = true
end
end
if good then
room:setEmotion(dest, "good")
else
room:setEmotion(dest, "bad")
end
end
}
newyinghunVS = sgs.CreateViewAsSkill{
name = "newyinghun",
n = 0,
view_as = function(self, cards)
return newyinghunCard:clone()
end,
enabled_at_play = function(self, player)
return false
end,
enabled_at_response = function(self, player, pattern)
return pattern == "@@newyinghun"
end
}
newyinghun = sgs.CreateTriggerSkill{
name = "newyinghun",
frequency = sgs.Skill_NotFrequent,
events = {sgs.EventPhaseStart},
view_as_skill = newyinghunVS,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
room:askForUseCard(player, "@@newyinghun", "@yinghun")
return false
end,
can_trigger = function(self, target)
if target then
if target:isAlive() and target:hasSkill(self:objectName()) then
if target:getPhase() == sgs.Player_Start then
return true
end
end
end
return false
end
}









