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++;
if(!event.isMine()) game.delay();
player.logSkill('qizh',result.targets);
player.discardPlayerCard(result.targets[0],true);
player.discardPlayerCard(result.targets[0],true,'he');
event.target=result.targets[0];
}
else{
@ -313,6 +313,11 @@ character.sp={
maxHandcard:function(player,num){
if(player.get('e','3')||player.get('e','4')) return;
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){
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){
for(var i=0;i<lib.cardPack.mode_derivation.length;i++){
@ -6085,9 +6091,6 @@
event.cards=player.get('hej');
event.playerCards=player.get('he');
if(event.cards.length){
for(var i=0;i<event.cards.length;i++){
event.cards[i].goto(ui.discardPile);
}
player.$throw(event.cards,1000);
game.log(player,'弃置了',event.cards);
}
@ -6104,7 +6107,7 @@
delete player.tempSkills[i];
}
var proc=function(player){
var proc=function(player,cards){
player.classList.add('dead');
// player.classList.remove('linked');
player.classList.remove('turnedover');
@ -6117,11 +6120,11 @@
player.next.previous=player.previous;
game.players.remove(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.character[player.name]&&
lib.character[player.name][4].contains('die_audio')){
@ -6132,8 +6135,9 @@
}
}
}
audiofunc(player);
game.broadcast(audiofunc,player);
proc(player,event.cards);
game.broadcast(proc,player,event.cards);
if(!_status.connectMode&&player==game.me&&!_status.over&&!game.controlOver){
ui.control.show();
if(get.config('revive')&&lib.mode[lib.config.mode].config.revive){
@ -6559,11 +6563,12 @@
judges:this.get('j'),
position:parseInt(this.dataset.position),
hujia:this.hujia,
className:this.className,
identityShown:this.identityShown,
identityNode:[this.node.identity.innerHTML,this.node.identity.dataset.color],
identity:this.identity,
transform:this.queueCount?'':this.style.transform
dead:this.isDead(),
linked:this.isLinked(),
turnedover:this.isTurnedOver(),
}
},
setNickname:function(str){
@ -9808,30 +9813,36 @@
player.$die();
},this);
if(lib.config.die_flip){
var top0=ui.window.offsetHeight/2;
var left0=ui.window.offsetWidth/2;
var ratio=(left0-this.offsetLeft)/(top0-this.offsetTop);
var left=Math.abs(50*ratio/Math.sqrt(1+ratio*ratio));
var top=Math.abs(50/Math.sqrt(1+ratio*ratio));
if(left0-this.offsetLeft>0) left=-left;
if(top0-this.offsetTop>0) top=-top;
if(lib.isMobileMe(this)){
left=-Math.random()*5-10;
top=Math.random()*5+10;
}
var transform='translate('+left+'px,'+top+'px) '+
'rotate('+(Math.random()*20-10)+'deg) '+
((Math.random()-0.5<0)?'rotateX(180deg)':'rotateY(180deg)');
if(lib.isMobileMe(this)){
this.node.avatar.style.transform=transform;
this.node.avatar2.style.transform=transform;
}
else{
this.style.transform=transform;
}
this.queue(false);
this.$dieflip();
}
if(lib.element.player.$dieAfter){
lib.element.player.$dieAfter.call(this);
}
},
$dieflip:function(){
var top0=ui.window.offsetHeight/2;
var left0=ui.window.offsetWidth/2;
var ratio=(left0-this.offsetLeft)/(top0-this.offsetTop);
var left=Math.abs(50*ratio/Math.sqrt(1+ratio*ratio));
var top=Math.abs(50/Math.sqrt(1+ratio*ratio));
if(left0-this.offsetLeft>0) left=-left;
if(top0-this.offsetTop>0) top=-top;
if(lib.isMobileMe(this)){
left=-Math.random()*5-10;
top=Math.random()*5+10;
}
var transform='translate('+left+'px,'+top+'px) '+
'rotate('+(Math.random()*20-10)+'deg) '+
((Math.random()-0.5<0)?'rotateX(180deg)':'rotateY(180deg)');
if(lib.isMobileMe(this)){
this.node.avatar.style.transform=transform;
this.node.avatar2.style.transform=transform;
}
else{
this.style.transform=transform;
}
this.queue(false);
},
$phaseJudge:function(card){
game.addVideo('phaseJudge',this,get.cardInfo(card));
var player=this;
@ -10744,6 +10755,19 @@
number2:function(a,b){
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:{
global:[],
@ -10886,7 +10910,7 @@
if(lib.config.tao_enemy&&event.dying.side!=player.side&&lib.config.mode!='identity'&&lib.config.mode!='guozhan'){
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.chooseToUse({
filterCard:function(card,player){
@ -11177,6 +11201,10 @@
ui.iptext.delete();
delete ui.iptext;
}
if(ui.ipbutton){
ui.ipbutton.delete();
delete ui.ipbutton;
}
var proceed=function(){
game.loadModeAsync(config.mode,function(mode){
for(var i in mode.ai){
@ -11196,6 +11224,9 @@
if(mode.game){
game.getIdentityList=lib.init.eval(mode.game.getIdentityList);
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={
finished:true,
@ -11228,6 +11259,10 @@
ui.iptext.delete();
delete ui.iptext;
}
if(ui.ipbutton){
ui.ipbutton.delete();
delete ui.ipbutton;
}
game.online=true;
game.ip=ip;
game.saveConfig('reconnect_info',[_status.ip,game.onlineID]);
@ -11254,6 +11289,9 @@
if(mode.game){
game.getIdentityList=lib.init.eval(mode.game.getIdentityList);
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);
game.players=[];
@ -11276,6 +11314,21 @@
player.identity=info.identity;
player.identityShown=info.identityShown;
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){
game.me=player;
@ -11337,6 +11390,9 @@
break;
}
game.ws.close();
if(_status.connectDenied){
_status.connectDenied();
}
},
cancel:function(id){
if(_status.event.id==id&&_status.event.isMine()&&_status.paused&&_status.imchoosing){
@ -21739,6 +21795,7 @@
avatar:function(){
if(!lib.config.change_skin) return;
if(this.parentNode.classList.contains('unseen')) return;
if(!this.name) return;
var avatar=this;
var player=this.parentNode;
if(!this._doubleClicking){
@ -21776,6 +21833,7 @@
avatar2:function(){
if(!lib.config.change_skin) return;
if(this.parentNode.classList.contains('unseen2')) return;
if(!this.name2) return;
var avatar=this;
var player=this.parentNode;
if(!this._doubleClicking){

View File

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

View File

@ -1,22 +1,77 @@
'use strict';
mode.connect={
start:function(){
'step 0'
var createNode=function(){
if(event.created) return;
event.created=true;
var node=ui.create.div('.shadowed');
node.style.width='400px';
node.style.height='30px';
node.style.lineHeight='30px';
node.style.fontFamily='xinwei';
node.style.fontSize='30px';
node.style.padding='10px';
node.style.left='calc(50% - 200px)';
node.style.top='calc(50% - 20px)';
node.style.whiteSpace='nowrap';
node.innerHTML=lib.config.last_ip||'';
node.contentEditable=true;
node.style.webkitUserSelect='text';
node.style.textAlign='center';
var connect=function(e){
clearTimeout(event.timeout);
e.preventDefault();
game.saveConfig('last_ip',node.innerHTML);
game.connect(node.innerHTML);
};
node.addEventListener('keydown',function(e){
if(e.keyCode==13){
connect(e);
}
});
ui.window.appendChild(node);
ui.ipnode=node;
var text=ui.create.div();
text.style.width='400px';
text.style.height='30px';
text.style.lineHeight='30px';
text.style.fontFamily='xinwei';
text.style.fontSize='30px';
text.style.padding='10px';
text.style.left='calc(50% - 200px)';
text.style.top='calc(50% - 80px)';
text.innerHTML='输入联机地址';
text.style.textAlign='center';
ui.window.appendChild(text);
ui.iptext=text;
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.saveConfig('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);
}
'step 2'
else{
createNode();
}
_status.connectDenied=createNode;
for(var i in lib.element.event){
event.parent[i]=lib.element.event[i];
}
@ -24,44 +79,5 @@ mode.connect={
add:{},
replace:{}
};
var node=ui.create.div('.shadowed');
node.style.width='400px';
node.style.height='30px';
node.style.lineHeight='30px';
node.style.fontFamily='xinwei';
node.style.fontSize='30px';
node.style.padding='10px';
node.style.left='calc(50% - 200px)';
node.style.top='calc(50% - 20px)';
node.style.whiteSpace='nowrap';
node.innerHTML=lib.config.last_ip||'';
node.contentEditable=true;
node.style.webkitUserSelect='text';
node.style.textAlign='center';
node.addEventListener('keydown',function(e){
if(e.keyCode==13){
clearTimeout(event.timeout);
e.preventDefault();
game.saveConfig('last_ip',node.innerHTML);
game.connect(node.innerHTML);
}
});
ui.window.appendChild(node);
ui.ipnode=node;
var text=ui.create.div();
text.style.width='400px';
text.style.height='30px';
text.style.lineHeight='30px';
text.style.fontFamily='xinwei';
text.style.fontSize='30px';
text.style.padding='10px';
text.style.left='calc(50% - 200px)';
text.style.top='calc(50% - 80px)';
text.innerHTML='输入联机地址';
text.style.textAlign='center';
ui.window.appendChild(text);
ui.iptext=text;
// game.connect('localhost');
}
};

View File

@ -175,6 +175,7 @@ mode.identity={
}
var map=[];
for(var i=0;i<lib.node.clients.length;i++){
if(!list.length) break;
var current=list.randomRemove();
current.ws=lib.node.clients[i];
current.playerid=current.ws.id;
@ -1093,6 +1094,29 @@ mode.identity={
},
element:{
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(){
// switch(this.identity){
// case 'zhu': this.popup('吾降矣',2000);break;
@ -1139,31 +1163,6 @@ mode.identity={
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){
var giveup;