太阳神三国杀lua吧 关注:2,637贴子:73,375
  • 9回复贴,共1

已经被这段代码虐瞎

只看楼主收藏回复

YangyanCard = sgs.CreateSkillCard{
name = "YangyanCard",
target_fixed = false,
will_throw = false,
on_use = function(self, room, source, targets)
local fire = source:getPile("fire")
room:fillAG(fire, source)
local id = room:askForAG(source, fire, false, "LuaYangyan")
room:throwCard(id, source)
source:invoke("clearAG")
local card = sgs.Sanguosha:getCard(id)
local number = card:getNumber()
local list = room:getAlivePlayers()
local dest = room:askForPlayerChosen(source, list, "LuaYangyan")
local count = (number+1) / 2
local theDamage = sgs.DamageStruct()
theDamage.from = source
theDamage.to = dest
theDamage.damage_Fire = count
theDamage.nature = sgs.DamageStruct_Normal
room:damage(theDamage)
end
}
这个技能卡我到底写错了什么为何到了clearAG就失效


1楼2015-08-22 08:04回复
    room:clearAG(source)
    你这样试试


    2楼2015-08-22 08:22
    回复
      YangyanCard = sgs.CreateSkillCard{
      name = "YangyanCard",
      target_fixed = false,
      will_throw = false,
      on_use = function(self, room, source, targets)
      local fire = source:getPile("fire")
      local dest = target[1]
      room:fillAG(fire, source)
      local id = room:askForAG(source, fire, false, "LuaYangyan")
      room:throwCard(id, source)
      room:clearAG(source)
      local card = sgs.Sanguosha:getCard(id)
      local number = card:getNumber()
      local count = (number+1) / 2
      local theDamage = sgs.DamageStruct()
      theDamage.from = source
      theDamage.to = dest
      theDamage.damage = count
      theDamage.nature = sgs.DamageStruct_Normal
      room:damage(theDamage)
      end
      }


      3楼2015-08-22 08:26
      收起回复
        YangyanCard = sgs.CreateSkillCard{
        name = "YangyanCard",
        on_use = function(self, room, source, targets)
        local fire = source:getPile("fire")
        room:fillAG(fire, source)
        local id = room:askForAG(source, fire, false, self:objectName())
        room:throwCard(id, source)
        room:clearAG(source)
        room:damage(sgs.DamageStruct(self:objectName(), source, targets[1], (sgs.Sanguosha:getCard(id):getNumber() + 1) / 2))
        end
        }
        我简化了代码 若还有问题 请重发代码完整版以及描述


        IP属地:内蒙古4楼2015-08-22 11:33
        收起回复
          LuaXvshi = sgs.CreateTriggerSkill{
          name = "LuaXvshi",
          frequency = sgs.Skill_NotFrequent,
          events = {sgs.DrawNCards, sgs.EventPhaseStart},
          on_trigger = function(self, event, player, data)
          local room = player:getRoom()
          if event == sgs.DrawNCards then
          local count = data:toInt()
          if count > 0 then
          if room:askForSkillInvoke(player, "LuaXvshi", data) then
          data:setValue(count - 1)
          local judge = sgs.JudgeStruct()
          judge.who = player
          judge.pattern = "."
          judge.good = true
          judge.reason = "LuaXvshi"
          room:judge(judge)
          local card = judge.card
          if card:isKindOf("BasicCard") then
          room:setTag("Xvshi_count", sgs.QVariant(card:getNumber()))
          end
          end
          end
          elseif event == sgs.PhaseStart then
          local phase = player:getPhase()
          if phase == sgs.Player_Finish then
          local tag = room:getTag("Xvshi_count")
          room:drawCards(player, tag:toInt(), "LuaXvshi")
          room:removeTag("Xvshi_count")
          end
          end
          end
          }


          5楼2015-08-22 18:27
          回复
            用标记代替好了 还有 问问题要说描述


            IP属地:内蒙古6楼2015-08-22 19:27
            回复