wuxie
This commit is contained in:
parent
968d8b0ee0
commit
db27b14f05
|
@ -87,7 +87,6 @@ card.refresh={
|
||||||
return !target.isMin()&&player!=target&&!target.get('e','5');
|
return !target.isMin()&&player!=target&&!target.get('e','5');
|
||||||
});
|
});
|
||||||
next.set('ai',function(target){
|
next.set('ai',function(target){
|
||||||
console.log(_status.event.choice);
|
|
||||||
return target==_status.event.choice?1:-1;
|
return target==_status.event.choice?1:-1;
|
||||||
});
|
});
|
||||||
next.set('choice',choice);
|
next.set('choice',choice);
|
||||||
|
|
186
card/standard.js
186
card/standard.js
|
@ -1379,31 +1379,8 @@ card.standard={
|
||||||
event.source=trigger.player;
|
event.source=trigger.player;
|
||||||
event.state=true;
|
event.state=true;
|
||||||
event.card=trigger.card;
|
event.card=trigger.card;
|
||||||
event.blacklist=[];
|
|
||||||
event._global_waiting=true;
|
event._global_waiting=true;
|
||||||
'step 1'
|
event.send=function(player,state,isJudge,card,source,target,targets,id){
|
||||||
var list=[],list2=[];
|
|
||||||
for(var i=0;i<game.players.length;i++){
|
|
||||||
if(game.players[i].hasWuxie()&&!event.blacklist.contains(game.players[i])){
|
|
||||||
list.push(game.players[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(list.length==0){
|
|
||||||
event.finish();
|
|
||||||
if(!event.state){
|
|
||||||
trigger.untrigger();
|
|
||||||
if(event.triggername=='phaseJudge'){
|
|
||||||
trigger.cancelled=true;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
trigger.finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var id=get.id();
|
|
||||||
event.id=id;
|
|
||||||
var send=function(state,isJudge,card,source,target,targets,id){
|
|
||||||
state=state?1:-1;
|
state=state?1:-1;
|
||||||
var str='';
|
var str='';
|
||||||
if(isJudge){
|
if(isJudge){
|
||||||
|
@ -1414,7 +1391,7 @@ card.standard={
|
||||||
str+='对'+get.translation(targets||target);
|
str+='对'+get.translation(targets||target);
|
||||||
}
|
}
|
||||||
str+='将'+(state>0?'生效':'失效')+',是否无懈?';
|
str+='将'+(state>0?'生效':'失效')+',是否无懈?';
|
||||||
var next=game.me.chooseToUse({
|
var next=player.chooseToUse({
|
||||||
filterCard:function(card,player){
|
filterCard:function(card,player){
|
||||||
if(card.name!='wuxie') return false;
|
if(card.name!='wuxie') return false;
|
||||||
var mod=game.checkMod(card,player,'unchanged','cardEnabled',player.get('s'));
|
var mod=game.checkMod(card,player,'unchanged','cardEnabled',player.get('s'));
|
||||||
|
@ -1471,49 +1448,51 @@ card.standard={
|
||||||
next.nouse=true;
|
next.nouse=true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var aix=function(player){
|
'step 1'
|
||||||
var source=event.source;
|
var list=[];
|
||||||
var card=event.card;
|
event.list=list;
|
||||||
var state=event.state?1:-1;
|
event.id=get.id();
|
||||||
var target=event.target;
|
for(var i=0;i<game.players.length;i++){
|
||||||
var targets=event.targets;
|
if(game.players[i].hasWuxie()){
|
||||||
if(event.triggername=='phaseJudge'){
|
list.push(game.players[i]);
|
||||||
var info=lib.card[card.viewAs||card.name];
|
|
||||||
if(info&&info.ai&&info.ai.wuxie){
|
|
||||||
var aiii=info.ai.wuxie(source,card,source,player,state);
|
|
||||||
if(typeof aiii=='number') return aiii;
|
|
||||||
}
|
|
||||||
if(Math.abs(ai.get.attitude(player,source))<3) return 0;
|
|
||||||
if(source.skills.contains('guanxing')) return 0;
|
|
||||||
if(card.name!='lebu'&&card.name!='bingliang'){
|
|
||||||
if(source!=player){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var eff=ai.get.effect(source,card,source,source);
|
|
||||||
if(eff>=0) return 0;
|
|
||||||
return state*ai.get.attitude(player,source);
|
|
||||||
}
|
}
|
||||||
else{
|
}
|
||||||
var info=get.info(card);
|
list.sort(function(a,b){
|
||||||
if(info.ai&&info.ai.wuxie){
|
return get.distance(event.source,a,'absolute')-get.distance(event.source,b,'absolute');
|
||||||
var aiii=info.ai.wuxie(target,card,source,player,state);
|
});
|
||||||
if(typeof aiii=='number') return aiii;
|
'step 2'
|
||||||
|
if(event.list.length==0){
|
||||||
|
event.finish();
|
||||||
|
if(!event.state){
|
||||||
|
trigger.untrigger();
|
||||||
|
if(event.triggername=='phaseJudge'){
|
||||||
|
trigger.cancelled=true;
|
||||||
}
|
}
|
||||||
if(info.multitarget&&targets){
|
else{
|
||||||
var eff=0;
|
trigger.finish();
|
||||||
for(var i=0;i<targets.length;i++){
|
|
||||||
eff+=ai.get.effect(targets[i],card,source,player)
|
|
||||||
}
|
|
||||||
return -eff*state;
|
|
||||||
}
|
}
|
||||||
if(Math.abs(ai.get.attitude(player,target))<3) return 0;
|
|
||||||
return -ai.get.effect(target,card,source,player)*state;
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
else if(_status.connectMode&&(event.list[0].isOnline()||event.list[0]==game.me)){
|
||||||
|
event.goto(4);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
event.current=event.list.shift();
|
||||||
|
event.send(event.current,event.state,event.triggername=='phaseJudge',event.card,event.source,event.target,event.targets,event.id);
|
||||||
|
}
|
||||||
|
'step 3'
|
||||||
|
if(result.bool){
|
||||||
|
event.wuxieresult=event.current;
|
||||||
|
event.wuxieresult2=result;
|
||||||
|
event.goto(8);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
event.goto(2);
|
||||||
|
}
|
||||||
|
'step 4'
|
||||||
|
var id=event.id;
|
||||||
var sendback=function(result,player){
|
var sendback=function(result,player){
|
||||||
if(result&&result.id==id&&!event.wuxieresult&&result.bool){
|
if(result&&result.id==id&&!event.wuxieresult&&result.bool){
|
||||||
clearTimeout(event.wuxietimeout);
|
|
||||||
event.wuxieresult=player;
|
event.wuxieresult=player;
|
||||||
event.wuxieresult2=result;
|
event.wuxieresult2=result;
|
||||||
game.broadcast('cancel',id);
|
game.broadcast('cancel',id);
|
||||||
|
@ -1536,25 +1515,22 @@ card.standard={
|
||||||
|
|
||||||
var withme=false;
|
var withme=false;
|
||||||
var withol=false;
|
var withol=false;
|
||||||
|
var list=event.list;
|
||||||
for(var i=0;i<list.length;i++){
|
for(var i=0;i<list.length;i++){
|
||||||
if(list[i].isOnline()){
|
if(list[i].isOnline()){
|
||||||
withol=true;
|
withol=true;
|
||||||
list[i].wait(sendback);
|
list[i].wait(sendback);
|
||||||
list[i].send(send,event.state,event.triggername=='phaseJudge',event.card,event.source,event.target,event.targets,event.id);
|
list[i].send(event.send,list[i],event.state,event.triggername=='phaseJudge',event.card,event.source,event.target,event.targets,event.id);
|
||||||
|
list.splice(i--,1);
|
||||||
}
|
}
|
||||||
else if(list[i]==game.me){
|
else if(list[i]==game.me){
|
||||||
withme=true;
|
withme=true;
|
||||||
send(event.state,event.triggername=='phaseJudge',event.card,event.source,event.target,event.targets,event.id);
|
event.send(list[i],event.state,event.triggername=='phaseJudge',event.card,event.source,event.target,event.targets,event.id);
|
||||||
}
|
list.splice(i--,1);
|
||||||
else if(aix(list[i])>0){
|
|
||||||
list2.push(list[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!withme){
|
if(!withme){
|
||||||
if(!withol){
|
event.goto(6);
|
||||||
event.aionly=true;
|
|
||||||
}
|
|
||||||
event.goto(3);
|
|
||||||
}
|
}
|
||||||
if(_status.connectMode){
|
if(_status.connectMode){
|
||||||
if(withme||withol){
|
if(withme||withol){
|
||||||
|
@ -1564,83 +1540,34 @@ card.standard={
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.withol=withol;
|
event.withol=withol;
|
||||||
if(list2.length){
|
'step 5'
|
||||||
event.aichoice=list2.randomGet();
|
|
||||||
event.wuxietimeout=setTimeout(function(){
|
|
||||||
if(!event.wuxieresult){
|
|
||||||
event.wuxieresult=event.aichoice;
|
|
||||||
event.wuxieresult2='ai';
|
|
||||||
game.broadcast('cancel',event.id);
|
|
||||||
if(_status.event.id==event.id&&_status.event.name=='chooseToUse'&&_status.paused){
|
|
||||||
ui.click.cancel();
|
|
||||||
if(ui.confirm) ui.confirm.close();
|
|
||||||
}
|
|
||||||
if(event.aionly){
|
|
||||||
game.resume();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},event.aionly?200:(Math.random()*5000+3000));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
event.aionly=false;
|
|
||||||
}
|
|
||||||
'step 2'
|
|
||||||
if(result&&result.bool&&!event.wuxieresult){
|
if(result&&result.bool&&!event.wuxieresult){
|
||||||
clearTimeout(event.wuxietimeout);
|
|
||||||
game.broadcast('cancel',event.id);
|
game.broadcast('cancel',event.id);
|
||||||
event.wuxieresult=game.me;
|
event.wuxieresult=game.me;
|
||||||
event.wuxieresult2=result;
|
event.wuxieresult2=result;
|
||||||
}
|
}
|
||||||
'step 3'
|
'step 6'
|
||||||
if(event.withol&&!event.resultOL){
|
if(event.withol&&!event.resultOL){
|
||||||
game.pause();
|
game.pause();
|
||||||
}
|
}
|
||||||
else if(event.aionly){
|
'step 7'
|
||||||
game.pause();
|
|
||||||
}
|
|
||||||
'step 4'
|
|
||||||
clearTimeout(event.wuxietimeout);
|
|
||||||
for(var i=0;i<game.players.length;i++){
|
for(var i=0;i<game.players.length;i++){
|
||||||
game.players[i].hideTimer();
|
game.players[i].hideTimer();
|
||||||
}
|
}
|
||||||
if(event.wuxieresult2=='ai'){
|
'step 8'
|
||||||
event.wuxieresult.chooseToUse({
|
if(event.wuxieresult){
|
||||||
filterCard:function(card,player){
|
|
||||||
if(card.name!='wuxie') return false;
|
|
||||||
var mod=game.checkMod(card,player,'unchanged','cardEnabled',player.get('s'));
|
|
||||||
if(mod!='unchanged') return mod;
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
forced:true,
|
|
||||||
nouse:true,
|
|
||||||
type:'wuxie',
|
|
||||||
ai1:function(){return 1}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
event.goto(6)
|
|
||||||
}
|
|
||||||
'step 5'
|
|
||||||
if(event.wuxieresult2=='ai'){
|
|
||||||
if(result&&result.bool){
|
|
||||||
event.wuxieresult2=result;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
event.blacklist.push(event.wuxieresult);
|
|
||||||
event.goto(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'step 6'
|
|
||||||
if(event.wuxieresult2){
|
|
||||||
event.wuxieresult.useResult(event.wuxieresult2);
|
event.wuxieresult.useResult(event.wuxieresult2);
|
||||||
}
|
}
|
||||||
'step 7'
|
'step 9'
|
||||||
if(event.wuxieresult){
|
if(event.wuxieresult){
|
||||||
if(result=='wuxied'){
|
if(result=='wuxied'){
|
||||||
event.state=!event.state;
|
event.state=!event.state;
|
||||||
}
|
}
|
||||||
event.goto(1);
|
event.goto(1);
|
||||||
}
|
}
|
||||||
|
else if(event.list.length){
|
||||||
|
event.goto(2);
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
if(!event.state){
|
if(!event.state){
|
||||||
trigger.untrigger();
|
trigger.untrigger();
|
||||||
|
@ -1655,7 +1582,6 @@ card.standard={
|
||||||
delete event.resultOL;
|
delete event.resultOL;
|
||||||
delete event.wuxieresult;
|
delete event.wuxieresult;
|
||||||
delete event.wuxieresult2;
|
delete event.wuxieresult2;
|
||||||
delete event.aichoice;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
wuxie1_old:{
|
wuxie1_old:{
|
||||||
|
|
|
@ -2,5 +2,6 @@ window.noname_update={
|
||||||
version:'1.8.2.8',
|
version:'1.8.2.8',
|
||||||
changeLog:[
|
changeLog:[
|
||||||
'旁观',
|
'旁观',
|
||||||
|
'修复无懈卡死问题'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue