diff --git a/card/sp.js b/card/sp.js index 6970ea73a..9d2c22004 100644 --- a/card/sp.js +++ b/card/sp.js @@ -6,7 +6,18 @@ card.sp={ fullskin:true, type:'trick', ai:{ - useful:1, + useful:function(){ + var player=_status.event.player; + if(player.countCards('h','jinchan')>1) return 0; + var num=player.getHandcardLimit(); + if(num==1){ + return 10; + } + if(num==2){ + return 6; + } + return 1; + }, value:5 } }, @@ -99,7 +110,47 @@ card.sp={ fulei:{ fullskin:true, type:'delay', - enable:true, + modTarget:function(card,player,target){ + return lib.filter.judge(card,player,target); + }, + enable:function(card,player){ + return player.canAddJudge(card); + }, + filterTarget:function(card,player,target){ + return (lib.filter.judge(card,player,target)&&player==target); + }, + selectTarget:[-1,-1], + judge:function(card){ + if(get.suit(card)=='spade') return -6; + return 0; + }, + effect:function(){ + if(result.judge){ + if(!card.storage.fulei){ + card.storage.fulei=1; + } + else{ + card.storage.fulei++; + } + player.damage(card.storage.fulei,'thunder','nosource'); + } + player.addJudgeNext(card); + }, + cancel:function(){ + player.addJudgeNext(card); + }, + ai:{ + basic:{ + order:1, + useful:0, + value:0, + }, + result:{ + target:function(player,target){ + return lib.card.shandian.ai.result.target(player,target); + } + }, + } }, qibaodao:{ fullskin:true, diff --git a/card/standard.js b/card/standard.js index d9411f78f..abe76443e 100644 --- a/card/standard.js +++ b/card/standard.js @@ -1147,7 +1147,7 @@ card.standard={ return lib.filter.judge(card,player,target); }, enable:function(card,player){ - return (lib.filter.judge(card,player,player)); + return player.canAddJudge(card); }, filterTarget:function(card,player,target){ return (lib.filter.judge(card,player,target)&&player==target); @@ -1162,59 +1162,11 @@ card.standard={ player.damage(3,'thunder','nosource'); } else{ - if(!card.expired){ - var target=player.next; - for(var iwhile=0;iwhile<10;iwhile++){ - if(target.hasJudge('shandian')){ - target=target.next; - } - else{ - break; - } - } - if(target.hasJudge('shandian')||target==player){ - ui.discardPile.appendChild(card); - } - else{ - if(card.name!='shandian'){ - target.addJudge('shandian',card); - } - else{ - target.addJudge(card); - } - } - } - else{ - card.expired=false; - } + player.addJudgeNext(card); } }, cancel:function(){ - if(!card.expired){ - var target=player.next; - for(var iwhile=0;iwhile<10;iwhile++){ - if(target.hasJudge('shandian')){ - target=target.next; - } - else{ - break; - } - } - if(target.hasJudge('shandian')||target==player){ - ui.discardPile.appendChild(card); - } - else{ - if(card.name!='shandian'){ - target.addJudge('shandian',card); - } - else{ - target.addJudge(card); - } - } - } - else{ - card.expired=false; - } + player.addJudgeNext(card); }, ai:{ basic:{ diff --git a/card/yunchou.js b/card/yunchou.js index 723d80232..f1d02dea7 100644 --- a/card/yunchou.js +++ b/card/yunchou.js @@ -713,7 +713,7 @@ card.yunchou={ return lib.filter.judge(card,player,target); }, enable:function(card,player){ - return (lib.filter.judge(card,player,player)); + return player.canAddJudge(card); }, filterTarget:function(card,player,target){ return (lib.filter.judge(card,player,target)&&player==target); @@ -735,59 +735,11 @@ card.yunchou={ } } else{ - if(!card.expired){ - var target=player.next; - for(var iwhile=0;iwhile<10;iwhile++){ - if(target.hasJudge('huoshan')){ - target=target.next; - } - else{ - break; - } - } - if(target.hasJudge('huoshan')||target==player){ - ui.discardPile.appendChild(card); - } - else{ - if(card.name!='huoshan'){ - target.addJudge('huoshan',card); - } - else{ - target.addJudge(card); - } - } - } - else{ - card.expired=false; - } + player.addJudgeNext(card); } }, cancel:function(){ - if(!card.expired){ - var target=player.next; - for(var iwhile=0;iwhile<10;iwhile++){ - if(target.hasJudge('huoshan')){ - target=target.next; - } - else{ - break; - } - } - if(target.hasJudge('huoshan')||target==player){ - ui.discardPile.appendChild(card); - } - else{ - if(card.name!='huoshan'){ - target.addJudge('huoshan',card); - } - else{ - target.addJudge(card); - } - } - } - else{ - card.expired=false; - } + player.addJudgeNext(card); }, ai:{ basic:{ @@ -810,7 +762,7 @@ card.yunchou={ hongshui:{ type:'delay', enable:function(card,player){ - return (lib.filter.judge(card,player,player)); + return player.canAddJudge(card); }, modTarget:function(card,player,target){ return lib.filter.judge(card,player,target); diff --git a/game/game.js b/game/game.js index e3d64a98a..fc987ecf4 100644 --- a/game/game.js +++ b/game/game.js @@ -14444,6 +14444,46 @@ next.setContent('addJudge'); return next; }, + canAddJudge:function(card){ + var name; + if(typeof card=='string'){ + name=card; + } + else{ + name=card.viewAs||card.name; + } + if(!name) return false; + if(this.hasJudge(name)) return false; + var mod=game.checkMod(card,this,this,'unchanged','targetEnabled',this); + if(mod!='unchanged') return mod; + return true; + }, + addJudgeNext:function(card){ + if(!card.expired){ + var target=this.next; + var name=card.viewAs||card.name; + for(var iwhile=0;iwhile<20;iwhile++){ + if(target==this||target.canAddJudge(card)){ + break; + } + target=target.next; + } + if(target==this){ + ui.discardPile.appendChild(card); + } + else{ + if(card.name!=name){ + target.addJudge(name,card); + } + else{ + target.addJudge(card); + } + } + } + else{ + card.expired=false; + } + }, judge:function(){ var next=game.createEvent('judge'); next.player=this; diff --git a/image/card/fulei.png b/image/card/fulei.png index 48f4d9ea4..04776e7e1 100644 Binary files a/image/card/fulei.png and b/image/card/fulei.png differ