This commit is contained in:
libccy 2017-02-10 16:13:06 +08:00
parent cd554129cd
commit 85046e9bc0
11 changed files with 130 additions and 76 deletions

View File

@ -1187,16 +1187,36 @@ card.swd={
} }
}, },
ai:{ ai:{
order:1, order:4,
result:{ result:{
target:function(player,target){ target:function(player,target){
if(target.get('e','2')){ if(target.get('e','2')){
if(target.num('h')) return -0.6; if(target.num('h')&&!target.hasSkillTag('noe')) return -0.6;
return 0; return 0;
} }
else{ else{
if(target.num('h')) return 0.5; var hs=target.get('h');
return 1; var num=0;
if(target.hasSkillTag('noe')){
num=1;
}
if(player==target){
if(hs.length==2) return num;
if(hs.length==1) return num+1;
if(hs.length<=4){
for(var i=0;i<hs.length;i++){
if(ai.get.value(hs[i])>6) return num;
}
}
if(hs.length>4) return num+0.5;
}
else{
if(hs.length){
if(hs.length<=3) return num;
return num+0.5;
}
}
return num+1;
} }
} }
}, },
@ -1229,7 +1249,7 @@ card.swd={
order:9, order:9,
result:{ result:{
target:function(player,target){ target:function(player,target){
if(target.num('h')<target.hp) return 1; if(!player.needsToDiscard()) return 1;
return 0; return 0;
} }
}, },
@ -1257,7 +1277,19 @@ card.swd={
result:{ result:{
target:function(player,target){ target:function(player,target){
if(target.hasSkillTag('noe')) return target.num('e')*2; if(target.hasSkillTag('noe')) return target.num('e')*2;
return -target.num('e'); var num=0;
var es=target.get('e');
for(var i=0;i<es.length;i++){
var subtype=get.subtype(es[i]);
if(subtype=='equip1'||subtype=='equip3'){
num++;
}
}
var mn=target.getEquip('muniu');
if(mn&&mn.cards&&mn.cards.length){
num+=mn.cards.length;
}
return -num;
} }
}, },
useful:[2,0.5], useful:[2,0.5],
@ -1285,7 +1317,7 @@ card.swd={
target.addTempSkill('qianxing',{player:'turnOverAfter'}); target.addTempSkill('qianxing',{player:'turnOverAfter'});
}, },
ai:{ ai:{
order:9, order:2,
result:{ result:{
target:-1, target:-1,
}, },
@ -4110,10 +4142,7 @@ card.swd={
} }
}, },
ai:{ ai:{
order:function(card,player){ order:1,
if(player.num('h',{type:'hslingjian'})) return 8.5;
return 1;
},
result:{ result:{
player:1, player:1,
} }

View File

@ -776,21 +776,21 @@ character.gujian={
direct:true, direct:true,
content:function(){ content:function(){
"step 0" "step 0"
player.chooseToDiscard(get.prompt('fumo',trigger.source),2,function(card){ var next=player.chooseToDiscard(get.prompt('fumo',trigger.source),2,function(card){
if(ui.selected.cards.length){ if(ui.selected.cards.length){
return get.color(card)==get.color(ui.selected.cards[0]); return get.color(card)==get.color(ui.selected.cards[0]);
} }
return player.num('h',{color:get.color(card)})>1; return player.num('h',{color:get.color(card)})>1;
}).set('complexCard',true).ai=function(card){ }).set('complexCard',true);
next.ai=function(card){
if(ai.get.damageEffect(trigger.source,player,player,'thunder')>0){ if(ai.get.damageEffect(trigger.source,player,player,'thunder')>0){
return 8-ai.get.value(card); return 8-ai.get.value(card);
} }
return 0; return 0;
}; };
next.logSkill=['fumo',trigger.source,'thunder'];
"step 1" "step 1"
if(result.bool){ if(result.bool){
player.logSkill('fumo',trigger.source,'thunder');
// player.line(trigger.source,'thunder');
trigger.source.damage('thunder'); trigger.source.damage('thunder');
} }
}, },

View File

@ -1358,7 +1358,6 @@ character.refresh={
} }
return target.num('he')>0; return target.num('he')>0;
}, },
complexTarget:true,
filter:function(event,player){ filter:function(event,player){
return player.num('he')>0; return player.num('he')>0;
}, },

View File

@ -55,7 +55,7 @@ character.shenhua={
}, },
selectCard:[0,Infinity], selectCard:[0,Infinity],
selectTarget:2, selectTarget:2,
complexTarget:true, complexCard:true,
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
if(player==target) return false; if(player==target) return false;
if(ui.selected.targets.length==0) return true; if(ui.selected.targets.length==0) return true;
@ -887,7 +887,6 @@ character.shenhua={
return target.num('ej')>0; return target.num('ej')>0;
} }
}, },
complexTarget:true,
selectTarget:2, selectTarget:2,
filterCard:lib.filter.cardDiscardable, filterCard:lib.filter.cardDiscardable,
prompt:'是否发动巧变跳过出牌阶段?', prompt:'是否发动巧变跳过出牌阶段?',
@ -2079,7 +2078,7 @@ character.shenhua={
}, },
selectCard:[0,Infinity], selectCard:[0,Infinity],
selectTarget:2, selectTarget:2,
complexTarget:true, complexCard:true,
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
if(player==target) return false; if(player==target) return false;
if(ui.selected.targets.length==0) return true; if(ui.selected.targets.length==0) return true;

