无名杀吧 关注:64,004贴子:287,029
  • 5回复贴,共1

【求援】来个大佬帮忙改一下代码

只看楼主收藏回复


想把“出牌阶段限一次”改成“结束阶段开始时”,但是总是报‘length’的bug好像是有变量没有初始化
代码放下面


IP属地:湖北1楼2020-11-13 17:31回复
    //enable:'phaseUse',
    //usable:1,
    trigger:{player:'phaseJieshuBegin'},


    IP属地:湖北4楼2020-11-13 17:33
    回复
      qianghuax:{
      enable:'phaseUse',
      usable:1,
      filterCard:function(card){
      var type=get.type(card,'trick');
      for(var i=0;i<ui.selected.cards.length;i++){
      if(type==get.type(ui.selected.cards[i],'trick')) return false;
      }
      return true;
      },
      complexCard:true,
      position:'he',
      check:function(card){
      return 8-get.value(card);
      },
      selectCard:[1,Infinity],
      content:function(){
      var cards2=[];
      for(var i=0;i<cards.length;i++){
      var type=get.type(cards[i],'trick');
      var list=game.findCards(function(name){
      if(cards[i].name==name) return;
      if(get.type({name:name},'trick')==type){
      return get.value({name:name})>get.value(cards[i]);
      }
      });
      if(!list.length){
      list=game.findCards(function(name){
      if(cards[i].name==name) return;
      if(get.type({name:name},'trick')==type){
      return get.value({name:name})==get.value(cards[i]);
      }
      });
      }
      if(!list.length){
      list=[cards[i].name];
      }
      cards2.push(game.createCard(list.randomGet()));
      }
      player.gain(cards2,'log');
      player.$draw(cards2);
      },
      ai:{
      order:8,
      result:{
      player:1
      }
      }
      },


      IP属地:湖北5楼2020-11-13 17:34
      回复
        qianghuax:{
        trigger:{
        player:'phaseJieshuBegin',
        },
        filter:function(event,player){
        return player.countCards('he',function(card){
        return lib.filter.cardDiscardable(card,player);
        });
        },
        check:function(event,player){
        return player.countCards('he',function(card){
        return lib.filter.cardDiscardable(card,player)&&get.value(card)<8;
        });
        },
        content:function(){
        'step 0'
        player.chooseToDiscard(get.prompt('qianghuax'),'he',[1,Infinity],function(card){
        var type=get.type(card,'trick');
        for(var i=0;i<ui.selected.cards.length;i++){
        if(type==get.type(ui.selected.cards[i],'trick')) return false;
        }
        return true;
        },function(card){
        return 8-get.value(card);
        });
        'step 1'
        if(result.cards.length){
        var cards2=[];
        var cards=result.cards;
        for(var i=0;i<cards.length;i++){
        var type=get.type(cards[i],'trick');
        var list=game.findCards(function(name){
        if(cards.name==name) return;
        if(get.type({name:name},'trick')==type){
        return get.value({name:name})>get.value(cards[i]);
        }
        });
        if(!list.length){
        list=game.findCards(function(name){
        if(cards[i].name==name) return;
        if(get.type({name:name},'trick')==type){
        return get.value({name:name})==get.value(cards[i]);
        }
        });
        }
        if(!list.length){
        list=[cards[i].name];
        }
        cards2.push(game.createCard(list.randomGet()));
        }
        player.gain(cards2,'log');
        player.$draw(cards2);
        }
        },
        },


        IP属地:重庆8楼2020-11-13 20:12
        收起回复