LuaJieLue = sgs.CreateTriggerSkill{
name = "JieLue" ,
events = {sgs.Damage, sgs.Damaged} ,
frequency = sgs.Skill_Compulsory ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.Damage then
local damage = data:toDamage()
if damage.from and damage.to and (damage.from:objectName() == player:objectName()) and not damage.to:isNude() and damage.from:distanceTo(damage.to) <= 1 then
local id=room:askForCardChosen(player,damage.to,"he","JieLue")
room:obtainCard(player,id,false)
end
elseif event == sgs.Damaged then
local damage = data:toDamage()
local from = damage.from
if from and (from:objectName() ~= player:objectName()) and (from:getHp()>player:getHp()) then
local card
if not player: isNude() then
card = room:askForExchange(player, self:objectName(), 1,1, true, "JieLueGive", true)
else
if card then
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_GIVE, player:objectName(),from:objectName(), self:objectName(), nil)
reason.m_playerId = from:objectName()
room:moveCardTo(card, player,from, sgs.Player_PlaceHand, reason)
else
local id=room:askForCardChosen(from,player,"he","JieLue")
room:throwCard(id,player,from)
end
end
end
return false
end
}
我参考老法正恩怨技能改的
期望的技能效果:锁定技,对距离为1的角色造成伤害时,你获得其一张牌;当你受到伤害时,若伤害来源体力值大于你,你选择一项:交给其一张牌或其弃置你一张牌
name = "JieLue" ,
events = {sgs.Damage, sgs.Damaged} ,
frequency = sgs.Skill_Compulsory ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.Damage then
local damage = data:toDamage()
if damage.from and damage.to and (damage.from:objectName() == player:objectName()) and not damage.to:isNude() and damage.from:distanceTo(damage.to) <= 1 then
local id=room:askForCardChosen(player,damage.to,"he","JieLue")
room:obtainCard(player,id,false)
end
elseif event == sgs.Damaged then
local damage = data:toDamage()
local from = damage.from
if from and (from:objectName() ~= player:objectName()) and (from:getHp()>player:getHp()) then
local card
if not player: isNude() then
card = room:askForExchange(player, self:objectName(), 1,1, true, "JieLueGive", true)
else
if card then
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_GIVE, player:objectName(),from:objectName(), self:objectName(), nil)
reason.m_playerId = from:objectName()
room:moveCardTo(card, player,from, sgs.Player_PlaceHand, reason)
else
local id=room:askForCardChosen(from,player,"he","JieLue")
room:throwCard(id,player,from)
end
end
end
return false
end
}
我参考老法正恩怨技能改的
期望的技能效果:锁定技,对距离为1的角色造成伤害时,你获得其一张牌;当你受到伤害时,若伤害来源体力值大于你,你选择一项:交给其一张牌或其弃置你一张牌