diff --git a/game/game.js b/game/game.js index 1204e1924..e21c0d205 100644 --- a/game/game.js +++ b/game/game.js @@ -302,6 +302,8 @@ window.play={}; qun:'群', male:'男', female:'女', + mad:'混乱', + mad_bg:'疯', draw_card:'摸牌', discard_card:'弃牌', reset_character:'重置武将牌', @@ -1508,96 +1510,41 @@ window.play={}; if(lib.config.reverse_sort) sort=-sort; cards[num].fix(); cards[num].animate('start'); - if(lib.config.strict_sort){ - j=0; - if(game.singleHandcard){ - position=sort>0?player.node.handcards1:player.node.handcards2; - } - else{ - position=player.node.handcards1; - } - for(j=0;jlib.config.sort_card(position.childNodes[j])) break; - } - } - if(event.animate=='draw'){ - player.$draw(); - (function(card,position){ - setTimeout(function(){ - position.insertBefore(card,position.childNodes[j]); - },500); - }(cards[num],position)) - } - else if(event.animate=='draw2'){ - player.$draw(cards[num]); - (function(card,position){ - setTimeout(function(){ - position.insertBefore(card,position.childNodes[j]); - },500); - }(cards[num],position)) - } - else if(event.animate=='gain'){ - player.$gain(cards[num]); - (function(card,position){ - setTimeout(function(){ - position.insertBefore(card,position.childNodes[j]); - },700); - }(cards[num],position)) - } - else if(event.animate=='gain2'){ - player.$gain2(cards[num]); - (function(card,position){ - setTimeout(function(){ - position.insertBefore(card,position.childNodes[j]); - },500); - }(cards[num],position)) - } - else{ - position.insertBefore(cards[num],position.childNodes[j]); - } - } - else{ - if(game.singleHandcard||sort>0) frag1.appendChild(cards[num]); - else frag2.appendChild(cards[num]); - } + + if(game.singleHandcard||sort>0) frag1.appendChild(cards[num]); + else frag2.appendChild(cards[num]); } - if(!lib.config.strict_sort){ - if(event.animate=='draw'){ - player.$draw(cards.length); - game.delay(1,500); - setTimeout(function(){ - player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild); - player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild); - player.update(); - },500); - } - else if(event.animate=='gain'){ - player.$gain(cards); - game.delay(1,700); - setTimeout(function(){ - player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild); - player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild); - player.update(); - },700); - } - else if(event.animate=='gain2'||event.animate=='draw2'){ - player.$gain2(cards); - game.delay(1,500); - setTimeout(function(){ - player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild); - player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild); - player.update(); - },500); - } - else{ + if(event.animate=='draw'){ + player.$draw(cards.length); + game.delay(1,500); + setTimeout(function(){ player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild); player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild); player.update(); - } + },500); + } + else if(event.animate=='gain'){ + player.$gain(cards); + game.delay(1,700); + setTimeout(function(){ + player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild); + player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild); + player.update(); + },700); + } + else if(event.animate=='gain2'||event.animate=='draw2'){ + player.$gain2(cards); + game.delay(1,500); + setTimeout(function(){ + player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild); + player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild); + player.update(); + },500); + } + else{ + player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild); + player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild); + player.update(); } }, lose:function(){ @@ -3160,6 +3107,19 @@ window.play={}; } next.content=lib.element.playerproto.respond; }, + directgain:function(cards){ + for(var i=0;i0){ + this.node.handcards1.appendChild(cards[i].animate('start')); + } + else{ + this.node.handcards2.appendChild(cards[i].animate('start')); + } + } + this.update(); + return this; + }, gain:function(){ var next=game.createEvent('gain'); next.player=this; @@ -3365,6 +3325,17 @@ window.play={}; } } }, + isMad:function(){ + return this.skills.contains('mad'); + }, + goMad:function(){ + this.addSkill('mad'); + game.log(get.translation(this)+'进入混乱状态'); + }, + unMad:function(){ + this.removeSkill('mad'); + game.log(get.translation(this)+'解除混乱状态'); + }, equip:function(card){ var next=game.createEvent('equip'); next.card=card; @@ -3826,15 +3797,12 @@ window.play={}; }, isUnderControl:function(){ if(this===game.me) return false; + if(this.isMad()) return false; if(lib.config.mode=='versus'){ return ui.autoreplace&&ui.autoreplace.classList.contains('on')&& this.side==game.me.side; } - else if(lib.config.mode=='chess'){ - return this.side==game.me.side; - } - else if(lib.config.mode=='boss'){ - if(this.gonemad) return false; + else if(lib.config.mode=='chess'||lib.config.mode=='boss'){ return this.side==game.me.side; } return false; @@ -4393,7 +4361,7 @@ window.play={}; delete this.skill; }, isMine:function(){ - return (this.player&&this.player==game.me&&!_status.auto); + return (this.player&&this.player==game.me&&!_status.auto&&!this.player.isMad()); }, trigger:function(name){ var event=this; @@ -4829,6 +4797,13 @@ window.play={}; global:[], storage:{}, unequip:{}, + mad:{ + mark:true, + intro:{ + content:'已进入混乱状态', + name:'混乱' + } + }, _recoverCheck:{ trigger:{player:'recoverBefore'}, forced:true, @@ -4972,11 +4947,20 @@ window.play={}; } } }, + _ismin:{ + mod:{ + cardEnabled:function(card,player){ + if(player.isMin()){ + if(get.type(card)=='equip') return false; + } + } + } + }, _chongzhu:{ enable:'phaseUse', prompt:'弃置要重铸的牌并摸一张牌', filter:function(event,player){ - if(player.isMin()) return false; + if(player.isMin()&&lib.config.mode=='stone') return false; return (player.get('h',function(card){ return get.info(card).chongzhu; }).length); @@ -6008,7 +5992,7 @@ window.play={}; "step 0" var end=player; do{ - player.draw(num,false).log=false; + player.directgain(get.cards(4)); if(player.singleHp===true&&!player.classList.contains('unseen')&&!player.classList.contains('unseen2')){ player.doubleDraw(); } @@ -7858,8 +7842,14 @@ window.play={}; intro:ui.create.div('.intro',node), group:ui.create.div('.identity',node) } - for(var i =0;i14){ + node.node.hp.innerHTML=lib.character[item][2]; + node.node.hp.classList.add('text'); + } + else{ + for(var i =0;i.name{left:5px;top:22px;} .button.character>.hp{left:5px;top:2px;} +.button.character>.hp.text{ + top:8px; + left:6px; + font-family:'huangcao'; + font-size:20px; + letter-spacing:3px; +} .button.character>.intro{top:71px;left:0;} .button.character>.identity{top:-6px;left:72px;} /*--------确认--------*/ diff --git a/layout/mode/chess.css b/layout/mode/chess.css index 9c9bda42f..3f681abb4 100644 --- a/layout/mode/chess.css +++ b/layout/mode/chess.css @@ -126,3 +126,6 @@ .chessscroll.right{ right:0; } +.button.forbidden{ + opacity:0.6 +} diff --git a/mode/boss.js b/mode/boss.js index b4c3a9f6f..d002ae735 100644 --- a/mode/boss.js +++ b/mode/boss.js @@ -10,25 +10,6 @@ mode.boss={ game.checkResult(); } }, - goMad:function(){ - this.mark('乱',{ - name:'混乱', - content:'已进入混乱状态' - }); - this.gonemad=true; - if(this==game.me){ - if(this.next.side==this.side){ - game.modeSwapPlayer(this.next); - } - else if(this.previous.side==this.side){ - game.modeSwapPlayer(this.previous); - } - else{ - this.die(); - } - } - game.log(get.translation(this)+'进入混乱状态'); - } } }, game:{ @@ -58,6 +39,8 @@ mode.boss={ "step 1" var bosslist=ui.create.div('#bosslist.hidden'); event.bosslist=bosslist; + bosslist.ontouchmove = ui.click.touchScroll; + bosslist.style.WebkitOverflowScrolling='touch'; if(!lib.config.touchscreen&&lib.config.mousewheel){ bosslist._scrollspeed=30; bosslist._scrollnum=10; @@ -408,22 +391,6 @@ mode.boss={ game.uncheck(); game.check(); }; - event.asboss=ui.create.control('应战',function(){ - event.boss=true; - event.enemy=[]; - for(var i=0;i=4&&!bosses.childNodes[i].classList.contains('glow')){ + bosses.childNodes[i].classList.add('forbidden'); + } + else{ + bosses.childNodes[i].classList.remove('forbidden'); + } + } + if(num){ + if(!event.asboss){ + event.asboss=ui.create.control('应战',function(){ + _status.boss=true; + ui.click.ok(); + }); + } + } + else{ + if(event.asboss){ + event.asboss.close(); + delete event.asboss; + } + } + addToButton(); + }; + for(var i=0;i=4) return true; + } + return false; + }, + filterCard:function(card){ + var suit=get.suit(card); + for(var i=0;i1) break; + } + } + if(num<=1) return; + if(_status.currentPhase==player&&player.num('h')=6){ + if(typeof card=='string') return; + if(card.name=='wuzhong') return; + if(card.name=='shunshou') return; + if(card.name=='yuanjiao') return; + if(card.name=='yiyi') return; + if(!player.skills.contains('cangming2')) return [0,0,0,0]; + } + } + }, + result:{ + target:-10 + } + }, + }, + cangming2:{ + trigger:{player:'phaseBegin'}, + forced:true, + popup:false, + content:function(){ + for(var i=0;i0; + }, content:function(){ "step 0" var move=player.skills.contains('noactpunish')?2:1; @@ -1173,8 +1398,7 @@ mode.chess={ ai:{ order:5, result:{ - player:function(player){ - var range=get.attackRange(player)>1; + playerx:function(player){ var nh=player.num('h'); if(!player.num('h','sha')&& !player.num('h','shunshou')&& @@ -1186,21 +1410,30 @@ mode.chess={ var neighbour; neighbour=player.getNeighbour(0,1); if(neighbour&&neighbour.side!=player.side){ - return range?1:0; + if(get.distance(player,neighbour,'attack')<1) return 1; + return 0; } neighbour=player.getNeighbour(0,-1); if(neighbour&&neighbour.side!=player.side){ - return range?1:0; + if(get.distance(player,neighbour,'attack')<1) return 1; + return 0; } neighbour=player.getNeighbour(1,0); if(neighbour&&neighbour.side!=player.side){ - return range?1:0; + if(get.distance(player,neighbour,'attack')<1) return 1; + return 0; } neighbour=player.getNeighbour(-1,0); if(neighbour&&neighbour.side!=player.side){ - return range?1:0; + if(get.distance(player,neighbour,'attack')<1) return 1; + return 0; } return 1; + }, + player:function(player){ + var x=lib.skill._chessmove.ai.result.playerx(player); + if(player.isMad()) return -x; + return x; } } } @@ -1230,6 +1463,129 @@ mode.chess={ player.chessFocus(); }, }, + boss_fengxing:{ + mod:{ + chessMove:function(player,current){ + return current+2; + }, + attackFrom:function(from,to,current){ + return current-2; + }, + }, + trigger:{player:'phaseDrawBegin'}, + forced:true, + content:function(){ + trigger.num+=2; + } + }, + boss_chiyu:{ + enable:'phaseUse', + usable:1, + filterCard:{color:'red'}, + nodelay:true, + check:function(card){return 8-ai.get.value(card);}, + filterTarget:function(card,player,target){ + return get.distance(player,target)<=5&&player!=target; + }, + filter:function(event,player){ + return player.num('h',{color:'red'})>0; + }, + selectTarget:-1, + content:function(){ + target.damage('fire'); + }, + line:'fire', + ai:{ + order:1, + result:{ + target:function(player,target){ + return ai.get.damageEffect(target,player,target,'fire'); + } + } + } + }, + boss_tenglong:{ + enable:'phaseUse', + usable:1, + position:'he', + filterCard:{type:'equip'}, + init:function(player){ + player.forcemin=true; + }, + check:function(card){ + var player=_status.currentPhase; + if(player.num('he',{subtype:get.subtype(card)})>1){ + return 12-ai.get.equipValue(card); + } + return 8-ai.get.equipValue(card); + }, + filter:function(event,player){ + return player.num('he',{type:'equip'}); + }, + filterTarget:function(card,player,target){ + return player!=target&&get.distance(player,target)<=2; + }, + content:function(){ + target.damage(3,'fire'); + }, + ai:{ + order:9, + result:{ + target:function(player,target){ + return ai.get.damageEffect(target,player,target,'fire'); + } + } + } + }, + boss_wuying:{ + mod:{ + globalTo:function(from,to,distance){ + return distance+2; + }, + chessMove:function(player,current){ + return current-1; + } + } + }, + boss_wushang:{ + trigger:{player:'phaseBegin'}, + forced:true, + filter:function(event,player){ + for(var i=0;i