From 11639b6b317a592fe06c1468926240ce50cf20e6 Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Thu, 28 Sep 2023 14:18:32 +0800 Subject: [PATCH] Bugfix for PR#414 --- character/mobile.js | 7 +++++-- character/tw.js | 6 ++++-- character/yijiang.js | 30 +++++++++++++++++++++--------- mode/guozhan.js | 14 ++++++-------- 4 files changed, 36 insertions(+), 21 deletions(-) diff --git a/character/mobile.js b/character/mobile.js index 5e074c8d2..9485823e7 100644 --- a/character/mobile.js +++ b/character/mobile.js @@ -454,12 +454,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 2' if(result.bool){ target.recover(); + event.finish(); } else{ target.draw([1,2,3,4,5].reduce((p,c)=>p+target.countEmptySlot(c),0)); - player.link(false); - player.turnOver(false); } + 'step 3' + player.link(false); + 'step 4' + player.turnOver(false); }, ai:{ expose:0.2, diff --git a/character/tw.js b/character/tw.js index 530dcaa61..513987f74 100644 --- a/character/tw.js +++ b/character/tw.js @@ -3016,14 +3016,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ var num=1-player.hp; if(num>0) player.recover(num); + event.finish(); } else{ target.gainMaxHp(); target.recover(); target.draw(); - var num=player.maxHp-player.hp; - if(num>0) player.recover(num); } + 'step 2' + var num=player.maxHp-player.hp; + if(num>0) player.recover(num); }, }, //王淩 diff --git a/character/yijiang.js b/character/yijiang.js index 9404cb21f..76404d57f 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -229,11 +229,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, locked:false, content:function(){ - 'step 0' player.draw(2).gaintag=['kangli']; player.when({source:'damageBegin1'}) .then(()=>{ - var cards=player.getCards('h',card=>card.hasGaintag('kangli')); + var cards=player.getCards('h',card=>card.hasGaintag('kangli')&&lib.filter.cardDiscardable(card,player,'kangli')); if(cards.length) player.discard(cards); }) }, @@ -256,6 +255,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ discard:false, lose:false, delay:false, + popname:true, check:function(card){ var num=6.5; if(ui.selected.cards.length){ @@ -278,6 +278,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ .assign({ numbers:numbers, playerx:player, + mod:{ + aiOrder:function(player,card,num){ + var number=get.number(card); + if(typeof number!='number'||number<=numbers[0]||number>=numbers[1]) return num+10; + }, + }, }) .filter((event,player)=>{ return event._tongwei_checked; @@ -286,15 +292,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var number=get.number(trigger.card); var numbers=get.info(event.name).numbers; event.playerx=get.info(event.name).playerx; - if(number<=numbers[0]||number>=numbers[1]) event.finish(); + if(typeof number!='number'||number<=numbers[0]||number>=numbers[1]) event.finish(); }) .then(()=>{ var playerx=event.playerx; var names=['sha','guohe'].filter(name=>playerx.canUse({name:name,isCard:true},player,false)); if(!names.length) event.finish(); - else if(names.length==1) event._result={control:names[0]}; - else playerx.chooseControl(names).set('prompt',`统围:视为对${get.translation(player)}使用一张【杀】或【过河拆桥】`).set('ai',()=>{ - return _status.event.choice; + else if(names.length==1) event._result={links:[[null,null,names[0]]]}; + else playerx.chooseButton([ + `请选择要视为对${get.translation(player)}使用的牌`, + [names,'vcard'], + ]).set('ai',(button)=>{ + return button.link[0][2]==_status.event.choice; }).set('choice',function(){ var list=names.map(name=>{ return [name,get.effect(player,{name:name,isCard:true},playerx,playerx)]; @@ -305,9 +314,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }()); }) .then(()=>{ - var name=result.control; + var name=result.links[0][2]; var card={name:name,isCard:true},playerx=event.playerx; - if(playerx.canUse(card,player,false)) playerx.useCard(card,player); + if(playerx.canUse(card,player,false)) playerx.useCard(card,player,'tongwei'); }) }, ai:{ @@ -476,10 +485,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 1' var guessedNum=result.index; var type=get.type2(trigger.card,trigger.player); - var count=trigger.player.countCards('h',card=>get.type2(card)==type); player.chat('我猜'+get.cnNumber(guessedNum)+'张'); game.log(player,'猜测',trigger.player,'有',get.cnNumber(guessedNum)+'张'+get.translation(type)+'牌'); + event.guessedNum=guessedNum; game.delay(); + 'step 2' + var count=trigger.player.countCards('h',card=>get.type2(card)==type); + var guessedNum=event.guessedNum; if(count==guessedNum){ player.popup('猜测正确','wood'); game.log(player,'猜测','#g正确'); diff --git a/mode/guozhan.js b/mode/guozhan.js index eb0dab913..c8e341396 100644 --- a/mode/guozhan.js +++ b/mode/guozhan.js @@ -2093,7 +2093,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ 'step 2' if(target.countCards('e')>0){ target.chooseControl().set('prompt','追妒:请选择一项').set('choiceList',[ - '令'+get.translation(trigger.player)+'此次对你造成的伤害+1', + '令'+get.translation(player)+'此次对你造成的伤害+1', '弃置装备区里的所有牌', ]).set('ai',function(){ var player=_status.event.player,cards=player.getCards('e'); @@ -2137,24 +2137,22 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ event.target=target; player.awakenSkill('gzshigong'); var list=lib.character[player.name2][3].filter(function(skill){ - var info=get.info(skill); - return info&&!get.is.locked(skill)&&!info.juexingji&&!info.hiddenSkill&&!info.zhuSkill&&!info.charlotte&&!info.limited&&!info.dutySkill&&!info.zhenfa&&!info.mainSkill&&!info.viceSkill&&!info.unique; + return get.skillCategoriesOf(skill).length==0; }); if(!list.length){ event._result={control:'cancel2'}; - event.goto(3); + event.goto(2); } else event.list=list; - 'step 1' player.removeCharacter(1); - 'step 2' - _status.currentPhase.chooseControl(event.list,'cancel2').set('choiceList',event.list.map(i=>{ + 'step 1' + target.chooseControl(event.list,'cancel2').set('choiceList',event.list.map(i=>{ return '
【'+get.translation(lib.translate[i+'_ab']||get.translation(i).slice(0,2))+'】
'+get.skillInfoTranslation(i,_status.currentPhase)+'
'; })).set('displayIndex',false).set('ai',function(){ if(get.attitude(_status.event.player,_status.event.getParent().player)>0) return 0; return [0,1].randomGet(); }).set('prompt',get.translation(player)+'对你发动了【示恭】').set('prompt2','获得一个技能并令其将体力回复至体力上限;或点击“取消”,令其将体力值回复至1点。'); - 'step 3' + 'step 2' if(result.control=='cancel2'){ player.recover(1-player.hp); event.finish();