diff --git a/card/standard.js b/card/standard.js index e04bcd1a0..253df5294 100755 --- a/card/standard.js +++ b/card/standard.js @@ -1420,19 +1420,27 @@ card.standard={ state:state, ai1:function(){ if(isJudge){ - var info=lib.card[card.viewAs||card.name]; + var name=card.viewAs||card.name; + var info=lib.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(name!='lebu'&&name!='bingliang'){ if(source!=_status.event.player){ return 0; } } - var eff=ai.get.effect(source,card,source,source); + var card2; + if(name!=card.name){ + card2={name:name}; + } + else{ + card2=card; + } + var eff=ai.get.effect(source,card2,source,source); if(eff>=0) return 0; return state*ai.get.attitude(_status.event.player,source); } diff --git a/character/sp.js b/character/sp.js index 4c5625086..d78690f75 100755 --- a/character/sp.js +++ b/character/sp.js @@ -1727,7 +1727,7 @@ character.sp={ trigger:{global:'phaseEnd'}, direct:true, filter:function(event,player){ - return player.storage.tunchu&&player.storage.tunchu.length>0&&event.player.num('h')==0; + return player.storage.tunchu&&player.storage.tunchu.length>0&&event.player.num('h')==0&&event.player.isAlive(); }, content:function(){ 'step 0' diff --git a/game/game.js b/game/game.js index 1be0fe9a5..a5661e537 100755 --- a/game/game.js +++ b/game/game.js @@ -3875,7 +3875,7 @@ connection:function(ws){ var client={ ws:ws, - id:get.id(), + id:ws.wsid||get.id(), closed:false }; lib.node.clients.push(client); @@ -6967,6 +6967,46 @@ this.node.name.innerHTML=''; delete this.nickname; delete this.avatar; + }, + initRoom:function(info,info2){ + if(!info){ + this.initOL('空房间',info2); + this.node.hp.innerHTML=''; + if(this.node.gaming){ + this.node.gaming.hide(); + } + } + else{ + var config=info[2]; + this.initOL(get.cnNumber(parseInt(config.number))+'人'+get.translation(config.mode),info[1]); + if(!this.node.gaming){ + this.node.gaming=ui.create.div('.gaming','游戏中',this); + this.node.gaming.dataset.nature='fire'; + } + if(config.gameStarted){ + this.node.gaming.show(); + } + else{ + this.node.gaming.hide(); + } + this.setNickname(info[0]); + this.maxHp=parseInt(config.number); + this.hp=info[3]; + this.update(); + if(this.hp==this.maxHp){ + this.roomfull=true; + } + else{ + this.roomfull=false; + } + if(config.gameStarted&&!config.observe){ + this.roomgaming=true; + } + else{ + this.roomgaming=false; + } + } + return this; }, uninit:function(){ this.node.avatar.hide(); @@ -7163,7 +7203,10 @@ hp.classList.remove('long'); } } - if(this.hp==0){ + if(hp.classList.contains('room')){ + hp.dataset.condition='high'; + } + else if(this.hp==0){ hp.dataset.condition=''; } else if(this.hp>Math.round(this.maxHp/2)||this.hp===this.maxHp){ @@ -11087,6 +11130,17 @@ return this; } }, + nodews:{ + send:function(message){ + game.send('server','send',this.wsid,message); + }, + on:function(type,func){ + this['on'+type]=func; + }, + close:function(){ + game.send('server','close',this.wsid); + } + }, ws:{ onopen:function(){ if(_status.connectCallback){ @@ -11129,7 +11183,7 @@ _status.connectCallback(false); delete _status.connectCallback; } - if(game.online){ + if(game.online||game.onlineroom){ localStorage.setItem(lib.configprefix+'directstart',true); game.reload(); } @@ -11479,11 +11533,12 @@ 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){ + filterCard:function(card,player,event){ + event=event||_status.event; var mod=game.checkMod(card,player,'unchanged','cardSavable',player.get('s')); if(mod!='unchanged') return mod; var savable=get.info(card).savable; - if(typeof savable=='function') savable=savable(card,player,_status.event.dying); + if(typeof savable=='function') savable=savable(card,player,event.dying); return savable; }, filterTarget:trigger.player, @@ -11684,6 +11739,9 @@ if(!ui.removeObserve){ ui.removeObserve=ui.create.system('移除旁观',function(){ lib.configOL.observe=false; + if(game.onlineroom){ + game.send('server','config',lib.configOL); + } while(lib.node.observing.length){ lib.node.observing.shift().ws.close(); } @@ -11792,12 +11850,30 @@ nickname:lib.config.connect_nickname },lib.config.banned_info); }, + onconnection:function(id){ + var ws={wsid:id}; + for(var i in lib.element.nodews){ + ws[i]=lib.element.nodews[i]; + } + lib.wsOL[id]=ws; + lib.init.connection(ws); + }, + onmessage:function(id,message){ + if(lib.wsOL[id]){ + lib.wsOL[id].onmessage(message); + } + }, + onclose:function(id){ + if(lib.wsOL[id]){ + lib.wsOL[id].onclose(); + } + }, createroom:function(){ game.online=false; game.onlineroom=true; lib.node={}; for(var i=0;idiv:not(.avatar):not(.name):not(.nameol){ +.player.connect>div:not(.avatar):not(.name):not(.nameol):not(.hp.room):not(.gaming){ display: none !important; } +.player.connect>.gaming{ + left:16px; + top:auto; + bottom: 16px; + font-family: 'xinwei' +} #arena #me>div>div>.card{ position: absolute; diff --git a/layout/newlayout/global.css b/layout/newlayout/global.css index dafa4bc2c..40b8318cb 100644 --- a/layout/newlayout/global.css +++ b/layout/newlayout/global.css @@ -153,7 +153,8 @@ z-index:3; transform:rotate(180deg); } -#arena.slim_player .player .hp{ +#arena.slim_player .player .hp, +#window>.player .hp{ bottom: 15px; left:121px; } diff --git a/mode/identity.js b/mode/identity.js index 0e31d9348..0e6b2cd00 100755 --- a/mode/identity.js +++ b/mode/identity.js @@ -979,14 +979,7 @@ mode.identity={ } } for(i in libCharacter){ - if(libCharacter[i][4]&&libCharacter[i][4].contains('forbidai')) continue; - if(lib.config.forbidai.contains(i)) continue; - // if(lib.config.forbidall.contains(i)) continue; - if(lib.config.banned.contains(i)) continue; - if(!get.config('double_character')&&get.config('ban_weak')&& - (lib.config.forbidsingle.contains(i)||lib.rank.c.contains(i)||lib.rank.d.contains(i))) continue; - if(get.config('ban_strong')&&(lib.rank.s.contains(i)||lib.rank.ap.contains(i))) continue; - if(get.config('double_character')&&lib.config.forbiddouble.contains(i)) continue; + if(lib.filter.characterDisabled(i)) continue; event.list.push(i); if(libCharacter[i][4]&&libCharacter[i][4].contains('zhu')){ list2.push(i); diff --git a/mode/stone.js b/mode/stone.js index 223dc600c..d075229ae 100755 --- a/mode/stone.js +++ b/mode/stone.js @@ -657,24 +657,22 @@ mode.stone={ } }, drawDeck:function(num,log){ - if(this.isMin()){ - this.draw(num,log); - return; - } if(!num){ num=1; } + var cards=this.getDeckCards(num); if(log==false){ - this.directgain(this.getDeckCards(num)); + this.directgain(cards); } else if(log==true){ - this.directgain(this.getDeckCards(num)); + this.directgain(cards); game.log(this,'从牌库中获得了'+get.cnNumber(num)+'张牌'); } else{ - this.gain(this.getDeckCards(num),'draw'); + this.gain(cards,'draw'); game.log(this,'从牌库中获得了'+get.cnNumber(num)+'张牌'); } + return cards; }, updateActCount:function(used,countx,current){ if(_status.video){ @@ -774,10 +772,13 @@ mode.stone={ return false; }, getDeckCards:function(num){ - var player=this; if(typeof num!='number'){ num=1; } + if(!this.deckCards){ + return get.cards(num); + } + var player=this; for(var i=0;i<5;i++){ if(player.deckCards.length