From 968d8b0ee0a09273569588c4c391c8382a722ee0 Mon Sep 17 00:00:00 2001 From: libccy Date: Mon, 4 Apr 2016 19:20:05 +0800 Subject: [PATCH] ob --- card/ex.js | 7 +- card/extra.js | 54 ++++++----- card/refresh.js | 48 ++++++---- card/standard.js | 24 ++--- character/refresh.js | 3 +- character/sp.js | 2 +- character/standard.js | 1 + character/yijiang.js | 16 ++-- game/game.js | 205 +++++++++++++++++++++++++++--------------- game/update.js | 5 +- mode/identity.js | 8 +- 11 files changed, 232 insertions(+), 141 deletions(-) diff --git a/card/ex.js b/card/ex.js index b00dd72fe..64dadeb50 100755 --- a/card/ex.js +++ b/card/ex.js @@ -36,6 +36,8 @@ card.ex={ content:function(){ "step 0" player.choosePlayerCard('是否发动【寒冰剑】?','he',trigger.target,Math.min(2,trigger.target.num('he')),function(button){ + var trigger=_status.event.getParent()._trigger; + var player=_status.event.player; var eff=ai.get.damageEffect(trigger.target,player,player); if(ai.get.attitude(player,trigger.target)>0){ if(eff>=0) return false; @@ -43,7 +45,8 @@ card.ex={ } if(eff<=0) return ai.get.buttonValue(button); if(trigger.target.hp==1) return false; - if(player.skills.contains('jiu')||player.skills.contains('tianxianjiu')) return false; + if(player.skills.contains('jiu')||player.skills.contains('tianxianjiu')|| + player.skills.contains('luoyi2')||player.skills.contains('reluoyi2')) return false; if(_status.event.dialog.buttons.length<2) return -1; var num=0; for(var i=0;i<_status.event.dialog.buttons.length;i++){ @@ -55,7 +58,7 @@ card.ex={ if(result.bool){ trigger.untrigger(); var cards=[]; - for(var i=0;i=player.actcount) return false; } @@ -116,16 +120,17 @@ card.extra={ return ai.get.value(card); }; "step 1" - event.dialog=ui.create.dialog(get.translation(target.name)+'展示的手牌',result.cards); + event.dialog=ui.create.dialog(get.translation(target)+'展示的手牌',result.cards); event.videoId=lib.status.videoId++; - game.addVideo('cardDialog',null,[get.translation(target.name)+'展示的手牌',get.cardsInfo(result.cards),event.videoId]); + + game.broadcast('createDialog',event.videoId,get.translation(target)+'展示的手牌',result.cards); + game.addVideo('cardDialog',null,[get.translation(target)+'展示的手牌',get.cardsInfo(result.cards),event.videoId]); event.card2=result.cards[0]; game.log(target,'展示了',event.card2); - player.chooseToDiscard(function(card){ - return get.suit(card)==get.suit(_status.event.parent.card2); - },function(card){ - if(ai.get.damageEffect(target,player,player,'fire')>0){ - return 7-ai.get.value(card,_status.event.player); + player.chooseToDiscard({suit:get.suit(event.card2)},function(card){ + var evt=_status.event.getParent(); + if(ai.get.damageEffect(evt.target,evt.player,evt.player,'fire')>0){ + return 7-ai.get.value(card,evt.player); } return -1; }).prompt=false; @@ -137,8 +142,9 @@ card.extra={ else{ target.addTempSkill('huogong2','phaseBegin'); } - game.addVideo('cardDialog',null,event.videoId); event.dialog.close(); + game.addVideo('cardDialog',null,event.videoId); + game.broadcast('closeDialog',event.videoId); }, ai:{ basic:{ @@ -367,13 +373,15 @@ card.extra={ popup:false, audio:false, content:function(){ - player.removeSkill('jiu'); - if(player.node.jiu){ - player.node.jiu.delete(); - player.node.jiu2.delete(); - delete player.node.jiu; - delete player.node.jiu2; - } + game.broadcastAll(function(player){ + player.removeSkill('jiu'); + if(player.node.jiu){ + player.node.jiu.delete(); + player.node.jiu2.delete(); + delete player.node.jiu; + delete player.node.jiu2; + } + },player); }, }, guding_skill:{ diff --git a/card/refresh.js b/card/refresh.js index f6b7a3804..919c43425 100755 --- a/card/refresh.js +++ b/card/refresh.js @@ -33,6 +33,22 @@ card.refresh={ }, discard:false, lose:true, + sync:function(muniu){ + if(game.online){ + return; + } + if(!muniu.cards){ + muniu.cards=[]; + } + for(var i=0;i0; }, @@ -54,6 +70,9 @@ card.refresh={ } if(muniu.cards==undefined) muniu.cards=[]; muniu.cards.push(cards[0]); + game.broadcast(function(muniu,cards){ + muniu.cards=cards; + },muniu,muniu.cards); var players=[]; for(var i=0;i1||cards[0].name!=card.name)){ game.log(player,'打出了',card,'(',cards,')'); @@ -6169,7 +6171,7 @@ delete player.tempSkills[i]; } - var proc=function(player,cards){ + game.broadcastAll(function(player,cards){ player.classList.add('dead'); // player.classList.remove('linked'); player.classList.remove('turnedover'); @@ -6196,9 +6198,7 @@ game.playAudio('die',player.name.slice(player.name.indexOf('_')+1)); } } - } - proc(player,event.cards); - game.broadcast(proc,player,event.cards); + },player,event.cards); if(!_status.connectMode&&player==game.me&&!_status.over&&!game.controlOver){ ui.control.show(); @@ -6337,7 +6337,7 @@ player.judging.unshift(get.cards()[0]); game.addVideo('judge1',player,[get.cardInfo(player.judging[0]),judgestr,event.videoId]); - var create=function(player,card,str,id){ + game.broadcastAll(function(player,card,str,id){ var event; if(game.online){ event={}; @@ -6356,9 +6356,7 @@ event.dialog=ui.create.dialog(str); event.dialog.classList.add('center'); event.dialog.videoId=id; - } - create(player,player.judging[0],judgestr,event.videoId); - game.broadcast(create,player,player.judging[0],judgestr,event.videoId); + },player,player.judging[0],judgestr,event.videoId); game.log(player,'进行'+event.judgestr+'判定,亮出的判定牌为',player.judging[0]); game.delay(2); @@ -6382,8 +6380,7 @@ player.popup('杯具'); } if(event.clearArena!=false){ - ui.clear(); - game.broadcast(ui.clear); + game.broadcastAll(ui.clear); } game.broadcast(function(id){ var dialog=get.idDialog(id); @@ -6651,13 +6648,13 @@ if(refnode){ lib.placePoppedDialog(dialog,{ clientX:ui.arena.offsetLeft+this.offsetLeft+refnode.offsetLeft+refnode.offsetWidth/2, - clientY:ui.arena.offsetTop+this.offsetTop+refnode.offsetTop+refnode.offsetHeight*3/4 + clientY:ui.arena.offsetTop+this.offsetTop+refnode.offsetTop+refnode.offsetHeight/4 }); } else{ lib.placePoppedDialog(dialog,{ clientX:this.offsetLeft+this.offsetWidth/2, - clientY:this.offsetTop+this.offsetHeight*3/4 + clientY:this.offsetTop+this.offsetHeight/4 }); } if(dialog._mod_height){ @@ -6666,7 +6663,16 @@ setTimeout(function(){ dialog.delete(); },2000); - lib.chatHistory.push([this,str]); + var info=[get.translation(this.name)||this.nickname,str]; + lib.chatHistory.push(info); + if(_status.addChatEntry){ + if(_status.addChatEntry._origin.parentNode){ + _status.addChatEntry(info); + } + else{ + delete _status.addChatEntry; + } + } }, getState:function(){ return { @@ -10643,6 +10649,11 @@ }, close:function(){ lib.node.clients.remove(this); + lib.node.observing.remove(this); + if(ui.removeObserve&&!lib.node.observing.length){ + ui.removeObserve.remove(); + delete ui.removeObserve; + } this.closed=true; if(_status.waitingForPlayer){ for(var i=0;i=parseInt(lib.configOL.number)){ this.send('denied','number'); + lib.node.clients.remove(this); + this.closed=true; } else{ if(config){ @@ -11267,6 +11300,27 @@ player.unwait(result); } }, + chat:function(id,str){ + var player; + if(lib.playerOL[id]){ + player=lib.playerOL[id]; + } + else if(game.connectPlayers){ + for(var i=0;i