This commit is contained in:
parent
b52796f333
commit
4b300b1fc2
342
card/standard.js
342
card/standard.js
|
@ -240,7 +240,7 @@ card.standard={
|
||||||
if(target.hp<0&&target!=player&&target.identity!='zhu') return 0;
|
if(target.hp<0&&target!=player&&target.identity!='zhu') return 0;
|
||||||
var att=ai.get.attitude(player,target);
|
var att=ai.get.attitude(player,target);
|
||||||
if(att<3&&att>=0&&player!=target) return 0;
|
if(att<3&&att>=0&&player!=target) return 0;
|
||||||
var tri=_status.event.parent._trigger;
|
var tri=_status.event.getParent()._trigger;
|
||||||
if(lib.config.mode=='identity'&&player.identity=='fan'&&target.identity=='fan'){
|
if(lib.config.mode=='identity'&&player.identity=='fan'&&target.identity=='fan'){
|
||||||
if(tri&&tri.name=='dying'&&tri.source&&tri.source.identity=='fan'&&tri.source!=target){
|
if(tri&&tri.name=='dying'&&tri.source&&tri.source.identity=='fan'&&tri.source!=target){
|
||||||
var num=0;
|
var num=0;
|
||||||
|
@ -452,13 +452,18 @@ card.standard={
|
||||||
_status.dieClose.push(dialog);
|
_status.dieClose.push(dialog);
|
||||||
dialog.videoId=lib.status.videoId++;
|
dialog.videoId=lib.status.videoId++;
|
||||||
game.addVideo('cardDialog',null,['五谷丰登',get.cardsInfo(cards),dialog.videoId]);
|
game.addVideo('cardDialog',null,['五谷丰登',get.cardsInfo(cards),dialog.videoId]);
|
||||||
event.parent.preResult=dialog.videoId;
|
event.getParent().preResult=dialog.videoId;
|
||||||
|
game.broadcast(function(cards,id){
|
||||||
|
var dialog=ui.create.dialog('五谷丰登',cards,true);
|
||||||
|
_status.dieClose.push(dialog);
|
||||||
|
dialog.videoId=id;
|
||||||
|
},cards,dialog.videoId);
|
||||||
},
|
},
|
||||||
content:function(){
|
content:function(){
|
||||||
"step 0"
|
"step 0"
|
||||||
for(var i=0;i<ui.dialogs.length;i++){
|
for(var i=0;i<ui.dialogs.length;i++){
|
||||||
if(ui.dialogs[i].videoId==event.preResult){
|
if(ui.dialogs[i].videoId==event.preResult){
|
||||||
event.dialog=ui.dialogs[i];
|
event.dialog=ui.dialogs[i];break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!event.dialog){
|
if(!event.dialog){
|
||||||
|
@ -466,26 +471,54 @@ card.standard={
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(event.dialog.buttons.length>1){
|
if(event.dialog.buttons.length>1){
|
||||||
var next=target.chooseButton(event.dialog,true,function(button){
|
var next=target.chooseButton(true,function(button){
|
||||||
return ai.get.value(button.link,_status.event.player);
|
return ai.get.value(button.link,_status.event.player);
|
||||||
});
|
});
|
||||||
next.closeDialog=false;
|
next.set('dialog',event.preResult);
|
||||||
next.dialog.style.display='';
|
next.set('closeDialog',false);
|
||||||
|
next.set('dialogdisplay',true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
event.directButton=event.dialog.buttons[0];
|
event.directButton=event.dialog.buttons[0];
|
||||||
}
|
}
|
||||||
"step 1"
|
"step 1"
|
||||||
var dialog=event.dialog;
|
var dialog=event.dialog;
|
||||||
var button=event.directButton||result.buttons[0];
|
var card;
|
||||||
if(button.link){
|
if(event.directButton){
|
||||||
target.gain(button.link);
|
card=event.directButton.link;
|
||||||
target.$gain2(button.link);
|
|
||||||
}
|
}
|
||||||
dialog.buttons.remove(button);
|
else{
|
||||||
button.getElementsByClassName('info')[0].innerHTML=get.translation(target.name);
|
card=result.links[0];
|
||||||
dialog.content.firstChild.innerHTML=
|
}
|
||||||
get.translation(target)+'选择了'+get.translation(button.link);
|
|
||||||
|
var button;
|
||||||
|
for(var i=0;i<dialog.buttons.length;i++){
|
||||||
|
if(dialog.buttons[i].link==card){
|
||||||
|
button=dialog.buttons[i];
|
||||||
|
button.querySelector('.info').innerHTML=get.translation(target.name);
|
||||||
|
dialog.buttons.remove(button);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var capt=get.translation(target)+'选择了'+get.translation(button.link);
|
||||||
|
if(card){
|
||||||
|
target.gain(card);
|
||||||
|
target.$gain2(card);
|
||||||
|
game.broadcast(function(card,id,name,capt){
|
||||||
|
var dialog=get.idDialog(id);
|
||||||
|
if(dialog){
|
||||||
|
dialog.content.firstChild.innerHTML=capt;
|
||||||
|
for(var i=0;i<dialog.buttons.length;i++){
|
||||||
|
if(dialog.buttons[i].link==card){
|
||||||
|
dialog.buttons[i].querySelector('.info').innerHTML=name;
|
||||||
|
dialog.buttons.splice(i--,1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},card,dialog.videoId,get.translation(target.name),capt);
|
||||||
|
}
|
||||||
|
dialog.content.firstChild.innerHTML=capt;
|
||||||
game.addVideo('dialogCapt',null,[dialog.videoId,dialog.content.firstChild.innerHTML]);
|
game.addVideo('dialogCapt',null,[dialog.videoId,dialog.content.firstChild.innerHTML]);
|
||||||
game.log(target,'选择了',button.link);
|
game.log(target,'选择了',button.link);
|
||||||
game.delay();
|
game.delay();
|
||||||
|
@ -498,6 +531,13 @@ card.standard={
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
game.broadcast(function(id){
|
||||||
|
var dialog=get.idDialog(id);
|
||||||
|
if(dialog){
|
||||||
|
dialog.close();
|
||||||
|
_status.dieClose.remove(dialog);
|
||||||
|
}
|
||||||
|
},event.preResult);
|
||||||
game.addVideo('cardDialog',null,event.preResult);
|
game.addVideo('cardDialog',null,event.preResult);
|
||||||
},
|
},
|
||||||
ai:{
|
ai:{
|
||||||
|
@ -967,7 +1007,9 @@ card.standard={
|
||||||
expose:0.2
|
expose:0.2
|
||||||
},
|
},
|
||||||
notarget:true,
|
notarget:true,
|
||||||
content:function(){},
|
content:function(){
|
||||||
|
event.result='wuxied';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
lebu:{
|
lebu:{
|
||||||
audio:true,
|
audio:true,
|
||||||
|
@ -1289,7 +1331,7 @@ card.standard={
|
||||||
filter:function(event,player){
|
filter:function(event,player){
|
||||||
if(event.responded) return false;
|
if(event.responded) return false;
|
||||||
if(!event.filterCard({name:'shan'})) return false;
|
if(!event.filterCard({name:'shan'})) return false;
|
||||||
if(event.parent.player.num('s','unequip')) return false;
|
if(event.getParent().player.num('s','unequip')) return false;
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
audio:true,
|
audio:true,
|
||||||
|
@ -1312,7 +1354,271 @@ card.standard={
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_wuxie1:{
|
_wuxie:{
|
||||||
|
trigger:{player:['useCardToBefore','phaseJudge']},
|
||||||
|
priority:5,
|
||||||
|
popup:false,
|
||||||
|
forced:true,
|
||||||
|
filter:function(event,player){
|
||||||
|
if(event.name!='phaseJudge'){
|
||||||
|
if(!event.target) return false;
|
||||||
|
if(get.type(event.card)!='trick') return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
content:function(){
|
||||||
|
'step 0'
|
||||||
|
if(trigger.multitarget){
|
||||||
|
event.targets=trigger.targets;
|
||||||
|
}
|
||||||
|
event.target=trigger.target;
|
||||||
|
event.source=trigger.player;
|
||||||
|
event.state=true;
|
||||||
|
event.card=trigger.card;
|
||||||
|
event.blacklist=[];
|
||||||
|
'step 1'
|
||||||
|
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){
|
||||||
|
var str='';
|
||||||
|
if(isJudge){
|
||||||
|
str+=get.translation(source)+'的';
|
||||||
|
}
|
||||||
|
str+=get.translation(card);
|
||||||
|
if(targets||target){
|
||||||
|
str+='对'+get.translation(targets||target);
|
||||||
|
}
|
||||||
|
str+='将'+(state?'生效':'失效')+',是否无懈?';
|
||||||
|
var next=game.me.chooseToUse({
|
||||||
|
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;
|
||||||
|
},
|
||||||
|
prompt:str,
|
||||||
|
type:'wuxie',
|
||||||
|
state:state,
|
||||||
|
ai1:function(){
|
||||||
|
if(isJudge){
|
||||||
|
var info=lib.card[card.viewAs||card.name];
|
||||||
|
if(info&&info.ai&&info.ai.wuxie){
|
||||||
|
var aiii=info.ai.wuxie(source,card,source,_status.event.player,state);
|
||||||
|
if(typeof aiii=='number') return aiii;
|
||||||
|
}
|
||||||
|
if(Math.abs(ai.get.attitude(_status.event.player,source))<3) return 0;
|
||||||
|
if(source.skills.contains('guanxing')) return 0;
|
||||||
|
if(card.name!='lebu'&&card.name!='bingliang'){
|
||||||
|
if(source!=_status.event.player){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var eff=ai.get.effect(source,card,source,_status.event.player);
|
||||||
|
if(eff>=0) return 0;
|
||||||
|
return state*ai.get.attitude(_status.event.player,source);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var info=get.info(card);
|
||||||
|
if(info.ai&&info.ai.wuxie){
|
||||||
|
var aiii=info.ai.wuxie(target,card,source,_status.event.player,state);
|
||||||
|
if(typeof aiii=='number') return aiii;
|
||||||
|
}
|
||||||
|
if(info.multitarget&&targets){
|
||||||
|
var eff=0;
|
||||||
|
for(var i=0;i<targets.length;i++){
|
||||||
|
eff+=ai.get.effect(targets[i],card,source,_status.event.player)
|
||||||
|
}
|
||||||
|
return -eff*state;
|
||||||
|
}
|
||||||
|
if(Math.abs(ai.get.attitude(_status.event.player,target))<3) return 0;
|
||||||
|
return -ai.get.effect(target,card,source,_status.event.player)*state;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
source:target,
|
||||||
|
source2:targets,
|
||||||
|
id:id
|
||||||
|
});
|
||||||
|
if(game.online){
|
||||||
|
_status.event._resultid=id;
|
||||||
|
game.resume();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
next.nouse=true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var aix=function(player){
|
||||||
|
var info=get.info(event.card);
|
||||||
|
if(info.ai&&info.ai.wuxie){
|
||||||
|
var aiii=info.ai.wuxie(event.target,event.card,event.source,player,event.state);
|
||||||
|
if(typeof aiii=='number') return aiii;
|
||||||
|
}
|
||||||
|
if(info.multitarget&&targets){
|
||||||
|
var eff=0;
|
||||||
|
for(var i=0;i<event.targets.length;i++){
|
||||||
|
eff+=ai.get.effect(event.targets[i],event.card,event.source,player)
|
||||||
|
}
|
||||||
|
return -eff*state;
|
||||||
|
}
|
||||||
|
if(Math.abs(ai.get.attitude(player,event.target))<3) return 0;
|
||||||
|
return -ai.get.effect(event.target,event.card,event.source,player)*event.state;
|
||||||
|
};
|
||||||
|
var sendback=function(result,player){
|
||||||
|
if(result&&result.id==id&&!event.wuxieresult&&result.bool){
|
||||||
|
clearTimeout(event.wuxietimeout);
|
||||||
|
event.wuxieresult=player;
|
||||||
|
event.wuxieresult2=result;
|
||||||
|
game.broadcast('cancel',id);
|
||||||
|
if(_status.event.id==id&&_status.event.name=='chooseToUse'&&_status.paused){
|
||||||
|
return (function(){
|
||||||
|
event.resultOL=_status.event.resultOL;
|
||||||
|
ui.click.cancel();
|
||||||
|
if(ui.confirm) ui.confirm.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(_status.event.id==id&&_status.event.name=='chooseToUse'&&_status.paused){
|
||||||
|
return (function(){
|
||||||
|
event.resultOL=_status.event.resultOL;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var withme=false;
|
||||||
|
var withol=false;
|
||||||
|
for(var i=0;i<list.length;i++){
|
||||||
|
if(list[i].isOnline()){
|
||||||
|
withol=true;
|
||||||
|
list[i].wait(sendback);
|
||||||
|
list[i].send(send,event.state,event.triggername=='phaseJudge',event.card,event.source,event.target,event.targets,event.id);
|
||||||
|
}
|
||||||
|
else if(list[i]==game.me){
|
||||||
|
withme=true;
|
||||||
|
send(event.state,event.triggername=='phaseJudge',event.card,event.source,event.target,event.targets,event.id);
|
||||||
|
}
|
||||||
|
else if(aix(list[i])>0){
|
||||||
|
list2.push(list[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!withme){
|
||||||
|
if(!withol){
|
||||||
|
event.aionly=true;
|
||||||
|
}
|
||||||
|
event.goto(3);
|
||||||
|
}
|
||||||
|
event.withol=withol;
|
||||||
|
if(list2.length){
|
||||||
|
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()*90000+3000));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
event.aionly=false;
|
||||||
|
}
|
||||||
|
'step 2'
|
||||||
|
if(result&&result.bool&&!event.wuxieresult){
|
||||||
|
clearTimeout(event.wuxietimeout);
|
||||||
|
game.broadcast('cancel',event.id);
|
||||||
|
event.wuxieresult=game.me;
|
||||||
|
event.wuxieresult2=result;
|
||||||
|
}
|
||||||
|
'step 3'
|
||||||
|
if(event.withol&&!event.resultOL){
|
||||||
|
game.pause();
|
||||||
|
}
|
||||||
|
else if(event.aionly){
|
||||||
|
game.pause();
|
||||||
|
}
|
||||||
|
'step 4'
|
||||||
|
clearTimeout(event.wuxietimeout);
|
||||||
|
if(event.wuxieresult2=='ai'){
|
||||||
|
event.wuxieresult.chooseToUse({
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
'step 7'
|
||||||
|
if(event.wuxieresult){
|
||||||
|
if(result=='wuxied'){
|
||||||
|
event.state=!event.state;
|
||||||
|
}
|
||||||
|
event.goto(1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(!event.state){
|
||||||
|
trigger.untrigger();
|
||||||
|
if(event.triggername=='phaseJudge'){
|
||||||
|
trigger.cancelled=true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
trigger.finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete event.resultOL;
|
||||||
|
delete event.wuxieresult;
|
||||||
|
delete event.wuxieresult2;
|
||||||
|
delete event.aichoice;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
wuxie1_old:{
|
||||||
trigger:{player:'useCardToBefore'},
|
trigger:{player:'useCardToBefore'},
|
||||||
priority:5,
|
priority:5,
|
||||||
filter:function(event,player){
|
filter:function(event,player){
|
||||||
|
@ -1439,7 +1745,7 @@ card.standard={
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_wuxie2:{
|
wuxie2_old:{
|
||||||
trigger:{player:'phaseJudge'},
|
trigger:{player:'phaseJudge'},
|
||||||
priority:5,
|
priority:5,
|
||||||
popup:false,
|
popup:false,
|
||||||
|
|
|
@ -4436,9 +4436,7 @@ character.sp={
|
||||||
enable:'chooseToUse',
|
enable:'chooseToUse',
|
||||||
direct:true,
|
direct:true,
|
||||||
filter:function(event,player){
|
filter:function(event,player){
|
||||||
return _status.currentPhase!==player&&
|
return _status.currentPhase!==player&&event.type!='wuxie'&&event.getParent().name!='_chenhuodajie';
|
||||||
event.parent.name!='_wuxie1'&&event.parent.name!='_wuxie2'&&
|
|
||||||
event.parent.name!='_chenhuodajie';
|
|
||||||
},
|
},
|
||||||
delay:0,
|
delay:0,
|
||||||
content:function(){
|
content:function(){
|
||||||
|
|
|
@ -148,7 +148,7 @@ character.standard={
|
||||||
"step 0"
|
"step 0"
|
||||||
player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+
|
player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+
|
||||||
get.translation(trigger.player.judging[0])+',是否发动【鬼才】?').ai=function(card){
|
get.translation(trigger.player.judging[0])+',是否发动【鬼才】?').ai=function(card){
|
||||||
var trigger=_status.event.parent._trigger;
|
var trigger=_status.event.getParent()._trigger;
|
||||||
var player=_status.event.player;
|
var player=_status.event.player;
|
||||||
var result=trigger.judge(card)-trigger.judge(trigger.player.judging[0]);
|
var result=trigger.judge(card)-trigger.judge(trigger.player.judging[0]);
|
||||||
var attitude=ai.get.attitude(player,trigger.player);
|
var attitude=ai.get.attitude(player,trigger.player);
|
||||||
|
@ -287,8 +287,7 @@ character.standard={
|
||||||
luoyi2:{
|
luoyi2:{
|
||||||
trigger:{source:'damageBegin'},
|
trigger:{source:'damageBegin'},
|
||||||
filter:function(event){
|
filter:function(event){
|
||||||
return event.card&&(event.card.name=='sha'||event.card.name=='juedou')&&
|
return event.card&&(event.card.name=='sha'||event.card.name=='juedou')&&event.notLink();
|
||||||
event.parent.name!='_lianhuan'&&event.parent.name!='_lianhuan2';
|
|
||||||
},
|
},
|
||||||
forced:true,
|
forced:true,
|
||||||
content:function(){
|
content:function(){
|
||||||
|
@ -319,7 +318,7 @@ character.standard={
|
||||||
"step 2"
|
"step 2"
|
||||||
player.chooseCardTarget({
|
player.chooseCardTarget({
|
||||||
filterCard:function(card){
|
filterCard:function(card){
|
||||||
return _status.event.parent.cards.contains(card);
|
return _status.event.getParent().cards.contains(card);
|
||||||
},
|
},
|
||||||
selectCard:[1,event.cards.length],
|
selectCard:[1,event.cards.length],
|
||||||
filterTarget:function(card,player,target){
|
filterTarget:function(card,player,target){
|
||||||
|
@ -607,7 +606,7 @@ character.standard={
|
||||||
if(event.current==undefined) event.current=player.next;
|
if(event.current==undefined) event.current=player.next;
|
||||||
if(event.current==player){
|
if(event.current==player){
|
||||||
player.addTempSkill('jijiang3','phaseAfter');
|
player.addTempSkill('jijiang3','phaseAfter');
|
||||||
event.parent.parent.step=0;
|
event.getParent(2).step=0;
|
||||||
event.finish();
|
event.finish();
|
||||||
}
|
}
|
||||||
else if(event.current.group=='shu'){
|
else if(event.current.group=='shu'){
|
||||||
|
@ -695,7 +694,8 @@ character.standard={
|
||||||
game.modeSwapPlayer(player);
|
game.modeSwapPlayer(player);
|
||||||
}
|
}
|
||||||
var cards=get.cards(Math.min(5,game.players.length));
|
var cards=get.cards(Math.min(5,game.players.length));
|
||||||
event.switchToAuto=function(){
|
event.cards=cards;
|
||||||
|
var switchToAuto=function(){
|
||||||
_status.imchoosing=false;
|
_status.imchoosing=false;
|
||||||
if(event.dialog) event.dialog.close();
|
if(event.dialog) event.dialog.close();
|
||||||
if(event.control) event.control.close();
|
if(event.control) event.control.close();
|
||||||
|
@ -737,29 +737,53 @@ character.standard={
|
||||||
game.log(player,'将'+get.cnNumber(top.length)+'张牌置于牌堆顶');
|
game.log(player,'将'+get.cnNumber(top.length)+'张牌置于牌堆顶');
|
||||||
game.delay(2);
|
game.delay(2);
|
||||||
};
|
};
|
||||||
if(event.isMine()){
|
var chooseButton=function(online,player,cards){
|
||||||
|
var event=_status.event;
|
||||||
|
player=player||event.player;
|
||||||
|
cards=cards||event.cards;
|
||||||
event.top=[];
|
event.top=[];
|
||||||
event.bottom=[];
|
event.bottom=[];
|
||||||
event.status=true;
|
event.status=true;
|
||||||
event.dialog=ui.create.dialog('按顺序选择置于牌堆顶的牌(先选择的在上)',cards);
|
event.dialog=ui.create.dialog('按顺序选择置于牌堆顶的牌(先选择的在上)',cards);
|
||||||
|
event.switchToAuto=function(){
|
||||||
|
event._result='ai';
|
||||||
|
event.dialog.close();
|
||||||
|
event.control.close();
|
||||||
|
_status.imchoosing=false;
|
||||||
|
},
|
||||||
event.control=ui.create.control('ok','pileTop','pileBottom',function(link){
|
event.control=ui.create.control('ok','pileTop','pileBottom',function(link){
|
||||||
var event=_status.event;
|
var event=_status.event;
|
||||||
if(link=='ok'){
|
if(link=='ok'){
|
||||||
var i;
|
if(online){
|
||||||
for(i=0;i<event.top.length;i++){
|
event._result={
|
||||||
ui.cardPile.insertBefore(event.top[i].link,ui.cardPile.firstChild);
|
top:[],
|
||||||
|
bottom:[]
|
||||||
|
}
|
||||||
|
for(var i=0;i<event.top.length;i++){
|
||||||
|
event._result.top.push(event.top[i].link);
|
||||||
|
}
|
||||||
|
for(var i=0;i<event.bottom.length;i++){
|
||||||
|
event._result.bottom.push(event.bottom[i].link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for(i=0;i<event.bottom.length;i++){
|
else{
|
||||||
ui.cardPile.appendChild(event.bottom[i].link);
|
var i;
|
||||||
}
|
for(i=0;i<event.top.length;i++){
|
||||||
for(i=0;i<event.dialog.buttons.length;i++){
|
ui.cardPile.insertBefore(event.top[i].link,ui.cardPile.firstChild);
|
||||||
if(event.dialog.buttons[i].classList.contains('glow')==false&&
|
}
|
||||||
event.dialog.buttons[i].classList.contains('target')==false)
|
for(i=0;i<event.bottom.length;i++){
|
||||||
ui.cardPile.appendChild(event.dialog.buttons[i].link);
|
ui.cardPile.appendChild(event.bottom[i].link);
|
||||||
|
}
|
||||||
|
for(i=0;i<event.dialog.buttons.length;i++){
|
||||||
|
if(event.dialog.buttons[i].classList.contains('glow')==false&&
|
||||||
|
event.dialog.buttons[i].classList.contains('target')==false)
|
||||||
|
ui.cardPile.appendChild(event.dialog.buttons[i].link);
|
||||||
|
}
|
||||||
|
player.popup(get.cnNumber(event.top.length)+'上'+get.cnNumber(event.cards.length-event.top.length)+'下');
|
||||||
|
game.log(player,'将'+get.cnNumber(event.top.length)+'张牌置于牌堆顶');
|
||||||
}
|
}
|
||||||
event.dialog.close();
|
event.dialog.close();
|
||||||
event.control.close();
|
event.control.close();
|
||||||
game.log(player,'将'+get.cnNumber(event.top.length)+'张牌置于牌堆顶');
|
|
||||||
game.resume();
|
game.resume();
|
||||||
_status.imchoosing=false;
|
_status.imchoosing=false;
|
||||||
}
|
}
|
||||||
|
@ -804,9 +828,43 @@ character.standard={
|
||||||
}
|
}
|
||||||
game.pause();
|
game.pause();
|
||||||
game.countChoose();
|
game.countChoose();
|
||||||
|
};
|
||||||
|
event.switchToAuto=switchToAuto;
|
||||||
|
|
||||||
|
if(event.isMine()){
|
||||||
|
chooseButton();
|
||||||
|
event.finish();
|
||||||
|
}
|
||||||
|
else if(event.isOnline()){
|
||||||
|
event.player.send(chooseButton,true,event.player,event.cards);
|
||||||
|
event.player.wait();
|
||||||
|
game.pause();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
event.switchToAuto();
|
event.switchToAuto();
|
||||||
|
event.finish();
|
||||||
|
}
|
||||||
|
"step 1"
|
||||||
|
if(event.result=='ai'||!event.result){
|
||||||
|
event.switchToAuto();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var top=event.result.top||[];
|
||||||
|
var bottom=event.result.bottom||[];
|
||||||
|
for(var i=0;i<top.length;i++){
|
||||||
|
ui.cardPile.insertBefore(top[i],ui.cardPile.firstChild);
|
||||||
|
}
|
||||||
|
for(i=0;i<bottom.length;i++){
|
||||||
|
ui.cardPile.appendChild(bottom[i]);
|
||||||
|
}
|
||||||
|
for(i=0;i<event.cards.length;i++){
|
||||||
|
if(!top.contains(event.cards[i])&&!bottom.contains(event.cards[i])){
|
||||||
|
ui.cardPile.appendChild(event.cards[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.popup(get.cnNumber(top.length)+'上'+get.cnNumber(event.cards.length-top.length)+'下');
|
||||||
|
game.log(player,'将'+get.cnNumber(top.length)+'张牌置于牌堆顶');
|
||||||
|
game.delay(2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ai:{
|
ai:{
|
||||||
|
|
|
@ -2182,10 +2182,15 @@ window.noname_asset_list=[
|
||||||
'theme/style/card/music.css',
|
'theme/style/card/music.css',
|
||||||
'theme/style/card/simple.css',
|
'theme/style/card/simple.css',
|
||||||
'theme/style/card/wood.css',
|
'theme/style/card/wood.css',
|
||||||
|
'theme/style/card/new.css',
|
||||||
|
'theme/style/card/image/new.png',
|
||||||
'theme/style/cardback/default.css',
|
'theme/style/cardback/default.css',
|
||||||
'theme/style/cardback/music.css',
|
'theme/style/cardback/music.css',
|
||||||
'theme/style/cardback/official.css',
|
'theme/style/cardback/official.css',
|
||||||
'theme/style/cardback/wood.css',
|
'theme/style/cardback/wood.css',
|
||||||
|
'theme/style/cardback/new.css',
|
||||||
|
'theme/style/cardback/image/new.png',
|
||||||
|
'theme/style/cardback/image/new2.png',
|
||||||
'theme/style/cardback/image/official.png',
|
'theme/style/cardback/image/official.png',
|
||||||
'theme/style/cardback/image/official2.png',
|
'theme/style/cardback/image/official2.png',
|
||||||
'theme/style/hp/default.css',
|
'theme/style/hp/default.css',
|
||||||
|
|
|
@ -17,7 +17,7 @@ window.config={
|
||||||
forbiddouble:['zhugedan','swd_kangnalishi','dongzhuo','wutugu','jg_simayi','hs_siwangzhiyi','hs_ronghejuren','hs_shanlingjuren'],
|
forbiddouble:['zhugedan','swd_kangnalishi','dongzhuo','wutugu','jg_simayi','hs_siwangzhiyi','hs_ronghejuren','hs_shanlingjuren'],
|
||||||
layoutfixed:['chess'],
|
layoutfixed:['chess'],
|
||||||
all:{
|
all:{
|
||||||
stockmode:['identity','guozhan','versus','boss','chess','stone'],
|
stockmode:['identity','guozhan','versus','boss','chess','stone','connect'],
|
||||||
layout:['default','newlayout'],
|
layout:['default','newlayout'],
|
||||||
theme:['woodden','music','simple'],
|
theme:['woodden','music','simple'],
|
||||||
card_font:['xiaozhuan','huangcao','caoshu','xingshu'],
|
card_font:['xiaozhuan','huangcao','caoshu','xingshu'],
|
||||||
|
|
531
game/game.js
531
game/game.js
|
@ -372,18 +372,6 @@
|
||||||
init:false,
|
init:false,
|
||||||
unfrequent:true
|
unfrequent:true
|
||||||
},
|
},
|
||||||
connect_nickname:{
|
|
||||||
name:'联机昵称',
|
|
||||||
input:true,
|
|
||||||
unfrequent:true,
|
|
||||||
init:'无名玩家'
|
|
||||||
},
|
|
||||||
connect_avatar:{
|
|
||||||
name:'联机头像',
|
|
||||||
init:'caocao',
|
|
||||||
item:{},
|
|
||||||
unfrequent:true
|
|
||||||
},
|
|
||||||
update:function(config,map){
|
update:function(config,map){
|
||||||
if(config.touchscreen){
|
if(config.touchscreen){
|
||||||
map.mousewheel.hide();
|
map.mousewheel.hide();
|
||||||
|
@ -628,7 +616,8 @@
|
||||||
default:'默认',
|
default:'默认',
|
||||||
wood:'木纹',
|
wood:'木纹',
|
||||||
music:'音乐',
|
music:'音乐',
|
||||||
simple:'原版'
|
simple:'原版',
|
||||||
|
new:'新版'
|
||||||
},
|
},
|
||||||
onclick:function(layout){
|
onclick:function(layout){
|
||||||
game.saveConfig('card_style',layout);
|
game.saveConfig('card_style',layout);
|
||||||
|
@ -645,7 +634,8 @@
|
||||||
default:'默认',
|
default:'默认',
|
||||||
wood:'木纹',
|
wood:'木纹',
|
||||||
music:'音乐',
|
music:'音乐',
|
||||||
official:'原版'
|
official:'原版',
|
||||||
|
new:'新版',
|
||||||
},
|
},
|
||||||
onclick:function(layout){
|
onclick:function(layout){
|
||||||
game.saveConfig('cardback_style',layout);
|
game.saveConfig('cardback_style',layout);
|
||||||
|
@ -957,20 +947,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
show_connect:{
|
|
||||||
name:'显示联机按钮',
|
|
||||||
init:true,
|
|
||||||
unfrequent:true,
|
|
||||||
onclick:function(bool){
|
|
||||||
game.saveConfig('show_connect',bool);
|
|
||||||
if(lib.config.show_connect){
|
|
||||||
ui.connectconfig.style.display='';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
ui.connectconfig.style.display='none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
show_cardpile:{
|
show_cardpile:{
|
||||||
name:'显示牌堆按钮',
|
name:'显示牌堆按钮',
|
||||||
init:true,
|
init:true,
|
||||||
|
@ -2719,7 +2695,28 @@
|
||||||
restart:true,
|
restart:true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
connect:{
|
||||||
|
name:'联机',
|
||||||
|
config:{
|
||||||
|
connect_nickname:{
|
||||||
|
name:'联机昵称',
|
||||||
|
input:true,
|
||||||
|
frequent:true,
|
||||||
|
init:'无名玩家'
|
||||||
|
},
|
||||||
|
connect_avatar:{
|
||||||
|
name:'联机头像',
|
||||||
|
init:'caocao',
|
||||||
|
item:{},
|
||||||
|
frequent:true,
|
||||||
|
onclick:function(item){
|
||||||
|
game.saveConfig('connect_avatar',item);
|
||||||
|
game.saveConfig('connect_avatar',item,true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
status:{
|
status:{
|
||||||
running:false,
|
running:false,
|
||||||
|
@ -3541,7 +3538,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(var i in lib.character){
|
for(var i in lib.character){
|
||||||
lib.configMenu.general.config.connect_avatar.item[i]=lib.translate[i];
|
lib.mode.connect.config.connect_avatar.item[i]=lib.translate[i];
|
||||||
}
|
}
|
||||||
if(lib.cardPack.mode_derivation){
|
if(lib.cardPack.mode_derivation){
|
||||||
for(var i=0;i<lib.cardPack.mode_derivation.length;i++){
|
for(var i=0;i<lib.cardPack.mode_derivation.length;i++){
|
||||||
|
@ -3728,13 +3725,7 @@
|
||||||
delete lib.packageReady;
|
delete lib.packageReady;
|
||||||
ui.create.arena();
|
ui.create.arena();
|
||||||
|
|
||||||
if(lib.config.reconnect_info){
|
if(window.indexedDB&&!_status.characterLoaded){
|
||||||
var info=lib.config.reconnect_info;
|
|
||||||
game.onlineID=info[1];
|
|
||||||
game.connect(info[0]);
|
|
||||||
game.saveConfig('reconnect_info');
|
|
||||||
}
|
|
||||||
else if(window.indexedDB&&!_status.characterLoaded){
|
|
||||||
_status.waitingForCharacters=true;
|
_status.waitingForCharacters=true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -3782,6 +3773,20 @@
|
||||||
}
|
}
|
||||||
localStorage.removeItem(lib.configprefix+'directstart');
|
localStorage.removeItem(lib.configprefix+'directstart');
|
||||||
},
|
},
|
||||||
|
startOnline:function(){
|
||||||
|
'step 0'
|
||||||
|
event._resultid=null;
|
||||||
|
event._result=null;
|
||||||
|
game.pause();
|
||||||
|
'step 1'
|
||||||
|
if(result){
|
||||||
|
if(event._resultid){
|
||||||
|
result.id=event._resultid;
|
||||||
|
}
|
||||||
|
game.send('result',result);
|
||||||
|
}
|
||||||
|
event.goto(0);
|
||||||
|
},
|
||||||
css:function(path,file,before){
|
css:function(path,file,before){
|
||||||
var style = document.createElement("link");
|
var style = document.createElement("link");
|
||||||
style.rel = "stylesheet";
|
style.rel = "stylesheet";
|
||||||
|
@ -4136,6 +4141,14 @@
|
||||||
"step 0"
|
"step 0"
|
||||||
_status.noclearcountdown=true;
|
_status.noclearcountdown=true;
|
||||||
if(event.isMine()){
|
if(event.isMine()){
|
||||||
|
if(event.type=='wuxie'){
|
||||||
|
if(ui.wuxie&&ui.wuxie.classList.contains('glow')){
|
||||||
|
event.result={
|
||||||
|
bool:false
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
var ok=game.check();
|
var ok=game.check();
|
||||||
if(!ok||!lib.config.auto_confirm){
|
if(!ok||!lib.config.auto_confirm){
|
||||||
game.pause();
|
game.pause();
|
||||||
|
@ -4231,28 +4244,19 @@
|
||||||
if(event.skillDialog&&get.objtype(event.skillDialog)=='div'){
|
if(event.skillDialog&&get.objtype(event.skillDialog)=='div'){
|
||||||
event.skillDialog.close();
|
event.skillDialog.close();
|
||||||
}
|
}
|
||||||
if(event.result.bool&&!game.online){
|
if(event.onresult){
|
||||||
if(event.result.skill&&get.info(event.result.skill).direct){
|
event.onresult(event.result);
|
||||||
_status.noclearcountdown=true;
|
}
|
||||||
}
|
if(event.result.bool&&!game.online&&!event.nouse){
|
||||||
if(event.logSkill){
|
player.useResult(event.result,event);
|
||||||
if(typeof event.logSkill=='string'){
|
|
||||||
player.logSkill(event.logSkill);
|
|
||||||
}
|
|
||||||
else if(Array.isArray(event.logSkill)){
|
|
||||||
player.logSkill.apply(player,event.logSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(event.result.card||!event.result.skill){
|
|
||||||
player.useCard(event.result.card,event.result.cards,event.result.targets,event.result.skill);
|
|
||||||
}
|
|
||||||
else if(event.result.skill){
|
|
||||||
player.useSkill(event.result.skill,event.result.cards,event.result.targets);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(event.dialog&&typeof event.dialog=='object') event.dialog.close();
|
if(event.dialog&&typeof event.dialog=='object') event.dialog.close();
|
||||||
if(!_status.noclearcountdown){
|
if(!_status.noclearcountdown){
|
||||||
game.stopCountChoose();
|
game.stopCountChoose();
|
||||||
|
}
|
||||||
|
"step 2"
|
||||||
|
if(event._result&&event.result){
|
||||||
|
event.result.result=event._result;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
chooseToRespond:function(){
|
chooseToRespond:function(){
|
||||||
|
@ -4447,6 +4451,9 @@
|
||||||
},
|
},
|
||||||
chooseButton:function(){
|
chooseButton:function(){
|
||||||
"step 0"
|
"step 0"
|
||||||
|
if(typeof event.dialog=='number'){
|
||||||
|
event.dialog=get.idDialog(event.dialog);
|
||||||
|
}
|
||||||
if(event.createDialog&&!event.dialog){
|
if(event.createDialog&&!event.dialog){
|
||||||
if(Array.isArray(event.createDialog)){
|
if(Array.isArray(event.createDialog)){
|
||||||
event.createDialog.add('hidden');
|
event.createDialog.add('hidden');
|
||||||
|
@ -4455,7 +4462,7 @@
|
||||||
event.closeDialog=true;
|
event.closeDialog=true;
|
||||||
}
|
}
|
||||||
if(event.dialog==undefined) event.dialog=ui.dialog;
|
if(event.dialog==undefined) event.dialog=ui.dialog;
|
||||||
if(event.isMine()){
|
if(event.isMine()||event.dialogdisplay){
|
||||||
event.dialog.style.display='';
|
event.dialog.style.display='';
|
||||||
event.dialog.open();
|
event.dialog.open();
|
||||||
}
|
}
|
||||||
|
@ -5054,9 +5061,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(event.animate!=false){
|
if(event.animate!=false){
|
||||||
if(card.name=='wuxie'&&event.getParent().source){
|
if(card.name=='wuxie'&&event.getParent().target){
|
||||||
var lining=event.getParent().source2||event.getParent().source;
|
var lining=event.getParent().target2||event.getParent().target;
|
||||||
if(Array.isArray(lining)&&event.getParent(2)._trigger.name=='jiedao'){
|
if(Array.isArray(lining)&&event.getParent()._trigger.name=='jiedao'){
|
||||||
player.line(lining[0],'green');
|
player.line(lining[0],'green');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -5223,6 +5230,9 @@
|
||||||
ui.tempnowuxie.close();
|
ui.tempnowuxie.close();
|
||||||
delete ui.tempnowuxie;
|
delete ui.tempnowuxie;
|
||||||
}
|
}
|
||||||
|
if(event._result){
|
||||||
|
event.result=event._result;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
useSkill:function(){
|
useSkill:function(){
|
||||||
"step 0"
|
"step 0"
|
||||||
|
@ -5566,9 +5576,9 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var broadcast=function(){
|
var broadcast=function(){
|
||||||
player.send(function(cards){
|
game.broadcast(function(player,cards){
|
||||||
game.me.directgain(cards);
|
player.directgain(cards);
|
||||||
},cards);
|
},player,cards);
|
||||||
};
|
};
|
||||||
if(event.animate=='draw'){
|
if(event.animate=='draw'){
|
||||||
player.$draw(cards.length);
|
player.$draw(cards.length);
|
||||||
|
@ -5645,25 +5655,26 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(player==game.me) ui.updatehl();
|
if(player==game.me) ui.updatehl();
|
||||||
player.send(function(cards){
|
game.broadcast(function(player,cards){
|
||||||
for(var i=0;i<cards.length;i++){
|
for(var i=0;i<cards.length;i++){
|
||||||
cards[i].delete();
|
cards[i].delete();
|
||||||
}
|
}
|
||||||
var player=game.me;
|
if(player==game.me){
|
||||||
for(var i=player.node.handcards1.childNodes.length-1;i>0;i--){
|
for(var i=player.node.handcards1.childNodes.length-1;i>0;i--){
|
||||||
if(player.node.handcards1.childNodes[i].classList.contains('removing')==false){
|
if(player.node.handcards1.childNodes[i].classList.contains('removing')==false){
|
||||||
player.node.handcards1.childNodes[i].animate('last');
|
player.node.handcards1.childNodes[i].animate('last');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(var i=player.node.handcards2.childNodes.length-1;i>0;i--){
|
for(var i=player.node.handcards2.childNodes.length-1;i>0;i--){
|
||||||
if(player.node.handcards2.childNodes[i].classList.contains('removing')==false){
|
if(player.node.handcards2.childNodes[i].classList.contains('removing')==false){
|
||||||
player.node.handcards2.childNodes[i].animate('last');
|
player.node.handcards2.childNodes[i].animate('last');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui.updatehl();
|
ui.updatehl();
|
||||||
},cards);
|
}
|
||||||
|
},player,cards);
|
||||||
game.addVideo('lose',player,[get.cardsInfo(hs),get.cardsInfo(es),get.cardsInfo(js)]);
|
game.addVideo('lose',player,[get.cardsInfo(hs),get.cardsInfo(es),get.cardsInfo(js)]);
|
||||||
player.update();
|
player.update();
|
||||||
game.addVideo('loseAfter',player);
|
game.addVideo('loseAfter',player);
|
||||||
|
@ -6330,7 +6341,9 @@
|
||||||
position:parseInt(this.dataset.position),
|
position:parseInt(this.dataset.position),
|
||||||
hujia:this.hujia,
|
hujia:this.hujia,
|
||||||
className:this.className,
|
className:this.className,
|
||||||
identity:[this.node.identity.innerHTML,this.node.identity.dataset.color],
|
identityShown:this.identityShown,
|
||||||
|
identityNode:[this.node.identity.innerHTML,this.node.identity.dataset.color],
|
||||||
|
identity:this.identity,
|
||||||
transform:this.queueCount?'':this.style.transform
|
transform:this.queueCount?'':this.style.transform
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -6346,7 +6359,6 @@
|
||||||
game.broadcast(function(player,hp,maxHp,nh,hujia){
|
game.broadcast(function(player,hp,maxHp,nh,hujia){
|
||||||
player.hp=hp;
|
player.hp=hp;
|
||||||
player.maxHp=maxHp;
|
player.maxHp=maxHp;
|
||||||
player._onlineh=nh;
|
|
||||||
player.hujia=hujia;
|
player.hujia=hujia;
|
||||||
player.update();
|
player.update();
|
||||||
},this,this.hp,this.maxHp,this.num('h'),this.hujia);
|
},this,this.hp,this.maxHp,this.num('h'),this.hujia);
|
||||||
|
@ -6416,9 +6428,6 @@
|
||||||
hp.style.transition='';
|
hp.style.transition='';
|
||||||
});
|
});
|
||||||
var numh=this.num('h');
|
var numh=this.num('h');
|
||||||
if(this._onlineh){
|
|
||||||
numh=this._onlineh;
|
|
||||||
}
|
|
||||||
if(_status.video){
|
if(_status.video){
|
||||||
numh=arguments[0];
|
numh=arguments[0];
|
||||||
}
|
}
|
||||||
|
@ -7315,6 +7324,26 @@
|
||||||
next.target=target;
|
next.target=target;
|
||||||
next.content=lib.element.playerproto.viewHandcards;
|
next.content=lib.element.playerproto.viewHandcards;
|
||||||
},
|
},
|
||||||
|
useResult:function(result,event){
|
||||||
|
event=event||_status.event;
|
||||||
|
if(result.skill&&get.info(result.skill).direct){
|
||||||
|
_status.noclearcountdown=true;
|
||||||
|
}
|
||||||
|
if(event.logSkill){
|
||||||
|
if(typeof event.logSkill=='string'){
|
||||||
|
this.logSkill(event.logSkill);
|
||||||
|
}
|
||||||
|
else if(Array.isArray(event.logSkill)){
|
||||||
|
this.logSkill.apply(this,event.logSkill);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(result.card||!result.skill){
|
||||||
|
this.useCard(result.card,result.cards,result.targets,result.skill);
|
||||||
|
}
|
||||||
|
else if(result.skill){
|
||||||
|
this.useSkill(result.skill,result.cards,result.targets);
|
||||||
|
}
|
||||||
|
},
|
||||||
useCard:function(){
|
useCard:function(){
|
||||||
var next=game.createEvent('useCard');
|
var next=game.createEvent('useCard');
|
||||||
next.player=this;
|
next.player=this;
|
||||||
|
@ -7516,9 +7545,9 @@
|
||||||
game.addVideo('directgain',this,get.cardsInfo(cards));
|
game.addVideo('directgain',this,get.cardsInfo(cards));
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
this.send(function(cards){
|
game.broadcast(function(player,cards){
|
||||||
game.me.directgain(cards);
|
player.directgain(cards);
|
||||||
},cards);
|
},this,cards);
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
gain:function(){
|
gain:function(){
|
||||||
|
@ -7828,25 +7857,43 @@
|
||||||
skip:function(name){
|
skip:function(name){
|
||||||
this.skipList.add(name);
|
this.skipList.add(name);
|
||||||
},
|
},
|
||||||
wait:function(){
|
wait:function(callback){
|
||||||
if(lib.node){
|
if(lib.node){
|
||||||
lib.node.torespond[this.playerid]='_noname_waiting';
|
if(typeof callback=='function'){
|
||||||
|
callback._noname_waiting=true;
|
||||||
|
lib.node.torespond[this.playerid]=callback;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
lib.node.torespond[this.playerid]='_noname_waiting';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unwait:function(result){
|
unwait:function(result){
|
||||||
if(!lib.node.torespond.hasOwnProperty(this.playerid)){
|
if(!lib.node.torespond.hasOwnProperty(this.playerid)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var noresume=false;
|
||||||
|
var proceed=null;
|
||||||
|
if(typeof lib.node.torespond[this.playerid]=='function'&&lib.node.torespond[this.playerid]._noname_waiting){
|
||||||
|
proceed=lib.node.torespond[this.playerid](result,this);
|
||||||
|
if(proceed===false){
|
||||||
|
noresume=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
lib.node.torespond[this.playerid]=result;
|
lib.node.torespond[this.playerid]=result;
|
||||||
for(var i in lib.node.torespond){
|
for(var i in lib.node.torespond){
|
||||||
if(lib.node.torespond[i]=='_noname_waiting'){
|
if(lib.node.torespond[i]=='_noname_waiting'){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if(lib.node.torespond[i]&&lib.node.torespond[i]._noname_waiting){
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_status.event.result=result;
|
_status.event.result=result;
|
||||||
_status.event.resultOL=lib.node.torespond;
|
_status.event.resultOL=lib.node.torespond;
|
||||||
lib.node.torespond={};
|
lib.node.torespond={};
|
||||||
if(_status.paused) game.resume();
|
if(typeof proceed=='function') proceed();
|
||||||
|
else if(_status.paused&&!noresume) game.resume();
|
||||||
},
|
},
|
||||||
logSkill:function(name,targets,nature){
|
logSkill:function(name,targets,nature){
|
||||||
if(get.itemtype(targets)=='player') targets=[targets];
|
if(get.itemtype(targets)=='player') targets=[targets];
|
||||||
|
@ -8404,6 +8451,26 @@
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
hasWuxie:function(){
|
||||||
|
if(this.num('h','wuxie')) return true;
|
||||||
|
var skills=this.get('s',true).concat(lib.skill.global);
|
||||||
|
game.expandSkills(skills);
|
||||||
|
for(var i=0;i<skills.length;i++){
|
||||||
|
var ifo=get.info(skills[i]);
|
||||||
|
if(ifo.viewAs&&ifo.viewAs.name=='wuxie'){
|
||||||
|
if(!ifo.viewAsFilter||ifo.viewAsFilter(this)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var hiddenCard=get.info(skills[i]).hiddenCard;
|
||||||
|
if(typeof hiddenCard=='function'&&hiddenCard(player,'wuxie')){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
getJudge:function(name){
|
getJudge:function(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++){
|
||||||
|
@ -9769,7 +9836,7 @@
|
||||||
storage:lib.playerOL[i].storage,
|
storage:lib.playerOL[i].storage,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.player.send(function(name,args,set,event,stat,skills){
|
this.player.send(function(name,args,set,event,trigger,stat,skills){
|
||||||
for(var i in skills){
|
for(var i in skills){
|
||||||
if(i=='global'){
|
if(i=='global'){
|
||||||
lib.skill.global=skills[i];
|
lib.skill.global=skills[i];
|
||||||
|
@ -9786,9 +9853,12 @@
|
||||||
next.set(set[i][0],set[i][1]);
|
next.set(set[i][0],set[i][1]);
|
||||||
}
|
}
|
||||||
next._modparent=event;
|
next._modparent=event;
|
||||||
|
next._trigger=trigger;
|
||||||
game.resume();
|
game.resume();
|
||||||
},this.name,this._args||[],this._set,
|
},this.name,this._args||[],this._set,
|
||||||
get.stringifiedResult(this.parent,3),this.player.getStat(),skills);
|
get.stringifiedResult(this.parent,3),
|
||||||
|
get.stringifiedResult(this._trigger,2),
|
||||||
|
this.player.getStat(),skills);
|
||||||
this.player.wait();
|
this.player.wait();
|
||||||
game.pause();
|
game.pause();
|
||||||
},
|
},
|
||||||
|
@ -9866,7 +9936,7 @@
|
||||||
return (this.player&&this.player.isOnline());
|
return (this.player&&this.player.isOnline());
|
||||||
},
|
},
|
||||||
notLink:function(){
|
notLink:function(){
|
||||||
return this.parent.name!='_lianhuan'&&this.parent.name!='_lianhuan2';
|
return this.getParent().name!='_lianhuan'&&this.getParent().name!='_lianhuan2';
|
||||||
},
|
},
|
||||||
trigger:function(name){
|
trigger:function(name){
|
||||||
if(_status.video) return;
|
if(_status.video) return;
|
||||||
|
@ -10459,6 +10529,7 @@
|
||||||
player.classList.add('glow_phase');
|
player.classList.add('glow_phase');
|
||||||
},player);
|
},player);
|
||||||
}
|
}
|
||||||
|
game.syncState();
|
||||||
game.addVideo('phaseChange',player);
|
game.addVideo('phaseChange',player);
|
||||||
_status.currentPhase=player;
|
_status.currentPhase=player;
|
||||||
game.log();
|
game.log();
|
||||||
|
@ -10715,7 +10786,7 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.send('init',this.id,lib.configOL);
|
this.send('init',this.id,lib.configOL,game.ip);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reinit:function(id){
|
reinit:function(id){
|
||||||
|
@ -10727,7 +10798,7 @@
|
||||||
game.broadcast(function(player){
|
game.broadcast(function(player){
|
||||||
player.setNickname();
|
player.setNickname();
|
||||||
},player);
|
},player);
|
||||||
this.send('reinit',lib.configOL,get.arenaState());
|
this.send('reinit',lib.configOL,get.arenaState(),game.getState?game.getState():{});
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.send('denied','offline');
|
this.send('denied','offline');
|
||||||
|
@ -10747,10 +10818,17 @@
|
||||||
if(player){
|
if(player){
|
||||||
player.unwait(result);
|
player.unwait(result);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
exec:function(func){
|
||||||
|
if(typeof func=='function'){
|
||||||
|
var args=Array.from(arguments);
|
||||||
|
args.shift();
|
||||||
|
func.apply(this,args);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
client:{
|
client:{
|
||||||
init:function(id,config){
|
init:function(id,config,ip){
|
||||||
game.online=true;
|
game.online=true;
|
||||||
game.onlineID=id;
|
game.onlineID=id;
|
||||||
game.saveConfig('reconnect_info',[_status.ip,id]);
|
game.saveConfig('reconnect_info',[_status.ip,id]);
|
||||||
|
@ -10759,23 +10837,38 @@
|
||||||
lib.playerOL={};
|
lib.playerOL={};
|
||||||
lib.cardOL={};
|
lib.cardOL={};
|
||||||
game.clearArena();
|
game.clearArena();
|
||||||
ui.create.connectPlayers();
|
game.finishCards();
|
||||||
|
ui.create.connectPlayers(ip);
|
||||||
|
ui.auto.hide();
|
||||||
var proceed=function(){
|
var proceed=function(){
|
||||||
_status.event={
|
game.loadModeAsync(config.mode,function(mode){
|
||||||
finished:true,
|
for(var i in mode.ai){
|
||||||
next:[],
|
if(typeof mode.ai[i]=='object'){
|
||||||
};
|
if(ai[i]==undefined) ai[i]={};
|
||||||
game.createEvent('game',false).content=function(){
|
for(j in mode.ai[i]){
|
||||||
'step 0'
|
ai[i][j]=lib.init.eval(mode.ai[i][j]);
|
||||||
event._result=null;
|
}
|
||||||
game.pause();
|
}
|
||||||
'step 1'
|
else{
|
||||||
if(result){
|
ai[i]=lib.init.eval(mode.ai[i]);
|
||||||
game.send('result',get.stringifiedResult(result));
|
}
|
||||||
|
}
|
||||||
|
for(var i in mode.translate){
|
||||||
|
lib.translate[i]=mode.translate[i];
|
||||||
}
|
}
|
||||||
event.goto(0);
|
if(mode.game){
|
||||||
};
|
game.getIdentityList=mode.game.getIdentityList;
|
||||||
game.loop();
|
game.updateState=mode.game.updateState;
|
||||||
|
}
|
||||||
|
_status.event={
|
||||||
|
finished:true,
|
||||||
|
next:[],
|
||||||
|
};
|
||||||
|
_status.paused=false;
|
||||||
|
game.createEvent('game',false).content=lib.init.startOnline;
|
||||||
|
game.loop();
|
||||||
|
game.send('inited');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if(_status.event.getParent()){
|
if(_status.event.getParent()){
|
||||||
game.forceOver('noover',proceed);
|
game.forceOver('noover',proceed);
|
||||||
|
@ -10788,63 +10881,102 @@
|
||||||
lib.character[j]=lib.character[j]||lib.characterPack[i][j];
|
lib.character[j]=lib.character[j]||lib.characterPack[i][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
game.send('inited');
|
|
||||||
},
|
},
|
||||||
reinit:function(config,state){
|
reinit:function(config,state,state2){
|
||||||
game.online=true;
|
game.online=true;
|
||||||
game.saveConfig('reconnect_info',[_status.ip,game.onlineID]);
|
game.saveConfig('reconnect_info',[_status.ip,game.onlineID]);
|
||||||
_status.connectMode=true;
|
_status.connectMode=true;
|
||||||
lib.configOL=config;
|
lib.configOL=config;
|
||||||
lib.playerOL={};
|
lib.playerOL={};
|
||||||
lib.cardOL={};
|
lib.cardOL={};
|
||||||
game.players=[];
|
|
||||||
for(var i in lib.characterPack){
|
|
||||||
for(var j in lib.characterPack[i]){
|
|
||||||
lib.character[j]=lib.character[j]||lib.characterPack[i][j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
game.clearArena();
|
game.loadModeAsync(config.mode,function(mode){
|
||||||
ui.arena.dataset.number=state.number;
|
for(var i in mode.ai){
|
||||||
|
if(typeof mode.ai[i]=='object'){
|
||||||
|
if(ai[i]==undefined) ai[i]={};
|
||||||
|
for(j in mode.ai[i]){
|
||||||
|
ai[i][j]=lib.init.eval(mode.ai[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ai[i]=lib.init.eval(mode.ai[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(var i in mode.translate){
|
||||||
|
lib.translate[i]=mode.translate[i];
|
||||||
|
}
|
||||||
|
if(mode.game){
|
||||||
|
game.getIdentityList=mode.game.getIdentityList;
|
||||||
|
game.updateState=mode.game.updateState;
|
||||||
|
}
|
||||||
|
state=get.parsedResult(state);
|
||||||
|
game.players=[];
|
||||||
|
for(var i in lib.characterPack){
|
||||||
|
for(var j in lib.characterPack[i]){
|
||||||
|
lib.character[j]=lib.character[j]||lib.characterPack[i][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
game.clearArena();
|
||||||
|
game.finishCards();
|
||||||
|
ui.arena.dataset.number=state.number;
|
||||||
|
var pos=state.players[game.onlineID].position;
|
||||||
|
for(var i in state.players){
|
||||||
|
var info=state.players[i];
|
||||||
|
var player=ui.create.player(ui.arena).animate('start');
|
||||||
|
player.dataset.position=info.position<pos?info.position-pos+parseInt(state.number):info.position-pos;
|
||||||
|
player.init(info.name,info.name2);
|
||||||
|
player.playerid=i;
|
||||||
|
player.nickname=info.nickname;
|
||||||
|
player.identity=info.identity;
|
||||||
|
player.identityShown=info.identityShown;
|
||||||
|
player.setNickname();
|
||||||
|
if(i==game.onlineID){
|
||||||
|
game.me=player;
|
||||||
|
|
||||||
var pos=state.players[game.onlineID].position;
|
}
|
||||||
for(var i in state.players){
|
player.directgain(info.handcards);
|
||||||
var info=state.players[i];
|
lib.playerOL[i]=player;
|
||||||
var player=ui.create.player(ui.arena).animate('start');
|
for(var i=0;i<info.equips.length;i++){
|
||||||
player.dataset.position=info.position<pos?info.position-pos+parseInt(state.number):info.position-pos;
|
player.$equip(info.equips[i]);
|
||||||
player.init(info.name,info.name2);
|
}
|
||||||
player.playerid=i;
|
for(var i=0;i<info.judges.length;i++){
|
||||||
player.nickname=info.nickname;
|
player.node.judges.appendChild(info.equips[i]);
|
||||||
player.setNickname();
|
}
|
||||||
if(i==game.onlineID){
|
if(player==game.me||player.identityShown){
|
||||||
game.me=player;
|
player.setIdentity();
|
||||||
|
}
|
||||||
|
else if(!game.getIdentityList&&info.identityNode){
|
||||||
|
player.node.identity.innerHTML=info.identityNode[0];
|
||||||
|
player.node.identity.dataset.color=info.identityNode[1];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
player.setIdentity('cai');
|
||||||
|
}
|
||||||
|
player.update();
|
||||||
|
game.players.push(player);
|
||||||
}
|
}
|
||||||
lib.playerOL[i]=player;
|
game.arrangePlayers();
|
||||||
game.players.push(player);
|
ui.create.me(true);
|
||||||
}
|
|
||||||
game.arrangePlayers();
|
_status.event={
|
||||||
ui.create.me(true);
|
finished:true,
|
||||||
game.createEvent('game',false).content=function(){
|
next:[],
|
||||||
'step 0'
|
};
|
||||||
event._result=null;
|
_status.paused=false;
|
||||||
game.pause();
|
|
||||||
'step 1'
|
if(game.updateState){
|
||||||
if(result){
|
game.updateState(state2);
|
||||||
game.send('result',get.stringifiedResult(result));
|
|
||||||
}
|
}
|
||||||
event.goto(0);
|
game.createEvent('game',false).content=lib.init.startOnline;
|
||||||
};
|
game.loop();
|
||||||
game.loop();
|
game.send('reinited');
|
||||||
game.send('inited');
|
});
|
||||||
},
|
},
|
||||||
exec:function(funcstr){
|
exec:function(func){
|
||||||
try{
|
if(typeof func=='function'){
|
||||||
var args=Array.from(arguments);
|
var args=Array.from(arguments);
|
||||||
args.shift();
|
args.shift();
|
||||||
eval('('+funcstr+').apply(this,args);');
|
func.apply(this,args);
|
||||||
}
|
|
||||||
catch(e){
|
|
||||||
console.log(e);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
denied:function(reason){
|
denied:function(reason){
|
||||||
|
@ -10852,10 +10984,21 @@
|
||||||
case 'version':alert('加入失败:版本不匹配');break;
|
case 'version':alert('加入失败:版本不匹配');break;
|
||||||
case 'gaming':alert('加入失败:游戏已开始');break;
|
case 'gaming':alert('加入失败:游戏已开始');break;
|
||||||
case 'number':alert('加入失败:房间已满');break;
|
case 'number':alert('加入失败:房间已满');break;
|
||||||
case 'offline':alert('无法重新连接');game.reload();break;
|
case 'offline':if(_status.paused) game.resume();break;
|
||||||
}
|
}
|
||||||
game.ws.close();
|
game.ws.close();
|
||||||
},
|
},
|
||||||
|
cancel:function(id){
|
||||||
|
if(_status.event.id==id&&_status.event.isMine()&&_status.paused&&_status.imchoosing){
|
||||||
|
ui.click.cancel();
|
||||||
|
if(ui.confirm){
|
||||||
|
ui.confirm.close();
|
||||||
|
}
|
||||||
|
if(_status.event.result){
|
||||||
|
_status.event.result.id=id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
gameStart:function(){
|
gameStart:function(){
|
||||||
for(var i=0;i<game.connectPlayers.length;i++){
|
for(var i=0;i<game.connectPlayers.length;i++){
|
||||||
game.connectPlayers[i].delete();
|
game.connectPlayers[i].delete();
|
||||||
|
@ -10865,6 +11008,7 @@
|
||||||
ui.connectStartButton.delete();
|
ui.connectStartButton.delete();
|
||||||
delete ui.connectStartButton;
|
delete ui.connectStartButton;
|
||||||
}
|
}
|
||||||
|
ui.auto.show();
|
||||||
},
|
},
|
||||||
updateWaiting:function(map){
|
updateWaiting:function(map){
|
||||||
for(var i=0;i<map.length;i++){
|
for(var i=0;i<map.length;i++){
|
||||||
|
@ -10896,6 +11040,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
syncState:function(){
|
||||||
|
if(game.getState&&game.updateState){
|
||||||
|
game.broadcast(function(state){
|
||||||
|
game.updateState(state);
|
||||||
|
},game.getState());
|
||||||
|
}
|
||||||
|
},
|
||||||
updateWaiting:function(){
|
updateWaiting:function(){
|
||||||
var map=[];
|
var map=[];
|
||||||
for(var i=0;i<game.connectPlayers.length;i++){
|
for(var i=0;i<game.connectPlayers.length;i++){
|
||||||
|
@ -10917,7 +11068,7 @@
|
||||||
ui.auto.hide();
|
ui.auto.hide();
|
||||||
event.hideauto=true;
|
event.hideauto=true;
|
||||||
}
|
}
|
||||||
ui.create.connectPlayers();
|
ui.create.connectPlayers(game.ip);
|
||||||
var me=game.connectPlayers[0];
|
var me=game.connectPlayers[0];
|
||||||
me.initOL(lib.config.connect_nickname,lib.config.connect_avatar);
|
me.initOL(lib.config.connect_nickname,lib.config.connect_avatar);
|
||||||
me.playerid=1;
|
me.playerid=1;
|
||||||
|
@ -10961,7 +11112,14 @@
|
||||||
_status.imchoosing=true;
|
_status.imchoosing=true;
|
||||||
if(_status.connectMode&&!_status.countDown){
|
if(_status.connectMode&&!_status.countDown){
|
||||||
ui.timer.show();
|
ui.timer.show();
|
||||||
game.countDown(parseInt(get.config('choose_timeout')),function(){
|
var num;
|
||||||
|
if(_status.connectMode){
|
||||||
|
num=lib.configOL.choose_timeout;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
num=get.config('choose_timeout');
|
||||||
|
}
|
||||||
|
game.countDown(parseInt(num),function(){
|
||||||
ui.click.auto();
|
ui.click.auto();
|
||||||
ui.timer.hide();
|
ui.timer.hide();
|
||||||
});
|
});
|
||||||
|
@ -11010,7 +11168,11 @@
|
||||||
},
|
},
|
||||||
send:function(){
|
send:function(){
|
||||||
if(game.ws){
|
if(game.ws){
|
||||||
game.ws.send(JSON.stringify(Array.from(arguments)));
|
var args=Array.from(arguments);
|
||||||
|
if(typeof args[0]=='function'){
|
||||||
|
args.unshift('exec');
|
||||||
|
}
|
||||||
|
game.ws.send(JSON.stringify(get.stringifiedResult(args)));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createServer:function(){
|
createServer:function(){
|
||||||
|
@ -11021,6 +11183,13 @@
|
||||||
lib.cardOL={};
|
lib.cardOL={};
|
||||||
var WebSocketServer=require('ws').Server;
|
var WebSocketServer=require('ws').Server;
|
||||||
var wss=new WebSocketServer({port:8080});
|
var wss=new WebSocketServer({port:8080});
|
||||||
|
var os=require('os');
|
||||||
|
var en0 = os.networkInterfaces().en0;
|
||||||
|
for(var i=0;i<en0.length;i++){
|
||||||
|
if(en0[i].family=='IPv4'){
|
||||||
|
game.ip=en0[i].address;break;
|
||||||
|
}
|
||||||
|
}
|
||||||
wss.on('connection',function(ws){
|
wss.on('connection',function(ws){
|
||||||
var client={
|
var client={
|
||||||
ws:ws,
|
ws:ws,
|
||||||
|
@ -13745,6 +13914,11 @@
|
||||||
while(_status.dieClose.length){
|
while(_status.dieClose.length){
|
||||||
_status.dieClose.shift().close();
|
_status.dieClose.shift().close();
|
||||||
}
|
}
|
||||||
|
game.broadcast(function(){
|
||||||
|
while(_status.dieClose.length){
|
||||||
|
_status.dieClose.shift().close();
|
||||||
|
}
|
||||||
|
});
|
||||||
event.finish();
|
event.finish();
|
||||||
}
|
}
|
||||||
else if(player&&player.removed&&event.name!='phaseLoop'){
|
else if(player&&player.removed&&event.name!='phaseLoop'){
|
||||||
|
@ -14308,6 +14482,15 @@
|
||||||
}
|
}
|
||||||
return players[0];
|
return players[0];
|
||||||
},
|
},
|
||||||
|
loadModeAsync:function(name,callback){
|
||||||
|
window.mode={};
|
||||||
|
var script=lib.init.js(lib.assetURL+'mode',name,function(){
|
||||||
|
script.remove();
|
||||||
|
var mode=window.mode;
|
||||||
|
delete window.mode;
|
||||||
|
callback(mode[name]);
|
||||||
|
});
|
||||||
|
},
|
||||||
loadMode:function(mode){
|
loadMode:function(mode){
|
||||||
var next=game.createEvent('loadMode');
|
var next=game.createEvent('loadMode');
|
||||||
next.mode=mode;
|
next.mode=mode;
|
||||||
|
@ -14687,7 +14870,6 @@
|
||||||
ui.discardPile.innerHTML='';
|
ui.discardPile.innerHTML='';
|
||||||
ui.special.innerHTML='';
|
ui.special.innerHTML='';
|
||||||
ui.playerids.remove();
|
ui.playerids.remove();
|
||||||
ui.connectconfig.remove();
|
|
||||||
game.players.length=0;
|
game.players.length=0;
|
||||||
game.dead.length=0;
|
game.dead.length=0;
|
||||||
game.me=null;
|
game.me=null;
|
||||||
|
@ -16094,8 +16276,6 @@
|
||||||
ui.system1=ui.create.div('#system1',ui.system);
|
ui.system1=ui.create.div('#system1',ui.system);
|
||||||
ui.system2=ui.create.div('#system2',ui.system);
|
ui.system2=ui.create.div('#system2',ui.system);
|
||||||
|
|
||||||
ui.connectconfig=ui.create.system('联机',null,true);
|
|
||||||
lib.setPopped(ui.connectconfig,ui.click.connectconfig,220,null,true);
|
|
||||||
ui.replay=ui.create.system('重来',game.reload,true);
|
ui.replay=ui.create.system('重来',game.reload,true);
|
||||||
ui.config2=ui.create.system('选项',ui.click.config);
|
ui.config2=ui.create.system('选项',ui.click.config);
|
||||||
ui.pause=ui.create.system('暂停',ui.click.pause);
|
ui.pause=ui.create.system('暂停',ui.click.pause);
|
||||||
|
@ -16105,9 +16285,6 @@
|
||||||
if(!lib.config.show_pause){
|
if(!lib.config.show_pause){
|
||||||
ui.pause.style.display='none';
|
ui.pause.style.display='none';
|
||||||
}
|
}
|
||||||
if(!lib.config.show_connect){
|
|
||||||
ui.connectconfig.style.display='none';
|
|
||||||
}
|
|
||||||
ui.cardPileButton=ui.create.system('牌堆',null,true);
|
ui.cardPileButton=ui.create.system('牌堆',null,true);
|
||||||
lib.setPopped(ui.cardPileButton,ui.click.cardPileButton,220);
|
lib.setPopped(ui.cardPileButton,ui.click.cardPileButton,220);
|
||||||
ui.wuxie=ui.create.system('不询问无懈',ui.click.wuxie,true);
|
ui.wuxie=ui.create.system('不询问无懈',ui.click.wuxie,true);
|
||||||
|
@ -16211,7 +16388,6 @@
|
||||||
|
|
||||||
if(_status.connectMode){
|
if(_status.connectMode){
|
||||||
ui.playerids.remove();
|
ui.playerids.remove();
|
||||||
ui.connectconfig.remove();
|
|
||||||
ui.pause.innerHTML='历史';
|
ui.pause.innerHTML='历史';
|
||||||
}
|
}
|
||||||
setTimerPosition.call(ui.timer);
|
setTimerPosition.call(ui.timer);
|
||||||
|
@ -16457,6 +16633,9 @@
|
||||||
active.update();
|
active.update();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if(!lib.node){
|
||||||
|
connectButton.style.display='none';
|
||||||
|
}
|
||||||
connectButton.style.left='275px';
|
connectButton.style.left='275px';
|
||||||
ui.connectButton=connectButton;
|
ui.connectButton=connectButton;
|
||||||
if(lib.config.connectMode){
|
if(lib.config.connectMode){
|
||||||
|
@ -19532,6 +19711,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var button=ui.create.div('.menubutton.large.highlight',game.online?'退出联机':'开始游戏',ui.window,function(){
|
var button=ui.create.div('.menubutton.large.highlight',game.online?'退出联机':'开始游戏',ui.window,function(){
|
||||||
|
if(button.clicked) return;
|
||||||
if(game.online){
|
if(game.online){
|
||||||
game.reload();
|
game.reload();
|
||||||
}
|
}
|
||||||
|
@ -19540,8 +19720,16 @@
|
||||||
}
|
}
|
||||||
button.delete();
|
button.delete();
|
||||||
delete ui.connectStartButton;
|
delete ui.connectStartButton;
|
||||||
|
button.clicked=true;
|
||||||
});
|
});
|
||||||
button.style.top='calc(200% / 3 + 280px / 3 + 6px)';
|
|
||||||
|
var bar=ui.create.div('.shadowed',ui.window);
|
||||||
|
bar.style.height='20px';
|
||||||
|
bar.style.width='80%';
|
||||||
|
bar.style.left='10%';
|
||||||
|
bar.style.top='calc(200% / 7 - 120px + 5px)';
|
||||||
|
|
||||||
|
button.style.top='calc(500% / 7 + 80px + 5px)';
|
||||||
button.style.width='130px';
|
button.style.width='130px';
|
||||||
button.style.left='calc(50% - 65px)';
|
button.style.left='calc(50% - 65px)';
|
||||||
ui.connectStartButton=button;
|
ui.connectStartButton=button;
|
||||||
|
@ -19821,6 +20009,7 @@
|
||||||
var node=ui.create.div('.newgame');
|
var node=ui.create.div('.newgame');
|
||||||
for(var i=0;i<3&&i+k*3<lib.config.all.mode.length;i++){
|
for(var i=0;i<3&&i+k*3<lib.config.all.mode.length;i++){
|
||||||
var thismode=lib.config.all.mode[i+k*3];
|
var thismode=lib.config.all.mode[i+k*3];
|
||||||
|
if(thismode=='connect') continue;
|
||||||
var div=ui.create.div(thismode==lib.config.mode?'.underlinenode.on':'.underlinenode',node);
|
var div=ui.create.div(thismode==lib.config.mode?'.underlinenode.on':'.underlinenode',node);
|
||||||
div.innerHTML=lib.translate[thismode];
|
div.innerHTML=lib.translate[thismode];
|
||||||
div.link=thismode;
|
div.link=thismode;
|
||||||
|
@ -21988,6 +22177,14 @@
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
var get={
|
var get={
|
||||||
|
idDialog:function(id){
|
||||||
|
for(var i=0;i<ui.dialogs.length;i++){
|
||||||
|
if(ui.dialogs[i].videoId==id){
|
||||||
|
return ui.dialogs[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
arenaState:function(){
|
arenaState:function(){
|
||||||
var state={
|
var state={
|
||||||
number:ui.arena.dataset.number,
|
number:ui.arena.dataset.number,
|
||||||
|
@ -21999,7 +22196,7 @@
|
||||||
return state;
|
return state;
|
||||||
},
|
},
|
||||||
id:function(){
|
id:function(){
|
||||||
return (Math.floor((new Date()).getTime()*Math.random())).toString();
|
return (Math.floor(1000000000+9000000000*Math.random())).toString();
|
||||||
},
|
},
|
||||||
zhu:function(player,skill){
|
zhu:function(player,skill){
|
||||||
if(typeof player=='string'){
|
if(typeof player=='string'){
|
||||||
|
|
|
@ -43,6 +43,7 @@ mode.pack={
|
||||||
boss:'挑战',
|
boss:'挑战',
|
||||||
chess:'战棋',
|
chess:'战棋',
|
||||||
stone:'炉石',
|
stone:'炉石',
|
||||||
|
connect:'联机',
|
||||||
};
|
};
|
||||||
background.pack={
|
background.pack={
|
||||||
zhulian_bg:'璧合',
|
zhulian_bg:'璧合',
|
||||||
|
|
|
@ -55,6 +55,7 @@ window.noname_source_list=[
|
||||||
'mode/identity.js',
|
'mode/identity.js',
|
||||||
'mode/stone.js',
|
'mode/stone.js',
|
||||||
'mode/versus.js',
|
'mode/versus.js',
|
||||||
|
'mode/connect.js',
|
||||||
'play/character.js',
|
'play/character.js',
|
||||||
'play/coin.js',
|
'play/coin.js',
|
||||||
'play/soldier.js',
|
'play/soldier.js',
|
||||||
|
@ -80,10 +81,15 @@ window.noname_source_list=[
|
||||||
'theme/style/card/music.css',
|
'theme/style/card/music.css',
|
||||||
'theme/style/card/simple.css',
|
'theme/style/card/simple.css',
|
||||||
'theme/style/card/wood.css',
|
'theme/style/card/wood.css',
|
||||||
|
'theme/style/card/new.css',
|
||||||
|
'theme/style/card/image/new.png',
|
||||||
'theme/style/cardback/default.css',
|
'theme/style/cardback/default.css',
|
||||||
'theme/style/cardback/music.css',
|
'theme/style/cardback/music.css',
|
||||||
'theme/style/cardback/official.css',
|
'theme/style/cardback/official.css',
|
||||||
'theme/style/cardback/wood.css',
|
'theme/style/cardback/wood.css',
|
||||||
|
'theme/style/cardback/new.css',
|
||||||
|
'theme/style/cardback/image/new.png',
|
||||||
|
'theme/style/cardback/image/new2.png',
|
||||||
'theme/style/cardback/image/official.png',
|
'theme/style/cardback/image/official.png',
|
||||||
'theme/style/cardback/image/official2.png',
|
'theme/style/cardback/image/official2.png',
|
||||||
'theme/style/hp/default.css',
|
'theme/style/hp/default.css',
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
window.noname_update={
|
window.noname_update={
|
||||||
version:'1.8.1.5',
|
version:'1.8.2',
|
||||||
changeLog:[
|
changeLog:[
|
||||||
'主题并入素材',
|
'联机预览版(身份模式、标准版包)',
|
||||||
'按钮位置选项',
|
'新卡牌样式(by @_游离感_ )',
|
||||||
'录像兼容性改进'
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,14 +352,14 @@
|
||||||
/*--------位置(1人)------*/
|
/*--------位置(1人)------*/
|
||||||
.player[data-position='0']{top:calc(100% - 170px);left:calc(50% - 75px);}
|
.player[data-position='0']{top:calc(100% - 170px);left:calc(50% - 75px);}
|
||||||
/*--------位置(联机)------*/
|
/*--------位置(联机)------*/
|
||||||
#window>.player.connect[data-position='0']{left:calc(200% / 7 - 1200px / 7);top:calc(100% / 3 - 400px / 3 + 12px);}
|
#window>.player.connect[data-position='0']{left:calc(200% / 7 - 1200px / 7);top:calc(300% / 7 - 160px + 5px);}
|
||||||
#window>.player.connect[data-position='1']{left:calc(300% / 7 - 750px / 7);top:calc(100% / 3 - 400px / 3 + 12px);}
|
#window>.player.connect[data-position='1']{left:calc(300% / 7 - 750px / 7);top:calc(300% / 7 - 160px + 5px);}
|
||||||
#window>.player.connect[data-position='2']{left:calc(400% / 7 - 300px / 7);top:calc(100% / 3 - 400px / 3 + 12px);}
|
#window>.player.connect[data-position='2']{left:calc(400% / 7 - 300px / 7);top:calc(300% / 7 - 160px + 5px);}
|
||||||
#window>.player.connect[data-position='3']{left:calc(500% / 7 + 150px / 7);top:calc(100% / 3 - 400px / 3 + 12px);}
|
#window>.player.connect[data-position='3']{left:calc(500% / 7 + 150px / 7);top:calc(300% / 7 - 160px + 5px);}
|
||||||
#window>.player.connect[data-position='4']{left:calc(200% / 7 - 1200px / 7);top:calc(150% / 3 - 20px + 9px);}
|
#window>.player.connect[data-position='4']{left:calc(200% / 7 - 1200px / 7);top:calc(400% / 7 - 40px + 5px);}
|
||||||
#window>.player.connect[data-position='5']{left:calc(300% / 7 - 750px / 7);top:calc(150% / 3 - 20px + 9px);}
|
#window>.player.connect[data-position='5']{left:calc(300% / 7 - 750px / 7);top:calc(400% / 7 - 40px + 5px);}
|
||||||
#window>.player.connect[data-position='6']{left:calc(400% / 7 - 300px / 7);top:calc(150% / 3 - 20px + 9px);}
|
#window>.player.connect[data-position='6']{left:calc(400% / 7 - 300px / 7);top:calc(400% / 7 - 40px + 5px);}
|
||||||
#window>.player.connect[data-position='7']{left:calc(500% / 7 + 150px / 7);top:calc(150% / 3 - 20px + 9px);}
|
#window>.player.connect[data-position='7']{left:calc(500% / 7 + 150px / 7);top:calc(400% / 7 - 40px + 5px);}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
'use strict';
|
||||||
|
mode.connect={
|
||||||
|
start:function(){
|
||||||
|
'step 0'
|
||||||
|
if(lib.config.reconnect_info){
|
||||||
|
var info=lib.config.reconnect_info;
|
||||||
|
game.onlineID=info[1];
|
||||||
|
game.connect(info[0]);
|
||||||
|
game.saveConfig('reconnect_info');
|
||||||
|
game.pause();
|
||||||
|
}
|
||||||
|
'step 1'
|
||||||
|
delete game.onlineID;
|
||||||
|
for(var i in lib.element.event){
|
||||||
|
event.parent[i]=lib.element.event[i];
|
||||||
|
}
|
||||||
|
event.parent.custom={
|
||||||
|
add:{},
|
||||||
|
replace:{}
|
||||||
|
};
|
||||||
|
game.connect('localhost');
|
||||||
|
}
|
||||||
|
};
|
|
@ -19,9 +19,14 @@ mode.identity={
|
||||||
else{
|
else{
|
||||||
lib.configOL.number=lib.configOL.player_number;
|
lib.configOL.number=lib.configOL.player_number;
|
||||||
}
|
}
|
||||||
lib.configOL.characterPack=['standard','wind'];
|
lib.configOL.characterPack=['standard'];
|
||||||
lib.configOL.cardPack=['standard'];
|
lib.configOL.cardPack=['standard'];
|
||||||
lib.configOL.mode='identity';
|
lib.configOL.mode='identity';
|
||||||
|
for(var i=0;i<lib.card.list.length;i++){
|
||||||
|
if(!lib.cardPack.standard.contains(lib.card.list[i][2])){
|
||||||
|
lib.card.list.splice(i--,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"step 1"
|
"step 1"
|
||||||
var playback=localStorage.getItem(lib.configprefix+'playback');
|
var playback=localStorage.getItem(lib.configprefix+'playback');
|
||||||
|
@ -54,9 +59,6 @@ mode.identity={
|
||||||
game.delay();
|
game.delay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!lib.node){
|
|
||||||
game.connect('localhost');
|
|
||||||
}
|
|
||||||
"step 2"
|
"step 2"
|
||||||
if(!lib.config.new_tutorial){
|
if(!lib.config.new_tutorial){
|
||||||
game.saveConfig('version',lib.version);
|
game.saveConfig('version',lib.version);
|
||||||
|
@ -268,6 +270,7 @@ mode.identity={
|
||||||
console.log(str);
|
console.log(str);
|
||||||
game.showIdentity();
|
game.showIdentity();
|
||||||
}
|
}
|
||||||
|
game.syncState();
|
||||||
event.trigger('gameStart');
|
event.trigger('gameStart');
|
||||||
|
|
||||||
var players=get.players(lib.sort.position);
|
var players=get.players(lib.sort.position);
|
||||||
|
@ -286,6 +289,37 @@ mode.identity={
|
||||||
game.phaseLoop(game.zhong||game.zhu);
|
game.phaseLoop(game.zhong||game.zhu);
|
||||||
},
|
},
|
||||||
game:{
|
game:{
|
||||||
|
getState:function(){
|
||||||
|
var state={};
|
||||||
|
for(var i in lib.playerOL){
|
||||||
|
var player=lib.playerOL[i];
|
||||||
|
state[i]={identity:player.identity};
|
||||||
|
if(player==game.zhu){
|
||||||
|
state[i].zhu=player.isZhu?true:false;
|
||||||
|
}
|
||||||
|
if(player==game.zhong){
|
||||||
|
state[i].zhong=true;
|
||||||
|
}
|
||||||
|
state[i].shown=player.ai.shown;
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
updateState:function(state){
|
||||||
|
for(var i in state){
|
||||||
|
var player=lib.playerOL[i];
|
||||||
|
if(player){
|
||||||
|
player.identity=state[i].identity;
|
||||||
|
if(typeof state[i].zhu=='boolean'){
|
||||||
|
game.zhu=player;
|
||||||
|
player.isZhu=state[i].zhu;
|
||||||
|
}
|
||||||
|
if(state[i].zhong){
|
||||||
|
game.zhong=player;
|
||||||
|
}
|
||||||
|
player.ai.shown=state[i].shown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
getIdentityList:function(player){
|
getIdentityList:function(player){
|
||||||
if(player.identityShown) return;
|
if(player.identityShown) return;
|
||||||
if(player==game.me) return;
|
if(player==game.me) return;
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 98 KiB |
|
@ -0,0 +1,9 @@
|
||||||
|
.card:not(*:empty){
|
||||||
|
color:rgb(77, 60, 51);
|
||||||
|
text-shadow:none;
|
||||||
|
background: url('image/new.png');
|
||||||
|
background-size:cover;
|
||||||
|
}
|
||||||
|
#arena:not(.chess) .player[data-position='0']>.equips>.equip5 {
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 99 KiB |
Binary file not shown.
After Width: | Height: | Size: 101 KiB |
|
@ -0,0 +1,8 @@
|
||||||
|
.card:empty,.card.infohidden{
|
||||||
|
background: url('image/new.png');
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
.card.infohidden:not(.infoflip){
|
||||||
|
background: url('image/new2.png');
|
||||||
|
background-size: cover;
|
||||||
|
}
|
Loading…
Reference in New Issue