diff --git a/character/diy.js b/character/diy.js index 6584de17d..6f9ad810c 100755 --- a/character/diy.js +++ b/character/diy.js @@ -3016,8 +3016,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, erika_yousheng:{ + init:(player)=>{ + player.addSkill('erika_yousheng_mamori'); + }, dutySkill:true, - group:['erika_yousheng_achieve','erika_yousheng_fail','erika_yousheng_mamori'], + group:['erika_yousheng_achieve','erika_yousheng_fail'], trigger:{global:'useCardToTarget'}, direct:true, filter(event,player){ diff --git a/character/mobile.js b/character/mobile.js index 00f7d17c7..f16c21c7b 100644 --- a/character/mobile.js +++ b/character/mobile.js @@ -581,7 +581,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ target.damage('nosource'); break; case '鹰': - player.gain(target.getGainableCards(player,'he'),target,'giveAuto'); + player.gain(target.getGainableCards(player,'he').randomGet(),target,'giveAuto'); break; case '熊': target.discard(target.getGainableCards(player,'e').randomGet()).discarder=player; diff --git a/character/standard.js b/character/standard.js index 10deb1d94..5a6f9f7a1 100755 --- a/character/standard.js +++ b/character/standard.js @@ -1579,14 +1579,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, async content(event,trigger,player){ const target=event.target; - const {result:{control}}=await target.chooseControl('heart2','diamond2','club2','spade2').set('ai',event=>{ + const 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'; case 2:return 'club2'; case 3:return 'spade2'; } - }); + }) + .forResultControl(); game.log(target,'选择了'+get.translation(control)); event.choice=control; target.chat('我选'+get.translation(event.choice)); @@ -1641,7 +1642,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }); }, async content(event,trigger,player){ - const {result:{bool,targets,cards}}=await player.chooseCardTarget({ + const [bool,targets,cards]=await player.chooseCardTarget({ position:'he', filterCard:lib.filter.cardDiscardable, filterTarget:(card,player,target)=>{ @@ -1671,7 +1672,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ prompt2:'弃置一张牌,将此【杀】转移给攻击范围内的一名其他角色', source:trigger.player, card:trigger.card, - }).setHiddenSkill(event.name); + }) + .setHiddenSkill(event.name) + .forResult('bool','targets','cards'); if(bool){ const target=targets[0]; player.logSkill(event.name,target); @@ -2210,7 +2213,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ async content(event,trigger,player){ const list=['弃牌','摸牌','取消']; if(!player.countCards('he')) list.remove('弃牌'); - const {result:{control}}=await player.chooseControl(list,()=>{ + const control=await player.chooseControl(list,()=>{ const player=_status.event.player; if(list.includes('弃牌')){ if(player.countCards('h')>3&&player.countCards('h','sha')>1){ @@ -2224,7 +2227,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return '摸牌'; } return 'cancel2'; - }).set('prompt',get.prompt2('new_jiangchi')); + }) + .set('prompt',get.prompt2('new_jiangchi')) + .forResultControl(); + if(control=='弃牌'){ player.chooseToDiscard(true,'he'); player.addTempSkill('jiangchi2','phaseUseEnd'); diff --git a/character/yijiang.js b/character/yijiang.js index 0369fa2cc..fee67e1a8 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -11905,6 +11905,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, ai:{ + filterDamage:true, + skillTagFilter:(player,tag,arg)=>{ + return arg&&arg.jiu==true; + }, effect:{ target:(card,player,target)=>{ if(target.hp<=0&&target.hasSkill('zhenlie_lose')&&get.tag(card,'recover')) return [1,1.2]; diff --git a/noname/library/element/gameEventPromise.js b/noname/library/element/gameEventPromise.js index 597b62717..4cabfb727 100644 --- a/noname/library/element/gameEventPromise.js +++ b/noname/library/element/gameEventPromise.js @@ -162,4 +162,95 @@ export class GameEventPromise extends Promise { game.promises.prompt('debugger调试').then(inputCallback); }); } + + /** + * + * 直接获得result中的信息。 + * + * + * @example + * ① + * let chooseCardResult = await player.chooseCard().forResult(); + * 选择的卡牌:chooseCardResult.cards + * ② + * let cards = await player.chooseCard().forResult('cards'); + * 选择的卡牌:cards + * ③ + * let [success,cards,targets] = await player.chooseCardTarget().forResult('bool','cards','targets'); + * success:是否做出选择。 + * cards:选择的牌。 + * targets:选择的目标。 + */ + forResult(){ + if(arguments.length == 0){ + return this.then(event=>{ + return Promise.resolve(event.result); + }); + }else if(arguments.length == 1){ + return this.then(event=>{ + return Promise.resolve(event.result[arguments[0]]); + }); + }else{ + return this.then(event=>{ + return Promise.resolve(Array.from(arguments).map(key=>event.result[key])); + }); + } + } + + /** + * 返回result中的bool项。 + * + * @returns {boolean} 返回的bool项 + */ + forResultBool(){ + return this.forResult('bool'); + } + + /** + * 返回result中的targets项。 + * + * @returns {lib.element.Player[]} 返回的targets项。 + * + */ + forResultTargets(){ + return this.forResult('targets'); + } + + /** + * 返回result中的cards项 + * + * @returns {lib.element.Card[]} 返回的cards项。 + * + */ + forResultCards(){ + return this.forResult('cards'); + } + + /** + * 返回result中的card项 + * + * @returns {lib.element.VCard|lib.element.Card} 返回的card项。 + * + */ + forResultCard(){ + return this.forResult('card'); + } + + /** + * 返回result中的control项。 + * + * @returns {string} 返回的control项。 + */ + forResultControl(){ + return this.forResult('control'); + } + + /** + * 返回result中的links项。 + * + * @returns {Array} 返回的links项。 + */ + forResultLinks(){ + return this.forResult('links'); + } } diff --git a/noname/ui/index.js b/noname/ui/index.js index e043027f3..87fb96956 100644 --- a/noname/ui/index.js +++ b/noname/ui/index.js @@ -3703,7 +3703,13 @@ class Create extends Uninstantable { // if(!get.config('menu_loadondemand')) node._initLink(); return node; }; - for (var i in lib.extensionMenu) { + let extensionsInMenu = Object.keys(lib.extensionMenu); + if(lib.config.extensionSort && Array.isArray(lib.config.extensionSort)){ + extensionsInMenu.sort((a,b)=>{ + return lib.config.extensionSort.indexOf(a) - lib.config.extensionSort.indexOf(b); + }); + } + for (let i of extensionsInMenu) { if (lib.config.all.stockextension.includes(i) && !lib.config.all.plays.includes(i)) continue; if (lib.config.hiddenPlayPack.includes(i)) continue; createModeConfig(i, start.firstChild);