View File

@ -1076,7 +1076,6 @@ character.sp={
init:function(player){ init:function(player){
player.storage.jianshu=false; player.storage.jianshu=false;
}, },
complexTarget:true,
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
if(ui.selected.targets.length){ if(ui.selected.targets.length){
return target.num('h')>0&&target.distanceTo(ui.selected.targets[0])<=1; return target.num('h')>0&&target.distanceTo(ui.selected.targets[0])<=1;
@ -6483,6 +6482,7 @@ character.sp={
position:'he', position:'he',
selectCard:[1,Infinity], selectCard:[1,Infinity],
complexSelect:true, complexSelect:true,
complexCard:true,
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
return target!=player&&get.distance(player,target,'attack')<=1&&ui.selected.cards.length==target.hp; return target!=player&&get.distance(player,target,'attack')<=1&&ui.selected.cards.length==target.hp;
}, },

View File

@ -1536,7 +1536,6 @@ character.standard={
check:function(card){return 10-ai.get.value(card)}, check:function(card){return 10-ai.get.value(card)},
filterCard:true, filterCard:true,
position:'he', position:'he',
complexTarget:true,
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
if(player==target) return false; if(player==target) return false;
if(target.sex!='male') return false; if(target.sex!='male') return false;

View File

@ -6986,7 +6986,6 @@ character.swd={
return true; return true;
}, },
complexCard:true, complexCard:true,
complexTarget:true,
selectCard:[1,Infinity], selectCard:[1,Infinity],
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
if(player==target) return false; if(player==target) return false;

View File

@ -5337,7 +5337,6 @@ character.yijiang={
return false; return false;
}, },
selectTarget:2, selectTarget:2,
complexTarget:true,
content:function(){ content:function(){
'step 0' 'step 0'
var gainner,giver; var gainner,giver;
@ -5419,7 +5418,6 @@ character.yijiang={
selectTarget:2, selectTarget:2,
multitarget:true, multitarget:true,
discard:false, discard:false,
complexTarget:true,
targetprompt:['得到牌','出杀目标'], targetprompt:['得到牌','出杀目标'],
prepare:'give', prepare:'give',
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
@ -6752,7 +6750,6 @@ character.yijiang={
return Math.abs(ui.selected.targets[0].num('e')-target.num('e'))<=player.maxHp-player.hp; return Math.abs(ui.selected.targets[0].num('e')-target.num('e'))<=player.maxHp-player.hp;
}, },
multitarget:true, multitarget:true,
complexTarget:true,
content:function(){ content:function(){
"step 0" "step 0"
event.cards=[targets[0].get('e'),targets[1].get('e')]; event.cards=[targets[0].get('e'),targets[1].get('e')];

View File

@ -2336,7 +2336,6 @@ character.yxs={
return 7-ai.get.value(card); return 7-ai.get.value(card);
}, },
multitarget:true, multitarget:true,
complexTarget:true,
targetprompt:['被移走','移动目标'], targetprompt:['被移走','移动目标'],
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
if(ui.selected.targets.length){ if(ui.selected.targets.length){

View File

@ -20504,59 +20504,63 @@
var cards=player.get(event.position||'h'); var cards=player.get(event.position||'h');
var firstCheck=false; var firstCheck=false;
range=get.select(event.selectCard); range=get.select(event.selectCard);
if(!event._cardChoice&&typeof event.selectCard!='function'){ if(!event._cardChoice&&typeof event.selectCard!='function'&&!event.complexCard&&range[1]!=-1){
if(range[0]==1&&range[1]==1){ event._cardChoice=[];
event._cardChoice=[]; firstCheck=true;
}
else if(typeof event.filterCard!='function'){
event._cardChoice=[];
}
else if(!event.complexCard){
event._cardChoice=[];
}
if(event._cardChoice){
firstCheck=true;
}
} }
// if(event.name=='chooseToUse'&&event.parent.name=='phaseUse'&&!event.skill&&
// !event._targetChoice&&event._cardChoice&&event._cardChoice.length){
// event._targetChoice=new Map();
// var tmpselect=ui.selected;
// for(var i=0;i<event._cardChoice.length;i++){
// var targets=[];
// if(!lib.card[event._cardChoice[i].name].complexTarget){
// ui.selected={buttons:[],cards:[event._cardChoice[i]],targets:[]};
// for(var j=0;j<game.players.length;j++){
// if(event.filterTarget(event._cardChoice[i],,game.players[i]))
// }
// }
// }
// }
var selectableCards=false; var selectableCards=false;
if(range[0]!=range[1]||range[0]>1) auto=false; if(range[0]!=range[1]||range[0]>1) auto=false;
for(i=0;i<cards.length;i++){ for(i=0;i<cards.length;i++){
if(event._cardChoice&&!firstCheck){ var nochess=true;
if(ui.selected.cards.length>=range[1]|| if(!lib.filter.cardAiIncluded(cards[i])){
!event._cardChoice.contains(cards[i])|| nochess=false;
!lib.filter.cardAiIncluded(cards[i])){ }
cards[i].classList.remove('selectable'); else if(event._cardChoice&&!firstCheck){
} if(!event._cardChoice.contains(cards[i])){
else{ nochess=false;
cards[i].classList.add('selectable');
} }
} }
else{ else{
if(event.filterCard(cards[i],player)&& if(player.isOut()||!lib.filter.cardRespondable(cards[i],player)||
lib.filter.cardAiIncluded(cards[i])&& cards[i].classList.contains('uncheck')||
(player.isOut()==false||event.includeOutCard)&& !event.filterCard(cards[i],player)){
lib.filter.cardRespondable(cards[i],player)&& nochess=false;
!cards[i].classList.contains('uncheck')){ }
if(ui.selected.cards.length<range[1]){ }
cards[i].classList.add('selectable'); if(nochess){
if(event._cardChoice){ if(ui.selected.cards.length<range[1]){
event._cardChoice.push(cards[i]); cards[i].classList.add('selectable');
} if(event._cardChoice){
} event._cardChoice.push(cards[i]);
else if(range[1]==-1){
cards[i].classList.add('selected');
ui.selected.cards.add(cards[i]);
}
else{
cards[i].classList.remove('selectable');
} }
} }
else if(range[1]==-1){
cards[i].classList.add('selected');
ui.selected.cards.add(cards[i]);
}
else{ else{
cards[i].classList.remove('selectable'); cards[i].classList.remove('selectable');
if(range[1]==-1){ }
cards[i].classList.remove('selected'); }
ui.selected.cards.remove(cards[i]); else{
} cards[i].classList.remove('selectable');
if(range[1]==-1){
cards[i].classList.remove('selected');
ui.selected.cards.remove(cards[i]);
} }
} }
if(cards[i].classList.contains('selected')){ if(cards[i].classList.contains('selected')){
@ -20582,20 +20586,33 @@
} }
else{ else{
var card=get.card(); var card=get.card();
var firstCheck=false;
range=get.select(event.selectTarget); range=get.select(event.selectTarget);
var selectableTargets=false; var selectableTargets=false;
if(range[0]!=range[1]||range[0]>1) auto=false; if(range[0]!=range[1]||range[0]>1) auto=false;
for(i=0;i<game.players.length;i++){ for(i=0;i<game.players.length;i++){
var nochess=true; var nochess=true;
if(game.chess&&!event.chessForceAll){ if(game.chess&&!event.chessForceAll&&player&&get.distance(player,game.players[i],'pure')>7){
if(player&&get.distance(player,game.players[i],'pure')>7){ nochess=false;
}
else if(game.players[i].isOut()){
nochess=false;
}
else if(event._targetChoice){
var targetChoice=event.targetChoice.get(card);
if(!Array.isArray(targetChoice)||!targetChoice.contains(game.players[i])){
nochess=false; nochess=false;
} }
} }
if(event.filterTarget(card,player,game.players[i])&&!game.players[i].forceout&& else if(!event.filterTarget(card,player,game.players[i])){
(game.players[i].isOut()==false||event.includeOutTarget)&&nochess){ nochess=false;
}
if(nochess){
if(ui.selected.targets.length<range[1]){ if(ui.selected.targets.length<range[1]){
game.players[i].classList.add('selectable'); game.players[i].classList.add('selectable');
if(Array.isArray(event._targetChoice)){
event._targetChoice.push(game.players[i]);
}
} }
else if(range[1]==-1){ else if(range[1]==-1){
game.players[i].classList.add('selected'); game.players[i].classList.add('selected');
@ -20615,9 +20632,9 @@
if(game.players[i].classList.contains('selected')){ if(game.players[i].classList.contains('selected')){
game.players[i].classList.add('selectable'); game.players[i].classList.add('selectable');
} }
else if(!selectableTargets&&game.players[i].classList.contains('selectable')){ else if(!selectableTargets&&game.players[i].classList.contains('selectable')){
selectableTargets=true; selectableTargets=true;
} }
if(game.players[i].instance){ if(game.players[i].instance){
if(game.players[i].classList.contains('selected')){ if(game.players[i].classList.contains('selected')){
game.players[i].instance.classList.add('selected'); game.players[i].instance.classList.add('selected');
@ -32906,6 +32923,23 @@
}; };
var get={ var get={
is:{ is:{
node:function(obj){
var str=Object.prototype.toString.call(obj);
if(str&&str.indexOf('[object HTML')) return true;
return false;
},
div:function(obj){
return Object.prototype.toString.call(obj) === '[object HTMLDivElement]';
},
map:function(obj){
return Object.prototype.toString.call(obj) === '[object Map]';
},
set:function(obj){
return Object.prototype.toString.call(obj) === '[object Set]';
},
object:function(obj){
return Object.prototype.toString.call(obj) === '[object Object]';
},
singleSelect:function(func){ singleSelect:function(func){
if(typeof func=='function') return false; if(typeof func=='function') return false;
var select=get.select(func); var select=get.select(func);

View File

@ -4170,7 +4170,6 @@ mode.stone={
} }
return true; return true;
}, },
complexTarget:true,
selectTarget:2, selectTarget:2,
multitarget:true, multitarget:true,
multiline:true, multiline:true,