From 4c52441407527924ba47c8ec6a83843ce55a0758 Mon Sep 17 00:00:00 2001 From: libccy Date: Mon, 4 May 2015 11:17:03 +0800 Subject: [PATCH] null --- card/standard.js | 3 +- character/diy.js | 3 + character/extra.js | 30 +++- character/fire.js | 3 + character/sp.js | 9 ++ character/swd.js | 3 + character/yijiang.js | 2 +- game/config.js | 6 +- game/game.js | 305 ++++++++++++++++-------------------- layout/default/layout.css | 6 +- layout/newlayout/layout.css | 24 --- mode/guozhan.js | 17 +- mode/identity.js | 22 +-- mode/stone.js | 230 +++++++++++++++++++++------ 14 files changed, 382 insertions(+), 281 deletions(-) diff --git a/card/standard.js b/card/standard.js index b3d29f3d3..a46b7349a 100644 --- a/card/standard.js +++ b/card/standard.js @@ -1191,7 +1191,8 @@ card.standard={ if(Math.abs(ai.get.attitude(_status.event.player,trigger.target))<3) return 0; return -ai.get.effect(trigger.target,trigger.card,trigger.player,_status.event.player)*state; }, - source:event.source + source:event.source, + source2:event.source2 }); "step 2" if(result.bool){ diff --git a/character/diy.js b/character/diy.js index b9bf81f88..d11d09536 100644 --- a/character/diy.js +++ b/character/diy.js @@ -237,6 +237,9 @@ character.diy={ // } }, ai:{ + skillTagFilter:function(player){ + if(player.storage.guihan) return false; + }, save:true, result:{ player:4, diff --git a/character/extra.js b/character/extra.js index c9e772fdf..78df25fe9 100644 --- a/character/extra.js +++ b/character/extra.js @@ -381,10 +381,17 @@ character.extra={ threaten:function(player,target){ if(target.hp==1) return 0.5; }, - result:{ + effect:{ target:function(card,player,target,current){ if(target.hp<=1&&get.tag(card,'damage')){ if(player.skills.contains('jueqing')) return [1,-5]; + var hasfriend=false; + for(var i=0;i=0){ + hasfriend=true;break; + } + } + if(!hasfriend) return; if(player.hp>2&&ai.get.attitude(player,target<=0)) return [0,2]; return [1,0,0,-player.hp]; } @@ -820,6 +827,22 @@ character.extra={ longhun:{ group:['longhun1','longhun2','longhun3','longhun4'], ai:{ + skillTagFilter:function(player,tag){ + switch(tag){ + case 'respondSha':{ + if(player.num('he',{suit:'diamond'})=player.hp; - }, check:function(card,event){ if(_status.event.player.hp>1) return 0; return 7-ai.get.value(card); @@ -891,7 +911,7 @@ character.extra={ }, viewAs:{name:'wuxie'}, viewAsFilter:function(player){ - return player.num('he',{suit:'spade'})>0; + return player.num('he',{suit:'spade'})>=player.hp; }, filterCard:function(card){ return get.suit(card)=='spade'; diff --git a/character/fire.js b/character/fire.js index 0e20d7b19..edca8d0b4 100644 --- a/character/fire.js +++ b/character/fire.js @@ -127,6 +127,9 @@ character.fire={ player.storage.niepan=true; }, ai:{ + skillTagFilter:function(player){ + if(player.storage.niepan) return false; + }, save:true, result:{ player:10 diff --git a/character/sp.js b/character/sp.js index a6adb94b8..b732fe739 100644 --- a/character/sp.js +++ b/character/sp.js @@ -2546,6 +2546,13 @@ character.sp={ check:function(event,player){ return player.hp==1||(player.hp==2&&player.num('h')<=1); }, + filter:function(event,player){ + return !player.storage.suiren; + }, + intro:{ + content:'limited', + }, + mark:true, direct:true, content:function(){ "step 0" @@ -2556,6 +2563,8 @@ character.sp={ } "step 1" if(result.bool){ + player.storage.suiren=true; + player.unmarkSkill('suiren'); player.logSkill('suiren',result.targets); player.removeSkill('yicong'); player.gainMaxHp(); diff --git a/character/swd.js b/character/swd.js index 806482001..78565fbe1 100644 --- a/character/swd.js +++ b/character/swd.js @@ -1208,6 +1208,9 @@ character.swd={ } }, ai:{ + skillTagFilter:function(player){ + if(player.storage.shouyin) return false; + }, expose:0.3, save:true, result:{ diff --git a/character/yijiang.js b/character/yijiang.js index 5f84b1b8a..17c70261b 100644 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -1079,12 +1079,12 @@ character.yijiang={ "step 1" if(result.bool){ var target=result.targets[0]; + player.logSkill('qiuyuan',target); event.target=target; target.chooseCard({name:'shan'},'交给'+get.translation(player)+ '一张闪,或成为此杀的额外目标').ai=function(card){ return ai.get.attitude(target,player)>=0?1:-1; } - player.logSkill('qiuyuan',target); game.delay(); } else{ diff --git a/game/config.js b/game/config.js index aa894e312..af00ed952 100644 --- a/game/config.js +++ b/game/config.js @@ -142,7 +142,8 @@ window.config={ theme_config:'主题', layout_config:'布局', mode_config:'游戏模式', - player_number_config:'角色个数', + player_number_config:'游戏人数', + battle_number_config:'参战人数', difficulty_config:'AI对人类态度', initshow_draw_config:'首亮摸牌', ai_strategy_config:'内奸策略', @@ -276,6 +277,7 @@ window.config={ free_choose:true, swap:true, change_identity:true, + battle_number:1 }, identity:{ identity:[ @@ -302,7 +304,7 @@ window.config={ difficulty:'normal', initshow_draw:2, dierestart:true - } + }, }, game_intro:{ diff --git a/game/game.js b/game/game.js index 6756fbd79..888d166e8 100644 --- a/game/game.js +++ b/game/game.js @@ -1128,11 +1128,8 @@ window.play={}; "step 0" player.lose(cards); if(event.skill){ - player.popup(event.skill); + player.logSkill(event.skill); player.popup(event.card.name); - if(player.checkShow){ - player.checkShow(event.skill); - } } if(lib.config.background_audio){ var sex=player.sex=='female'?'female':'male'; @@ -1155,7 +1152,7 @@ window.play={}; } if(event.animate!=false){ if(card.name=='wuxie'&&event.parent.source){ - player.line(event.parent.source,'green'); + player.line(event.parent.source2||event.parent.source,'green'); } else{ var config={}; @@ -1849,13 +1846,13 @@ window.play={}; } if(player==game.me&&!_status.over){ ui.control.show(); - if(get.config('swap')&&lib.config.mode!='versus'){ + if(get.config('swap')&&lib.config.mode_choice.contains('swap')){ ui.swap=ui.create.control('换人',ui.click.dieswap); } - if(get.config('revive')){ + if(get.config('revive')&&lib.config.mode_choice.contains('revive')){ ui.revive=ui.create.control('revive',ui.click.dierevive); } - if(get.config('dierestart')&&lib.config.mode!='versus'){ + if(get.config('dierestart')&&lib.config.mode_choice.contains('dierestart')){ ui.restart=ui.create.control('restart',game.reload); } } @@ -3425,21 +3422,23 @@ window.play={}; this.skipList.add(name); }, logSkill:function(name,targets,nature){ - this.popup(name); if(get.itemtype(targets)=='player') targets=[targets]; - if(typeof targets=='object'&&targets.length){ - var str=get.translation(this)+'对'+get.translation(targets[0]); - for(var i=1;i=0){ if(log!=false){ game.log(get.translation(player)+'从'+get.translation(this)+'获得了'+get.cnNumber(card)+'张牌'); } @@ -4304,12 +4307,21 @@ window.play={}; }, trigger:function(name){ var event=this; - var i,j,next,add; + var i,j,iwhile,next,add; + var totalPopulation=game.players.length+game.dead.length+1; if(event.player&&event.player.removed) return; if(!event.player&&name!='gameStart') return; event._endTrigger=event.player||game.me; - while(event._endTrigger.isDead()){ - event._endTrigger=event._endTrigger.next; + for(iwhile=0;iwhile0); var i,j,range,cards,cards2,skills,check,effect; var ok=false,forced=event.forced; - while(1){ + var iwhile=100; + while(iwhile--){ range=get.select(event.selectCard); if(ui.selected.cards.length>=range[0]){ ok=true; @@ -10421,7 +10391,8 @@ window.play={}; if(event.filterTarget==undefined) return (check()>0); var i,j,range,targets,targets2,effect; var ok=false,forced=event.forced; - while(1){ + var iwhile=100; + while(iwhile--){ range=get.select(event.selectTarget); if(range[1]==-1){ j=0; @@ -11204,9 +11175,7 @@ window.play={}; for(i in mode[lib.config.mode].get){ get[i]=lib.init.eval(mode[lib.config.mode].get[i]); } - for(i in mode[lib.config.mode].config){ - lib.config.current_mode[i]=mode[lib.config.mode].config[i]; - } + lib.config.current_mode=mode[lib.config.mode].config||[]; lib.config.mode_choice=mode[lib.config.mode].config; for(i in mode[lib.config.mode]){ if(i=='element') continue; @@ -11302,8 +11271,8 @@ window.play={}; for(j in play[i].get){ get[j]=lib.init.eval(play[i].get[j]); } - for(j in play[i].config){ - lib.config.current_mode[j]=play[i].config[j]; + if(play[i].config){ + lib.config.current_mode=lib.config.current_mode.concat(play[i].config); } for(j in play[i]){ if(j=='mode'||j=='forbid'||j=='init'||j=='element'||j=='game'||j=='get'||j=='config'||j=='ui') continue; diff --git a/layout/default/layout.css b/layout/default/layout.css index 27a8bd127..ffbc0bd26 100644 --- a/layout/default/layout.css +++ b/layout/default/layout.css @@ -187,6 +187,8 @@ margin-bottom: 5px; /*--------角色--------*/ .player{z-index: 4;width: 240px;height: 120px;} .player.minskin{width:120px;} +.player.replaceme{-webkit-animation:replaceme 0.5s} +.player.replaceenemy{-webkit-animation:replaceenemy 0.5s} .player>div{z-index: 2;} .player.dead,.player.likedead{z-index: 1;-webkit-filter:grayscale(1);} .player>.name{left: 18px;top:36px;} @@ -267,7 +269,7 @@ margin-bottom: 5px; .linked>.count{right: 154px;} .acted>.identity{-webkit-transform:rotate(180deg);} -/*--------位置(n人)------*/ +/*--------位置(炉石)------*/ #arena.stone>.player.minskin[data-position='4']{top:calc(100% - 305px);left:calc(100% - 120px);} #arena.stone>.card[data-position='4']{top:calc(100% - 297px);left:calc(100% - 112px);} #arena.stone>.popup[data-position='4']{top:calc(100% - 340px);left:calc(100% - 112px);} @@ -698,6 +700,8 @@ div[data-nature='soil']{ @-webkit-keyframes equip_hover2{0% {}50% {opacity: 0.6}100%{opacity: 0.3}} @-webkit-keyframes dialog_start{from {opacity: 0;top:100px;}} @-webkit-keyframes dialog_start2{from {opacity: 0;-webkit-transform:scale(0.8);}} +@-webkit-keyframes replaceme{from {opacity: 0;-webkit-transform:translateY(120px)}} +@-webkit-keyframes replaceenemy{from {opacity: 0;-webkit-transform:translateY(-120px)}} @-webkit-keyframes drawing{0% {opacity: 0;left:calc(50% - 52px);top:calc(50% - 52px);}50%{opacity: 1}100%{opacity: 0}} @-webkit-keyframes card_start{from {opacity: 0;-webkit-transform:scale(0);}} @-webkit-keyframes card_start2{from {opacity: 0;-webkit-transform:scale(0);margin-left: -52px;margin-right: -52px;}} diff --git a/layout/newlayout/layout.css b/layout/newlayout/layout.css index f54cf4ca3..3c2966d68 100644 --- a/layout/newlayout/layout.css +++ b/layout/newlayout/layout.css @@ -291,31 +291,7 @@ .linked>.identity{top: -5px;} .linked>.count{right: auto;} /*--------位置(n人)------*/ -#arena.stone>.player.minskin[data-position='4']{top:calc(100% - 305px);left:calc(100% - 120px);} -#arena.stone>.card[data-position='4']{top:calc(100% - 297px);left:calc(100% - 112px);} -#arena.stone>.popup[data-position='4']{top:calc(100% - 340px);left:calc(100% - 112px);} -#arena.stone>.player.minskin[data-position='6']{top:calc(100% - 305px);left:calc(100% - 260px);} -#arena.stone>.card[data-position='6']{top:calc(100% - 297px);left:calc(100% - 252px);} -#arena.stone>.popup[data-position='6']{top:calc(100% - 340px);left:calc(100% - 252px);} -#arena.stone>.player.minskin[data-position='7']{top:calc(100% - 305px);left:140px;} -#arena.stone>.card[data-position='7']{top:calc(100% - 297px);left:148px;} -#arena.stone>.popup[data-position='7']{top:calc(100% - 340px);left:148px;} -#arena.stone>.player.minskin[data-position='5']{top:calc(100% - 305px);left:0;} -#arena.stone>.card[data-position='5']{top:calc(100% - 297px);left:8px;} -#arena.stone>.popup[data-position='5']{top:calc(100% - 340px);left:8px;} -#arena>.player.minskin[data-position='9']{top:10px;left:calc(100% - 120px);} -#arena.stone>.card[data-position='9']{top:18px;left:calc(100% - 112px);} -#arena.stone>.popup[data-position='9']{top:140px;left:calc(100% - 112px);} -#arena>.player.minskin[data-position='11']{top:10px;left:calc(100% - 260px);} -#arena.stone>.card[data-position='11']{top:18px;left:calc(100% - 252px);} -#arena.stone>.popup[data-position='11']{top:140px;left:calc(100% - 252px);} -#arena>.player.minskin[data-position='10']{top:10px;left:140px;} -#arena.stone>.card[data-position='10']{top:18px;left:148px;} -#arena.stone>.popup[data-position='10']{top:140px;left:148px;} -#arena>.player.minskin[data-position='8']{top:10px;left:0;} -#arena.stone>.card[data-position='8']{top:18px;left:8px;} -#arena.stone>.popup[data-position='8']{top:140px;left:8px;} /*--------位置(8人)------*/ [data-number='8']>.player[data-position='1']{top:calc(200% / 3 - 160px);left:calc(100% - 150px);} [data-number='8']>.player[data-position='2']{top:calc(100% / 3 - 170px);left:calc(100% - 150px);} diff --git a/mode/guozhan.js b/mode/guozhan.js index 458b4b48e..6068f7e93 100644 --- a/mode/guozhan.js +++ b/mode/guozhan.js @@ -695,18 +695,7 @@ mode.guozhan={ }, } }, - config:{ - player_number:true, - initshow_draw:true, - free_choose:true, - change_identity:true, - change_choice:true, - change_card:true, - swap:true, - dierestart:true, - ai_identity:true, - revive:true, - double_hp:true, - difficulty:true, - }, + config:['player_number','initshow_draw', + 'free_choose','change_identity','change_choice','change_card', + 'swap','dierestart','ai_identity','revive','double_hp','difficulty'] } diff --git a/mode/identity.js b/mode/identity.js index 80579d662..145f0f0ee 100644 --- a/mode/identity.js +++ b/mode/identity.js @@ -697,22 +697,8 @@ mode.identity={ } } }, - config:{ - player_number:true, - double_character:true, - double_hp:true, - ban_weak:true, - enhance_zhu:true, - free_choose:true, - change_identity:true, - change_choice:true, - change_card:true, - dierestart:true, - swap:true, - revive:true, - auto_identity:true, - ai_strategy:true, - ai_identity:true, - difficulty:true, - }, + config:['player_number','double_character','double_hp', + 'ban_weak','enhance_zhu','free_choose','change_identity', + 'change_choice','change_card','dierestart','swap','revive', + 'auto_identity','ai_strategy','ai_identity','difficulty'] } diff --git a/mode/stone.js b/mode/stone.js index 0ec4b903c..882f2e768 100644 --- a/mode/stone.js +++ b/mode/stone.js @@ -3,18 +3,29 @@ mode.stone={ player:{ init:function(player){ if(!player.isMin()){ - player.node.actcount=ui.create.div('.actcount.hp',player); - player.actcount=1; - player.actcharacterlist=[]; + if(!player.node.actcount){ + player.node.actcount=ui.create.div('.actcount.hp',player); + } + if(typeof player.actcount!=='number'){ + player.actcount=1; + } + if(!player.actcharacterlist){ + player.actcharacterlist=[]; + } player.updateActCount(); } }, updateActCount:function(){ - while(this.actcount>this.node.actcount.childElementCount){ - ui.create.div(this.node.actcount); - } - while(this.actcountthis.node.actcount.childElementCount){ + ui.create.div(this.node.actcount); + } + else if(this.actcount=0){ + player.actcharacterlist[index]=null; } } } @@ -61,9 +133,11 @@ mode.stone={ player.phase(); event.num=0; "step 1" - var current=player.actcharacterlist[event.num]; - if(current){ - current.phase(); + if(event.num0; + }, + viewAsFilter:function(player){ + return player.num('h',{type:'stonecharacter'})>0; + }, + ai:{ + skillTagFilter:function(player){ + return player.num('h',{type:'stonecharacter'})>0; + }, + respondSha:true, + order:4, + useful:-1, + value:-1 + } + }, + stoneshan:{ + enable:['chooseToRespond'], + filterCard:{type:'equip'}, + viewAs:{name:'shan'}, + check:function(){return 1}, + filter:function(event,player){ + return player.num('h',{type:'equip'})>0; + }, + viewAsFilter:function(player){ + return player.num('h',{type:'equip'})>0; + }, + ai:{ + skillTagFilter:function(player){ + return player.num('h',{type:'equip'})>0; + }, + respondShan:true, + order:4, + useful:-1, + value:-1 + } + }, }, translate:{ stone_weibing:'士兵', @@ -377,18 +515,16 @@ mode.stone={ stone_feipin:'妃嫔', stone_yiji:'艺伎', stone_daogu:'道姑', + + stonesha:'炉杀', + stoneshan:'石闪', }, ai:{ get:{ attitude:function(from,to){ - return (to.identity=='zhu'?7:5)*(from.side==to.side?1:-1); + return (to.identity=='zhu'?6:5)*(from.side==to.side?1:-1); } } }, - config:{ - double_character:true, - ban_weak:true, - free_choose:true, - change_choice:true, - }, + config:['battle_number','double_character','ban_weak','free_choose','change_choice'] }