This commit is contained in:
libccy 2016-04-04 00:11:05 +08:00
parent 53a1e75c10
commit 8699a78908
5 changed files with 185 additions and 108 deletions

View File

@ -102,7 +102,7 @@ character.sp={
player.storage.qizhi++; player.storage.qizhi++;
if(!event.isMine()) game.delay(); if(!event.isMine()) game.delay();
player.logSkill('qizh',result.targets); player.logSkill('qizh',result.targets);
player.discardPlayerCard(result.targets[0],true); player.discardPlayerCard(result.targets[0],true,'he');
event.target=result.targets[0]; event.target=result.targets[0];
} }
else{ else{
@ -313,6 +313,11 @@ character.sp={
maxHandcard:function(player,num){ maxHandcard:function(player,num){
if(player.get('e','3')||player.get('e','4')) return; if(player.get('e','3')||player.get('e','4')) return;
return num+1; return num+1;
},
targetInRange:function(card,player,target,now){
if(player.get('e','5')) return;
var type=get.type(card);
if(type=='trick'||type=='delay') return true;
} }
} }
}, },

View File

@ -3537,8 +3537,14 @@
} }
} }
} }
var connect_avatar_list=[];
for(var i in lib.character){ for(var i in lib.character){
lib.mode.connect.config.connect_avatar.item[i]=lib.translate[i]; connect_avatar_list.push(i);
}
connect_avatar_list.sort(lib.sort.capt);
for(var i=0;i<connect_avatar_list.length;i++){
var ia=connect_avatar_list[i];
lib.mode.connect.config.connect_avatar.item[ia]=lib.translate[ia];
} }
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++){
@ -6085,9 +6091,6 @@
event.cards=player.get('hej'); event.cards=player.get('hej');
event.playerCards=player.get('he'); event.playerCards=player.get('he');
if(event.cards.length){ if(event.cards.length){
for(var i=0;i<event.cards.length;i++){
event.cards[i].goto(ui.discardPile);
}
player.$throw(event.cards,1000); player.$throw(event.cards,1000);
game.log(player,'弃置了',event.cards); game.log(player,'弃置了',event.cards);
} }
@ -6104,7 +6107,7 @@
delete player.tempSkills[i]; delete player.tempSkills[i];
} }
var proc=function(player){ var proc=function(player,cards){
player.classList.add('dead'); player.classList.add('dead');
// player.classList.remove('linked'); // player.classList.remove('linked');
player.classList.remove('turnedover'); player.classList.remove('turnedover');
@ -6117,11 +6120,11 @@
player.next.previous=player.previous; player.next.previous=player.previous;
game.players.remove(player); game.players.remove(player);
game.dead.push(player); game.dead.push(player);
}
proc(player);
game.broadcast(proc,player);
var audiofunc=function(player){ for(var i=0;i<cards.length;i++){
cards[i].goto(ui.discardPile);
}
if(lib.config.background_speak){ if(lib.config.background_speak){
if(lib.character[player.name]&& if(lib.character[player.name]&&
lib.character[player.name][4].contains('die_audio')){ lib.character[player.name][4].contains('die_audio')){
@ -6132,8 +6135,9 @@
} }
} }
} }
audiofunc(player); proc(player,event.cards);
game.broadcast(audiofunc,player); game.broadcast(proc,player,event.cards);
if(!_status.connectMode&&player==game.me&&!_status.over&&!game.controlOver){ if(!_status.connectMode&&player==game.me&&!_status.over&&!game.controlOver){
ui.control.show(); ui.control.show();
if(get.config('revive')&&lib.mode[lib.config.mode].config.revive){ if(get.config('revive')&&lib.mode[lib.config.mode].config.revive){
@ -6559,11 +6563,12 @@
judges:this.get('j'), judges:this.get('j'),
position:parseInt(this.dataset.position), position:parseInt(this.dataset.position),
hujia:this.hujia, hujia:this.hujia,
className:this.className,
identityShown:this.identityShown, identityShown:this.identityShown,
identityNode:[this.node.identity.innerHTML,this.node.identity.dataset.color], identityNode:[this.node.identity.innerHTML,this.node.identity.dataset.color],
identity:this.identity, identity:this.identity,
transform:this.queueCount?'':this.style.transform dead:this.isDead(),
linked:this.isLinked(),
turnedover:this.isTurnedOver(),
} }
}, },
setNickname:function(str){ setNickname:function(str){
@ -9808,6 +9813,13 @@
player.$die(); player.$die();
},this); },this);
if(lib.config.die_flip){ if(lib.config.die_flip){
this.$dieflip();
}
if(lib.element.player.$dieAfter){
lib.element.player.$dieAfter.call(this);
}
},
$dieflip:function(){
var top0=ui.window.offsetHeight/2; var top0=ui.window.offsetHeight/2;
var left0=ui.window.offsetWidth/2; var left0=ui.window.offsetWidth/2;
var ratio=(left0-this.offsetLeft)/(top0-this.offsetTop); var ratio=(left0-this.offsetLeft)/(top0-this.offsetTop);
@ -9830,7 +9842,6 @@
this.style.transform=transform; this.style.transform=transform;
} }
this.queue(false); this.queue(false);
}
}, },
$phaseJudge:function(card){ $phaseJudge:function(card){
game.addVideo('phaseJudge',this,get.cardInfo(card)); game.addVideo('phaseJudge',this,get.cardInfo(card));
@ -10744,6 +10755,19 @@
number2:function(a,b){ number2:function(a,b){
return get.number(b)-get.number(a); return get.number(b)-get.number(a);
}, },
capt:function(a,b){
var aa=a,bb=b;
if(aa.indexOf('_')!=-1){
aa=aa.slice(aa.indexOf('_')+1);
}
if(bb.indexOf('_')!=-1){
bb=bb.slice(bb.indexOf('_')+1);
}
if(aa!=bb){
return aa>bb?1:-1;
}
return a>b?1:-1;
}
}, },
skill:{ skill:{
global:[], global:[],
@ -10886,7 +10910,7 @@
if(lib.config.tao_enemy&&event.dying.side!=player.side&&lib.config.mode!='identity'&&lib.config.mode!='guozhan'){ if(lib.config.tao_enemy&&event.dying.side!=player.side&&lib.config.mode!='identity'&&lib.config.mode!='guozhan'){
event._result={bool:false} event._result={bool:false}
} }
else if(player.isOnline()||player.hasSkillTag('save',true)||player.num('h','tao')||player.num('h','spell_zhiliaoshui')|| else if(player.isOnline()||(_status.connectMode&&player==game.me)||player.hasSkillTag('save',true)||player.num('h','tao')||player.num('h','spell_zhiliaoshui')||
(player==event.dying&&(player.num('h','jiu')||player.num('h','hufu')||player.num('h','tianxianjiu')))){ (player==event.dying&&(player.num('h','jiu')||player.num('h','hufu')||player.num('h','tianxianjiu')))){
player.chooseToUse({ player.chooseToUse({
filterCard:function(card,player){ filterCard:function(card,player){
@ -11177,6 +11201,10 @@
ui.iptext.delete(); ui.iptext.delete();
delete ui.iptext; delete ui.iptext;
} }
if(ui.ipbutton){
ui.ipbutton.delete();
delete ui.ipbutton;
}
var proceed=function(){ var proceed=function(){
game.loadModeAsync(config.mode,function(mode){ game.loadModeAsync(config.mode,function(mode){
for(var i in mode.ai){ for(var i in mode.ai){
@ -11196,6 +11224,9 @@
if(mode.game){ if(mode.game){
game.getIdentityList=lib.init.eval(mode.game.getIdentityList); game.getIdentityList=lib.init.eval(mode.game.getIdentityList);
game.updateState=lib.init.eval(mode.game.updateState); game.updateState=lib.init.eval(mode.game.updateState);
if(mode.element&&mode.element.player&&mode.element.player.$dieAfter){
lib.element.player.$dieAfter=mode.element.player.$dieAfter;
}
} }
_status.event={ _status.event={
finished:true, finished:true,
@ -11228,6 +11259,10 @@
ui.iptext.delete(); ui.iptext.delete();
delete ui.iptext; delete ui.iptext;
} }
if(ui.ipbutton){
ui.ipbutton.delete();
delete ui.ipbutton;
}
game.online=true; game.online=true;
game.ip=ip; game.ip=ip;
game.saveConfig('reconnect_info',[_status.ip,game.onlineID]); game.saveConfig('reconnect_info',[_status.ip,game.onlineID]);
@ -11254,6 +11289,9 @@
if(mode.game){ if(mode.game){
game.getIdentityList=lib.init.eval(mode.game.getIdentityList); game.getIdentityList=lib.init.eval(mode.game.getIdentityList);
game.updateState=lib.init.eval(mode.game.updateState); game.updateState=lib.init.eval(mode.game.updateState);
if(mode.element&&mode.element.player&&mode.element.player.$dieAfter){
lib.element.player.$dieAfter=mode.element.player.$dieAfter;
}
} }
state=get.parsedResult(state); state=get.parsedResult(state);
game.players=[]; game.players=[];
@ -11276,6 +11314,21 @@
player.identity=info.identity; player.identity=info.identity;
player.identityShown=info.identityShown; player.identityShown=info.identityShown;
player.setNickname(); player.setNickname();
if(info.dead){
player.classList.add('dead');
if(lib.config.die_flip){
player.$dieflip();
}
if(lib.element.player.$dieAfter){
lib.element.player.$dieAfter.call(player);
}
}
if(info.linked){
player.classList.add('linked');
}
if(info.turnedover){
player.classList.add('turnedover');
}
if(i==game.onlineID){ if(i==game.onlineID){
game.me=player; game.me=player;
@ -11337,6 +11390,9 @@
break; break;
} }
game.ws.close(); game.ws.close();
if(_status.connectDenied){
_status.connectDenied();
}
}, },
cancel:function(id){ cancel:function(id){
if(_status.event.id==id&&_status.event.isMine()&&_status.paused&&_status.imchoosing){ if(_status.event.id==id&&_status.event.isMine()&&_status.paused&&_status.imchoosing){
@ -21739,6 +21795,7 @@
avatar:function(){ avatar:function(){
if(!lib.config.change_skin) return; if(!lib.config.change_skin) return;
if(this.parentNode.classList.contains('unseen')) return; if(this.parentNode.classList.contains('unseen')) return;
if(!this.name) return;
var avatar=this; var avatar=this;
var player=this.parentNode; var player=this.parentNode;
if(!this._doubleClicking){ if(!this._doubleClicking){
@ -21776,6 +21833,7 @@
avatar2:function(){ avatar2:function(){
if(!lib.config.change_skin) return; if(!lib.config.change_skin) return;
if(this.parentNode.classList.contains('unseen2')) return; if(this.parentNode.classList.contains('unseen2')) return;
if(!this.name2) return;
var avatar=this; var avatar=this;
var player=this.parentNode; var player=this.parentNode;
if(!this._doubleClicking){ if(!this._doubleClicking){

View File

@ -1,9 +1,8 @@
window.noname_update={ window.noname_update={
version:'1.8.2.5', version:'1.8.2.5',
changeLog:[ changeLog:[
'联机音效', '修复重连后的显示问题',
'投降按钮', '改进重连效果',
'出牌进度条', '修复卡死问题',
'修复若干卡死问题',
] ]
} }

View File

@ -1,29 +1,9 @@
'use strict'; 'use strict';
mode.connect={ mode.connect={
start:function(){ start:function(){
'step 0' var createNode=function(){
if(lib.config.reconnect_info){ if(event.created) return;
var info=lib.config.reconnect_info; event.created=true;
game.saveConfig('reconnect_info');
game.onlineID=info[1];
var n=5;
var connect=function(){
game.connect(info[0],function(success){
if(!success&&n--){
event.timeout=setTimeout(connect,1000);
}
});
};
event.timeout=setTimeout(connect,500);
}
'step 2'
for(var i in lib.element.event){
event.parent[i]=lib.element.event[i];
}
event.parent.custom={
add:{},
replace:{}
};
var node=ui.create.div('.shadowed'); var node=ui.create.div('.shadowed');
node.style.width='400px'; node.style.width='400px';
node.style.height='30px'; node.style.height='30px';
@ -38,12 +18,16 @@ mode.connect={
node.contentEditable=true; node.contentEditable=true;
node.style.webkitUserSelect='text'; node.style.webkitUserSelect='text';
node.style.textAlign='center'; node.style.textAlign='center';
node.addEventListener('keydown',function(e){
if(e.keyCode==13){ var connect=function(e){
clearTimeout(event.timeout); clearTimeout(event.timeout);
e.preventDefault(); e.preventDefault();
game.saveConfig('last_ip',node.innerHTML); game.saveConfig('last_ip',node.innerHTML);
game.connect(node.innerHTML); game.connect(node.innerHTML);
};
node.addEventListener('keydown',function(e){
if(e.keyCode==13){
connect(e);
} }
}); });
ui.window.appendChild(node); ui.window.appendChild(node);
@ -62,6 +46,38 @@ mode.connect={
text.style.textAlign='center'; text.style.textAlign='center';
ui.window.appendChild(text); ui.window.appendChild(text);
ui.iptext=text; ui.iptext=text;
// game.connect('localhost');
var button=ui.create.div('.menubutton.highlight.large','连接',connect);
button.style.width='70px';
button.style.left='calc(50% - 35px)';
button.style.top='calc(50% + 60px)';
ui.window.appendChild(button);
ui.ipbutton=button;
}
if(lib.config.reconnect_info){
var info=lib.config.reconnect_info;
game.onlineID=info[1];
var n=5;
var connect=function(){
game.connect(info[0],function(success){
if(!success&&n--){
createNode();
event.timeout=setTimeout(connect,1000);
}
});
};
event.timeout=setTimeout(connect,500);
}
else{
createNode();
}
_status.connectDenied=createNode;
for(var i in lib.element.event){
event.parent[i]=lib.element.event[i];
}
event.parent.custom={
add:{},
replace:{}
};
} }
}; };

View File

@ -175,6 +175,7 @@ mode.identity={
} }
var map=[]; var map=[];
for(var i=0;i<lib.node.clients.length;i++){ for(var i=0;i<lib.node.clients.length;i++){
if(!list.length) break;
var current=list.randomRemove(); var current=list.randomRemove();
current.ws=lib.node.clients[i]; current.ws=lib.node.clients[i];
current.playerid=current.ws.id; current.playerid=current.ws.id;
@ -1093,6 +1094,29 @@ mode.identity={
}, },
element:{ element:{
player:{ player:{
$dieAfter:function(){
if(!this.node.dieidentity){
var node=ui.create.div('.damage.dieidentity',get.translation(this.identity+'2'),this);
ui.refresh(node);
node.style.opacity=1;
this.node.dieidentity=node;
}
var trans=this.style.transform;
if(trans){
if(trans.indexOf('rotateY')!=-1){
this.node.dieidentity.style.transform='rotateY(180deg)';
}
else if(trans.indexOf('rotateX')!=-1){
this.node.dieidentity.style.transform='rotateX(180deg)';
}
else{
this.node.dieidentity.style.transform='';
}
}
else{
this.node.dieidentity.style.transform='';
}
},
dieSpeak:function(){ dieSpeak:function(){
// switch(this.identity){ // switch(this.identity){
// case 'zhu': this.popup('吾降矣',2000);break; // case 'zhu': this.popup('吾降矣',2000);break;
@ -1139,31 +1163,6 @@ mode.identity={
delete _status.clickingidentity; delete _status.clickingidentity;
} }
} }
var setIdentity=function(player){
if(!player.node.dieidentity){
var node=ui.create.div('.damage.dieidentity',get.translation(player.identity+'2'),player);
ui.refresh(node);
node.style.opacity=1;
player.node.dieidentity=node;
}
var trans=player.style.transform;
if(trans){
if(trans.indexOf('rotateY')!=-1){
player.node.dieidentity.style.transform='rotateY(180deg)';
}
else if(trans.indexOf('rotateX')!=-1){
player.node.dieidentity.style.transform='rotateX(180deg)';
}
else{
player.node.dieidentity.style.transform='';
}
}
else{
player.node.dieidentity.style.transform='';
}
}
setIdentity(this);
game.broadcast(setIdentity,this);
if(!_status.over){ if(!_status.over){
var giveup; var giveup;