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:{
useful:function(card,i){
if(_status.event.player.hp>1){
if(i==0) return 5;
if(i==0) return 4;
return 1;
}
if(i==0) return 7.3;

View File

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

View File

@ -146,114 +146,21 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
audio:'jiewei',
filter:function(event,player){
return !player.isTurnedOver();
return !player.isTurnedOver()&&player.canMoveCard();
},
content:function(){
"step 0"
player.chooseCardTarget({
ai1:function(card){
return 7-get.useful(card);
},
ai2:function(target){
var player=_status.event.player;
if(ui.selected.targets.length==0){
if(target.countCards('j')&&get.attitude(player,target)>0) return 10;
if(get.attitude(player,target)<0){
var players=game.filterPlayer();
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
});
player.chooseToDiscard('he',get.prompt('xinjiewei'),'弃置一张牌并移动场上的一张牌',lib.filter.cardDiscardable).set('ai',function(card){
if(!_status.event.check) return 0;
return 7-get.value(card);
}).set('check',player.canMoveCard(true)).set('logSkill','xinjiewei');
"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)});
}
});
if(result.bool){
player.moveCard(true);
}
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();
}
else{
var next=player.chooseToDiscard('是否发动巧变跳过判定阶段?');
var next=player.chooseToDiscard(get.prompt('qiaobian'),'弃置一张手牌并跳过判定阶段');
next.set('ai',get.unuseful2);
next.set('logSkill','qiaobian');
}
@ -985,41 +892,35 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
check=(num>=2&&num2>0);
player.chooseCardTarget({
ai1:function(card){
var evt=_status.event;
if(!evt.check) return 0;
return 6-get.useful(card);
},
ai2:function(target){
var evt=_status.event;
if(!evt.check) return 0;
return 1-get.attitude(evt.player,target);
},
filterTarget:function(card,player,target){
return target.countCards('h')>0;
},
selectTarget:[0,2],
filterCard:lib.filter.cardDiscardable,
prompt:'是否发动巧变跳过摸牌阶段?',
check:check,
target:target
});
player.chooseToDiscard(get.prompt('qiaobian'),'弃置一张手牌并跳过摸牌阶段,然后可以获得至多两名角色各一张手牌',lib.filter.cardDiscardable).set('ai',function(card){
if(!_status.event.check) return 0;
return 7-get.value(card);
}).set('check',check).set('logSkill','qiaobian');
"step 1"
if(result.bool){
player.logSkill('qiaobian',result.targets);
player.discard(result.cards);
trigger.finish();
trigger.untrigger();
player.chooseTarget([1,2],'获得至多两名角色各一张手牌',function(card,player,target){
return target!=player&&target.countCards('h');
}).set('ai',function(target){
return 1-get.attitude(_status.event.player,target);
})
}
else{
event.finish();
}
"step 2"
if(result.bool){
player.line(result.targets,'green');
event.targets=result.targets;
if(!event.targets.length) event.finish();
}
else{
event.finish();
}
"step 2"
player.gainMultiple(event.targets);
trigger.finish();
trigger.untrigger();
"step 3"
player.gainMultiple(event.targets);
"step 4"
game.delay();
},
ai:{
@ -1035,7 +936,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
content:function(){
"step 0"
var check=game.hasPlayer(function(current){
var check;
if(!player.canMoveCard(true)){
check=false;
}
else{
check=game.hasPlayer(function(current){
return get.attitude(player,current)>0&&current.countCards('j');
});
if(!check){
@ -1049,114 +955,20 @@ game.import('character',function(lib,game,ui,get,ai,_status){
check=true;
}
}
player.chooseCardTarget({
ai1:function(card){
}
player.chooseToDiscard(get.prompt('qiaobian'),'弃置一张手牌并跳过出牌阶段,然后可以移动场上的一张牌',lib.filter.cardDiscardable).set('ai',function(card){
if(!_status.event.check) return 0;
return 7-get.useful(card);
},
ai2:function(target){
if(!_status.event.check) return 0;
var player=_status.event.player;
if(ui.selected.targets.length==0){
if(target.countCards('j')&&get.attitude(player,target)>0) return 10;
if(get.attitude(player,target)<0){
var players=game.filterPlayer();
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:'是否发动巧变跳过出牌阶段?',
targetprompt:['被移走','移动目标'],
check:check,
target:target
});
return 7-get.value(card);
}).set('check',check).set('logSkill','qiaobian');
"step 1"
if(!result.bool){
event.finish();
return;
}
if(result.bool){
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)});
}
});
player.moveCard();
}
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:{
expose:0.2
@ -1172,7 +984,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){
"step 0"
var discard=player.countCards('h')>player.hp;
var next=player.chooseToDiscard('是否发动巧变跳过弃牌阶段?');
var next=player.chooseToDiscard(get.prompt('qiaobian'),'弃置一张手牌并跳过弃牌阶段');
next.logSkill='qiaobian';
next.ai=function(card){
if(discard){

View File

@ -927,6 +927,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
liguang:{
trigger:{player:'phaseEnd'},
filter:function(event,player){
if(!player.canMoveCard()) return false;
if(!game.hasPlayer(function(current){
return current.countCards('ej');
})){
@ -937,109 +938,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
content:function(){
"step 0"
player.chooseCardTarget({
ai1:function(card){
player.chooseToDiscard(get.prompt('liguang'),'弃置一张手牌并移动场上的一张牌',lib.filter.cardDiscardable).set('ai',function(card){
if(!_status.event.check) return 0;
return 7-get.useful(card);
},
ai2:function(target){
var player=_status.event.player;
if(ui.selected.targets.length==0){
if(target.countCards('j')&&get.attitude(player,target)>0) return 10;
if(get.attitude(player,target)<0){
var players=game.filterPlayer();
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
});
}).set('check',player.canMoveCard(true)).set('logSkill','liguang');
"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)});
}
});
if(result.bool){
player.moveCard(true);
}
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:{
expose:0.2,

View File

@ -11044,6 +11044,110 @@
event.choosing=false;
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(){
"step 0"
if(!card){
@ -14630,6 +14734,68 @@
viewHandcards:function(target){
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){
event=event||_status.event;
if(result._sendskill){
@ -16958,6 +17124,9 @@
return false;
},
hasJudge:function(name){
if(name&&typeof name=='object'){
name=name.viewAs||name.name;
}
var judges=this.node.judges.childNodes;
for(var i=0;i<judges.length;i++){
if(judges[i].classList.contains('removing')) continue;
@ -38891,7 +39060,7 @@
}
else{
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;
if(_status.event.targetprompt){
targetprompt=_status.event.targetprompt;