From 235100e50ce367fca35b5c4386d2c260c45850f2 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 10:40:10 +0800 Subject: [PATCH 01/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E7=89=88=E5=8C=85?= =?UTF-8?q?=E6=8A=80=E8=83=BDstdshushen=E6=8A=80=E8=83=BD=E4=BD=BF?= =?UTF-8?q?=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/character/standard.js b/character/standard.js index 6308d4dff..ac9d86b80 100755 --- a/character/standard.js +++ b/character/standard.js @@ -99,23 +99,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:'shushen', trigger:{player:'recoverEnd'}, direct:true, - content:function(){ - 'step 0' + async content(event,trigger,player){ event.num=trigger.num||1; - 'step 1' - player.chooseTarget(get.prompt2('stdshushen'),lib.filter.notMe).set('ai',function(target){ - return get.attitude(_status.event.player,target); - }); - 'step 2' - if(result.bool){ - var target=result.targets[0]; + while(player.hasSkill('stdshushen')){ + const {result:{targets}}=await player.promises.chooseTarget(get.prompt2('stdshushen'),lib.filter.notMe) + .set('ai',target=>get.attitude(_status.event.player,target)); + const target=targets[0]; player.logSkill('stdshushen',target); - target.draw(target.countCards('h')?1:2); - if(event.num>1&&player.hasSkill('stdshushen')){ - event.num--; - event.goto(1); - } - } + await target.promises.draw(target.countCards('h')?1:2); + if(--event.num<1) break; + }; }, ai:{threaten:0.8,expose:0.1}, }, From dbceeddb5ec9512e42d605363b2c02de2e05d66d Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 10:42:05 +0800 Subject: [PATCH 02/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E7=89=88=E5=8C=85?= =?UTF-8?q?=E6=8A=80=E8=83=BDstdkuangfu=E6=8A=80=E8=83=BD=E4=BD=BF?= =?UTF-8?q?=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/character/standard.js b/character/standard.js index ac9d86b80..68fe475a6 100755 --- a/character/standard.js +++ b/character/standard.js @@ -120,9 +120,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return player.isPhaseUsing()&&event.card&&event.card.name=='sha'&&event.player!=player&&event.player.isIn(); }, - content:function(){ - if(trigger.player.hp Date: Sat, 9 Dec 2023 10:44:59 +0800 Subject: [PATCH 03/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E7=89=88=E5=8C=85?= =?UTF-8?q?=E6=8A=80=E8=83=BDrewangzun=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8?= =?UTF-8?q?async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/character/standard.js b/character/standard.js index 68fe475a6..26cf98e6e 100755 --- a/character/standard.js +++ b/character/standard.js @@ -136,10 +136,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return event.player.hp>player.hp; }, logTarget:'player', - content:function(){ - player.draw(); - var zhu=false; - var target=trigger.player; + async content(event,trigger,player){ + await player.promises.draw(); + let zhu=false; + const target=trigger.player; switch(get.mode()){ case 'identity':{ zhu=target.isZhu; @@ -159,7 +159,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } } if(zhu){ - player.draw(); + await player.promises.draw(); target.addTempSkill('rewangzun2'); target.addMark('rewangzun2',1,false); } From 469e9fd8397639bf50de542c720d8f0c8599d23d Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 10:50:06 +0800 Subject: [PATCH 04/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E7=89=88=E5=8C=85?= =?UTF-8?q?=E6=8A=80=E8=83=BDretongji=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8a?= =?UTF-8?q?sync=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/character/standard.js b/character/standard.js index 26cf98e6e..6fd397e34 100755 --- a/character/standard.js +++ b/character/standard.js @@ -183,12 +183,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return event.card.name=='sha'&&event.player!=player&&!event.targets.contains(player)&& event.target.inRange(player)&&event.target.countCards('he')>0; }, - content:function(){ - 'step 0' - trigger.target.chooseCard('he','是否对'+get.translation(player)+'发动【同疾】?','弃置一张牌,将'+get.translation(trigger.card)+'转移给'+get.translation(player)).set('ai',function(card){ + async content(event,trigger,player){ + const {result:{bool,cards}}=await trigger.promises.target.chooseCard('he','是否对'+get.translation(player)+'发动【同疾】?','弃置一张牌,将'+get.translation(trigger.card)+'转移给'+get.translation(player)) + .set('ai',card=>{ if(!_status.event.check) return -1; return get.unuseful(card)+9; - }).set('check',function(){ + }) + .set('check',(()=>{ if(trigger.target.countCards('h','shan')){ return -get.attitude(trigger.target,player); } @@ -202,12 +203,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 8-get.attitude(trigger.target,player); } return -1; - }()>0); - 'step 1' - if(result.bool){ + })()>0); + if(bool){ player.logSkill('retongji',trigger.target); - trigger.target.discard(result.cards); - var evt=trigger.getParent(); + await trigger.target.promises.discard(cards); + const evt=trigger.getParent(); evt.triggeredTargets2.remove(trigger.target); evt.targets.remove(trigger.target); evt.targets.push(player); From 280043d78c6a5e52425ba1fa8dace485c3fb9796 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 11:02:46 +0800 Subject: [PATCH 05/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E7=89=88=E5=8C=85hujia?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 67 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/character/standard.js b/character/standard.js index 6fd397e34..e8d500d1b 100755 --- a/character/standard.js +++ b/character/standard.js @@ -233,42 +233,41 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(get.damageEffect(player,event.player,player)>=0) return false; return true; }, - content:function(){ - "step 0" - if(event.current==undefined) event.current=player.next; - if(event.current==player){ - event.finish(); - } - else if(event.current.group=='wei'){ - if((event.current==game.me&&!_status.auto)||( - get.attitude(event.current,player)>2)|| - event.current.isOnline()){ - player.storage.hujiaing=true; - var next=event.current.chooseToRespond('是否替'+get.translation(player)+'打出一张闪?',{name:'shan'}); - next.set('ai',function(){ - var event=_status.event; - return (get.attitude(event.player,event.source)-2); - }); - next.set('skillwarn','替'+get.translation(player)+'打出一张闪'); - next.autochoose=lib.filter.autoRespondShan; - next.set('source',player); + async content(event,trigger,player){ + while(true){ + let bool; + if(!event.current) event.current=player.next; + if(event.current==player) return; + else if(event.current.group=='wei'){ + if((event.current==game.me&&!_status.auto)||( + get.attitude(event.current,player)>2)|| + event.current.isOnline()){ + player.storage.hujiaing=true; + const next=event.current.promises.chooseToRespond('是否替'+get.translation(player)+'打出一张闪?',{name:'shan'}); + next.set('ai',()=>{ + const event=_status.event; + return (get.attitude(event.player,event.source)-2); + }); + next.set('skillwarn','替'+get.translation(player)+'打出一张闪'); + next.autochoose=lib.filter.autoRespondShan; + next.set('source',player); + bool=(await next).result.bool; + } } - } - "step 1" - player.storage.hujiaing=false; - if(result.bool){ - event.finish(); - trigger.result={bool:true,card:{name:'shan',isCard:true}}; - trigger.responded=true; - trigger.animate=false; - if(typeof event.current.ai.shown=='number'&&event.current.ai.shown<0.95){ - event.current.ai.shown+=0.3; - if(event.current.ai.shown>0.95) event.current.ai.shown=0.95; + player.storage.hujiaing=false; + if(bool){ + trigger.result={bool:true,card:{name:'shan',isCard:true}}; + trigger.responded=true; + trigger.animate=false; + if(typeof event.current.ai.shown=='number'&&event.current.ai.shown<0.95){ + event.current.ai.shown+=0.3; + if(event.current.ai.shown>0.95) event.current.ai.shown=0.95; + } + return; + } + else{ + event.current=event.current.next; } - } - else{ - event.current=event.current.next; - event.goto(0); } }, ai:{ From f63d5be2e5e41173b962c464776c2c676a92f240 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 11:04:10 +0800 Subject: [PATCH 06/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85jianxiong?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index e8d500d1b..966576c93 100755 --- a/character/standard.js +++ b/character/standard.js @@ -288,8 +288,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return get.itemtype(event.cards)=='cards'&&get.position(event.cards[0],true)=='o'; }, - content:function(){ - player.gain(trigger.cards,'gain2'); + async content(event,trigger,player){ + await player.promises.gain(trigger.cards,'gain2'); }, ai:{ maixie:true, From e1d5866eadadcd72f189e3fd798041140b1cc5fc Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 11:06:16 +0800 Subject: [PATCH 07/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85fankui?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index 966576c93..06b970707 100755 --- a/character/standard.js +++ b/character/standard.js @@ -310,8 +310,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return (event.source&&event.source.countGainableCards(player,event.source!=player?'he':'e')&&event.num>0); }, - content:function(){ - player.gainPlayerCard(true,trigger.source,trigger.source!=player?'he':'e'); + async content(event,trigger,player){ + await player.promises.gainPlayerCard(true,trigger.source,trigger.source!=player?'he':'e'); }, ai:{ maixie_defend:true, From e31b7dc734e5ab1f0fcdb519fca6386d18a4b08e Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 11:25:14 +0800 Subject: [PATCH 08/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85guicai?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 63 +++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/character/standard.js b/character/standard.js index 06b970707..336d3c269 100755 --- a/character/standard.js +++ b/character/standard.js @@ -333,22 +333,21 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return player.countCards(get.mode()=='guozhan'?'hes':'hs')>0; }, - content:function(){ - "step 0" - player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+ - get.translation(trigger.player.judging[0])+','+get.prompt('guicai'),get.mode()=='guozhan'?'hes':'hs',function(card){ - var player=_status.event.player; - var mod2=game.checkMod(card,player,'unchanged','cardEnabled2',player); + async content(event,trigger,player){ + const {result:{bool:chooseCardResultBool,cards:chooseCardResultCards}}=await player.promises.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+ + get.translation(trigger.player.judging[0])+','+get.prompt('guicai'),get.mode()=='guozhan'?'hes':'hs',card=>{ + const player=_status.event.player; + const mod2=game.checkMod(card,player,'unchanged','cardEnabled2',player); if(mod2!='unchanged') return mod2; - var mod=game.checkMod(card,player,'unchanged','cardRespondable',player); + const mod=game.checkMod(card,player,'unchanged','cardRespondable',player); if(mod!='unchanged') return mod; return true; - }).set('ai',function(card){ - var trigger=_status.event.getTrigger(); - var player=_status.event.player; - var judging=_status.event.judging; - var result=trigger.judge(card)-trigger.judge(judging); - var attitude=get.attitude(player,trigger.player); + }).set('ai',card=>{ + const trigger=_status.event.getTrigger(); + const player=_status.event.player; + const judging=_status.event.judging; + const result=trigger.judge(card)-trigger.judge(judging); + const attitude=get.attitude(player,trigger.player); if(attitude==0||result==0) return 0; if(attitude>0){ return result-get.value(card)/2; @@ -357,30 +356,22 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return -result-get.value(card)/2; } }).set('judging',trigger.player.judging[0]).setHiddenSkill('guicai'); - "step 1" - if(result.bool){ - player.respond(result.cards,'guicai','highlight','noOrdering'); - } - else{ - event.finish(); - } - "step 2" - if(result.bool){ - if(trigger.player.judging[0].clone){ - trigger.player.judging[0].clone.classList.remove('thrownhighlight'); - game.broadcast(function(card){ - if(card.clone){ - card.clone.classList.remove('thrownhighlight'); - } - },trigger.player.judging[0]); - game.addVideo('deletenode',player,get.cardsInfo([trigger.player.judging[0].clone])); - } - game.cardsDiscard(trigger.player.judging[0]); - trigger.player.judging[0]=result.cards[0]; - trigger.orderingCards.addArray(result.cards); - game.log(trigger.player,'的判定牌改为',result.cards[0]); - game.delay(2); + if(!chooseCardResultBool) return; + await player.promises.respond(chooseCardResultCards,'guicai','highlight','noOrdering'); + if(trigger.player.judging[0].clone){ + trigger.player.judging[0].clone.classList.remove('thrownhighlight'); + game.broadcast(function(card){ + if(card.clone){ + card.clone.classList.remove('thrownhighlight'); + } + },trigger.player.judging[0]); + game.addVideo('deletenode',player,get.cardsInfo([trigger.player.judging[0].clone])); } + await game.cardsDiscard(trigger.player.judging[0]).toPromise(); + trigger.player.judging[0]=chooseCardResultCards[0]; + trigger.orderingCards.addArray(chooseCardResultCards); + game.log(trigger.player,'的判定牌改为',chooseCardResultCards[0]); + game.delay(2); }, ai:{ rejudge:true, From c61d214cb750670847a0861416ba0674226adddd Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 12:19:10 +0800 Subject: [PATCH 09/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85ganglie?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/character/standard.js b/character/standard.js index 336d3c269..6eb916d4b 100755 --- a/character/standard.js +++ b/character/standard.js @@ -390,25 +390,21 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return (get.attitude(player,event.source)<=0); }, logTarget:'source', - content:function(){ - "step 0" - player.judge(function(card){ + async content(event,trigger,player){ + const judgeEvent=player.promises.judge(card=>{ if(get.suit(card)=='heart') return -2; return 2; - }).judge2=function(result){ - return result.bool; - }; - "step 1" - if(result.judge<2){ - event.finish();return; - } - trigger.source.chooseToDiscard(2).set('ai',function(card){ + }); + judgeEvent.judge2=result=>result.bool; + const {result:{judge}}=await judgeEvent; + if(judge<2) return; + const {result:{bool}}=await trigger.source.promises.chooseToDiscard(2) + .set('ai',card=>{ if(card.name=='tao') return -10; if(card.name=='jiu'&&_status.event.player.hp==1) return -10; return get.unuseful(card)+2.5*(5-get.owner(card).hp); }); - "step 2" - if(result.bool==false){ + if(bool==false){ trigger.source.damage(); } }, From 10ab434921641f1c34f2cf7d865a6bd3c569e0df Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 12:27:14 +0800 Subject: [PATCH 10/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85ganglie=5Fthre?= =?UTF-8?q?e=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/character/standard.js b/character/standard.js index 6eb916d4b..4b12947be 100755 --- a/character/standard.js +++ b/character/standard.js @@ -423,38 +423,29 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:'ganglie', trigger:{player:'damageEnd'}, direct:true, - content:function(){ - "step 0" - player.chooseTarget(get.prompt2('ganglie_three'),function(card,player,target){ + async content(event,trigger,player){ + const {result:{bool:chooseTargetResultBool,targets:chooseTargetResultTargets}}=await player.promises.chooseTarget(get.prompt2('ganglie_three'),(card,player,target)=>{ return target.isEnemyOf(player); - }).set('ai',function(target){ + }).set('ai',target=>{ return -get.attitude(_status.event.player,target)/(1+target.countCards('h')); }); - "step 1" - if(result.bool){ - event.target=result.targets[0]; - player.logSkill('ganglie_three',target); - } - else event.finish(); - "step 2" - player.judge(function(card){ + if(!chooseTargetResultBool) return; + event.target=chooseTargetResultTargets[0]; + player.logSkill('ganglie_three',event.target); + const judgeEvent=player.promises.judge(card=>{ if(get.suit(card)=='heart') return -2; return 2; - }).judge2=function(result){ - return result.bool; - }; - "step 3" - if(result.judge<2){ - event.finish();return; - } - target.chooseToDiscard(2).set('ai',function(card){ + }); + judgeEvent.judge2=result=>result.bool; + const {result:{judge}}=await judgeEvent; + if(judge<2) return; + const {result:{bool:chooseToDiscardResultBool}}=await player.promises.chooseToDiscard(2).set('ai',card=>{ if(card.name=='tao') return -10; if(card.name=='jiu'&&_status.event.player.hp==1) return -10; return get.unuseful(card)+2.5*(5-get.owner(card).hp); }); - "step 4" - if(result.bool==false){ - target.damage(); + if(chooseToDiscardResultBool==false){ + event.target.damage(); } }, ai:{ From ae6f6cefd982ea9480806803ac6b30ac9afe6d16 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 12:31:27 +0800 Subject: [PATCH 11/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85tuxi=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/character/standard.js b/character/standard.js index 4b12947be..e16a467d0 100755 --- a/character/standard.js +++ b/character/standard.js @@ -466,31 +466,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return !event.numFixed; }, - content:function(){ - "step 0" - var check; - var i,num=game.countPlayer(function(current){ + async content(event,trigger,player){ + let check; + let i,num=game.countPlayer(function(current){ return current!=player&¤t.countCards('h')&&get.attitude(player,current)<=0; }); check=(num>=2); - player.chooseTarget(get.prompt('tuxi'),'获得其他一至两名角色的各一张手牌',[1,2],function(card,player,target){ + const {result:{bool,targets}}=await player.promises.chooseTarget(get.prompt('tuxi'),'获得其他一至两名角色的各一张手牌',[1,2],(card,player,target)=>{ return target.countCards('h')>0&&player!=target; - },function(target){ + },target=>{ if(!_status.event.aicheck) return 0; - var att=get.attitude(_status.event.player,target); + const att=get.attitude(_status.event.player,target); if(target.hasSkill('tuntian')) return att/10; return 1-att; }).set('aicheck',check); - "step 1" - if(result.bool){ - player.logSkill('tuxi',result.targets); - player.gainMultiple(result.targets); - trigger.changeToZero(); - } - else{ - event.finish(); - } - "step 2" + if(!bool) return; + player.logSkill('tuxi',targets); + await player.promises.gainMultiple(targets); + trigger.changeToZero(); game.delay(); }, ai:{ From b0aa085628e649965d217ec8a285f6af777581d2 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 12:32:11 +0800 Subject: [PATCH 12/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85luoyi=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index e16a467d0..8875b708c 100755 --- a/character/standard.js +++ b/character/standard.js @@ -505,7 +505,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return !event.numFixed&&event.num>0; }, - content:function(){ + async content(event,trigger,player){ player.addTempSkill('luoyi2','phaseJieshuBegin'); trigger.num--; } From 73e719c376292b522108cb3e40ff0f0bbf1b3d47 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 12:32:32 +0800 Subject: [PATCH 13/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85luoyi2?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index 8875b708c..d2b6b0a52 100755 --- a/character/standard.js +++ b/character/standard.js @@ -516,7 +516,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return event.card&&(event.card.name=='sha'||event.card.name=='juedou')&&event.notLink(); }, forced:true, - content:function(){ + async content(event,trigger,player){ trigger.num++; }, ai:{ From 1ab59753649073d2a2e6831ea31568159613675d Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 12:33:14 +0800 Subject: [PATCH 14/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85tiandu?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index d2b6b0a52..f66fa3eea 100755 --- a/character/standard.js +++ b/character/standard.js @@ -540,8 +540,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return get.position(event.result.card,true)=='o'; }, - content:function(){ - player.gain(trigger.result.card,'gain2'); + async content(event,trigger,player){ + await player.promises.gain(trigger.result.card,'gain2'); } }, yiji:{ From 60596cd0c089de07fdf6c227d1e8968e3d3c8221 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 12:38:27 +0800 Subject: [PATCH 15/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85yiji=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E8=B0=83=E6=95=B4=E7=BC=A9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 87 +++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/character/standard.js b/character/standard.js index f66fa3eea..76cc25f04 100755 --- a/character/standard.js +++ b/character/standard.js @@ -551,68 +551,67 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event){ return event.num>0; }, - async content(event, trigger, player) { - event.count = trigger.num; + async content(event,trigger,player){ + event.count=trigger.num; // event.goto -> while - while (event.count > 0) { + while(event.count>0){ event.count--; - const { cards } = await game.cardsGotoOrdering(get.cards(2)).toPromise(); - if (_status.connectMode) game.broadcastAll(function () { _status.noclearcountdown = true }); - event.given_map = {}; - if (!cards.length) return; + const {cards}=await game.cardsGotoOrdering(get.cards(2)).toPromise(); + if(_status.connectMode) game.broadcastAll(function(){_status.noclearcountdown=true}); + event.given_map={}; + if(!cards.length) return; // event.goto -> do while - do { - const { result: { bool, links } } = - cards.length == 1 ? - { result: { links: cards.slice(0), bool: true } } : - await player.promises.chooseCardButton('遗计:请选择要分配的牌', true, cards, [1, cards.length]) - .set('ai', function (button) { - if (ui.selected.buttons.length == 0) return 1; + do{ + const {result:{bool,links}} = + cards.length==1? + {result:{links:cards.slice(0),bool: true}}: + await player.promises.chooseCardButton('遗计:请选择要分配的牌',true,cards,[1,cards.length]) + .set('ai',button=>{ + if(ui.selected.buttons.length==0) return 1; return 0; }); - if (!bool) return; + if(!bool) return; cards.removeArray(links); - event.togive = links.slice(0); - const { result: { targets } } = await player.promises.chooseTarget('选择一名角色获得' + get.translation(links), true) - .set('ai', function (target) { - var att = get.attitude(_status.event.player, target); - if (_status.event.enemy) { + event.togive=links.slice(0); + const {result:{targets}}=await player.promises.chooseTarget('选择一名角色获得'+get.translation(links),true) + .set('ai',target=>{ + const att=get.attitude(_status.event.player,target); + if(_status.event.enemy){ return -att; } - else if (att > 0) { - return att / (1 + target.countCards('h')); + else if(att>0){ + return att/(1+target.countCards('h')); } - else { - return att / 100; + else{ + return att/100; } }) - .set('enemy', get.value(event.togive[0], player, 'raw') < 0); - if (targets.length) { - const id = targets[0].playerid, - map = event.given_map; - if (!map[id]) map[id] = []; + .set('enemy',get.value(event.togive[0],player,'raw')<0); + if(targets.length){ + const id=targets[0].playerid, + map=event.given_map; + if(!map[id]) map[id]=[]; map[id].addArray(event.togive); } - } while (cards.length > 0); - if (_status.connectMode) { - game.broadcastAll(function () { delete _status.noclearcountdown; game.stopCountChoose() }); + }while(cards.length>0); + if(_status.connectMode){ + game.broadcastAll(function(){delete _status.noclearcountdown;game.stopCountChoose()}); } - const list = []; - for (const i in event.given_map) { - const source = (_status.connectMode ? lib.playerOL : game.playerMap)[i]; - player.line(source, 'green'); + const list=[]; + for(const i in event.given_map){ + const source=(_status.connectMode?lib.playerOL:game.playerMap)[i]; + player.line(source,'green'); list.push([source, event.given_map[i]]); } await game.loseAsync({ - gain_list: list, - giver: player, - animate: 'draw', + gain_list:list, + giver:player, + animate:'draw', }).toPromise().setContent('gaincardMultiple'); - if (event.count > 0 && player.hasSkill(event.name) && !get.is.blocked(event.name, player)) { - const { result: { bool: repeat } } = await player.promises.chooseBool(get.prompt2(event.name)).set('frequentSkill', event.name); - if (repeat) { - player.logSkill(event.name); - } else return; + if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name, player)){ + const {result:{bool:chooseBoolResultBool}}=await player.promises.chooseBool(get.prompt2(event.name)).set('frequentSkill',event.name); + if(chooseBoolResultBool) player.logSkill(event.name); + else return; } else return; } From 5a7349860123a6972261afe605d6e93c25d61be7 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 13:35:03 +0800 Subject: [PATCH 16/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85luoshen?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 71 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/character/standard.js b/character/standard.js index 76cc25f04..11a20de7c 100755 --- a/character/standard.js +++ b/character/standard.js @@ -646,45 +646,42 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'phaseZhunbeiBegin'}, frequent:true, preHidden:true, - content:function(){ - "step 0" - if(event.cards==undefined) event.cards=[]; - var next=player.judge(function(card){ - if(get.color(card)=='black') return 1.5; - return -1.5; - }); - next.judge2=function(result){ - return result.bool; - }; - if(get.mode()!='guozhan'&&!player.hasSkillTag('rejudge')) next.set('callback',function(){ - if(event.judgeResult.color=='black'&&get.position(card,true)=='o') player.gain(card,'gain2'); - }); - else next.set('callback',function(){ - if(event.judgeResult.color=='black') event.getParent().orderingCards.remove(card); - }); - "step 1" - if(result.judge>0){ - event.cards.push(result.card); - player.chooseBool('是否再次发动【洛神】?').set('frequentSkill','luoshen'); - } - else{ - for(var i=0;i{ + if(get.color(card)=='black') return 1.5; + return -1.5; + }); + judgeEvent.judge2=result=>result.bool; + if(get.mode()!='guozhan'&&!player.hasSkillTag('rejudge')) judgeEvent.set('callback',async event=>{ + if(event.judgeResult.color=='black'&&get.position(event.card,true)=='o') await player.promises.gain(event.card,'gain2'); + }); + else judgeEvent.set('callback',async event=>{ + if(event.judgeResult.color=='black') event.getParent().orderingCards.remove(event.card); + }); + const {result:{judge,card}}=await judgeEvent; + let bool; + if(judge>0){ + event.cards.push(card); + bool=(await player.promises.chooseBool('是否再次发动【洛神】?').set('frequentSkill','luoshen')).result.bool; + } + else{ + for(let i=0;i Date: Sat, 9 Dec 2023 13:39:52 +0800 Subject: [PATCH 17/71] =?UTF-8?q?=E9=92=88=E5=AF=B9game.delay=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0game.asyncDelay=E5=92=8Cgame.asyncDelayx=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- game/game.js | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index 11a20de7c..6f345a764 100755 --- a/character/standard.js +++ b/character/standard.js @@ -371,7 +371,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger.player.judging[0]=chooseCardResultCards[0]; trigger.orderingCards.addArray(chooseCardResultCards); game.log(trigger.player,'的判定牌改为',chooseCardResultCards[0]); - game.delay(2); + await game.asyncDelay(2); }, ai:{ rejudge:true, diff --git a/game/game.js b/game/game.js index 818105c53..c40142075 100644 --- a/game/game.js +++ b/game/game.js @@ -41664,6 +41664,39 @@ new Promise(resolve=>{ } return game.delay(time,time2); }, + /** + * 在async content中对game.delay的代替使用方法 + * + * 因为async content里不应该使用game.pause和game.resume + */ + asyncDelay:function(time,time2){ + // if(_status.paused) return; + // game.pause(); + if(typeof time!='number') time=1; + if(typeof time2!='number') time2=0; + time=time*lib.config.duration+time2; + if(lib.config.speed=='vvfast') time/=3; + //_status.timeout=setTimeout(game.resume,time); + return new Promise(resolve=>{ + setTimeout(resolve,time); + }); + }, + /** + * 在async content中对game.delayx的代替使用方法 + * + * 因为async content里不应该使用game.pause和game.resume + */ + asyncDelayx:function(time,time2){ + if(typeof time!='number') time=1; + switch(lib.config.game_speed){ + case 'vslow':time*=2.5;break; + case 'slow':time*=1.5;break; + case 'fast':time*=0.7;break; + case 'vfast':time*=0.4;break; + case 'vvfast':time*=0.2;break; + } + return game.asyncDelay(time,time2); + }, check:function(event){ var i,j,range; if(event==undefined) event=_status.event; From 95572ccaad01ec7844f0cfbf6f37a77db9ef7dc6 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 13:49:41 +0800 Subject: [PATCH 18/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85xinluoshen?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 62 +++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/character/standard.js b/character/standard.js index 6f345a764..8a9046c8b 100755 --- a/character/standard.js +++ b/character/standard.js @@ -691,44 +691,38 @@ game.import('character',function(lib,game,ui,get,ai,_status){ // alter:true, trigger:{player:'phaseZhunbeiBegin'}, frequent:true, - content:function(){ - "step 0" - if(event.cards==undefined) event.cards=[]; - player.judge(function(card){ - if(get.color(card)=='black') return 1.5; - return -1.5; - },ui.special).judge2=function(result){ - return result.bool; - }; - "step 1" - if(result.judge>0){ - event.cards.push(result.card); - if(lib.config.autoskilllist.contains('luoshen')){ - player.chooseBool('是否再次发动【洛神】?'); + async content(event,trigger,player){ + while(true){ + if(event.cards==undefined) event.cards=[]; + const judgeEvent=player.promises.judge(card=>{ + if(get.color(card)=='black') return 1.5; + return -1.5; + },ui.special); + judgeEvent.judge2=result=>result.bool; + const {result:{judge,card}}=await judgeEvent; + let bool; + if(judge>0){ + event.cards.push(card); + bool=lib.config.autoskilllist.contains('luoshen')?(await player.promises.chooseBool('是否再次发动【洛神】?')).result.bool:true; } else{ - event._result={bool:true}; - } - } - else{ - for(var i=0;i Date: Sat, 9 Dec 2023 14:00:52 +0800 Subject: [PATCH 19/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85rende=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/character/standard.js b/character/standard.js index 8a9046c8b..2e1341cc1 100755 --- a/character/standard.js +++ b/character/standard.js @@ -835,14 +835,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } return 10-get.value(card); }, - content:function(){ - player.give(cards,target); - var evt2=event.getParent(3); - var num=0; - player.getHistory('lose',function(evt){ + async content(event,trigger,player){ + const evt2=event.getParent(3); + let num=0; + player.getHistory('lose',evt=>{ if(evt.getParent(2).name=='rende'&&evt.getParent(5)==evt2) num+=evt.cards.length; }); - if(num<2&&num+cards.length>1) player.recover(); + await player.promises.give(event.cards,event.target); + if(num<2&&num+event.cards.length>1) await player.promises.recover(); }, ai:{ order:function(skill,player){ From 301da21725d73985912234ff1da3b34f151ab5ee Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:01:49 +0800 Subject: [PATCH 20/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85rende1?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index 2e1341cc1..fa9eed7ce 100755 --- a/character/standard.js +++ b/character/standard.js @@ -887,7 +887,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ rende1:{ trigger:{player:'phaseUseBegin'}, silent:true, - content:function(){ + async content(event,trigger,player){ player.storage.rende=0; } }, From cc55589fb505fe9c4a0aec2ac1a32c2f03870c59 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:16:02 +0800 Subject: [PATCH 21/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85jijiang1?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 73 ++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/character/standard.js b/character/standard.js index fa9eed7ce..b7119137e 100755 --- a/character/standard.js +++ b/character/standard.js @@ -928,48 +928,43 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return event.skill=='jijiang'; }, forced:true, - content:function(){ - "step 0" + async content(event,trigger,player){ delete trigger.skill; trigger.getParent().set('jijiang',true); - "step 1" - if(event.current==undefined) event.current=player.next; - if(event.current==player){ - player.addTempSkill('jijiang3'); - event.finish(); - trigger.cancel(); - trigger.getParent().goto(0); - } - else if(event.current.group=='shu'){ - var next=event.current.chooseToRespond('是否替'+get.translation(player)+'打出一张杀?',{name:'sha'}); - next.set('ai',function(){ - var event=_status.event; - return (get.attitude(event.player,event.source)-2); - }); - next.set('source',player); - next.set('jijiang',true); - next.set('skillwarn','替'+get.translation(player)+'打出一张杀'); - next.noOrdering=true; - next.autochoose=lib.filter.autoRespondSha; - } - else{ - event.current=event.current.next; - event.redo(); - } - "step 2" - if(result.bool){ - event.finish(); - trigger.card=result.card; - trigger.cards=result.cards; - trigger.throw=false; - if(typeof event.current.ai.shown=='number'&&event.current.ai.shown<0.95){ - event.current.ai.shown+=0.3; - if(event.current.ai.shown>0.95) event.current.ai.shown=0.95; + while(true){ + let bool,card,cards; + if(event.current==undefined) event.current=player.next; + if(event.current==player){ + player.addTempSkill('jijiang3'); + trigger.cancel(); + trigger.getParent().goto(0); + return; } - } - else{ - event.current=event.current.next; - event.goto(1); + else if(event.current.group=='shu'){ + const next=event.current.promises.chooseToRespond('是否替'+get.translation(player)+'打出一张杀?',{name:'sha'}); + next.set('ai',()=>{ + const event=_status.event; + return (get.attitude(event.player,event.source)-2); + }); + next.set('source',player); + next.set('jijiang',true); + next.set('skillwarn','替'+get.translation(player)+'打出一张杀'); + next.noOrdering=true; + next.autochoose=lib.filter.autoRespondSha; + ({bool,card,cards}=(await next).result); + if(bool){ + trigger.card=card; + trigger.cards=cards; + trigger.throw=false; + if(typeof event.current.ai.shown=='number'&&event.current.ai.shown<0.95){ + event.current.ai.shown+=0.3; + if(event.current.ai.shown>0.95) event.current.ai.shown=0.95; + } + return; + } + else event.current=event.current.next; + } + else event.current=event.current.next; } } }, From 7630d68d9f1bb18b8756027b270385b794d84bf8 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:16:23 +0800 Subject: [PATCH 22/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85jijiang3?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index b7119137e..f25e49c7d 100755 --- a/character/standard.js +++ b/character/standard.js @@ -975,7 +975,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event){ return event.skill!='jijiang'&&event.skill!='qinwang'; }, - content:function(){ + async content(event,trigger,player){ player.removeSkill('jijiang3'); } }, From 5e8090b33b2f99f7271383a0b93d77ae0c2ab6c5 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:18:38 +0800 Subject: [PATCH 23/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85zhongyi?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index f25e49c7d..13a922e76 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1033,10 +1033,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, discard:false, lose:false, - content:function(){ + async content(event,trigger,player){ player.awakenSkill('zhongyi'); player.addTempSkill('zhongyi2','roundStart'); - player.addToExpansion(player,'give',cards).gaintag.add('zhongyi2'); + await player.promise.addToExpansion(player,'give',event.cards).gaintag.add('zhongyi2'); }, }, zhongyi2:{ From 4c89703368f6c24a3723031fa21fab99a2644c59 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:19:18 +0800 Subject: [PATCH 24/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85zhongyi2?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index 13a922e76..d49877787 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1036,7 +1036,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ async content(event,trigger,player){ player.awakenSkill('zhongyi'); player.addTempSkill('zhongyi2','roundStart'); - await player.promise.addToExpansion(player,'give',event.cards).gaintag.add('zhongyi2'); + await player.promises.addToExpansion(player,'give',event.cards).gaintag.add('zhongyi2'); }, }, zhongyi2:{ @@ -1047,7 +1047,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return event.getParent().name=='sha'&&event.source&&event.source.isFriendOf(player); }, - content:function(){trigger.num++}, + async content(event,trigger,player){trigger.num++}, intro:{content:'expansion',markcount:'expansion'}, onremove:function(player,skill){ var cards=player.getExpansions(skill); From 1c034983d90577c0a8da4dc831e6b102514d1c12 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:19:58 +0800 Subject: [PATCH 25/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85paoxiao?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index d49877787..d13f3549e 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1067,7 +1067,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return !event.audioed&&event.card.name=='sha'&&player.countUsed('sha',true)>1&&event.getParent().type=='phase'; }, - content:function(){ + async content(event,trigger,player){ trigger.audioed=true; }, mod:{ From 6c5e9ec96dda4bb2c707490198d0793e89ab0dbe Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:29:35 +0800 Subject: [PATCH 26/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85guanxing?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 53 ++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/character/standard.js b/character/standard.js index d13f3549e..20f09ab80 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1092,31 +1092,25 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'phaseZhunbeiBegin'}, frequent:true, preHidden:true, - content:function(){ - "step 0" - var num=Math.min(5,game.countPlayer()); - if(player.hasSkill('yizhi')&&player.hasSkill('guanxing')){ - num=5; - } - var cards=get.cards(num); - game.cardsGotoOrdering(cards); - var next=player.chooseToMove(); + async content(event,trigger,player){ + const num=player.hasSkill('yizhi')&&player.hasSkill('guanxing')?5:Math.min(5,game.countPlayer()); + const cards=get.cards(num); + await game.cardsGotoOrdering(cards).toPromise(); + const next=player.promises.chooseToMove(); next.set('list',[ ['牌堆顶',cards], ['牌堆底'], ]); next.set('prompt','观星:点击将牌移动到牌堆顶或牌堆底'); - next.processAI=function(list){ - var cards=list[0][1],player=_status.event.player; - var top=[]; - var judges=player.getCards('j'); - var stopped=false; + next.processAI=list=>{ + const cards=list[0][1],player=_status.event.player; + const top=[]; + const judges=player.getCards('j'); + let stopped=false; if(!player.hasWuxie()){ - for(var i=0;ijudge(b)-judge(a)); if(judge(cards[0])<0){ stopped=true;break; } @@ -1125,11 +1119,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } } } - var bottom; + let bottom; if(!stopped){ - cards.sort(function(a,b){ - return get.value(b,player)-get.value(a,player); - }); + cards.sort((a,b)=>get.value(b,player)-get.value(a,player)); while(cards.length){ if(get.value(cards[0],player)<=5) break; top.unshift(cards.shift()); @@ -1138,22 +1130,21 @@ game.import('character',function(lib,game,ui,get,ai,_status){ bottom=cards; return [top,bottom]; } - "step 1" - var top=result.moved[0]; - var bottom=result.moved[1]; + const {result:{moved}}=await next; + const top=moved[0]; + const bottom=moved[1]; top.reverse(); - game.cardsGotoPile( + await game.cardsGotoPile( top.concat(bottom), ['top_cards',top], - function(event,card){ + (event,card)=>{ if(event.top_cards.includes(card)) return ui.cardPile.firstChild; return null; } - ) + ).toPromise(); player.popup(get.cnNumber(top.length)+'上'+get.cnNumber(bottom.length)+'下'); game.log(player,'将'+get.cnNumber(top.length)+'张牌置于牌堆顶'); - "step 2" - game.delayx(); + await game.asyncDelayx(); }, ai:{ threaten:1.2 From 9cf1d6334ea5beb6da0163e56426dfef6e2cf8b0 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:31:03 +0800 Subject: [PATCH 27/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85longdan?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index 20f09ab80..e61a5eb16 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1198,8 +1198,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!get.zhu(player,'shouyue')) return false; return event.skill=='longdan_sha'||event.skill=='longdan_shan'; }, - content:function(){ - player.draw(); + async content(event,trigger,player){ + await player.promises.draw(); player.storage.fanghun2++; } }, From 8a044c6292941051ac5ea8182602423105d1623c Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:33:54 +0800 Subject: [PATCH 28/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85tieji=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/character/standard.js b/character/standard.js index e61a5eb16..86eebe67f 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1294,9 +1294,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, logTarget:'target', preHidden:true, - content:function(){ - "step 0" - player.judge(function(card){ + async content(event,trigger,player){ + const judgeEvent=player.promises.judge(card=>{ if(get.zhu(_status.event.player,'shouyue')){ if(get.suit(card)!='spade') return 2; } @@ -1304,11 +1303,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(get.color(card)=='red') return 2; } return -0.5; - }).judge2=function(result){ - return result.bool; - }; - "step 1" - if(result.bool){ + }); + judgeEvent.judge2=result=>result.bool; + const {result:{bool}}=await judgeEvent; + if(bool){ trigger.getParent().directHit.add(trigger.target); } }, From 72e0d6274db9c6442e7a5ce09b062affe4c9a6a2 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:34:27 +0800 Subject: [PATCH 29/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85jizhi=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index 86eebe67f..4bef811cb 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1326,8 +1326,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event){ return (get.type(event.card)=='trick'&&event.card.isCard); }, - content:function(){ - player.draw(); + async content(event,trigger,player){ + await player.promises.draw(); }, ai:{ threaten:1.4, From 8957b3920f76f1867b6da719a4f4446d5c1111bc Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:37:13 +0800 Subject: [PATCH 30/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85xinjizhi?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/character/standard.js b/character/standard.js index 4bef811cb..ce562169e 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1346,25 +1346,19 @@ game.import('character',function(lib,game,ui,get,ai,_status){ init:function(player){ player.storage.xinjizhi=0; }, - content:function(){ - 'step 0' - player.draw(); - 'step 1' + async content(event, trigger, player){ + const {result}=await player.promises.draw(); if(get.is.altered('xinjizhi')&&get.type(result[0])=='basic'){ event.card=result[0]; - player.chooseBool('是否弃置'+get.translation(event.card)+'并令本回合手牌上限+1?').set('ai',function(evt,player){ + const {result:{bool}}=await player.promises.chooseBool('是否弃置'+get.translation(event.card)+'并令本回合手牌上限+1?').set('ai',(evt,player)=>{ return _status.currentPhase==player&&player.needsToDiscard(-3)&&_status.event.value<6; }).set('value',get.value(event.card,player)); - } - else{ - event.finish(); - } - 'step 2' - if(result.bool){ - player.discard(event.card); - player.storage.xinjizhi++; - if(_status.currentPhase==player){ - player.markSkill('xinjizhi'); + if(bool){ + player.discard(event.card); + player.storage.xinjizhi++; + if(_status.currentPhase==player){ + player.markSkill('xinjizhi'); + } } } }, @@ -1388,7 +1382,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ clear:{ trigger:{global:'phaseAfter'}, silent:true, - content:function(){ + async content(event, trigger, player){ player.storage.xinjizhi=0; player.unmarkSkill('xinjizhi'); } From f58869b8b6330eadb7ac76a84266017f6ab6d19a Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:40:47 +0800 Subject: [PATCH 31/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85xinzhiheng?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/character/standard.js b/character/standard.js index ce562169e..578dd8118 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1438,11 +1438,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 6-get.value(card) }, delay:0, - content:function(){ - 'step 0' - if(!player.hasSkill('xinzhiheng_delay')) game.delayx(); - 'step 1' - player.draw(cards.length); + async content(event,trigger,player){ + if(!player.hasSkill('xinzhiheng_delay')) await game.asyncDelayx(); + await player.draw(event.cards.length); }, group:'xinzhiheng_draw', subSkill:{ @@ -1458,7 +1456,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } return false; }, - content:function(){ + async content(event,trigger,player){ player.draw(); player.addTempSkill('xinzhiheng_delay','xinzhihengAfter'); } From 133d7263bbd40b3f5a50cf90c8ac38d9ad60312b Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:41:12 +0800 Subject: [PATCH 32/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85zhiheng?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index 578dd8118..4c934cbe8 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1498,8 +1498,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ check:function(card){ return 6-get.value(card) }, - content:function(){ - player.draw(cards.length); + async content(event,trigger,player){ + player.draw(event.cards.length); }, ai:{ order:1, From aa61be899f3a1b2b3cf684427eeb29da2f3ab3f4 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:41:28 +0800 Subject: [PATCH 33/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85jiuyuan?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index 4c934cbe8..2c62cd2e4 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1521,7 +1521,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(event.player.group!='wu') return false; return true; }, - content:function(){ + async content(event,trigger,player){ trigger.baseDamage++; } }, From e7f8e89d5c1f35ef6df2e004d86a287f9d7482b6 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:42:11 +0800 Subject: [PATCH 34/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85xinjiuyuan?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index 2c62cd2e4..360ce1bc6 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1540,8 +1540,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(event.player.group!='wu') return false; return true; }, - content:function(){ - player.recover(); + async content(event,trigger,player){ + await player.promises.recover(); }, global:'xinjiuyuan2', }, From 9fc9ebe5470ee8d74f39d20c2a7258a2e6bcd61b Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:46:03 +0800 Subject: [PATCH 35/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85xinjiuyuan2?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/character/standard.js b/character/standard.js index 360ce1bc6..8e1805dbc 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1557,29 +1557,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }); }, direct:true, - content:function(){ - 'step 0' - var list=game.filterPlayer(function(target){ - return player!=target&&target.isDamaged()&&target.hpplayer!=target&&target.isDamaged()&&target.hp0){ + const current=event.list.shift(); event.current=current; - player.chooseBool(get.prompt('xinjiuyuan',current)).set('choice',get.attitude(player,current)>0); + const {result:{bool}}=await player.promises.chooseBool(get.prompt('xinjiuyuan',current)).set('choice',get.attitude(player,current)>0); + if(bool){ + player.logSkill('xinjiuyuan',event.current); + await event.current.promises.recover(); + await player.promises.draw(); + } } - else{ - event.finish(); - } - 'step 2' - if(result.bool){ - player.logSkill('xinjiuyuan',event.current); - event.current.recover(); - player.draw(); - } - event.goto(1); } }, qixi:{ From bd4fe272a24f98110974a810f6e4e7e32cf2d3d0 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:48:28 +0800 Subject: [PATCH 36/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85xinjizhi?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E5=88=A0=E9=99=A4alter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 42 ++---------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/character/standard.js b/character/standard.js index 8e1805dbc..4f51e93ab 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1340,54 +1340,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ frequent:true, // alter:true, filter:function(event){ - if(!get.is.altered('xinjizhi')&&get.type(event.card)=='delay') return false; + if(get.type(event.card)=='delay') return false; return (get.type(event.card,'trick')=='trick'&&event.cards[0]&&event.cards[0]==event.card); }, - init:function(player){ - player.storage.xinjizhi=0; - }, async content(event, trigger, player){ - const {result}=await player.promises.draw(); - if(get.is.altered('xinjizhi')&&get.type(result[0])=='basic'){ - event.card=result[0]; - const {result:{bool}}=await player.promises.chooseBool('是否弃置'+get.translation(event.card)+'并令本回合手牌上限+1?').set('ai',(evt,player)=>{ - return _status.currentPhase==player&&player.needsToDiscard(-3)&&_status.event.value<6; - }).set('value',get.value(event.card,player)); - if(bool){ - player.discard(event.card); - player.storage.xinjizhi++; - if(_status.currentPhase==player){ - player.markSkill('xinjizhi'); - } - } - } + await player.promises.draw(); }, ai:{ threaten:1.4, noautowuxie:true, }, - mod:{ - maxHandcard:function(player,num){ - if(get.is.altered('xinjizhi')&&_status.currentPhase==player){ - return num+player.storage.xinjizhi; - } - return num; - } - }, - intro:{ - content:'本回合手牌上限+#' - }, - group:'xinjizhi_clear', - subSkill:{ - clear:{ - trigger:{global:'phaseAfter'}, - silent:true, - async content(event, trigger, player){ - player.storage.xinjizhi=0; - player.unmarkSkill('xinjizhi'); - } - } - } }, qicai:{ mod:{ From 6cfc6f09a4b4fbee8a15d8d7ac59e7883d4de93d Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:49:08 +0800 Subject: [PATCH 37/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85keji=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index 4f51e93ab..d15d9c156 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1563,7 +1563,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } return true; }, - content:function(){ + async content(event,trigger,player){ trigger.cancel(); } }, From a160e4e065aa0ae93d2f3e59a3a74e3b3c20f063 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:50:43 +0800 Subject: [PATCH 38/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85kurou=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/character/standard.js b/character/standard.js index d15d9c156..a710170d0 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1571,11 +1571,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, enable:'phaseUse', prompt:'失去1点体力并摸两张牌', - content:function(){ - "step 0" - player.loseHp(1); - "step 1" - player.draw(2); + async content(event,trigger,player){ + await player.promises.loseHp(1); + await player.promises.draw(2); }, ai:{ basic:{ From 93271e4676c30d82377d06896256dd1b5b42f8a5 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:51:08 +0800 Subject: [PATCH 39/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85yingzi?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index a710170d0..d8ebb3e35 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1596,7 +1596,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return !event.numFixed; }, - content:function(){ + async content(event,trigger,player){ trigger.num++; }, ai:{ From 29e6c17a08e0120827a9e96194b5cc9041400f96 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 14:54:03 +0800 Subject: [PATCH 40/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85fanjian?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/character/standard.js b/character/standard.js index d8ebb3e35..9274e17fa 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1613,9 +1613,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filterTarget:function(card,player,target){ return player!=target; }, - content:function(){ - "step 0" - target.chooseControl('heart2','diamond2','club2','spade2').set('ai',function(event){ + async content(event,trigger,player){ + const target=event.target; + const {result:{control}}=await target.promises.chooseControl('heart2','diamond2','club2','spade2').set('ai',event=>{ switch(Math.floor(Math.random()*6)){ case 0:return 'heart2'; case 1:case 4:case 5:return 'diamond2'; @@ -1623,13 +1623,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ case 3:return 'spade2'; } }); - "step 1" - game.log(target,'选择了'+get.translation(result.control)); - event.choice=result.control; + game.log(target,'选择了'+get.translation(control)); + event.choice=control; target.chat('我选'+get.translation(event.choice)); - target.gainPlayerCard(player,true,'h'); - "step 2" - if(result.bool&&get.suit(result.cards[0],player)+'2'!=event.choice) target.damage('nocard'); + const {result:{bool,cards}}=await target.promises.gainPlayerCard(player,true,'h'); + if(bool&&get.suit(cards[0],player)+'2'!=event.choice) await target.promises.damage('nocard'); }, ai:{ order:1, From ee7c41a849b845642054ea9baa452d8d7e727f22 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:16:41 +0800 Subject: [PATCH 41/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85liuli=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/character/standard.js b/character/standard.js index 9274e17fa..9ab79254e 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1678,22 +1678,19 @@ game.import('character',function(lib,game,ui,get,ai,_status){ current!=player&&lib.filter.targetEnabled(event.card,event.player,current); }); }, - content:function(){ - "step 0" - var next=player.chooseCardTarget({ + async content(event,trigger,player){ + const {result:{bool,targets,cards}}=await player.promises.chooseCardTarget({ position:'he', filterCard:lib.filter.cardDiscardable, - filterTarget:function(card,player,target){ - var trigger=_status.event; + filterTarget:(card,player,target)=>{ + const trigger=_status.event; if(player.inRange(target)&&target!=trigger.source){ if(lib.filter.targetEnabled(trigger.card,trigger.source,target)) return true; } return false; }, - ai1:function(card){ - return get.unuseful(card)+9; - }, - ai2:function(target){ + ai1:card=>get.unuseful(card)+9, + ai2:target=>{ if(_status.event.player.countCards('h','shan')){ return -get.attitude(_status.event.player,target); } @@ -1713,12 +1710,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ source:trigger.player, card:trigger.card, }).setHiddenSkill(event.name); - "step 1" - if(result.bool){ - var target=result.targets[0]; + if(bool){ + const target=targets[0]; player.logSkill(event.name,target); - player.discard(result.cards); - var evt=trigger.getParent(); + await player.promises.discard(cards); + const evt=trigger.getParent(); evt.triggeredTargets2.remove(player); evt.targets.remove(player); evt.targets.push(target); From 4be531224ef833a6672c1f24a0ae370696ef390c Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:18:07 +0800 Subject: [PATCH 42/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85lianying?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index 9ab79254e..e33794d56 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1767,8 +1767,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var evt=event.getl(player); return evt&&evt.player==player&&evt.hs&&evt.hs.length>0; }, - content:function(){ - player.draw(); + async content(event,trigger,player){ + await player.promises.draw(); }, ai:{ threaten:0.8, From e2664760dd1d83b773506efafd9a1f68187bbf32 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:26:42 +0800 Subject: [PATCH 43/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85xiaoji?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96yiji=E6=8A=80=E8=83=BD=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/character/standard.js b/character/standard.js index e33794d56..1bb078e9d 100755 --- a/character/standard.js +++ b/character/standard.js @@ -554,7 +554,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ async content(event,trigger,player){ event.count=trigger.num; // event.goto -> while - while(event.count>0){ + while(true){ event.count--; const {cards}=await game.cardsGotoOrdering(get.cards(2)).toPromise(); if(_status.connectMode) game.broadcastAll(function(){_status.noclearcountdown=true}); @@ -1797,20 +1797,19 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var evt=event.getl(player); return evt&&evt.player==player&&evt.es&&evt.es.length>0; }, - content:function(){ - "step 0" + async content(event,trigger,player){ event.count=trigger.getl(player).es.length; - "step 1" - event.count--; - player.draw(2); - "step 2" - if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){ - player.chooseBool(get.prompt2('xiaoji')).set('frequentSkill','xiaoji').ai=lib.filter.all; - } - "step 3" - if(result.bool){ - player.logSkill('xiaoji'); - event.goto(1); + while(true){ + event.count--; + await player.promises.draw(2); + if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){ + const chooseBoolEvent=player.promises.chooseBool(get.prompt2('xiaoji')).set('frequentSkill','xiaoji'); + chooseBoolEvent.ai=lib.filter.all; + const {result:{bool}}=await chooseBoolEvent; + if(bool){ + player.logSkill('xiaoji'); + }else break; + } } }, ai:{ From 2fa474b4e7e4167abfcf33f9fe7e2b18fd7c73e7 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:27:37 +0800 Subject: [PATCH 44/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85jieyin?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/character/standard.js b/character/standard.js index 1bb078e9d..b4c75ec1a 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1842,9 +1842,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(target==player) return false; return true; }, - content:function(){ - player.recover(); - target.recover(); + async content(event,trigger,player){ + await player.promises.recover(); + await event.target.promises.recover(); }, ai:{ order:5.5, From e1aaf6037bb3e0c87bb9ad80972e955480f46fa4 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:31:52 +0800 Subject: [PATCH 45/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85xinjieyin?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/character/standard.js b/character/standard.js index b4c75ec1a..c8d037ad6 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1901,23 +1901,22 @@ game.import('character',function(lib,game,ui,get,ai,_status){ discard:false, delay:0, lose:false, - content:function(){ - 'step 0' + async content(event,trigger,player){ + const {cards,target}=event; if(get.position(cards[0])=='e'){ player.$give(cards,target); - target.equip(cards[0]); + await target.promises.equip(cards[0]); } else{ - player.discard(cards); + await player.promises.discard(cards); } - 'step 1' if(player.hp>target.hp){ - player.draw(); - if(target.isDamaged()) target.recover(); + await player.promises.draw(); + if(target.isDamaged()) await target.promises.recover(); } else if(player.hp Date: Sat, 9 Dec 2023 15:32:16 +0800 Subject: [PATCH 46/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85qingnang?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index c8d037ad6..fe7341a22 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2013,8 +2013,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(target.hp>=target.maxHp) return false; return true; }, - content:function(){ - target.recover(); + async content(event,trigger,player){ + await event.target.promises.recover(); }, ai:{ order:9, From 97887dcc585c89ffbf04df7fdf1ba0d28816c409 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:33:20 +0800 Subject: [PATCH 47/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85wushuang1?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/character/standard.js b/character/standard.js index fe7341a22..44dd5e943 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2087,9 +2087,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, //priority:-1, logTarget:'target', - content:function(){ - var id=trigger.target.playerid; - var map=trigger.getParent().customArgs; + async content(event,trigger,player){ + const id=trigger.target.playerid; + const map=trigger.getParent().customArgs; if(!map[id]) map[id]={}; if(typeof map[id].shanRequired=='number'){ map[id].shanRequired++; From 9c9f9d04c2e880ae2471b704f5e1085d221be094 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:33:51 +0800 Subject: [PATCH 48/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85wushuang2?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/character/standard.js b/character/standard.js index 44dd5e943..0368e29bd 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2117,10 +2117,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return event.card.name=='juedou'; }, //priority:-1, - content:function(){ - var id=(player==trigger.player?trigger.target:trigger.player)['playerid']; - var idt=trigger.target.playerid; - var map=trigger.getParent().customArgs; + async content(event,trigger,player){ + const id=(player==trigger.player?trigger.target:trigger.player)['playerid']; + const idt=trigger.target.playerid; + const map=trigger.getParent().customArgs; if(!map[idt]) map[idt]={}; if(!map[idt].shaReq) map[idt].shaReq={}; if(!map[idt].shaReq[id]) map[idt].shaReq[id]=1; From 4247130d288381d9647a8109f9751ea8f4b1a7d1 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:37:00 +0800 Subject: [PATCH 49/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85zhanshen?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/character/standard.js b/character/standard.js index 0368e29bd..ce746cc32 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2144,11 +2144,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return target.isFriendOf(player); }).length>0 }, - content:function(){ + async content(event,trigger,player){ player.awakenSkill('zhanshen'); - var card=player.getEquips(1); - if(cards.length) player.discard(card); - player.loseMaxHp(); + const cards=player.getEquips(1); + if(cards.length) await player.promises.discard(cards); + await player.promises.loseMaxHp(); player.addSkill('mashu'); player.addSkill('shenji'); }, From 4c18380ea3b9737d3447eb0f69be081bbdd49082 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:39:00 +0800 Subject: [PATCH 50/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85lijian?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/character/standard.js b/character/standard.js index ce746cc32..be97c5996 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2189,9 +2189,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ targetprompt:['先出杀','后出杀'], selectTarget:2, multitarget:true, - content:function(){ - targets[1].useCard({name:'juedou',isCard:true},'nowuxie',targets[0],'noai').animate=false; - game.delay(0.5); + async content(event,trigger,player){ + const useCardEvent=event.targets[1].useCard({name:'juedou',isCard:true},'nowuxie',event.targets[0],'noai'); + useCardEvent.animate = false; + await useCardEvent; + await game.asyncDelay(0.5); }, ai:{ order:8, From 7e6b94cf738aaa686454f8bda08abb4638689877 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:39:36 +0800 Subject: [PATCH 51/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85biyue=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index be97c5996..63268c6fb 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2216,8 +2216,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'phaseJieshuBegin'}, frequent:true, preHidden:true, - content:function(){ - player.draw(); + async content(event,trigger,player){ + await player.promise.draw(); }, }, xinbiyue:{ From 3fb277914aed4464cea5e129073c149f5eea4f30 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:40:55 +0800 Subject: [PATCH 52/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85xinbiyue?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/character/standard.js b/character/standard.js index 63268c6fb..39c60f9eb 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2225,12 +2225,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'phaseJieshuBegin'}, frequent:true, // alter:true, - content:function(){ - var num=1; - if(get.is.altered('xinbiyue')&&!player.countCards('h')){ - num=2; - } - player.draw(num); + async content(event,trigger,player){ + await player.promise.draw(1); }, }, yaowu:{ From 395131abb188d25ae392b0fe440d4e9f070ba530 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:41:40 +0800 Subject: [PATCH 53/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85yaowu=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index 39c60f9eb..8f1f4368a 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2243,8 +2243,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ check:function(){ return false; }, - content:function(){ - trigger.source.chooseDrawRecover(true); + async content(event,trigger,player){ + await trigger.source.promise.chooseDrawRecover(true); }, ai:{ effect:{ From 78b159049f06e644ff9d2c26547a6ef3127029a1 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:44:57 +0800 Subject: [PATCH 54/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85new=5Fjiangchi?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content,=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=B8=A4=E5=A4=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/character/standard.js b/character/standard.js index 8f1f4368a..d3226aa18 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2217,7 +2217,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ frequent:true, preHidden:true, async content(event,trigger,player){ - await player.promise.draw(); + await player.promises.draw(); }, }, xinbiyue:{ @@ -2226,7 +2226,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ frequent:true, // alter:true, async content(event,trigger,player){ - await player.promise.draw(1); + await player.promises.draw(1); }, }, yaowu:{ @@ -2244,7 +2244,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return false; }, async content(event,trigger,player){ - await trigger.source.promise.chooseDrawRecover(true); + await trigger.source.promises.chooseDrawRecover(true); }, ai:{ effect:{ @@ -2262,13 +2262,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player:"phaseDrawEnd", }, direct:true, - content:function (){ - "step 0" - var list=['弃牌','摸牌','取消']; + async content(event,trigger,player){ + const list=['弃牌','摸牌','取消']; if(!player.countCards('he')) list.remove('弃牌'); - player.chooseControl(list,function(){ - var player=_status.event.player; - if(list.contains('弃牌')){ + const {result:{control}}=await player.promises.chooseControl(list,()=>{ + const player=_status.event.player; + if(list.includes('弃牌')){ if(player.countCards('h')>3&&player.countCards('h','sha')>1){ return '弃牌'; } @@ -2281,14 +2280,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } return 'cancel2'; }).set('prompt',get.prompt2('new_jiangchi')); - "step 1" - if(result.control=='弃牌'){ - player.chooseToDiscard(true,'he'); + if(control=='弃牌'){ + await player.promises.chooseToDiscard(true,'he'); player.addTempSkill('jiangchi2','phaseUseEnd'); player.logSkill('new_jiangchi'); } - else if(result.control=='摸牌'){ - player.draw(); + else if(control=='摸牌'){ + await player.promises.draw(); player.addTempSkill('new_jiangchi3','phaseEnd'); player.logSkill('new_jiangchi'); } From 093507cc9d6fb7d3b0d0dbe9c52eb08b62d6d38a Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:47:51 +0800 Subject: [PATCH 55/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85xinfu=5Fjijie?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/character/standard.js b/character/standard.js index d3226aa18..658c05174 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2316,13 +2316,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ enable:"phaseUse", usable:1, audio:2, - content:function(){ - 'step 0' - var card=get.bottomCards()[0]; - game.cardsGotoOrdering(card); + async content(event,trigger,player){ + const card=get.bottomCards()[0]; + await game.cardsGotoOrdering(card).toPromise(); event.card=card; - player.chooseTarget(true).set('ai',function(target){ - var att=get.attitude(_status.event.player,target); + const {result:{bool,targets}}=await player.promises.chooseTarget(true).set('ai',target=>{ + let att=get.attitude(_status.event.player,target); if(_status.event.du){ if(target.hasSkillTag('nodu')) return 0.5; return -att; @@ -2336,12 +2335,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ '机捷:选择一名角色获得此牌', [card] ]); - 'step 1' - if(result.bool){ - var target=result.targets[0]; + if(bool){ + const target=targets[0]; player.line(target,'green'); - var next=target.gain(card,'draw'); - next.giver=player; + const gainEvent=target.promises.gain(card,'draw'); + gainEvent.giver=player; + await gainEvent; } }, ai:{ From cac9ab08f00ad8c951f9e7aa8a39557c41aeec4b Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:50:45 +0800 Subject: [PATCH 56/71] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85xinfu=5Fjiyuan?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/character/standard.js b/character/standard.js index 658c05174..d005526fe 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2366,25 +2366,21 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }); }, direct:true, - content:function(){ - 'step 0' + async content(event,trigger,player){ if(trigger.name!='loseAsync') event.targets=[trigger.player]; - else event.targets=game.filterPlayer(function(current){ - return current!=player&&trigger.getg(current).length>0; - }); - 'step 1' - var target=event.targets.shift(); - event.target=target; - player.chooseBool(get.prompt2('xinfu_jiyuan',target)).set('ai',function(){ - var evt=_status.event; - return get.attitude(player,evt.getParent().target)>0; - }); - 'step 2' - if(result.bool){ - player.logSkill('xinfu_jiyuan',target); - target.draw(); - } - if(targets.length>0) event.goto(1); + else event.targets=game.filterPlayer(current=>current!=player&&trigger.getg(current).length>0); + do{ + const target=event.targets.shift(); + event.target=target; + const {result:{bool}}=await player.promises.chooseBool(get.prompt2('xinfu_jiyuan',target)).set('ai',()=>{ + const evt=_status.event; + return get.attitude(player,evt.getParent().target)>0; + }); + if(bool){ + player.logSkill('xinfu_jiyuan',target); + await target.promises.draw(); + } + }while(event.targets.length>0); }, }, }, From 5bdafa9de25fb1d25cf95f962afeaf6dd9abb954 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 15:55:55 +0800 Subject: [PATCH 57/71] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dstdkuangfu=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E6=B2=A1=E4=BD=BF=E7=94=A8await=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index d005526fe..ca3a24aa1 100755 --- a/character/standard.js +++ b/character/standard.js @@ -121,8 +121,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return player.isPhaseUsing()&&event.card&&event.card.name=='sha'&&event.player!=player&&event.player.isIn(); }, async content(event,trigger,player){ - if(trigger.player.hp Date: Sat, 9 Dec 2023 15:58:05 +0800 Subject: [PATCH 58/71] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtuxi=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E6=B2=A1=E4=BD=BF=E7=94=A8game.delay=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index ca3a24aa1..e8d18d97c 100755 --- a/character/standard.js +++ b/character/standard.js @@ -484,7 +484,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.logSkill('tuxi',targets); await player.promises.gainMultiple(targets); trigger.changeToZero(); - game.delay(); + await game.asyncDelay(); }, ai:{ threaten:2, From 8195f4f3db9530a137254a2d1327e96320e4ad8c Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 16:03:35 +0800 Subject: [PATCH 59/71] =?UTF-8?q?xinqicai=E6=8A=80=E8=83=BD=E5=88=A0?= =?UTF-8?q?=E9=99=A4alter=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/character/standard.js b/character/standard.js index e8d18d97c..7ef2ca5c5 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1365,12 +1365,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ targetInRange:function(card,player,target,now){ var type=get.type(card); if(type=='trick'||type=='delay') return true; - }, - canBeDiscarded:function(card){ - if(get.is.altered('xinqicai')&&get.position(card)=='e') return false; - }, - cardDiscardable:function(card){ - if(get.is.altered('xinqicai')&&get.position(card)=='e') return false; } }, }, From 9480300dd20c7a03cdc3fab7d5f4d7ca6ce2ad7f Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 16:04:19 +0800 Subject: [PATCH 60/71] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dxinzhiheng=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E6=B2=A1=E4=BD=BF=E7=94=A8promises=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index 7ef2ca5c5..c406b390f 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1396,7 +1396,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ delay:0, async content(event,trigger,player){ if(!player.hasSkill('xinzhiheng_delay')) await game.asyncDelayx(); - await player.draw(event.cards.length); + await player.promises.draw(event.cards.length); }, group:'xinzhiheng_draw', subSkill:{ From bbf5e455cd5e3e37b2e12cb57e438fe9cbcae77d Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 16:04:41 +0800 Subject: [PATCH 61/71] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dzhiheng=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E6=B2=A1=E4=BD=BF=E7=94=A8promises=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index c406b390f..3eddb5c38 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1455,7 +1455,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 6-get.value(card) }, async content(event,trigger,player){ - player.draw(event.cards.length); + await player.promises.draw(event.cards.length); }, ai:{ order:1, From 75474dfd2e9047c2fa28bff97ad0590162e8170a Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 16:07:20 +0800 Subject: [PATCH 62/71] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dlijian=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E7=9A=84=E7=BC=A9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/character/standard.js b/character/standard.js index 3eddb5c38..892b61ff6 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2185,7 +2185,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ multitarget:true, async content(event,trigger,player){ const useCardEvent=event.targets[1].useCard({name:'juedou',isCard:true},'nowuxie',event.targets[0],'noai'); - useCardEvent.animate = false; + useCardEvent.animate=false; await useCardEvent; await game.asyncDelay(0.5); }, From 2da3b7423e9f9385c265cb837f62bae97287a7cf Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 16:36:54 +0800 Subject: [PATCH 63/71] =?UTF-8?q?=E4=BC=98=E5=8C=96jijiang1=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E7=9A=84=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/character/standard.js b/character/standard.js index 892b61ff6..0fdab6f3a 100755 --- a/character/standard.js +++ b/character/standard.js @@ -932,7 +932,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ delete trigger.skill; trigger.getParent().set('jijiang',true); while(true){ - let bool,card,cards; if(event.current==undefined) event.current=player.next; if(event.current==player){ player.addTempSkill('jijiang3'); @@ -941,17 +940,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return; } else if(event.current.group=='shu'){ - const next=event.current.promises.chooseToRespond('是否替'+get.translation(player)+'打出一张杀?',{name:'sha'}); - next.set('ai',()=>{ + const chooseToRespondEvent=event.current.promises.chooseToRespond('是否替'+get.translation(player)+'打出一张杀?',{name:'sha'}); + chooseToRespondEvent.set('ai',()=>{ const event=_status.event; return (get.attitude(event.player,event.source)-2); }); - next.set('source',player); - next.set('jijiang',true); - next.set('skillwarn','替'+get.translation(player)+'打出一张杀'); - next.noOrdering=true; - next.autochoose=lib.filter.autoRespondSha; - ({bool,card,cards}=(await next).result); + chooseToRespondEvent.set('source',player); + chooseToRespondEvent.set('jijiang',true); + chooseToRespondEvent.set('skillwarn','替'+get.translation(player)+'打出一张杀'); + chooseToRespondEvent.noOrdering=true; + chooseToRespondEvent.autochoose=lib.filter.autoRespondSha; + const {bool,card,cards}=(await chooseToRespondEvent).result; if(bool){ trigger.card=card; trigger.cards=cards; From 3f1f0a4514d134723a7a007997e525fd874d1c36 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 16:54:55 +0800 Subject: [PATCH 64/71] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 300 +++++++++++++++++++++--------------------- 1 file changed, 149 insertions(+), 151 deletions(-) diff --git a/character/standard.js b/character/standard.js index 0fdab6f3a..cbac476e5 100755 --- a/character/standard.js +++ b/character/standard.js @@ -117,7 +117,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{source:'damageSource'}, forced:true, usable:1, - filter:function(event,player){ + filter(event,player){ return player.isPhaseUsing()&&event.card&&event.card.name=='sha'&&event.player!=player&&event.player.isIn(); }, async content(event,trigger,player){ @@ -132,7 +132,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{global:'phaseZhunbeiBegin'}, forced:true, audio:'wangzun', - filter:function(event,player){ + filter(event,player){ return event.player.hp>player.hp; }, logTarget:'player', @@ -168,7 +168,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ rewangzun2:{ onremove:true, mod:{ - maxHandcard:function(player,num){ + maxHandcard(player,num){ return num-player.countMark('rewangzun2'); }, }, @@ -179,7 +179,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ logTarget:'target', audio:'tongji', direct:true, - filter:function(event,player){ + filter(event,player){ return event.card.name=='sha'&&event.player!=player&&!event.targets.contains(player)&& event.target.inRange(player)&&event.target.countCards('he')>0; }, @@ -220,7 +220,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ unique:true, zhuSkill:true, trigger:{player:['chooseToRespondBefore','chooseToUseBefore']}, - filter:function(event,player){ + filter(event,player){ if(event.responded) return false; if(player.storage.hujiaing) return false; if(!player.hasZhuSkill('hujia')) return false; @@ -229,7 +229,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return current!=player&¤t.group=='wei'; }); }, - check:function(event,player){ + check(event,player){ if(get.damageEffect(player,event.player,player)>=0) return false; return true; }, @@ -272,7 +272,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, ai:{ respondShan:true, - skillTagFilter:function(player){ + skillTagFilter(player){ if(player.storage.hujiaing) return false; if(!player.hasZhuSkill('hujia')) return false; return game.hasPlayer(function(current){ @@ -285,7 +285,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, preHidden:true, trigger:{player:'damageEnd'}, - filter:function(event,player){ + filter(event,player){ return get.itemtype(event.cards)=='cards'&&get.position(event.cards[0],true)=='o'; }, async content(event,trigger,player){ @@ -295,7 +295,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ maixie:true, maixie_hp:true, effect:{ - target:function(card,player,target){ + target(card,player,target){ if(player.hasSkillTag('jueqing',false,target)) return [1,-1]; if(get.tag(card,'damage')) return [1,0.55]; } @@ -307,7 +307,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'damageEnd'}, logTarget:'source', preHidden:true, - filter:function(event,player){ + filter(event,player){ return (event.source&&event.source.countGainableCards(player,event.source!=player?'he':'e')&&event.num>0); }, async content(event,trigger,player){ @@ -316,7 +316,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ maixie_defend:true, effect:{ - target:function(card,player,target){ + target(card,player,target){ if(player.countCards('he')>1&&get.tag(card,'damage')){ if(player.hasSkillTag('jueqing',false,target)) return [1,-1.5]; if(get.attitude(target,player)<0) return [1,1]; @@ -330,7 +330,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{global:'judge'}, direct:true, preHidden:true, - filter:function(event,player){ + filter(event,player){ return player.countCards(get.mode()=='guozhan'?'hes':'hs')>0; }, async content(event,trigger,player){ @@ -383,10 +383,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ganglie:{ audio:2, trigger:{player:'damageEnd'}, - filter:function(event,player){ + filter(event,player){ return (event.source!=undefined); }, - check:function(event,player){ + check(event,player){ return (get.attitude(player,event.source)<=0); }, logTarget:'source', @@ -411,7 +411,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ maixie_defend:true, effect:{ - target:function(card,player,target){ + target(card,player,target){ if(player.hasSkillTag('jueqing',false,target)) return [1,-1]; return 0.8; // if(get.tag(card,'damage')&&get.damageEffect(target,player,player)>0) return [1,0,0,-1.5]; @@ -451,7 +451,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ maixie_defend:true, effect:{ - target:function(card,player,target){ + target(card,player,target){ if(player.hasSkillTag('jueqing',false,target)) return [1,-1]; return 0.8; // if(get.tag(card,'damage')&&get.damageEffect(target,player,player)>0) return [1,0,0,-1.5]; @@ -463,7 +463,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, trigger:{player:'phaseDrawBegin1'}, direct:true, - filter:function(event,player){ + filter(event,player){ return !event.numFixed; }, async content(event,trigger,player){ @@ -494,7 +494,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ luoyi:{ audio:2, trigger:{player:'phaseDrawBegin2'}, - check:function(event,player){ + check(event,player){ if(player.skipList.includes('phaseUse')||player.countCards('h')<3) return false; if(!player.hasSha()) return false; return game.hasPlayer(function(current){ @@ -502,7 +502,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }); }, preHidden:true, - filter:function(event,player){ + filter(event,player){ return !event.numFixed&&event.num>0; }, async content(event,trigger,player){ @@ -512,7 +512,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, luoyi2:{ trigger:{source:'damageBegin1'}, - filter:function(event){ + filter(event){ return event.card&&(event.card.name=='sha'||event.card.name=='juedou')&&event.notLink(); }, forced:true, @@ -528,16 +528,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audioname:['re_guojia','xizhicai','gz_nagisa'], trigger:{player:'judgeEnd'}, preHidden:true, - frequent:function(event){ + frequent(event){ if(event.result.card.name=='du') return false; //if(get.mode()=='guozhan') return false; return true; }, - check:function(event){ + check(event){ if(event.result.card.name=='du') return false; return true; }, - filter:function(event,player){ + filter(event,player){ return get.position(event.result.card,true)=='o'; }, async content(event,trigger,player){ @@ -548,7 +548,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, trigger:{player:'damageEnd'}, frequent:true, - filter:function(event){ + filter(event){ return event.num>0; }, async content(event,trigger,player){ @@ -620,7 +620,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ maixie:true, maixie_hp:true, effect:{ - target:function(card,player,target){ + target(card,player,target){ if(get.tag(card,'damage')){ if(player.hasSkillTag('jueqing',false,target)) return [1,-2]; if(!target.hasFriend()) return; @@ -726,7 +726,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, mod:{ - ignoredHandcard:function(card,player){ + ignoredHandcard(card,player){ if(get.is.altered('xinluoshen')&&player.storage.xinluoshen&&player.storage.xinluoshen.contains(card)){ return true; } @@ -745,7 +745,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, qingguo:{ mod:{ - aiValue:function(player,card,num){ + aiValue(player,card,num){ if(get.name(card)!='shan'&&get.color(card)!='black') return; var cards=player.getCards('hs',function(card){ return get.name(card)=='shan'||get.color(card)=='black'; @@ -762,7 +762,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(get.name(card)=='shan') return Math.min(num,[6,4,3][Math.min(geti(),2)])*0.6; return Math.max(num,[6.5,4,3][Math.min(geti(),2)]); }, - aiUseful:function(){ + aiUseful(){ return lib.skill.qingguo.mod.aiValue.apply(this,arguments); }, }, @@ -770,24 +770,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, audioname:['sb_zhenji'], enable:['chooseToRespond','chooseToUse'], - filterCard:function(card){ + filterCard(card){ return get.color(card)=='black'; }, viewAs:{name:'shan'}, - viewAsFilter:function(player){ + viewAsFilter(player){ if(!player.countCards('hs',{color:'black'})) return false; }, position:'hs', prompt:'将一张黑色手牌当闪使用或打出', - check:function(){return 1}, + check(){return 1}, ai:{ order:3, respondShan:true, - skillTagFilter:function(player){ + skillTagFilter(player){ if(!player.countCards('hs',{color:'black'})) return false; }, effect:{ - target:function(card,player,target,current){ + target(card,player,target,current){ if(get.tag(card,'respondShan')&¤t<0) return 0.6 } } @@ -801,10 +801,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ discard:false, lose:false, delay:0, - filterTarget:function(card,player,target){ + filterTarget(card,player,target){ return player!=target; }, - check:function(card){ + check(card){ if(ui.selected.cards.length>1) return 0; if(ui.selected.cards.length&&ui.selected.cards[0].name=='du') return 0; if(!ui.selected.cards.length&&card.name=='du') return 20; @@ -845,14 +845,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(num<2&&num+event.cards.length>1) await player.promises.recover(); }, ai:{ - order:function(skill,player){ + order(skill,player){ if(player.hp1){ return 10; } return 1; }, result:{ - target:function(player,target){ + target(player,target){ if(target.hasSkillTag('nogain')) return 0; if(ui.selected.cards.length&&ui.selected.cards[0].name=='du'){ if(target.hasSkillTag('nodu')) return 0; @@ -868,7 +868,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, effect:{ - target:function(card,player,target){ + target(card,player,target){ if(player==target&&get.type(card)=='equip'){ if(player.countCards('e',{subtype:get.subtype(card)})){ var players=game.filterPlayer(); @@ -897,7 +897,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ unique:true, group:['jijiang1'], zhuSkill:true, - filter:function(event,player){ + filter(event,player){ if(!player.hasZhuSkill('jijiang')||!game.hasPlayer(function(current){ return current!=player&¤t.group=='shu'; })) return false; @@ -905,14 +905,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, enable:['chooseToUse','chooseToRespond'], viewAs:{name:'sha'}, - filterCard:function(){return false}, + filterCard(){return false}, selectCard:-1, ai:{ - order:function(){ + order(){ return get.order({name:'sha'})+0.3; }, respondSha:true, - skillTagFilter:function(player){ + skillTagFilter(player){ if(!player.hasZhuSkill('jijiang')||!game.hasPlayer(function(current){ return current!=player&¤t.group=='shu'; })) return false; @@ -924,7 +924,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audioname:['liushan','re_liubei','re_liushan','ol_liushan'], trigger:{player:['useCardBegin','respondBegin']}, logTarget:'targets', - filter:function(event,player){ + filter(event,player){ return event.skill=='jijiang'; }, forced:true, @@ -971,7 +971,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{global:['useCardAfter','useSkillAfter','phaseAfter']}, silent:true, charlotte:true, - filter:function(event){ + filter(event){ return event.skill!='jijiang'&&event.skill!='qinwang'; }, async content(event,trigger,player){ @@ -986,13 +986,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, audioname:['re_guanyu','guanzhang','jsp_guanyu','guansuo','re_guanzhang','dc_jsp_guanyu'], enable:['chooseToRespond','chooseToUse'], - filterCard:function(card,player){ + filterCard(card,player){ if(get.zhu(player,'shouyue')) return true; return get.color(card)=='red'; }, position:'hes', viewAs:{name:'sha'}, - viewAsFilter:function(player){ + viewAsFilter(player){ if(get.zhu(player,'shouyue')){ if(!player.countCards('hes')) return false; } @@ -1001,13 +1001,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, prompt:'将一张红色牌当杀使用或打出', - check:function(card){ + check(card){ var val=get.value(card); if(_status.event.name=='chooseToRespond') return 1/Math.max(0.1,val); return 5-val; }, ai:{ - skillTagFilter:function(player){ + skillTagFilter(player){ if(get.zhu(player,'shouyue')){ if(!player.countCards('hes')) return false; } @@ -1027,7 +1027,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ animationColor:'orange', filterCard:true, position:'he', - filter:function(event,player){ + filter(event,player){ return player.countCards('he')>0; }, discard:false, @@ -1043,12 +1043,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, popup:false, logTarget:'source', - filter:function(event,player){ + filter(event,player){ return event.getParent().name=='sha'&&event.source&&event.source.isFriendOf(player); }, async content(event,trigger,player){trigger.num++}, intro:{content:'expansion',markcount:'expansion'}, - onremove:function(player,skill){ + onremove(player,skill){ var cards=player.getExpansions(skill); if(cards.length) player.loseToDiscardpile(cards); }, @@ -1063,20 +1063,20 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, trigger:{player:'useCard1'}, forced:true, - filter:function(event,player){ + filter(event,player){ return !event.audioed&&event.card.name=='sha'&&player.countUsed('sha',true)>1&&event.getParent().type=='phase'; }, async content(event,trigger,player){ trigger.audioed=true; }, mod:{ - cardUsable:function(card,player,num){ + cardUsable(card,player,num){ if(card.name=='sha') return Infinity; } }, ai:{ unequip:true, - skillTagFilter:function(player,tag,arg){ + skillTagFilter(player,tag,arg){ if(!get.zhu(player,'shouyue')) return false; if(arg&&arg.name=='sha') return true; return false; @@ -1151,7 +1151,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, kongcheng:{ mod:{ - targetEnabled:function(card,player,target,now){ + targetEnabled(card,player,target,now){ if(target.countCards('h')==0){ if(card.name=='sha'||card.name=='juedou') return false; } @@ -1162,7 +1162,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audioname:['re_zhugeliang'], ai:{ noh:true, - skillTagFilter:function(player,tag){ + skillTagFilter(player,tag){ if(tag=='noh'){ if(player.countCards('h')!=1) return false; } @@ -1175,14 +1175,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, firstDo:true, audioname:['re_zhugeliang'], - filter:function(event,player){ + filter(event,player){ if(player.countCards('h')) return false; for(var i=0;i0||arg.card.name!='sha'||!ui.cardPile.firstChild||get.color(ui.cardPile.firstChild,player)!='red') return false; }, }, @@ -1322,7 +1322,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'useCard'}, frequent:true, preHidden:true, - filter:function(event){ + filter(event){ return (get.type(event.card)=='trick'&&event.card.isCard); }, async content(event,trigger,player){ @@ -1338,7 +1338,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'useCard'}, frequent:true, // alter:true, - filter:function(event){ + filter(event){ if(get.type(event.card)=='delay') return false; return (get.type(event.card,'trick')=='trick'&&event.cards[0]&&event.cards[0]==event.card); }, @@ -1352,7 +1352,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, qicai:{ mod:{ - targetInRange:function(card,player,target,now){ + targetInRange(card,player,target,now){ var type=get.type(card); if(type=='trick'||type=='delay') return true; } @@ -1361,7 +1361,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ xinqicai:{ // alter:true, mod:{ - targetInRange:function(card,player,target,now){ + targetInRange(card,player,target,now){ var type=get.type(card); if(type=='trick'||type=='delay') return true; } @@ -1370,7 +1370,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ xinzhiheng:{ audio:'zhiheng', mod:{ - aiOrder:function(player,card,num){ + aiOrder(player,card,num){ if(num<=0||get.itemtype(card)!=='card'||get.type(card)!=='equip') return num; let eq=player.getEquip(get.subtype(card)); if(eq&&get.equipValue(card)-get.equipValue(eq)=8; @@ -1402,7 +1402,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ draw:{ trigger:{player:'loseEnd'}, silent:true, - filter:function(event,player){ + filter(event,player){ if(event.getParent(2).skill!='xinzhiheng') return false; if(!get.is.altered('xinzhiheng')) return false; if(player.countCards('h')) return false; @@ -1419,7 +1419,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ delay:{} }, ai:{ - order:function(item,player){ + order(item,player){ if(player.hasCard((i)=>get.value(i)>Math.max(6,9-player.hp),'he')) return 1; return 10; }, @@ -1427,7 +1427,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player:1 }, nokeep:true, - skillTagFilter:function(player,tag,arg){ + skillTagFilter(player,tag,arg){ if(tag==='nokeep') return (!arg||arg&&arg.card&&get.name(arg.card)==='tao')&&player.isPhaseUsing()&&!player.getStat().skill.xinzhiheng&&player.hasCard((card)=>get.name(card)!=='tao','h'); }, threaten:1.55 @@ -1437,7 +1437,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, audioname:['gz_jun_sunquan'], mod:{ - aiOrder:function(player,card,num){ + aiOrder(player,card,num){ if(num<=0||get.itemtype(card)!=='card'||get.type(card)!=='equip') return num; let eq=player.getEquip(get.subtype(card)); if(eq&&get.equipValue(card)-get.equipValue(eq)=player.hp-1) return -1; if(player.hp<3) return -1; return 1; @@ -1586,7 +1586,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audioname:['sp_lvmeng'], trigger:{player:'phaseDrawBegin2'}, frequent:true, - filter:function(event,player){ + filter(event,player){ return !event.numFixed; }, async content(event,trigger,player){ @@ -1600,10 +1600,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, enable:'phaseUse', usable:1, - filter:function(event,player){ + filter(event,player){ return player.countCards('h')>0; }, - filterTarget:function(card,player,target){ + filterTarget(card,player,target){ return player!=target; }, async content(event,trigger,player){ @@ -1625,7 +1625,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ order:1, result:{ - target:function(player,target){ + target(player,target){ var eff=get.damageEffect(target,player); if(eff>=0) return 1+eff; var value=0,i; @@ -1642,17 +1642,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, guose:{ audio:2, - filter:function(event,player){ + filter(event,player){ return player.countCards('hes',{suit:'diamond'})>0; }, enable:'chooseToUse', - filterCard:function(card){ + filterCard(card){ return get.suit(card)=='diamond'; }, position:'hes', viewAs:{name:'lebu'}, prompt:'将一张方片牌当乐不思蜀使用', - check:function(card){return 6-get.value(card)}, + check(card){return 6-get.value(card)}, ai:{ threaten:1.5 } @@ -1663,7 +1663,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{target:'useCardToTarget'}, direct:true, preHidden:true, - filter:function(event,player){ + filter(event,player){ if(event.card.name!='sha') return false; if(player.countCards('he')==0) return false; return game.hasPlayer(function(current){ @@ -1715,7 +1715,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, ai:{ effect:{ - target:function(card,player,target){ + target(card,player,target){ if(target.countCards('he')==0) return; if(card.name!='sha') return; var min=1; @@ -1742,7 +1742,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, qianxun:{ mod:{ - targetEnabled:function(card,player,target,now){ + targetEnabled(card,player,target,now){ if(card.name=='shunshou'||card.name=='lebu') return false; } }, @@ -1755,7 +1755,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ global:['equipAfter','addJudgeAfter','gainAfter','loseAsyncAfter','addToExpansionAfter'], }, frequent:true, - filter:function(event,player){ + filter(event,player){ if(player.countCards('h')) return false; var evt=event.getl(player); return evt&&evt.player==player&&evt.hs&&evt.hs.length>0; @@ -1766,12 +1766,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ threaten:0.8, effect:{ - target:function(card){ + target(card){ if(card.name=='guohe'||card.name=='liuxinghuoyu') return 0.5; } }, noh:true, - skillTagFilter:function(player,tag){ + skillTagFilter(player,tag){ if(tag=='noh'){ if(player.countCards('h')!=1) return false; } @@ -1786,7 +1786,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ global:['equipAfter','addJudgeAfter','gainAfter','loseAsyncAfter','addToExpansionAfter'], }, frequent:true, - filter:function(event,player){ + filter(event,player){ var evt=event.getl(player); return evt&&evt.player==player&&evt.es&&evt.es.length>0; }, @@ -1809,7 +1809,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ noe:true, reverseEquip:true, effect:{ - target:function(card,player,target,current){ + target(card,player,target,current){ if(get.type(card)=='equip'&&!get.cardtag(card,'gifts')) return [1,3]; } } @@ -1821,7 +1821,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filterCard:true, usable:1, selectCard:2, - check:function(card){ + check(card){ var player=get.owner(card); if(player.countCards('h')>player.hp) return 8-get.value(card) @@ -1829,7 +1829,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 6-get.value(card) return 4-get.value(card) }, - filterTarget:function(card,player,target){ + filterTarget(card,player,target){ if(!target.hasSex('male')) return false; if(target.hp>=target.maxHp) return false; if(target==player) return false; @@ -1842,7 +1842,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ order:5.5, result:{ - player:function(player){ + player(player){ if(player.hpplayer.hp) return 0 return -1; @@ -1862,11 +1862,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filterCard:true, usable:1, position:'he', - filter:function(event,player){ + filter(event,player){ if(!get.is.altered('xinjieyin')) return false; return player.countCards('he')>0; }, - check:function(card){ + check(card){ var player=_status.event.player; if(get.position(card)=='e'){ var subtype=get.subtype(card); @@ -1884,7 +1884,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 8-get.value(card); } }, - filterTarget:function(card,player,target){ + filterTarget(card,player,target){ if(!target.hasSex('male')) return false; var card=ui.selected.cards[0]; if(!card) return false; @@ -1913,7 +1913,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, ai:{ - order:function(){ + order(){ var player=_status.event.player; var es=player.getCards('e'); for(var i=0;i=2; }, - check:function(card){ + check(card){ var player=get.owner(card); if(player.countCards('h')>player.hp) return 8-get.value(card) @@ -1967,7 +1967,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 6-get.value(card) return 4-get.value(card) }, - filterTarget:function(card,player,target){ + filterTarget(card,player,target){ if(!target.hasSex('male')) return false; if(target.hp>=target.maxHp) return false; if(target==player) return false; @@ -1980,7 +1980,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ order:5.5, result:{ - player:function(player){ + player(player){ if(player.hpplayer.hp) return 0 return -1; @@ -1999,10 +1999,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ enable:'phaseUse', filterCard:true, usable:1, - check:function(card){ + check(card){ return 9-get.value(card) }, - filterTarget:function(card,player,target){ + filterTarget(card,player,target){ if(target.hp>=target.maxHp) return false; return true; }, @@ -2012,7 +2012,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ order:9, result:{ - target:function(player,target){ + target(player,target){ if(target.hp==1) return 5; if(player==target&&player.countCards('h')>player.hp) return 5; return 2; @@ -2023,7 +2023,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, jijiu:{ mod:{ - aiValue:function(player,card,num){ + aiValue(player,card,num){ if(get.name(card)!='tao'&&get.color(card)!='red') return; var cards=player.getCards('hs',function(card){ return get.name(card)=='tao'||get.color(card)=='red'; @@ -2039,7 +2039,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }; return Math.max(num,[6.5,4,3,2][Math.min(geti(),2)]); }, - aiUseful:function(){ + aiUseful(){ return lib.skill.kanpo.mod.aiValue.apply(this,arguments); }, }, @@ -2047,16 +2047,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, audioname:['re_huatuo'], enable:'chooseToUse', - viewAsFilter:function(player){ + viewAsFilter(player){ return player!=_status.currentPhase&&player.countCards('hes',{color:'red'})>0; }, - filterCard:function(card){ + filterCard(card){ return get.color(card)=='red'; }, position:'hes', viewAs:{name:'tao'}, prompt:'将一张红色牌当桃使用', - check:function(card){return 15-get.value(card)}, + check(card){return 15-get.value(card)}, ai:{ threaten:1.5, } @@ -2075,7 +2075,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audioname:['re_lvbu','shen_lvbu','lvlingqi'], trigger:{player:'useCardToPlayered'}, forced:true, - filter:function(event,player){ + filter(event,player){ return event.card.name=='sha'&&!event.getParent().directHit.contains(event.target); }, //priority:-1, @@ -2093,7 +2093,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, ai:{ directHit_ai:true, - skillTagFilter:function(player,tag,arg){ + skillTagFilter(player,tag,arg){ if(arg.card.name!='sha'||arg.target.countCards('h','shan')>1) return false; }, }, @@ -2103,10 +2103,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audioname:['re_lvbu','shen_lvbu','lvlingqi'], trigger:{player:'useCardToPlayered',target:'useCardToTargeted'}, forced:true, - logTarget:function(trigger,player){ + logTarget(trigger,player){ return player==trigger.player?trigger.target:trigger.player }, - filter:function(event,player){ + filter(event,player){ return event.card.name=='juedou'; }, //priority:-1, @@ -2121,7 +2121,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, ai:{ directHit_ai:true, - skillTagFilter:function(player,tag,arg){ + skillTagFilter(player,tag,arg){ if(arg.card.name!='juedou'||Math.floor(arg.target.countCards('h','sha')/2)>player.countCards('h','sha')) return false; } } @@ -2132,7 +2132,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, skillAnimation:true, animationColor:'gray', - filter:function(event,player){ + filter(event,player){ return player.isDamaged()&&game.dead.filter(function(target){ return target.isFriendOf(player); }).length>0 @@ -2149,11 +2149,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, shenji:{ mod:{ - selectTarget:function(card,player,range){ + selectTarget(card,player,range){ if(range[1]==-1) return; if(card.name=='sha') range[1]+=2; }, - cardUsable:function(card,player,num){ + cardUsable(card,player,num){ if(card.name=='sha') return num+1; } }, @@ -2163,15 +2163,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audioname:['re_diaochan'], enable:'phaseUse', usable:1, - filter:function(event,player){ + filter(event,player){ return game.countPlayer(function(current){ return current!=player&¤t.hasSex('male'); })>1; }, - check:function(card){return 10-get.value(card)}, + check(card){return 10-get.value(card)}, filterCard:true, position:'he', - filterTarget:function(card,player,target){ + filterTarget(card,player,target){ if(player==target) return false; if(!target.hasSex('male')) return false; if(ui.selected.targets.length==1){ @@ -2191,7 +2191,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ order:8, result:{ - target:function(player,target){ + target(player,target){ if(ui.selected.targets.length==0){ return -3; } @@ -2226,22 +2226,20 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'damageBegin3'}, //priority:1, audio:2, - filter:function(event){ + filter(event){ if(event.card&&(event.card.name=='sha')){ if(get.color(event.card)=='red') return true; } return false; }, forced:true, - check:function(){ - return false; - }, + check(){return false;}, async content(event,trigger,player){ await trigger.source.promises.chooseDrawRecover(true); }, ai:{ effect:{ - target:function(card,player,target,current){ + target(card,player,target,current){ if(card.name=='sha'&&(get.color(card)=='red')){ return [1,-2]; } @@ -2287,18 +2285,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, new_jiangchi3:{ mod:{ - cardEnabled:function(card){ + cardEnabled(card){ if(card.name=='sha') return false; }, - cardRespondable:function(card){ + cardRespondable(card){ if(card.name=='sha') return false; }, - ignoredHandcard:function(card,player){ + ignoredHandcard(card,player){ if(get.name(card)=='sha'){ return true; } }, - cardDiscardable:function(card,player,name){ + cardDiscardable(card,player,name){ if(name=='phaseDiscard'&&get.name(card)=='sha'){ return false; } @@ -2348,7 +2346,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ global:['dying','gainAfter','loseAsyncAfter'], }, audio:2, - filter:function(event,player){ + filter(event,player){ if(event.name=='dying') return true; if(event.giver!=player) return false; if(event.name=='gain'){ From f23532bcef17e8214dc77b576263a026f7055d98 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 20:09:49 +0800 Subject: [PATCH 65/71] =?UTF-8?q?=E5=A2=9E=E5=8A=A0get#stringify=E5=AF=B9?= =?UTF-8?q?=E5=A4=9A=E7=A7=8D=E5=87=BD=E6=95=B0=E5=86=99=E6=B3=95=E7=9A=84?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/game/game.js b/game/game.js index c40142075..3ec0ba9ea 100644 --- a/game/game.js +++ b/game/game.js @@ -59934,11 +59934,59 @@ new Promise(resolve=>{ if(get.objtype(obj)=='object'){ str='{\n'; for(var i in obj){ + var insertDefaultString; + var insertFunctionString=indent+' '+get.stringify(obj[i],level+1)+',\n'; + var parseFunction=i=>{ + var string=obj[i].toString(); + var execResult; + if(obj[i] instanceof GeneratorFunction){ + // *content(){} + execResult=new RegExp(`\\*\\s*${i}[\\s\\S]*?\\(`).exec(obj[i]); + if(execResult&&execResult.index===0){ + return insertFunctionString; + } + // content:function*(){} + else{ + return insertDefaultString; + } + } + else if(obj[i] instanceof AsyncFunction){ + execResult=new RegExp(`async\\s*${i}[\\s\\S]*?\\(`).exec(obj[i]); + // async content(){} + if(execResult&&execResult.index===0){ + return insertFunctionString; + } + // content:async function(){} + else{ + return insertDefaultString; + } + }else{ + execResult=new RegExp(`${i}[\\s\\S]*?\\(`).exec(obj[i]); + // content(){} + if(execResult&&execResult.index===0){ + return insertFunctionString; + } + // content:function(){} + else{ + return insertDefaultString; + } + } + }; if(/[^a-zA-Z]/.test(i)){ - str+=indent+' "'+i+'":'+get.stringify(obj[i],level+1)+',\n'; + insertDefaultString=indent+' "'+i+'":'+get.stringify(obj[i],level+1)+',\n'; + if(typeof obj[i]!=='function'){ + str+=insertDefaultString; + }else{ + str+=parseFunction(i); + } } else{ - str+=indent+' '+i+':'+get.stringify(obj[i],level+1)+',\n'; + insertDefaultString=indent+' '+i+':'+get.stringify(obj[i],level+1)+',\n'; + if(typeof obj[i]!=='function'){ + str+=insertDefaultString; + }else{ + str+=parseFunction(i); + } } } str+=indent+'}'; From 45bf4aa20f102b46de4277c88c1cabcc2660a439 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 20:54:28 +0800 Subject: [PATCH 66/71] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=88=96=E5=BC=95=E7=94=A8=E6=8A=80=E8=83=BD=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=97=B6=E5=87=BA=E7=8E=B0=E7=9A=84=5Fpriority=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/game/game.js b/game/game.js index 3ec0ba9ea..f17dbdf9a 100644 --- a/game/game.js +++ b/game/game.js @@ -49655,8 +49655,7 @@ new Promise(resolve=>{ } newSkill.querySelector('.new_description').value=page.content.pack.translate[this.link+'_info']; var info=page.content.pack.skill[this.link]; - container.code='skill='+get.stringify(info); - + container.code='skill='+get.stringify(Object.defineProperty({...info}, '_priority', {enumerable:false,writable:true,configurable:true})); toggle.innerHTML='编辑技能
>
'; editnode.innerHTML='编辑技能'; editnode.classList.remove('disabled'); @@ -49872,7 +49871,7 @@ new Promise(resolve=>{ skillopt.style.display='none'; addSkillButton.style.display='none'; cancelSkillButton.style.display='none'; - container.code='skill='+get.stringify(lib.skill[skillopt.value]); + container.code='skill='+get.stringify(Object.defineProperty({...lib.skill[skillopt.value]}, '_priority', {enumerable:false,writable:true,configurable:true})); editbutton.onclick.call(editbutton); if(lib.translate[skillopt.value+'_info']){ newSkill.querySelector('input.new_description').value=lib.translate[skillopt.value+'_info']; From fa04881b21b2c8e15ee3f7a967ec1921bfc28784 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Wed, 13 Dec 2023 01:16:15 +0800 Subject: [PATCH 67/71] =?UTF-8?q?game.createEvent=E7=9A=84=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=80=BC=E6=94=B9=E4=B8=BApromise=E5=BD=A2=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E4=BA=8B=E4=BB=B6=EF=BC=8C=E4=BD=86=5Fstatus.event?= =?UTF-8?q?=E6=88=96=E5=85=B6next=EF=BC=8Cafter=E7=9A=84=E5=80=BC=E6=9C=AA?= =?UTF-8?q?=E5=8F=98=E3=80=82=E4=B8=94=E5=AF=B9event.next.remove=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 174 +++++++++++++++++++++--------------------- game/game.js | 70 +++++++++-------- 2 files changed, 127 insertions(+), 117 deletions(-) diff --git a/character/standard.js b/character/standard.js index cbac476e5..795eedd98 100755 --- a/character/standard.js +++ b/character/standard.js @@ -102,11 +102,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ async content(event,trigger,player){ event.num=trigger.num||1; while(player.hasSkill('stdshushen')){ - const {result:{targets}}=await player.promises.chooseTarget(get.prompt2('stdshushen'),lib.filter.notMe) + const {result:{targets}}=await player.chooseTarget(get.prompt2('stdshushen'),lib.filter.notMe) .set('ai',target=>get.attitude(_status.event.player,target)); const target=targets[0]; player.logSkill('stdshushen',target); - await target.promises.draw(target.countCards('h')?1:2); + await target.draw(target.countCards('h')?1:2); if(--event.num<1) break; }; }, @@ -121,8 +121,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return player.isPhaseUsing()&&event.card&&event.card.name=='sha'&&event.player!=player&&event.player.isIn(); }, async content(event,trigger,player){ - if(trigger.player.hp0; }, async content(event,trigger,player){ - const {result:{bool,cards}}=await trigger.promises.target.chooseCard('he','是否对'+get.translation(player)+'发动【同疾】?','弃置一张牌,将'+get.translation(trigger.card)+'转移给'+get.translation(player)) + const {result:{bool,cards}}=await trigger.target.chooseCard('he','是否对'+get.translation(player)+'发动【同疾】?','弃置一张牌,将'+get.translation(trigger.card)+'转移给'+get.translation(player)) .set('ai',card=>{ if(!_status.event.check) return -1; return get.unuseful(card)+9; @@ -206,7 +206,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ })()>0); if(bool){ player.logSkill('retongji',trigger.target); - await trigger.target.promises.discard(cards); + await trigger.target.discard(cards); const evt=trigger.getParent(); evt.triggeredTargets2.remove(trigger.target); evt.targets.remove(trigger.target); @@ -243,7 +243,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ get.attitude(event.current,player)>2)|| event.current.isOnline()){ player.storage.hujiaing=true; - const next=event.current.promises.chooseToRespond('是否替'+get.translation(player)+'打出一张闪?',{name:'shan'}); + const next=event.current.chooseToRespond('是否替'+get.translation(player)+'打出一张闪?',{name:'shan'}); next.set('ai',()=>{ const event=_status.event; return (get.attitude(event.player,event.source)-2); @@ -289,7 +289,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return get.itemtype(event.cards)=='cards'&&get.position(event.cards[0],true)=='o'; }, async content(event,trigger,player){ - await player.promises.gain(trigger.cards,'gain2'); + await player.gain(trigger.cards,'gain2'); }, ai:{ maixie:true, @@ -311,7 +311,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return (event.source&&event.source.countGainableCards(player,event.source!=player?'he':'e')&&event.num>0); }, async content(event,trigger,player){ - await player.promises.gainPlayerCard(true,trigger.source,trigger.source!=player?'he':'e'); + await player.gainPlayerCard(true,trigger.source,trigger.source!=player?'he':'e'); }, ai:{ maixie_defend:true, @@ -334,7 +334,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return player.countCards(get.mode()=='guozhan'?'hes':'hs')>0; }, async content(event,trigger,player){ - const {result:{bool:chooseCardResultBool,cards:chooseCardResultCards}}=await player.promises.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+ + const {result:{bool:chooseCardResultBool,cards:chooseCardResultCards}}=await player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+ get.translation(trigger.player.judging[0])+','+get.prompt('guicai'),get.mode()=='guozhan'?'hes':'hs',card=>{ const player=_status.event.player; const mod2=game.checkMod(card,player,'unchanged','cardEnabled2',player); @@ -357,7 +357,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }).set('judging',trigger.player.judging[0]).setHiddenSkill('guicai'); if(!chooseCardResultBool) return; - await player.promises.respond(chooseCardResultCards,'guicai','highlight','noOrdering'); + await player.respond(chooseCardResultCards,'guicai','highlight','noOrdering'); if(trigger.player.judging[0].clone){ trigger.player.judging[0].clone.classList.remove('thrownhighlight'); game.broadcast(function(card){ @@ -367,7 +367,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ },trigger.player.judging[0]); game.addVideo('deletenode',player,get.cardsInfo([trigger.player.judging[0].clone])); } - await game.cardsDiscard(trigger.player.judging[0]).toPromise(); + await game.cardsDiscard(trigger.player.judging[0]); trigger.player.judging[0]=chooseCardResultCards[0]; trigger.orderingCards.addArray(chooseCardResultCards); game.log(trigger.player,'的判定牌改为',chooseCardResultCards[0]); @@ -391,14 +391,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, logTarget:'source', async content(event,trigger,player){ - const judgeEvent=player.promises.judge(card=>{ + const judgeEvent=player.judge(card=>{ if(get.suit(card)=='heart') return -2; return 2; }); judgeEvent.judge2=result=>result.bool; const {result:{judge}}=await judgeEvent; if(judge<2) return; - const {result:{bool}}=await trigger.source.promises.chooseToDiscard(2) + const {result:{bool}}=await trigger.source.chooseToDiscard(2) .set('ai',card=>{ if(card.name=='tao') return -10; if(card.name=='jiu'&&_status.event.player.hp==1) return -10; @@ -424,7 +424,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'damageEnd'}, direct:true, async content(event,trigger,player){ - const {result:{bool:chooseTargetResultBool,targets:chooseTargetResultTargets}}=await player.promises.chooseTarget(get.prompt2('ganglie_three'),(card,player,target)=>{ + const {result:{bool:chooseTargetResultBool,targets:chooseTargetResultTargets}}=await player.chooseTarget(get.prompt2('ganglie_three'),(card,player,target)=>{ return target.isEnemyOf(player); }).set('ai',target=>{ return -get.attitude(_status.event.player,target)/(1+target.countCards('h')); @@ -432,14 +432,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!chooseTargetResultBool) return; event.target=chooseTargetResultTargets[0]; player.logSkill('ganglie_three',event.target); - const judgeEvent=player.promises.judge(card=>{ + const judgeEvent=player.judge(card=>{ if(get.suit(card)=='heart') return -2; return 2; }); judgeEvent.judge2=result=>result.bool; const {result:{judge}}=await judgeEvent; if(judge<2) return; - const {result:{bool:chooseToDiscardResultBool}}=await player.promises.chooseToDiscard(2).set('ai',card=>{ + const {result:{bool:chooseToDiscardResultBool}}=await player.chooseToDiscard(2).set('ai',card=>{ if(card.name=='tao') return -10; if(card.name=='jiu'&&_status.event.player.hp==1) return -10; return get.unuseful(card)+2.5*(5-get.owner(card).hp); @@ -472,7 +472,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return current!=player&¤t.countCards('h')&&get.attitude(player,current)<=0; }); check=(num>=2); - const {result:{bool,targets}}=await player.promises.chooseTarget(get.prompt('tuxi'),'获得其他一至两名角色的各一张手牌',[1,2],(card,player,target)=>{ + const {result:{bool,targets}}=await player.chooseTarget(get.prompt('tuxi'),'获得其他一至两名角色的各一张手牌',[1,2],(card,player,target)=>{ return target.countCards('h')>0&&player!=target; },target=>{ if(!_status.event.aicheck) return 0; @@ -482,7 +482,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }).set('aicheck',check); if(!bool) return; player.logSkill('tuxi',targets); - await player.promises.gainMultiple(targets); + await player.gainMultiple(targets); trigger.changeToZero(); await game.asyncDelay(); }, @@ -541,7 +541,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return get.position(event.result.card,true)=='o'; }, async content(event,trigger,player){ - await player.promises.gain(trigger.result.card,'gain2'); + await player.gain(trigger.result.card,'gain2'); } }, yiji:{ @@ -556,7 +556,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ // event.goto -> while while(true){ event.count--; - const {cards}=await game.cardsGotoOrdering(get.cards(2)).toPromise(); + const {cards}=await game.cardsGotoOrdering(get.cards(2)); if(_status.connectMode) game.broadcastAll(function(){_status.noclearcountdown=true}); event.given_map={}; if(!cards.length) return; @@ -565,7 +565,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ const {result:{bool,links}} = cards.length==1? {result:{links:cards.slice(0),bool: true}}: - await player.promises.chooseCardButton('遗计:请选择要分配的牌',true,cards,[1,cards.length]) + await player.chooseCardButton('遗计:请选择要分配的牌',true,cards,[1,cards.length]) .set('ai',button=>{ if(ui.selected.buttons.length==0) return 1; return 0; @@ -573,7 +573,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!bool) return; cards.removeArray(links); event.togive=links.slice(0); - const {result:{targets}}=await player.promises.chooseTarget('选择一名角色获得'+get.translation(links),true) + const {result:{targets}}=await player.chooseTarget('选择一名角色获得'+get.translation(links),true) .set('ai',target=>{ const att=get.attitude(_status.event.player,target); if(_status.event.enemy){ @@ -607,9 +607,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ gain_list:list, giver:player, animate:'draw', - }).toPromise().setContent('gaincardMultiple'); + }).setContent('gaincardMultiple'); if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name, player)){ - const {result:{bool:chooseBoolResultBool}}=await player.promises.chooseBool(get.prompt2(event.name)).set('frequentSkill',event.name); + const {result:{bool:chooseBoolResultBool}}=await player.chooseBool(get.prompt2(event.name)).set('frequentSkill',event.name); if(chooseBoolResultBool) player.logSkill(event.name); else return; } @@ -649,13 +649,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ async content(event,trigger,player){ while(true){ if(event.cards==undefined) event.cards=[]; - const judgeEvent=player.promises.judge(card=>{ + const judgeEvent=player.judge(card=>{ if(get.color(card)=='black') return 1.5; return -1.5; }); judgeEvent.judge2=result=>result.bool; if(get.mode()!='guozhan'&&!player.hasSkillTag('rejudge')) judgeEvent.set('callback',async event=>{ - if(event.judgeResult.color=='black'&&get.position(event.card,true)=='o') await player.promises.gain(event.card,'gain2'); + if(event.judgeResult.color=='black'&&get.position(event.card,true)=='o') await player.gain(event.card,'gain2'); }); else judgeEvent.set('callback',async event=>{ if(event.judgeResult.color=='black') event.getParent().orderingCards.remove(event.card); @@ -664,7 +664,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ let bool; if(judge>0){ event.cards.push(card); - bool=(await player.promises.chooseBool('是否再次发动【洛神】?').set('frequentSkill','luoshen')).result.bool; + bool=(await player.chooseBool('是否再次发动【洛神】?').set('frequentSkill','luoshen')).result.bool; } else{ for(let i=0;i{ + const judgeEvent=player.judge(card=>{ if(get.color(card)=='black') return 1.5; return -1.5; },ui.special); @@ -703,7 +703,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ let bool; if(judge>0){ event.cards.push(card); - bool=lib.config.autoskilllist.contains('luoshen')?(await player.promises.chooseBool('是否再次发动【洛神】?')).result.bool:true; + bool=lib.config.autoskilllist.contains('luoshen')?(await player.chooseBool('是否再次发动【洛神】?')).result.bool:true; } else{ for(let i=0;i{ if(evt.getParent(2).name=='rende'&&evt.getParent(5)==evt2) num+=evt.cards.length; }); - await player.promises.give(event.cards,event.target); - if(num<2&&num+event.cards.length>1) await player.promises.recover(); + await player.give(event.cards,event.target); + if(num<2&&num+event.cards.length>1) await player.recover(); }, ai:{ order(skill,player){ @@ -940,7 +940,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return; } else if(event.current.group=='shu'){ - const chooseToRespondEvent=event.current.promises.chooseToRespond('是否替'+get.translation(player)+'打出一张杀?',{name:'sha'}); + const chooseToRespondEvent=event.current.chooseToRespond('是否替'+get.translation(player)+'打出一张杀?',{name:'sha'}); chooseToRespondEvent.set('ai',()=>{ const event=_status.event; return (get.attitude(event.player,event.source)-2); @@ -1035,7 +1035,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ async content(event,trigger,player){ player.awakenSkill('zhongyi'); player.addTempSkill('zhongyi2','roundStart'); - await player.promises.addToExpansion(player,'give',event.cards).gaintag.add('zhongyi2'); + await player.addToExpansion(player,'give',event.cards).gaintag.add('zhongyi2'); }, }, zhongyi2:{ @@ -1094,8 +1094,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ async content(event,trigger,player){ const num=player.hasSkill('yizhi')&&player.hasSkill('guanxing')?5:Math.min(5,game.countPlayer()); const cards=get.cards(num); - await game.cardsGotoOrdering(cards).toPromise(); - const next=player.promises.chooseToMove(); + await game.cardsGotoOrdering(cards); + const next=player.chooseToMove(); next.set('list',[ ['牌堆顶',cards], ['牌堆底'], @@ -1140,7 +1140,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(event.top_cards.includes(card)) return ui.cardPile.firstChild; return null; } - ).toPromise(); + ); player.popup(get.cnNumber(top.length)+'上'+get.cnNumber(bottom.length)+'下'); game.log(player,'将'+get.cnNumber(top.length)+'张牌置于牌堆顶'); await game.asyncDelayx(); @@ -1198,7 +1198,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return event.skill=='longdan_sha'||event.skill=='longdan_shan'; }, async content(event,trigger,player){ - await player.promises.draw(); + await player.draw(); player.storage.fanghun2++; } }, @@ -1294,7 +1294,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ logTarget:'target', preHidden:true, async content(event,trigger,player){ - const judgeEvent=player.promises.judge(card=>{ + const judgeEvent=player.judge(card=>{ if(get.zhu(_status.event.player,'shouyue')){ if(get.suit(card)!='spade') return 2; } @@ -1326,7 +1326,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return (get.type(event.card)=='trick'&&event.card.isCard); }, async content(event,trigger,player){ - await player.promises.draw(); + await player.draw(); }, ai:{ threaten:1.4, @@ -1343,7 +1343,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return (get.type(event.card,'trick')=='trick'&&event.cards[0]&&event.cards[0]==event.card); }, async content(event, trigger, player){ - await player.promises.draw(); + await player.draw(); }, ai:{ threaten:1.4, @@ -1395,7 +1395,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ delay:0, async content(event,trigger,player){ if(!player.hasSkill('xinzhiheng_delay')) await game.asyncDelayx(); - await player.promises.draw(event.cards.length); + await player.draw(event.cards.length); }, group:'xinzhiheng_draw', subSkill:{ @@ -1454,7 +1454,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 6-get.value(card) }, async content(event,trigger,player){ - await player.promises.draw(event.cards.length); + await player.draw(event.cards.length); }, ai:{ order:1, @@ -1496,7 +1496,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return true; }, async content(event,trigger,player){ - await player.promises.recover(); + await player.recover(); }, global:'xinjiuyuan2', }, @@ -1517,11 +1517,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ while(event.list.length>0){ const current=event.list.shift(); event.current=current; - const {result:{bool}}=await player.promises.chooseBool(get.prompt('xinjiuyuan',current)).set('choice',get.attitude(player,current)>0); + const {result:{bool}}=await player.chooseBool(get.prompt('xinjiuyuan',current)).set('choice',get.attitude(player,current)>0); if(bool){ player.logSkill('xinjiuyuan',event.current); - await event.current.promises.recover(); - await player.promises.draw(); + await event.current.recover(); + await player.draw(); } } } @@ -1565,8 +1565,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ enable:'phaseUse', prompt:'失去1点体力并摸两张牌', async content(event,trigger,player){ - await player.promises.loseHp(1); - await player.promises.draw(2); + await player.loseHp(1); + await player.draw(2); }, ai:{ basic:{ @@ -1608,7 +1608,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, async content(event,trigger,player){ const target=event.target; - const {result:{control}}=await target.promises.chooseControl('heart2','diamond2','club2','spade2').set('ai',event=>{ + const {result:{control}}=await target.chooseControl('heart2','diamond2','club2','spade2').set('ai',event=>{ switch(Math.floor(Math.random()*6)){ case 0:return 'heart2'; case 1:case 4:case 5:return 'diamond2'; @@ -1619,8 +1619,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ game.log(target,'选择了'+get.translation(control)); event.choice=control; target.chat('我选'+get.translation(event.choice)); - const {result:{bool,cards}}=await target.promises.gainPlayerCard(player,true,'h'); - if(bool&&get.suit(cards[0],player)+'2'!=event.choice) await target.promises.damage('nocard'); + const {result:{bool,cards}}=await target.gainPlayerCard(player,true,'h'); + if(bool&&get.suit(cards[0],player)+'2'!=event.choice) await target.damage('nocard'); }, ai:{ order:1, @@ -1672,7 +1672,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }); }, async content(event,trigger,player){ - const {result:{bool,targets,cards}}=await player.promises.chooseCardTarget({ + const {result:{bool,targets,cards}}=await player.chooseCardTarget({ position:'he', filterCard:lib.filter.cardDiscardable, filterTarget:(card,player,target)=>{ @@ -1706,7 +1706,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(bool){ const target=targets[0]; player.logSkill(event.name,target); - await player.promises.discard(cards); + await player.discard(cards); const evt=trigger.getParent(); evt.triggeredTargets2.remove(player); evt.targets.remove(player); @@ -1761,7 +1761,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return evt&&evt.player==player&&evt.hs&&evt.hs.length>0; }, async content(event,trigger,player){ - await player.promises.draw(); + await player.draw(); }, ai:{ threaten:0.8, @@ -1794,9 +1794,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ event.count=trigger.getl(player).es.length; while(true){ event.count--; - await player.promises.draw(2); + await player.draw(2); if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){ - const chooseBoolEvent=player.promises.chooseBool(get.prompt2('xiaoji')).set('frequentSkill','xiaoji'); + const chooseBoolEvent=player.chooseBool(get.prompt2('xiaoji')).set('frequentSkill','xiaoji'); chooseBoolEvent.ai=lib.filter.all; const {result:{bool}}=await chooseBoolEvent; if(bool){ @@ -1836,8 +1836,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return true; }, async content(event,trigger,player){ - await player.promises.recover(); - await event.target.promises.recover(); + await player.recover(); + await event.target.recover(); }, ai:{ order:5.5, @@ -1898,18 +1898,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){ const {cards,target}=event; if(get.position(cards[0])=='e'){ player.$give(cards,target); - await target.promises.equip(cards[0]); + await target.equip(cards[0]); } else{ - await player.promises.discard(cards); + await player.discard(cards); } if(player.hp>target.hp){ - await player.promises.draw(); - if(target.isDamaged()) await target.promises.recover(); + await player.draw(); + if(target.isDamaged()) await target.recover(); } else if(player.hp{ + const {result:{control}}=await player.chooseControl(list,()=>{ const player=_status.event.player; if(list.includes('弃牌')){ if(player.countCards('h')>3&&player.countCards('h','sha')>1){ @@ -2272,12 +2272,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 'cancel2'; }).set('prompt',get.prompt2('new_jiangchi')); if(control=='弃牌'){ - await player.promises.chooseToDiscard(true,'he'); + await player.chooseToDiscard(true,'he'); player.addTempSkill('jiangchi2','phaseUseEnd'); player.logSkill('new_jiangchi'); } else if(control=='摸牌'){ - await player.promises.draw(); + await player.draw(); player.addTempSkill('new_jiangchi3','phaseEnd'); player.logSkill('new_jiangchi'); } @@ -2309,9 +2309,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, async content(event,trigger,player){ const card=get.bottomCards()[0]; - await game.cardsGotoOrdering(card).toPromise(); + await game.cardsGotoOrdering(card); event.card=card; - const {result:{bool,targets}}=await player.promises.chooseTarget(true).set('ai',target=>{ + const {result:{bool,targets}}=await player.chooseTarget(true).set('ai',target=>{ let att=get.attitude(_status.event.player,target); if(_status.event.du){ if(target.hasSkillTag('nodu')) return 0.5; @@ -2329,7 +2329,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(bool){ const target=targets[0]; player.line(target,'green'); - const gainEvent=target.promises.gain(card,'draw'); + const gainEvent=target.gain(card,'draw'); gainEvent.giver=player; await gainEvent; } @@ -2363,13 +2363,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ do{ const target=event.targets.shift(); event.target=target; - const {result:{bool}}=await player.promises.chooseBool(get.prompt2('xinfu_jiyuan',target)).set('ai',()=>{ + const {result:{bool}}=await player.chooseBool(get.prompt2('xinfu_jiyuan',target)).set('ai',()=>{ const evt=_status.event; return get.attitude(player,evt.getParent().target)>0; }); if(bool){ player.logSkill('xinfu_jiyuan',target); - await target.promises.draw(); + await target.draw(); } }while(event.targets.length>0); }, diff --git a/game/game.js b/game/game.js index f17dbdf9a..4ed81e600 100644 --- a/game/game.js +++ b/game/game.js @@ -15,6 +15,7 @@ new Promise(resolve=>{ * @typedef {InstanceType} Card * @typedef {InstanceType} VCard * @typedef {InstanceType} GameEvent + * @typedef {InstanceType} GameEventPromise * @typedef {InstanceType} NodeWS */ const userAgent=navigator.userAgent.toLowerCase(); @@ -21031,22 +21032,6 @@ new Promise(resolve=>{ }; player.queueCount=0; player.outCount=0; - /** - * 这部分应该用d.ts写。目前只给出大概类型 - * @type { {[key in keyof Player]: (...args) => Promise & GameEvent} } - */ - player.promises=new Proxy({},{ - get(target,prop){ - const eventKeys=Object.keys(lib.element.player).filter(key=>typeof lib.element.player[key]=='function'); - if (eventKeys.includes(prop)){ - return function (...args) { - /** @type { GameEvent } */ - const event=player[prop](...args); - return event.toPromise(); - }; - } - } - }); } buildEventListener(noclick){ let player = this; @@ -31273,6 +31258,7 @@ new Promise(resolve=>{ } }, GameEvent:class{ + #promise; /** * @param {string} [name] * @param {false} [trigger] @@ -31293,6 +31279,24 @@ new Promise(resolve=>{ * @type {GameEvent[]} */ this.next=[]; + Object.defineProperty(this.next,'remove',{ + enumerable:false, + value:function(){ + for(const item of arguments){ + let pos=-1; + if (typeof item=='number'&&isNaN(item)){ + pos=this.findIndex(v=>isNaN(v)) + }else if(item instanceof lib.element.GameEventPromise){ + pos=this.indexOf(item.toEvent()); + }else{ + pos=this.indexOf(item); + } + if(pos==-1) continue; + this.splice(pos,1); + } + return this; + } + }); /** * @type {GameEvent[]} */ @@ -31316,7 +31320,7 @@ new Promise(resolve=>{ if(trigger!==false&&!game.online) this._triggered=0; } static initialGameEvent(){ - return new lib.element.GameEvent().finish(); + return new lib.element.GameEvent().finish().toPromise(); } /** * @param {keyof this} key @@ -31643,14 +31647,14 @@ new Promise(resolve=>{ this.next.push(next); next.setContent(content); Object.entries(map).forEach(entry=>next.set(entry[0],entry[1])); - return next; + return next.toPromise(); } insertAfter(content,map){ const next=new lib.element.GameEvent(`${this.name}Inserted`,false); this.after.push(next); next.setContent(content); Object.entries(map).forEach(entry=>next.set(entry[0],entry[1])); - return next; + return next.toPromise(); } backup(skill){ this._backup={ @@ -32104,13 +32108,13 @@ new Promise(resolve=>{ /** * 事件转为Promise化 * - * @returns { Promise & GameEvent } + * @returns { Promise & GameEvent & GameEventPromise } */ toPromise(){ - if(this.async&&this.resolve){ - throw new TypeError('This event has been converted into a promise'); + if(!this.#promise){ + this.#promise=new lib.element.GameEventPromise(this); } - return new lib.element.GameEventPromise(this); + return this.#promise; } }, /** @@ -32126,13 +32130,13 @@ new Promise(resolve=>{ * @todo 需要完成异步事件的debugger方法 * * @example - * 使用toPromise()函数将普通事件转换为异步事件: + * 使用await xx()等待异步事件执行: * ```js - * await game.xxx().toPromise().setContent('yyy').set(zzz, 'i'); + * await game.xxx().setContent('yyy').set(zzz, 'i'); * ``` - * 使用player.promises.xxx()函数将对于player的普通事件转换为异步事件并执行: + * 使用await player.xxx()等待异步事件执行: * ```js - * await player.promises.draw(2); + * await player.draw(2); * game.log('等待', player, '摸牌完成执行log'); * ``` */ @@ -32142,6 +32146,7 @@ new Promise(resolve=>{ static get [Symbol.species]() { return Promise; } + #event; /** * @param { GameEvent } event * @returns { Promise & GameEvent } @@ -32154,7 +32159,7 @@ new Promise(resolve=>{ event.resolve=resolve; // 如果父级事件也是一个异步的话,那应该立即执行这个事件的 // 如果在AsyncFunction执行过程中在别的位置新建了一个异步事件,那也直接(等会set配置完)执行 - if(_status.event.next.includes(event)&&_status.event.content instanceof AsyncFunction){ + if(_status.event&&_status.event.next.includes(event)&&_status.event.content instanceof AsyncFunction){ if (_status.event!=event) { event.parent=_status.event; _status.event=event; @@ -32167,6 +32172,7 @@ new Promise(resolve=>{ Promise.resolve().then(()=>game.loop(event)); } }); + this.#event=event; return new Proxy(this,{ get(target,prop,receiver){ const thisValue=Reflect.get(target,prop); @@ -32182,7 +32188,7 @@ new Promise(resolve=>{ const returnValue=eventValue.call(event,...args); return returnValue==event?receiver:returnValue; }).bind(event); - return eventValue; + return eventValue==event?receiver:eventValue; }, set(target,prop,newValue){ return Reflect.set(event,prop,newValue); @@ -32201,6 +32207,10 @@ new Promise(resolve=>{ }, }); } + /** 获取原事件对象 */ + toEvent(){ + return this.#event; + } /** * TODO: 实现debugger */ @@ -40357,7 +40367,7 @@ new Promise(resolve=>{ createEvent:(name,trigger,triggerEvent)=>{ const next=new lib.element.GameEvent(name,trigger); (triggerEvent||_status.event).next.push(next); - return next; + return next.toPromise(); }, addCharacter:(name,information)=>{ const extensionName=_status.extension||information.extension,character=[ From 375193287ecf9fd552c175ac6a8dbde6418c9b0c Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Wed, 13 Dec 2023 01:19:21 +0800 Subject: [PATCH 68/71] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dstdshushen=E4=B8=8D?= =?UTF-8?q?=E9=80=89=E7=9B=AE=E6=A0=87=E4=BC=9A=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/character/standard.js b/character/standard.js index 795eedd98..63328a2be 100755 --- a/character/standard.js +++ b/character/standard.js @@ -102,9 +102,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ async content(event,trigger,player){ event.num=trigger.num||1; while(player.hasSkill('stdshushen')){ - const {result:{targets}}=await player.chooseTarget(get.prompt2('stdshushen'),lib.filter.notMe) + const {result:{bool,targets}}=await player.chooseTarget(get.prompt2('stdshushen'),lib.filter.notMe) .set('ai',target=>get.attitude(_status.event.player,target)); - const target=targets[0]; + if(!bool) break; + const target = targets[0]; player.logSkill('stdshushen',target); await target.draw(target.countCards('h')?1:2); if(--event.num<1) break; From e16406ee59248908c039e7727fe044c15455e00b Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Wed, 13 Dec 2023 01:37:51 +0800 Subject: [PATCH 69/71] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=A8=A1=E5=9D=97=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- noname.js | 15 +++++++++++++++ noname/game.js | 1 + noname/library/initialization.js | 2 ++ noname/ui.js | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/noname.js b/noname.js index e69de29bb..3bfde465e 100644 --- a/noname.js +++ b/noname.js @@ -0,0 +1,15 @@ +import { ai } from './noname/ai.js'; +import { Game as game } from './noname/game.js'; +import { Get as get } from './noname/get.js'; +import { Library as lib } from './noname/library.js'; +import { status as _status } from './noname/status.js'; +import { UI as ui } from './noname/ui.js'; + +export { + ai, + game, + get, + lib, + _status, + ui +} \ No newline at end of file diff --git a/noname/game.js b/noname/game.js index 42dc0c8b0..954c89362 100644 --- a/noname/game.js +++ b/noname/game.js @@ -1,3 +1,4 @@ +import { GNC as gnc } from "./gnc.js"; export class Game { static promises = { /** diff --git a/noname/library/initialization.js b/noname/library/initialization.js index 9ebfb094d..328d2f6c8 100644 --- a/noname/library/initialization.js +++ b/noname/library/initialization.js @@ -1,4 +1,6 @@ import { Promises } from "./initialization/promises.js"; +import { GNC as gnc } from "../gnc.js"; +import { Library as lib } from "../library.js"; export class Initialization { static promises = Promises; diff --git a/noname/ui.js b/noname/ui.js index 284d00363..9e4f266ac 100644 --- a/noname/ui.js +++ b/noname/ui.js @@ -5,7 +5,7 @@ import { selected } from "./ui/selected.js"; class HTMLWindowElement extends HTMLDivElement { } -customElements.define("window", HTMLWindowElement, { +customElements.define("noname-window", HTMLWindowElement, { extends: "div" }); From f08becf03ace5202a8db8c03517acc7ec491ef4a Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Wed, 13 Dec 2023 08:59:31 +0800 Subject: [PATCH 70/71] =?UTF-8?q?event=E5=85=A8=E9=9D=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BApromise=EF=BC=8C=E5=8C=85=E6=8B=ACevent.next=E5=92=8Ce?= =?UTF-8?q?vent.after=E7=9A=84=E5=85=83=E7=B4=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 89 ++++++++++++++++++++++++++-------------------------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/game/game.js b/game/game.js index 4ed81e600..f3b56266f 100644 --- a/game/game.js +++ b/game/game.js @@ -31258,6 +31258,7 @@ new Promise(resolve=>{ } }, GameEvent:class{ + /** @type { Promise & GameEvent & GameEventPromise } */ #promise; /** * @param {string} [name] @@ -31279,24 +31280,24 @@ new Promise(resolve=>{ * @type {GameEvent[]} */ this.next=[]; - Object.defineProperty(this.next,'remove',{ - enumerable:false, - value:function(){ - for(const item of arguments){ - let pos=-1; - if (typeof item=='number'&&isNaN(item)){ - pos=this.findIndex(v=>isNaN(v)) - }else if(item instanceof lib.element.GameEventPromise){ - pos=this.indexOf(item.toEvent()); - }else{ - pos=this.indexOf(item); - } - if(pos==-1) continue; - this.splice(pos,1); - } - return this; - } - }); + // Object.defineProperty(this.next,'remove',{ + // enumerable:false, + // value:function(){ + // for(const item of arguments){ + // let pos=-1; + // if (typeof item=='number'&&isNaN(item)){ + // pos=this.findIndex(v=>isNaN(v)) + // }else if(item instanceof lib.element.GameEventPromise){ + // pos=this.indexOf(item.toEvent()); + // }else{ + // pos=this.indexOf(item); + // } + // if(pos==-1) continue; + // this.splice(pos,1); + // } + // return this; + // } + // }); /** * @type {GameEvent[]} */ @@ -31643,18 +31644,18 @@ new Promise(resolve=>{ return this._rand; } insert(content,map){ - const next=new lib.element.GameEvent(`${this.name}Inserted`,false); + const next=(new lib.element.GameEvent(`${this.name}Inserted`,false)).toPromise(); this.next.push(next); next.setContent(content); Object.entries(map).forEach(entry=>next.set(entry[0],entry[1])); - return next.toPromise(); + return next; } insertAfter(content,map){ - const next=new lib.element.GameEvent(`${this.name}Inserted`,false); + const next=(new lib.element.GameEvent(`${this.name}Inserted`,false)).toPromise(); this.after.push(next); next.setContent(content); Object.entries(map).forEach(entry=>next.set(entry[0],entry[1])); - return next.toPromise(); + return next; } backup(skill){ this._backup={ @@ -32157,20 +32158,25 @@ new Promise(resolve=>{ event.async=true; // 事件结束后触发resolve event.resolve=resolve; - // 如果父级事件也是一个异步的话,那应该立即执行这个事件的 - // 如果在AsyncFunction执行过程中在别的位置新建了一个异步事件,那也直接(等会set配置完)执行 - if(_status.event&&_status.event.next.includes(event)&&_status.event.content instanceof AsyncFunction){ - if (_status.event!=event) { - event.parent=_status.event; - _status.event=event; - game.getGlobalHistory('everything').push(event); + if(!_status.event) return; + // game.createEvent的时候还没立即push到next里 + Promise.resolve().then(()=>{ + const eventPromise=_status.event.next.find(e=>e.toEvent()==event); + // 如果父级事件也是一个异步的话,那应该立即执行这个事件的 + // 如果在AsyncFunction执行过程中在别的位置新建了一个异步事件,那也直接(等会set配置完)执行 + if(eventPromise&&_status.event.content instanceof AsyncFunction){ + if(_status.event!=eventPromise){ + eventPromise.parent=_status.event; + _status.event=eventPromise; + game.getGlobalHistory('everything').push(eventPromise); + } + // 异步执行game.loop + // 不直接game.loop(event)是因为需要让别人可以手动set()和setContent() + // 再执行game.loop是因为原有的game.loop被await卡住了, + // 得新执行一个只执行这个异步事件的game.loop + Promise.resolve().then(()=>game.loop(eventPromise)); } - // 异步执行game.loop - // 不直接game.loop(event)是因为需要让别人可以手动set()和setContent() - // 再执行game.loop是因为原有的game.loop被await卡住了, - // 得新执行一个只执行这个异步事件的game.loop - Promise.resolve().then(()=>game.loop(event)); - } + }); }); this.#event=event; return new Proxy(this,{ @@ -32183,11 +32189,6 @@ new Promise(resolve=>{ return thisValue; } const eventValue=Reflect.get(event,prop); - // 返回值如果是event,则修改为GameEventPromise类实例 - if(typeof eventValue=='function') return (function(...args){ - const returnValue=eventValue.call(event,...args); - return returnValue==event?receiver:returnValue; - }).bind(event); return eventValue==event?receiver:eventValue; }, set(target,prop,newValue){ @@ -40365,9 +40366,9 @@ new Promise(resolve=>{ * @legacy Use {@link lib.element.GameEvent.constructor} instead. */ createEvent:(name,trigger,triggerEvent)=>{ - const next=new lib.element.GameEvent(name,trigger); + const next=(new lib.element.GameEvent(name,trigger)).toPromise(); (triggerEvent||_status.event).next.push(next); - return next.toPromise(); + return next; }, addCharacter:(name,information)=>{ const extensionName=_status.extension||information.extension,character=[ @@ -41410,7 +41411,7 @@ new Promise(resolve=>{ } }, /** - * @param { GameEvent } [belongAsyncEvent] + * @param { Promise & GameEvent & GameEventPromise } [belongAsyncEvent] */ async loop(belongAsyncEvent){ if(belongAsyncEvent){ @@ -41424,7 +41425,7 @@ new Promise(resolve=>{ const _resolve = () => { if (event.async) { if (typeof event.resolve == 'function') { - event.resolve(event); + event.resolve(event.toEvent()); } else { throw new TypeError('异步事件的event.resolve未赋值,使用await时将会被永久等待'); } From 2c5593c9017e48568c6190a3934adf88f5b3f65a Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Wed, 13 Dec 2023 09:00:34 +0800 Subject: [PATCH 71/71] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/game/game.js b/game/game.js index f3b56266f..328ad267d 100644 --- a/game/game.js +++ b/game/game.js @@ -31277,29 +31277,11 @@ new Promise(resolve=>{ this.step=0; this.finished=false; /** - * @type {GameEvent[]} + * @type {(Promise & GameEvent & GameEventPromise)[]} */ this.next=[]; - // Object.defineProperty(this.next,'remove',{ - // enumerable:false, - // value:function(){ - // for(const item of arguments){ - // let pos=-1; - // if (typeof item=='number'&&isNaN(item)){ - // pos=this.findIndex(v=>isNaN(v)) - // }else if(item instanceof lib.element.GameEventPromise){ - // pos=this.indexOf(item.toEvent()); - // }else{ - // pos=this.indexOf(item); - // } - // if(pos==-1) continue; - // this.splice(pos,1); - // } - // return this; - // } - // }); /** - * @type {GameEvent[]} + * @type {(Promise & GameEvent & GameEventPromise)[]} */ this.after=[]; this.custom={