无名杀吧 关注:63,692贴子:286,028
  • 1回复贴,共1

大佬们求教写代码

只看楼主收藏回复

与一名角色交换所有技能,所有手牌咋写啊,难不难


来自Android客户端1楼2022-08-17 14:37回复
    skill={
    audio:"ext:九州录:2",
    enable:"phaseUse",
    usable:1,
    position:"he",
    filterCard:function(){
    if(ui.selected.targets.length==2) return false;
    return true;
    },
    selectCard:[0,Infinity],
    selectTarget:1,
    complexCard:true,
    filterTarget:function(card,player,target){
    if(player==target) return false;
    if(ui.selected.targets.length==0) return true;
    ui.selected.targets[0];
    return true;
    },
    multitarget:true,
    multiline:true,
    complexSelect:true,
    content:function(){
    var skills1=player.getSkills();
    var skills2=targets[0].getSkills();
    player.removeSkill(skills1);
    targets[0].removeSkill(skills2);
    player.addSkill(skills2);
    targets[0].addSkill(skills1);
    targets[0].swapHandcards(player);
    },
    check:function(card){
    var list=[],player=_status.event.player;
    var num=player.countCards('he');
    var count;
    var players=game.filterPlayer();
    for(var i=0;i<players.length;i++){
    if(players[i]!=player&&get.attitude(player,players[i])>3) list.push(players[i]);
    }
    list.sort(function(a,b){
    return a.countCards('h')-b.countCards('h');
    });
    if(list.length==0) return -1;
    var from=list[0];
    list.length=0;
    for(var i=0;i<players.length;i++){
    if(players[i]!=player&&get.attitude(player,players[i])<1) list.push(players[i]);
    }
    if(list.length==0) return -1;
    list.sort(function(a,b){
    return b.countCards('h')-a.countCards('h');
    });
    if(from.countCards('h')>=list[0].countCards('h')) return -1;
    for(var i=0;i<list.length&&from.countCards('h')<list[i].countCards('h');i++){
    if(list[i].countCards('h')-from.countCards('h')<=num){
    count=list[i].countCards('h')-from.countCards('h');break;
    }
    }
    if(count<2&&from.countCards('h')>=2) return -1;
    if(ui.selected.cards.length<count) return 11-get.value(card);
    return -1;
    },
    ai:{
    order:6,
    threaten:3,
    expose:0.9,
    result:{
    target:function(player,target){
    var list=[];
    var num=player.countCards('he');
    var players=game.filterPlayer();
    if(ui.selected.targets.length==0){
    for(var i=0;i<players.length;i++){
    if(players[i]!=player&&get.attitude(player,players[i])>3) list.push(players[i]);
    }
    list.sort(function(a,b){
    return a.countCards('h')-b.countCards('h');
    });
    if(target==list[0]) return get.attitude(player,target);
    return -get.attitude(player,target);
    }
    else{
    var from=ui.selected.targets[0];
    for(var i=0;i<players.length;i++){
    if(players[i]!=player&&get.attitude(player,players[i])<1) list.push(players[i]);
    }
    list.sort(function(a,b){
    return b.countCards('h')-a.countCards('h');
    });
    if(from.countCards('h')>=list[0].countCards('h')) return -get.attitude(player,target);
    for(var i=0;i<list.length&&from.countCards('h')<list[i].countCards('h');i++){
    if(list[i].countCards('h')-from.countCards('h')<=num){
    var count=list[i].countCards('h')-from.countCards('h');
    if(count<2&&from.countCards('h')>=2) return -get.attitude(player,target);
    if(target==list[i]) return get.attitude(player,target);
    return -get.attitude(player,target);
    }
    }
    }
    },
    },
    },
    }


    IP属地:北京2楼2022-08-21 13:39
    回复