This commit is contained in:
libccy 2017-07-20 08:52:37 +08:00
parent 46e34811d0
commit 22bf57bc33
5 changed files with 253 additions and 363 deletions

View File

@ -55,7 +55,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
basic:{ basic:{
useful:function(card,i){ useful:function(card,i){
if(_status.event.player.hp>1){ if(_status.event.player.hp>1){
if(i==0) return 5; if(i==0) return 4;
return 1; return 1;
} }
if(i==0) return 7.3; if(i==0) return 7.3;

View File

@ -815,7 +815,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
ai:{ ai:{
basic:{ basic:{
order:7.2, order:7.2,
useful:4, useful:4.5,
value:9.2 value:9.2
}, },
result:{ result:{

View File

@ -146,114 +146,21 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true, direct:true,
audio:'jiewei', audio:'jiewei',
filter:function(event,player){ filter:function(event,player){
return !player.isTurnedOver(); return !player.isTurnedOver()&&player.canMoveCard();
}, },
content:function(){ content:function(){
"step 0" "step 0"
player.chooseCardTarget({ player.chooseToDiscard('he',get.prompt('xinjiewei'),'弃置一张牌并移动场上的一张牌',lib.filter.cardDiscardable).set('ai',function(card){
ai1:function(card){ if(!_status.event.check) return 0;
return 7-get.useful(card); return 7-get.value(card);
}, }).set('check',player.canMoveCard(true)).set('logSkill','xinjiewei');
ai2:function(target){ "step 1"
var player=_status.event.player; if(result.bool){
if(ui.selected.targets.length==0){ player.moveCard(true);
if(target.countCards('j')&&get.attitude(player,target)>0) return 10; }
if(get.attitude(player,target)<0){ else{
var players=game.filterPlayer(); event.finish();
for(var i=0;i<players.length;i++){ }
if(get.attitude(player,players[i])>0){
if((target.getEquip(1)&&!players[i].getEquip(1))||
(target.getEquip(2)&&!players[i].getEquip(2))||
(target.getEquip(3)&&!players[i].getEquip(3))||
(target.getEquip(4)&&!players[i].getEquip(4))||
(target.getEquip(5)&&!players[i].getEquip(5))) return -get.attitude(player,target);
}
}
}
return 0;
}
return -get.attitude(player,target)*get.attitude(player,ui.selected.targets[0]);
},
multitarget:true,
filterTarget:function(card,player,target){
if(ui.selected.targets.length){
var from=ui.selected.targets[0];
var judges=from.getCards('j');
for(var i=0;i<judges.length;i++){
if(!target.hasJudge(judges[i].viewAs||judges[i].name)) return true;
}
if(target.isMin()) return false;
if((from.getEquip(1)&&!target.getEquip(1))||
(from.getEquip(2)&&!target.getEquip(2))||
(from.getEquip(3)&&!target.getEquip(3))||
(from.getEquip(4)&&!target.getEquip(4))||
(from.getEquip(5)&&!target.getEquip(5))) return true;
return false;
}
else{
return target.countCards('ej')>0;
}
},
selectTarget:2,
filterCard:lib.filter.cardDiscardable,
prompt:get.prompt('jiewei'),
prompt2:'弃置一张牌,然后移动场上的一张牌',
position:'he',
targetprompt:['被移走','移动目标'],
target:target
});
"step 1"
if(!result.bool){
event.finish();
return;
}
player.discard(result.cards);
player.logSkill('jiewei',result.targets,false);
player.line2(result.targets);
event.targets=result.targets;
"step 2"
game.delay();
"step 3"
if(targets.length==2){
player.choosePlayerCard('ej',true,function(button){
var player=_status.event.player;
var targets0=_status.event.targets0;
var targets1=_status.event.targets1;
if(get.attitude(player,targets0)>get.attitude(player,targets1)){
return get.position(button.link)=='j'?10:0;
}
else{
if(get.position(button.link)=='j') return -10;
return get.equipValue(button.link);
}
},targets[0]).set('targets0',targets[0]).set('targets1',targets[1]).set('filterButton',function(button){
var targets1=_status.event.targets1;
if(get.position(button.link)=='j'){
return !targets1.hasJudge(button.link.viewAs||button.link.name);
}
else{
return !targets1.countCards('e',{subtype:get.subtype(button.link)});
}
});
}
else{
event.finish();
}
"step 4"
if(result.bool&&result.links.length){
var link=result.links[0];
if(get.position(link)=='e'){
event.targets[1].equip(link);
}
else if(link.viewAs){
event.targets[1].addJudge({name:link.viewAs},[link]);
}
else{
event.targets[1].addJudge(link);
}
event.targets[0].$give(link,event.targets[1])
game.delay();
}
} }
} }
} }
@ -951,7 +858,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
event.finish(); event.finish();
} }
else{ else{
var next=player.chooseToDiscard('是否发动巧变跳过判定阶段?'); var next=player.chooseToDiscard(get.prompt('qiaobian'),'弃置一张手牌并跳过判定阶段');
next.set('ai',get.unuseful2); next.set('ai',get.unuseful2);
next.set('logSkill','qiaobian'); next.set('logSkill','qiaobian');
} }
@ -985,41 +892,35 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
check=(num>=2&&num2>0); check=(num>=2&&num2>0);
player.chooseCardTarget({ player.chooseToDiscard(get.prompt('qiaobian'),'弃置一张手牌并跳过摸牌阶段,然后可以获得至多两名角色各一张手牌',lib.filter.cardDiscardable).set('ai',function(card){
ai1:function(card){ if(!_status.event.check) return 0;
var evt=_status.event; return 7-get.value(card);
if(!evt.check) return 0; }).set('check',check).set('logSkill','qiaobian');
return 6-get.useful(card); "step 1"
}, if(result.bool){
ai2:function(target){ trigger.finish();
var evt=_status.event; trigger.untrigger();
if(!evt.check) return 0; player.chooseTarget([1,2],'获得至多两名角色各一张手牌',function(card,player,target){
return 1-get.attitude(evt.player,target); return target!=player&&target.countCards('h');
}, }).set('ai',function(target){
filterTarget:function(card,player,target){ return 1-get.attitude(_status.event.player,target);
return target.countCards('h')>0; })
}, }
selectTarget:[0,2], else{
filterCard:lib.filter.cardDiscardable, event.finish();
prompt:'是否发动巧变跳过摸牌阶段?', }
check:check, "step 2"
target:target
});
"step 1"
if(result.bool){ if(result.bool){
player.logSkill('qiaobian',result.targets); player.line(result.targets,'green');
player.discard(result.cards);
event.targets=result.targets; event.targets=result.targets;
if(!event.targets.length) event.finish(); if(!event.targets.length) event.finish();
} }
else{ else{
event.finish(); event.finish();
} }
"step 2"
player.gainMultiple(event.targets);
trigger.finish();
trigger.untrigger();
"step 3" "step 3"
player.gainMultiple(event.targets);
"step 4"
game.delay(); game.delay();
}, },
ai:{ ai:{
@ -1035,128 +936,39 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true, direct:true,
content:function(){ content:function(){
"step 0" "step 0"
var check=game.hasPlayer(function(current){ var check;
return get.attitude(player,current)>0&&current.countCards('j'); if(!player.canMoveCard(true)){
}); check=false;
if(!check){ }
if(player.countCards('h')>player.hp+1){ else{
check=false; check=game.hasPlayer(function(current){
} return get.attitude(player,current)>0&&current.countCards('j');
else if(player.countCards('h',{name:['wuzhong']})){ });
check=false; if(!check){
} if(player.countCards('h')>player.hp+1){
else{ check=false;
check=true; }
} else if(player.countCards('h',{name:['wuzhong']})){
} check=false;
player.chooseCardTarget({ }
ai1:function(card){ else{
if(!_status.event.check) return 0; check=true;
return 7-get.useful(card); }
}, }
ai2:function(target){ }
if(!_status.event.check) return 0; player.chooseToDiscard(get.prompt('qiaobian'),'弃置一张手牌并跳过出牌阶段,然后可以移动场上的一张牌',lib.filter.cardDiscardable).set('ai',function(card){
var player=_status.event.player; if(!_status.event.check) return 0;
if(ui.selected.targets.length==0){ return 7-get.value(card);
if(target.countCards('j')&&get.attitude(player,target)>0) return 10; }).set('check',check).set('logSkill','qiaobian');
if(get.attitude(player,target)<0){ "step 1"
var players=game.filterPlayer(); if(result.bool){
for(var i=0;i<players.length;i++){ trigger.untrigger();
if(get.attitude(player,players[i])>0){ trigger.finish();
if((target.getEquip(1)&&!players[i].getEquip(1))|| player.moveCard();
(target.getEquip(2)&&!players[i].getEquip(2))|| }
(target.getEquip(3)&&!players[i].getEquip(3))|| else{
(target.getEquip(4)&&!players[i].getEquip(4))|| event.finish();
(target.getEquip(5)&&!players[i].getEquip(5))) return -get.attitude(player,target); }
}
}
}
return 0;
}
return -get.attitude(player,target)*get.attitude(player,ui.selected.targets[0]);
},
multitarget:true,
filterTarget:function(card,player,target){
if(ui.selected.targets.length){
var from=ui.selected.targets[0];
var judges=from.getCards('j');
for(var i=0;i<judges.length;i++){
if(!target.hasJudge(judges[i].viewAs||judges[i].name)) return true;
}
if(target.isMin()) return false;
if((from.getEquip(1)&&!target.getEquip(1))||
(from.getEquip(2)&&!target.getEquip(2))||
(from.getEquip(3)&&!target.getEquip(3))||
(from.getEquip(4)&&!target.getEquip(4))||
(from.getEquip(5)&&!target.getEquip(5))) return true;
return false;
}
else{
return target.countCards('ej')>0;
}
},
selectTarget:2,
filterCard:lib.filter.cardDiscardable,
prompt:'是否发动巧变跳过出牌阶段?',
targetprompt:['被移走','移动目标'],
check:check,
target:target
});
"step 1"
if(!result.bool){
event.finish();
return;
}
trigger.untrigger();
trigger.finish();
player.discard(result.cards);
player.logSkill('qiaobian',result.targets,false);
player.line2(result.targets);
event.targets=result.targets;
if(!event.targets.length) event.finish();
"step 2"
game.delay();
"step 3"
if(targets.length==2){
player.choosePlayerCard('ej',function(button){
var player=_status.event.player;
var targets0=_status.event.targets0;
var targets1=_status.event.targets1;
if(get.attitude(player,targets0)>get.attitude(player,targets1)){
return get.position(button.link)=='j'?10:0;
}
else{
if(get.position(button.link)=='j') return -10;
return get.equipValue(button.link);
}
},targets[0]).set('targets0',targets[0]).set('targets1',targets[1]).set('filterButton',function(button){
var targets1=_status.event.targets1;
if(get.position(button.link)=='j'){
return !targets1.hasJudge(button.link.viewAs||button.link.name);
}
else{
return !targets1.countCards('e',{subtype:get.subtype(button.link)});
}
});
}
else{
event.finish();
}
"step 4"
if(result.bool&&result.links.length){
var link=result.links[0];
if(get.position(link)=='e'){
event.targets[1].equip(link);
}
else if(link.viewAs){
event.targets[1].addJudge({name:link.viewAs},[link]);
}
else{
event.targets[1].addJudge(link);
}
event.targets[0].$give(link,event.targets[1])
game.delay();
}
}, },
ai:{ ai:{
expose:0.2 expose:0.2
@ -1172,7 +984,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){ content:function(){
"step 0" "step 0"
var discard=player.countCards('h')>player.hp; var discard=player.countCards('h')>player.hp;
var next=player.chooseToDiscard('是否发动巧变跳过弃牌阶段?'); var next=player.chooseToDiscard(get.prompt('qiaobian'),'弃置一张手牌并跳过弃牌阶段');
next.logSkill='qiaobian'; next.logSkill='qiaobian';
next.ai=function(card){ next.ai=function(card){
if(discard){ if(discard){

View File

@ -927,6 +927,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
liguang:{ liguang:{
trigger:{player:'phaseEnd'}, trigger:{player:'phaseEnd'},
filter:function(event,player){ filter:function(event,player){
if(!player.canMoveCard()) return false;
if(!game.hasPlayer(function(current){ if(!game.hasPlayer(function(current){
return current.countCards('ej'); return current.countCards('ej');
})){ })){
@ -936,110 +937,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
direct:true, direct:true,
content:function(){ content:function(){
"step 0" "step 0"
player.chooseCardTarget({ player.chooseToDiscard(get.prompt('liguang'),'弃置一张手牌并移动场上的一张牌',lib.filter.cardDiscardable).set('ai',function(card){
ai1:function(card){ if(!_status.event.check) return 0;
return 7-get.useful(card); return 7-get.useful(card);
}, }).set('check',player.canMoveCard(true)).set('logSkill','liguang');
ai2:function(target){ "step 1"
var player=_status.event.player; if(result.bool){
if(ui.selected.targets.length==0){ player.moveCard(true);
if(target.countCards('j')&&get.attitude(player,target)>0) return 10; }
if(get.attitude(player,target)<0){ else{
var players=game.filterPlayer(); event.finish();
for(var i=0;i<players.length;i++){ }
if(get.attitude(player,players[i])>0){
if((target.getEquip(1)&&!players[i].getEquip(1))||
(target.getEquip(2)&&!players[i].getEquip(2))||
(target.getEquip(3)&&!players[i].getEquip(3))||
(target.getEquip(4)&&!players[i].getEquip(4))||
(target.getEquip(5)&&!players[i].getEquip(5))) return -get.attitude(player,target);
}
}
}
return 0;
}
return -get.attitude(player,target)*get.attitude(player,ui.selected.targets[0]);
},
multitarget:true,
filterTarget:function(card,player,target){
if(ui.selected.targets.length){
var from=ui.selected.targets[0];
var judges=from.getCards('j');
for(var i=0;i<judges.length;i++){
if(!target.hasJudge(judges[i].viewAs||judges[i].name)) return true;
}
if(target.isMin()) return false;
if((from.getEquip(1)&&!target.getEquip(1))||
(from.getEquip(2)&&!target.getEquip(2))||
(from.getEquip(3)&&!target.getEquip(3))||
(from.getEquip(4)&&!target.getEquip(4))||
(from.getEquip(5)&&!target.getEquip(5))) return true;
return false;
}
else{
return target.countCards('ej')>0;
}
},
selectTarget:2,
filterCard:lib.filter.cardDiscardable,
prompt:get.prompt('liguang'),
prompt2:'弃置一张手牌,然后移动场上的一张牌',
targetprompt:['被移走','移动目标'],
target:target
});
"step 1"
if(!result.bool){
event.finish();
return;
}
player.discard(result.cards);
player.logSkill('liguang',result.targets,false);
player.line2(result.targets);
event.targets=result.targets;
"step 2"
game.delay();
"step 3"
if(targets.length==2){
player.choosePlayerCard('ej',true,function(button){
var player=_status.event.player;
var targets0=_status.event.targets0;
var targets1=_status.event.targets1;
if(get.attitude(player,targets0)>get.attitude(player,targets1)){
return get.position(button.link)=='j'?10:0;
}
else{
if(get.position(button.link)=='j') return -10;
return get.equipValue(button.link);
}
},targets[0]).set('targets0',targets[0]).set('targets1',targets[1]).set('filterButton',function(button){
var targets1=_status.event.targets1;
if(get.position(button.link)=='j'){
return !targets1.hasJudge(button.link.viewAs||button.link.name);
}
else{
return !targets1.countCards('e',{subtype:get.subtype(button.link)});
}
});
}
else{
event.finish();
}
"step 4"
if(result.bool&&result.links.length){
var link=result.links[0];
if(get.position(link)=='e'){
event.targets[1].equip(link);
}
else if(link.viewAs){
event.targets[1].addJudge({name:link.viewAs},[link]);
}
else{
event.targets[1].addJudge(link);
}
event.targets[0].$give(link,event.targets[1])
game.delay();
}
}, },
ai:{ ai:{
expose:0.2, expose:0.2,

View File

@ -11044,6 +11044,110 @@
event.choosing=false; event.choosing=false;
if(event.dialog) event.dialog.close(); if(event.dialog) event.dialog.close();
}, },
moveCard:function(){
'step 0'
if(!player.canMoveCard()){
event.finish();
return;
}
var next=player.chooseTarget(2,function(card,player,target){
if(ui.selected.targets.length){
var from=ui.selected.targets[0];
var js=from.getCards('j');
for(var i=0;i<js.length;i++){
if(!target.hasJudge(js[i])) return true;
}
if(target.isMin()) return false;
var es=from.getCards('e');
for(var i=0;i<es.length;i++){
if(!target.getEquip(get.subtype(es[i]))) return true;
}
return false;
}
else{
return target.countCards('ej')>0;
}
});
next.set('ai',function(target){
var player=_status.event.player;
var att=get.attitude(player,target);
if(ui.selected.targets.length==0){
if(att>0){
if(target.countCards('j')) return 10;
}
else if(att<0){
if(game.hasPlayer(function(current){
if(get.attitude(player,current)>0){
var es=target.getCards('e');
for(var i=0;i<es.length;i++){
if(!current.getEquip(get.subtype(es[i]))) return true;
}
}
})){
return -att;
}
}
return 0;
}
return -att*get.attitude(player,ui.selected.targets[0]);
});
next.set('multitarget',true);
next.set('targetprompt',_status.event.targetprompt||['被移走','移动目标']);
next.set('prompt',event.prompt||'移动场上的一张牌');
if(event.prompt2) next.set('prompt2',event.prompt2);
if(event.forced) next.set('forced',true);
'step 1'
if(result.bool){
player.line2(result.targets,'green');
event.targets=result.targets;
}
else{
event.finish();
}
'step 2'
game.delay();
'step 3'
if(targets.length==2){
player.choosePlayerCard('ej',true,function(button){
var player=_status.event.player;
var targets0=_status.event.targets0;
var targets1=_status.event.targets1;
if(get.attitude(player,targets0)>get.attitude(player,targets1)){
return get.position(button.link)=='j'?10:0;
}
else{
if(get.position(button.link)=='j') return -10;
return get.equipValue(button.link);
}
},targets[0]).set('targets0',targets[0]).set('targets1',targets[1]).set('filterButton',function(button){
var targets1=_status.event.targets1;
if(get.position(button.link)=='j'){
return !targets1.hasJudge(button.link);
}
else{
return !targets1.countCards('e',{subtype:get.subtype(button.link)});
}
});
}
else{
event.finish();
}
'step 4'
if(result.bool&&result.links.length){
var link=result.links[0];
if(get.position(link)=='e'){
event.targets[1].equip(link);
}
else if(link.viewAs){
event.targets[1].addJudge({name:link.viewAs},[link]);
}
else{
event.targets[1].addJudge(link);
}
event.targets[0].$give(link,event.targets[1])
game.delay();
}
},
useCard:function(){ useCard:function(){
"step 0" "step 0"
if(!card){ if(!card){
@ -14630,6 +14734,68 @@
viewHandcards:function(target){ viewHandcards:function(target){
return this.viewCards(get.translation(target)+'的手牌',target.getCards('h')); return this.viewCards(get.translation(target)+'的手牌',target.getCards('h'));
}, },
canMoveCard:function(withatt){
var player=this;
return game.hasPlayer(function(current){
var att=get.attitude(player,current);
if(!withatt||att<=0){
var es=current.getCards('e');
for(var i=0;i<es.length;i++){
if(game.hasPlayer(function(current2){
if(withatt){
var att2=get.attitude(player,current2);
if(att2<=0) return false;
}
return current!=current2&&!current2.isMin()&&!current2.getEquip(get.subtype(es[i]));
})){
return true;
}
}
}
if(!withatt||att>0){
var js=current.getCards('j');
for(var i=0;i<js.length;i++){
if(game.hasPlayer(function(current2){
if(withatt){
var att2=get.attitude(player,current2);
if(att2>0) return false;
}
return current!=current2&&!current2.hasJudge(js[i]);
})){
return true;
}
}
}
});
},
moveCard:function(){
var next=game.createEvent('moveCard');
next.player=this;
for(var i=0;i<arguments.length;i++){
if(typeof arguments[i]=='boolean'){
next.forced=arguments[i];
}
else if(typeof arguments[i]=='string'){
if(next.prompt){
next.prompt2=arguments[i];
}
else{
next.prompt=arguments[i];
}
}
else if(Array.isArray(arguments[i])){
for(var j=0;j<arguments[i].length;j++){
if(typeof arguments[i][j]!='string') break;
}
if(j==arguments[i].length){
next.targetprompt=arguments[i];
}
}
}
next.setContent('moveCard');
next._args=Array.from(arguments);
return next;
},
useResult:function(result,event){ useResult:function(result,event){
event=event||_status.event; event=event||_status.event;
if(result._sendskill){ if(result._sendskill){
@ -16958,6 +17124,9 @@
return false; return false;
}, },
hasJudge:function(name){ hasJudge:function(name){
if(name&&typeof name=='object'){
name=name.viewAs||name.name;
}
var judges=this.node.judges.childNodes; var judges=this.node.judges.childNodes;
for(var i=0;i<judges.length;i++){ for(var i=0;i<judges.length;i++){
if(judges[i].classList.contains('removing')) continue; if(judges[i].classList.contains('removing')) continue;
@ -38891,7 +39060,7 @@
} }
else{ else{
ui.selected.targets.add(this); ui.selected.targets.add(this);
if(_status.event.name=='chooseToUse'||_status.event.name=='chooseCardTarget'){ if(_status.event.name=='chooseTarget'||_status.event.name=='chooseToUse'||_status.event.name=='chooseCardTarget'){
var targetprompt=null; var targetprompt=null;
if(_status.event.targetprompt){ if(_status.event.targetprompt){
targetprompt=_status.event.targetprompt; targetprompt=_status.event.targetprompt;