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

请问,如何将两个技能合为一个

取消只看楼主收藏回复

请问,如何将两个技能合为一个
例如,将嫉恶和无双合并为一个技能


IP属地:上海1楼2015-02-27 20:30回复
    LuabaozouCard = sgs.CreateSkillCard{
    name = "LuabaozouCard",
    target_fixed = true,
    will_throw = true,
    on_use = function(self, room, source, targets)
    source:setFlags("Luabaozou")
    end
    }
    Luabaozou = sgs.CreateViewAsSkill{
    name = "Luabaozou",
    n = 1,
    view_filter = function(self, selected, to_select)
    return to_select:isKindOf("EquipCard")
    end,
    view_as = function(self, cards)
    if #cards == 1 then
    local card = LuabaozouCard:clone()
    card:addSubcard(cards[1])
    return card
    end
    end,
    enabled_at_play = function(self, player)
    if not player:hasUsed("#LuabaozouCard") then
    return not player:isNude()
    end
    return false
    end
    }
    LuabaozouBuff = sgs.CreateTriggerSkill{
    name = "#LuabaozouBuff",
    frequency = sgs.Skill_Frequent,
    events = {sgs.ConfirmDamage,sgs.TargetConfirmed,sgs.CardEffected},
    on_trigger = function(self, event, player, data)
    local damage = data:toDamage()
    local reason = damage.card
    local room = player:getRoom()
    if reason then
    if reason:isKindOf("Slash") or reason:isKindOf("Duel") then
    damage.damage = damage.damage + 3
    data:setValue(damage)
    end
    elseif event == sgs.TargetConfirmed then
    local use = data:toCardUse()
    local can_invoke = false
    if use.card:isKindOf("Slash") and (player and player:isAlive() and player:hasSkill(self:objectName())) and (use.from:objectName() == player:objectName()) then
    can_invoke = true
    local jink_table = sgs.QList2Table(player:getTag("Jink_" .. use.card:toString()):toIntList())
    for i = 0, use.to:length() - 1, 1 do
    if jink_table[i + 1] == 1 then
    jink_table[i + 1] = 2 --只要设置出两张闪就可以了,不用两次askForCard
    end
    end
    local jink_data = sgs.QVariant()
    jink_data:setValue(Table2IntList(jink_table))
    player:setTag("Jink_" .. use.card:toString(), jink_data)
    end
    elseif event == sgs.CardEffected then
    local effect = data:toCardEffect()
    if effect.card:isKindOf("Duel") then
    if effect.from and effect.from:isAlive() and effect.from:hasSkill(self:objectName()) then
    can_invoke = true
    end
    if effect.to and effect.to:isAlive() and effect.to:hasSkill(self:objectName()) then
    can_invoke = true
    end
    end
    if not can_invoke then return false end
    if effect.card:isKindOf("Duel") then
    if room:isCanceled(effect) then
    effect.to:setFlags("Global_NonSkillNullify")
    return true;
    end
    if effect.to:isAlive() then
    local second = effect.from
    local first = effect.to
    room:setEmotion(first, "duel");
    room:setEmotion(second, "duel")
    while true do
    if not first:isAlive() then
    break
    end
    local slash
    if second:hasSkill(self:objectName()) then
    slash = room:askForCard(first,"slash","@Luabaozou-slash-1:" .. second:objectName(),data,sgs.Card_MethodResponse, second);
    if slash == nil then
    break
    end
    slash = room:askForCard(first, "slash", "@Luabaozou-slash-2:" .. second:objectName(),data,sgs.Card_MethodResponse,second);
    if slash == nil then
    break
    end
    else
    slash = room:askForCard(first,"slash","duel-slash:" .. second:objectName(),data,sgs.Card_MethodResponse,second)
    if slash == nil then
    break
    end
    end
    local temp = first
    first = second
    second = temp
    end
    local daamgeSource = function() if second:isAlive() then return secoud else return nil end end
    local damage = sgs.DamageStruct(effect.card, daamgeSource() , first)
    if second:objectName() ~= effect.from:objectName() then
    damage.by_user = false;
    end
    room:damage(damage)
    end
    room:setTag("SkipGameRule",sgs.QVariant(true))
    end
    end
    return false
    end,
    can_trigger = function(self, target)
    if target then
    if target:hasFlag("Luabaozou") then
    return target:isAlive()
    end
    end
    return false
    end
    }
    Table2IntList = function(theTable)
    local result = sgs.IntList()
    for i = 1, #theTable, 1 do
    result:append(theTable[i])
    end
    return result
    end
    我把裸衣和无双合并了
    代码如上,亲测好用
    我想再合并个咆哮试试。。。但不知道该咋弄了


    IP属地:上海2楼2015-02-27 21:09
    回复
      luoying:addSkill(Luabaozou)
      luoying:addSkill(Luaxianming)
      luoying:addSkill(Luabishi)
      luoying:addSkill(LuabaozouBuff)
      extension:insertRelatedSkills("Luaxianming", "Lualeidong","Luamoutian", "NosQicai" )
      extension:insertRelatedSkills("Luabishi", "weimu","xiangle" )


      IP属地:上海4楼2015-02-28 12:37
      收起回复
        这样?还是不好使啊!而且,有几个技能是我自己写的,要加引号么?


        IP属地:上海5楼2015-02-28 12:38
        收起回复
          又跑了一个。。。快来人啊!救命啊!怎么写啊?


          IP属地:上海7楼2015-02-28 13:38
          收起回复