太阳神三国杀lua吧 关注:2,646贴子:73,407
  • 4回复贴,共1

[求助]锁定技的问题

只看楼主收藏回复

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的角色造成伤害时,你获得其一张牌;当你受到伤害时,若伤害来源体力值大于你,你选择一项:交给其一张牌或其弃置你一张牌


IP属地:陕西1楼2017-07-31 23:19回复
    我就是学计算机的,也学了python,不过用lua写还是很不习惯
    贴吧里有人彻底整理过函数吗?


    IP属地:陕西2楼2017-07-31 23:22
    回复
      2025-06-21 00:09:09
      广告
      忘记写错误了,不好意思
      报错是在最后一行的位置:unexpected symbol near '}'


      IP属地:陕西3楼2017-07-31 23:25
      回复
        if then end 逗号 大括号 小括号的问题恐怕得你自己找


        IP属地:广西来自Android客户端4楼2017-08-01 00:57
        收起回复