From 4ac8f8df120c5dbe1a32e238eca8aa217f36b6a7 Mon Sep 17 00:00:00 2001 From: libccy Date: Fri, 4 Aug 2017 08:21:30 +0800 Subject: [PATCH] round --- character/rank.js | 3 ++ character/xianjian.js | 121 ++---------------------------------------- game/game.js | 66 +++++++++++++++++++++++ 3 files changed, 73 insertions(+), 117 deletions(-) diff --git a/character/rank.js b/character/rank.js index e2dc9ba9d..72d2e8352 100644 --- a/character/rank.js +++ b/character/rank.js @@ -185,6 +185,9 @@ window.noname_character_rank={ 'xizhicai', ], am:[ + 'gw_haizhiyezhu', + 'gw_nitelila', + 'gw_bierna', 'gw_fuertaisite', 'gw_hengsaite', 'gw_kuite', diff --git a/character/xianjian.js b/character/xianjian.js index f4445050d..df1945c37 100644 --- a/character/xianjian.js +++ b/character/xianjian.js @@ -570,28 +570,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, linghuo:{ - init:function(player){ - player.storage.linghuo=-1; - }, - intro:{ - content:function(storage,player){ - var num=2-(game.roundNumber-storage); - if(num>0){ - return get.cnNumber(num)+'轮后技能重置'; - } - return '技能可发动'; - }, - markcount:function(storage,player){ - var num=2-(game.roundNumber-storage); - if(num>0){ - return num; - } - return 0; - } - }, + round:2, trigger:{global:'phaseEnd'}, filter:function(event,player){ - if(2-(game.roundNumber-player.storage.linghuo)>0) return false; return event.player.getStat('damage')&&event.player!=player; }, check:function(event,player){ @@ -605,58 +586,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ trigger.player.damage('fire'); - player.storage.linghuo=game.roundNumber; - player.syncStorage('linghuo'); - player.markSkill('linghuo'); }, - group:'linghuo_mark', - subSkill:{ - mark:{ - trigger:{global:'roundStart'}, - silent:true, - content:function(){ - if(2-(game.roundNumber-player.storage.linghuo)>0){ - player.updateMarks(); - } - else{ - player.unmarkSkill('linghuo'); - } - } - } - } }, guijin:{ - init:function(player){ - player.storage.guijin=-2; - }, - intro:{ - content:function(storage,player){ - var num=3-(game.roundNumber-storage); - if(num>0){ - return get.cnNumber(num)+'轮后技能重置'; - } - return '技能可发动'; - }, - markcount:function(storage,player){ - var num=3-(game.roundNumber-storage); - if(num>0){ - return num; - } - return 0; - } - }, - group:'guijin_mark', + round:3, enable:'phaseUse', delay:0, - filter:function(event,player){ - return 3-(game.roundNumber-player.storage.guijin)<=0; - }, content:function(){ 'step 0' event.cards=get.cards(4); - player.storage.guijin=game.roundNumber; - player.syncStorage('guijin'); - player.markSkill('guijin'); 'step 1' if(event.cards.length){ var more=false,remain=false,nomore=false; @@ -751,20 +689,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 1; } } - }, - subSkill:{ - mark:{ - trigger:{global:'roundStart'}, - silent:true, - content:function(){ - if(3-(game.roundNumber-player.storage.guijin)>0){ - player.updateMarks(); - } - else{ - player.unmarkSkill('guijin'); - } - } - } } }, guijin2:{ @@ -781,28 +705,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, chengxin:{ - init:function(player){ - player.storage.chengxin=-3; - }, - intro:{ - content:function(storage,player){ - var num=4-(game.roundNumber-storage); - if(num>0){ - return get.cnNumber(num)+'轮后技能重置'; - } - return '技能可发动'; - }, - markcount:function(storage,player){ - var num=4-(game.roundNumber-storage); - if(num>0){ - return num; - } - return 0; - } - }, + round:4, enable:'chooseToUse', filter:function(event,player){ - if(4-(game.roundNumber-player.storage.chengxin)>0) return false; return event.type=='dying'; }, filterTarget:function(card,player,target){ @@ -812,9 +717,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ target.recover(1-target.hp); target.addTempSkill('chengxin2',{player:'phaseAfter'}); - player.storage.chengxin=game.roundNumber; - player.syncStorage('chengxin'); - player.markSkill('chengxin'); }, ai:{ order:6, @@ -827,22 +729,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ result:{ target:3 }, - }, - group:'chengxin_mark', - subSkill:{ - mark:{ - trigger:{global:'roundStart'}, - silent:true, - content:function(){ - if(4-(game.roundNumber-player.storage.chengxin)>0){ - player.updateMarks(); - } - else{ - player.unmarkSkill('chengxin'); - } - } - } - } + } }, chengxin2:{ trigger:{player:'damageBefore'}, diff --git a/game/game.js b/game/game.js index d34db6c76..fb380eb29 100644 --- a/game/game.js +++ b/game/game.js @@ -8977,6 +8977,9 @@ player.storage.counttrigger&&player.storage.counttrigger[event.skill]>=info.usable){ event.finish(); } + else if(info.round&&(info.round-(game.roundNumber-player.storage[event.skill+'_roundcount'])>0)){ + event.finish(); + } else{ var hidden=player.hiddenSkills.slice(0); game.expandSkills(hidden); @@ -11590,6 +11593,12 @@ default:info.prepare(cards,player,targets); } } + if(info.round){ + var roundname=skill+'_roundcount'; + player.storage[roundname]=game.roundNumber; + player.syncStorage(roundname); + player.markSkill(roundname); + } "step 1" var info=get.info(event.skill); if(info&&info.contentBefore){ @@ -15881,6 +15890,12 @@ if(this.checkShow){ this.checkShow(name); } + if(info.round){ + var roundname=name+'_roundcount'; + this.storage[roundname]=game.roundNumber; + this.syncStorage(roundname); + this.markSkill(roundname); + } game.trySkillAudio(name,this,true); if(game.chess){ this.chessFocus(); @@ -25605,6 +25620,7 @@ if(info.viewAs&&info.viewAsFilter&&info.viewAsFilter(player)==false) enable=false; if(info.usable&&get.skillCount(skills2[i])>=info.usable) enable=false; if(info.chooseButton&&_status.event.noButton) enable=false; + if(info.round&&(info.round-(game.roundNumber-player.storage[skills2[i]+'_roundcount'])>0)) enable=false; } if(enable){ if(event.isMine()||!event._aiexclude.contains(skills2[i])){ @@ -26820,6 +26836,56 @@ game.finishSkill(i+'_'+j,true); } } + if(info.round){ + var k=i+'_roundcount'; + if(typeof info.group=='string'){ + info.group=[info.group,k]; + } + else if(Array.isArray(info.group)){ + info.group.add(k); + } + else{ + info.group=[k]; + } + lib.skill[k]=(function(round,name){ + return { + init:function(player){ + player.storage[name]=1-round; + }, + intro:{ + content:function(storage,player){ + var num=round-(game.roundNumber-storage); + if(num>0){ + return get.cnNumber(num)+'轮后技能重置'; + } + return '技能可发动'; + }, + markcount:function(storage,player){ + var num=round-(game.roundNumber-storage); + if(num>0){ + return num; + } + return 0; + } + }, + trigger:{global:'roundStart'}, + forced:true, + popup:false, + silent:true, + content:function(){ + var skill=event.name.slice(0,event.name.indexOf('_roundcount')); + if(lib.skill[skill].round-(game.roundNumber-player.storage[event.name])>0){ + player.updateMarks(); + } + else{ + player.unmarkSkill(event.name); + } + } + }; + }(info.round,k)); + lib.translate[k]=lib.translate[i]||''; + lib.translate[k+'_bg']=lib.translate[i+'_bg']||lib.translate[k][0]; + } if(info.marktext){ lib.translate[i+'_bg']=info.marktext; }