diff --git a/audio/card/female/fudichouxin.mp3 b/audio/card/female/fudichouxin.mp3 new file mode 100644 index 000000000..cfc1ebb57 Binary files /dev/null and b/audio/card/female/fudichouxin.mp3 differ diff --git a/audio/card/female/toulianghuanzhu.mp3 b/audio/card/female/toulianghuanzhu.mp3 new file mode 100644 index 000000000..7e8e7156c Binary files /dev/null and b/audio/card/female/toulianghuanzhu.mp3 differ diff --git a/audio/card/male/fudichouxin.mp3 b/audio/card/male/fudichouxin.mp3 new file mode 100644 index 000000000..18b5b42d0 Binary files /dev/null and b/audio/card/male/fudichouxin.mp3 differ diff --git a/audio/card/male/toulianghuanzhu.mp3 b/audio/card/male/toulianghuanzhu.mp3 new file mode 100644 index 000000000..067624528 Binary files /dev/null and b/audio/card/male/toulianghuanzhu.mp3 differ diff --git a/audio/die/chengji.mp3 b/audio/die/chengji.mp3 new file mode 100644 index 000000000..2f85bf38b Binary files /dev/null and b/audio/die/chengji.mp3 differ diff --git a/audio/die/gongsunxiu.mp3 b/audio/die/gongsunxiu.mp3 new file mode 100644 index 000000000..f8b9d8975 Binary files /dev/null and b/audio/die/gongsunxiu.mp3 differ diff --git a/audio/die/lizhaojiaobo.mp3 b/audio/die/lizhaojiaobo.mp3 new file mode 100644 index 000000000..123f2963b Binary files /dev/null and b/audio/die/lizhaojiaobo.mp3 differ diff --git a/audio/die/mb_caomao.mp3 b/audio/die/mb_caomao.mp3 new file mode 100644 index 000000000..bc917aea3 Binary files /dev/null and b/audio/die/mb_caomao.mp3 differ diff --git a/audio/die/mb_sp_guanqiujian.mp3 b/audio/die/mb_sp_guanqiujian.mp3 new file mode 100644 index 000000000..c37327afb Binary files /dev/null and b/audio/die/mb_sp_guanqiujian.mp3 differ diff --git a/audio/die/ol_lukai.mp3 b/audio/die/ol_lukai.mp3 new file mode 100644 index 000000000..82fc8bc4c Binary files /dev/null and b/audio/die/ol_lukai.mp3 differ diff --git a/audio/skill/dcgangu1.mp3 b/audio/skill/dcgangu1.mp3 new file mode 100644 index 000000000..54cfa202d Binary files /dev/null and b/audio/skill/dcgangu1.mp3 differ diff --git a/audio/skill/dcgangu2.mp3 b/audio/skill/dcgangu2.mp3 new file mode 100644 index 000000000..e7b620043 Binary files /dev/null and b/audio/skill/dcgangu2.mp3 differ diff --git a/audio/skill/dckuizhen1.mp3 b/audio/skill/dckuizhen1.mp3 new file mode 100644 index 000000000..876926255 Binary files /dev/null and b/audio/skill/dckuizhen1.mp3 differ diff --git a/audio/skill/dckuizhen2.mp3 b/audio/skill/dckuizhen2.mp3 new file mode 100644 index 000000000..f613f5d98 Binary files /dev/null and b/audio/skill/dckuizhen2.mp3 differ diff --git a/audio/skill/mbcuizhen1.mp3 b/audio/skill/mbcuizhen1.mp3 new file mode 100644 index 000000000..7698c7298 Binary files /dev/null and b/audio/skill/mbcuizhen1.mp3 differ diff --git a/audio/skill/mbcuizhen2.mp3 b/audio/skill/mbcuizhen2.mp3 new file mode 100644 index 000000000..60e22c201 Binary files /dev/null and b/audio/skill/mbcuizhen2.mp3 differ diff --git a/audio/skill/mbjuejin1.mp3 b/audio/skill/mbjuejin1.mp3 new file mode 100644 index 000000000..89a6155bc Binary files /dev/null and b/audio/skill/mbjuejin1.mp3 differ diff --git a/audio/skill/mbjuejin2.mp3 b/audio/skill/mbjuejin2.mp3 new file mode 100644 index 000000000..a48370ee8 Binary files /dev/null and b/audio/skill/mbjuejin2.mp3 differ diff --git a/audio/skill/mbkuangli1.mp3 b/audio/skill/mbkuangli1.mp3 new file mode 100644 index 000000000..7ca0cc1ca Binary files /dev/null and b/audio/skill/mbkuangli1.mp3 differ diff --git a/audio/skill/mbkuangli2.mp3 b/audio/skill/mbkuangli2.mp3 new file mode 100644 index 000000000..aa519a215 Binary files /dev/null and b/audio/skill/mbkuangli2.mp3 differ diff --git a/audio/skill/mbkuili1.mp3 b/audio/skill/mbkuili1.mp3 new file mode 100644 index 000000000..5ddb33cff Binary files /dev/null and b/audio/skill/mbkuili1.mp3 differ diff --git a/audio/skill/mbkuili2.mp3 b/audio/skill/mbkuili2.mp3 new file mode 100644 index 000000000..94eb9c725 Binary files /dev/null and b/audio/skill/mbkuili2.mp3 differ diff --git a/audio/skill/mbqianlong1.mp3 b/audio/skill/mbqianlong1.mp3 new file mode 100644 index 000000000..e848f335c Binary files /dev/null and b/audio/skill/mbqianlong1.mp3 differ diff --git a/audio/skill/mbqianlong2.mp3 b/audio/skill/mbqianlong2.mp3 new file mode 100644 index 000000000..bb51536db Binary files /dev/null and b/audio/skill/mbqianlong2.mp3 differ diff --git a/audio/skill/mbqianlong3.mp3 b/audio/skill/mbqianlong3.mp3 new file mode 100644 index 000000000..14b845c89 Binary files /dev/null and b/audio/skill/mbqianlong3.mp3 differ diff --git a/audio/skill/mbqianlong4.mp3 b/audio/skill/mbqianlong4.mp3 new file mode 100644 index 000000000..c103071c3 Binary files /dev/null and b/audio/skill/mbqianlong4.mp3 differ diff --git a/audio/skill/mbqianlong5.mp3 b/audio/skill/mbqianlong5.mp3 new file mode 100644 index 000000000..663f323e8 Binary files /dev/null and b/audio/skill/mbqianlong5.mp3 differ diff --git a/audio/skill/mbqianlong6.mp3 b/audio/skill/mbqianlong6.mp3 new file mode 100644 index 000000000..7d50bb760 Binary files /dev/null and b/audio/skill/mbqianlong6.mp3 differ diff --git a/audio/skill/mbshishou1.mp3 b/audio/skill/mbshishou1.mp3 new file mode 100644 index 000000000..c78a1aaf9 Binary files /dev/null and b/audio/skill/mbshishou1.mp3 differ diff --git a/audio/skill/mbshishou2.mp3 b/audio/skill/mbshishou2.mp3 new file mode 100644 index 000000000..fe60f784f Binary files /dev/null and b/audio/skill/mbshishou2.mp3 differ diff --git a/audio/skill/mbweitong1.mp3 b/audio/skill/mbweitong1.mp3 new file mode 100644 index 000000000..2de7ec6bd Binary files /dev/null and b/audio/skill/mbweitong1.mp3 differ diff --git a/audio/skill/mbxiongsi1.mp3 b/audio/skill/mbxiongsi1.mp3 new file mode 100644 index 000000000..0f9a6d65f Binary files /dev/null and b/audio/skill/mbxiongsi1.mp3 differ diff --git a/audio/skill/mbxiongsi2.mp3 b/audio/skill/mbxiongsi2.mp3 new file mode 100644 index 000000000..ec2a86dcb Binary files /dev/null and b/audio/skill/mbxiongsi2.mp3 differ diff --git a/audio/skill/mbzuoyou1.mp3 b/audio/skill/mbzuoyou1.mp3 new file mode 100644 index 000000000..8b40ce73f Binary files /dev/null and b/audio/skill/mbzuoyou1.mp3 differ diff --git a/audio/skill/mbzuoyou2.mp3 b/audio/skill/mbzuoyou2.mp3 new file mode 100644 index 000000000..2cbb78fb1 Binary files /dev/null and b/audio/skill/mbzuoyou2.mp3 differ diff --git a/audio/skill/oljiane1.mp3 b/audio/skill/oljiane1.mp3 new file mode 100644 index 000000000..fee12637b Binary files /dev/null and b/audio/skill/oljiane1.mp3 differ diff --git a/audio/skill/oljiane2.mp3 b/audio/skill/oljiane2.mp3 new file mode 100644 index 000000000..c64c4cd15 Binary files /dev/null and b/audio/skill/oljiane2.mp3 differ diff --git a/audio/skill/olxuanzhu1.mp3 b/audio/skill/olxuanzhu1.mp3 new file mode 100644 index 000000000..a84af8a38 Binary files /dev/null and b/audio/skill/olxuanzhu1.mp3 differ diff --git a/audio/skill/olxuanzhu2.mp3 b/audio/skill/olxuanzhu2.mp3 new file mode 100644 index 000000000..b3bb0c3af Binary files /dev/null and b/audio/skill/olxuanzhu2.mp3 differ diff --git a/audio/skill/rejiushi_mb_caomao1.mp3 b/audio/skill/rejiushi_mb_caomao1.mp3 new file mode 100644 index 000000000..fe05d0725 Binary files /dev/null and b/audio/skill/rejiushi_mb_caomao1.mp3 differ diff --git a/audio/skill/rejiushi_mb_caomao2.mp3 b/audio/skill/rejiushi_mb_caomao2.mp3 new file mode 100644 index 000000000..21db5b72a Binary files /dev/null and b/audio/skill/rejiushi_mb_caomao2.mp3 differ diff --git a/audio/skill/sbfangzhu_mb_caomao1.mp3 b/audio/skill/sbfangzhu_mb_caomao1.mp3 new file mode 100644 index 000000000..232a31d95 Binary files /dev/null and b/audio/skill/sbfangzhu_mb_caomao1.mp3 differ diff --git a/audio/skill/sbfangzhu_mb_caomao2.mp3 b/audio/skill/sbfangzhu_mb_caomao2.mp3 new file mode 100644 index 000000000..879631b55 Binary files /dev/null and b/audio/skill/sbfangzhu_mb_caomao2.mp3 differ diff --git a/audio/skill/sbqingzheng_mb_caomao1.mp3 b/audio/skill/sbqingzheng_mb_caomao1.mp3 new file mode 100644 index 000000000..69d8ca64c Binary files /dev/null and b/audio/skill/sbqingzheng_mb_caomao1.mp3 differ diff --git a/audio/skill/sbqingzheng_mb_caomao2.mp3 b/audio/skill/sbqingzheng_mb_caomao2.mp3 new file mode 100644 index 000000000..100657944 Binary files /dev/null and b/audio/skill/sbqingzheng_mb_caomao2.mp3 differ diff --git a/audio/skill/twxiayong_tw_yanliang1.mp3 b/audio/skill/twxiayong1_tw_yanliang.mp3 similarity index 100% rename from audio/skill/twxiayong_tw_yanliang1.mp3 rename to audio/skill/twxiayong1_tw_yanliang.mp3 diff --git a/audio/skill/twxiayong_tw_yanliang2.mp3 b/audio/skill/twxiayong2_tw_yanliang.mp3 similarity index 100% rename from audio/skill/twxiayong_tw_yanliang2.mp3 rename to audio/skill/twxiayong2_tw_yanliang.mp3 diff --git a/card/standard.js b/card/standard.js index cfd269871..c8c5e83ec 100644 --- a/card/standard.js +++ b/card/standard.js @@ -760,16 +760,43 @@ game.import('card',function(lib,game,ui,get,ai,_status){ } "step 2" ui.clear(); - var num; - if(event.targets){ - num=event.targets.length; + var cards; + if(card.storage&&Array.isArray(card.storage.fixedShownCards)){ + cards=card.storage.fixedShownCards.slice(); + var lose_list=[],cards2=[]; + cards.forEach(card=>{ + var owner=get.owner(card); + if(owner){ + var arr=lose_list.find(i=>i[0]==owner); + if(arr) arr[1].push(card); + else lose_list.push([owner,[card]]); + } + else cards2.add(card); + }); + if(lose_list.length){ + lose_list.forEach(list=>{ + list[0].$throw(list[1]); + game.log(list[0],'将',list[1],'置于了处理区'); + }) + game.loseAsync({ + lose_list:lose_list, + }).setContent('chooseToCompareLose'); + } + if(cards2.length) game.cardsGotoOrdering(cards2); + game.delayex(); } else{ - num=game.countPlayer(); + var num; + if(event.targets){ + num=event.targets.length; + } + else{ + num=game.countPlayer(); + } + if(card.storage&&typeof card.storage.extraCardsNum=='number') num+=card.storage.extraCardsNum; + cards=get.cards(num); + game.cardsGotoOrdering(cards).relatedEvent=event.getParent(); } - if(card.storage&&typeof card.storage.extraCardsNum=='number') num+=card.storage.extraCardsNum; - var cards=get.cards(num); - game.cardsGotoOrdering(cards).relatedEvent=event.getParent(); var dialog=ui.create.dialog('五谷丰登',cards,true); _status.dieClose.push(dialog); dialog.videoId=lib.status.videoId++; @@ -2735,7 +2762,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ next.set('ai',function(card){ var evt=_status.event.getTrigger(); if(get.attitude(evt.player,evt.target)<0){ - if(player.needsToDiscard()) return 15-get.value(card); + if(evt.player.needsToDiscard()) return 15-get.value(card); if(evt.baseDamage+evt.extraDamage>=Math.min(2,evt.target.hp)) return 8-get.value(card); return 5-get.value(card); } diff --git a/character/clan.js b/character/clan.js index 368646427..30b705d6c 100644 --- a/character/clan.js +++ b/character/clan.js @@ -24,18 +24,178 @@ game.import('character',function(lib,game,ui,get,ai,_status){ clan_xunyou:['male','wei',3,['clanbaichu','clandaojie'],['clan:颍川荀氏']], clan_wuqiao:['male','jin',4,['clanqiajue','clanmuyin'],['clan:陈留吴氏']], clan_wangguang:['male','wei',3,['clanlilun','clanjianji','clanzhongliu'],['clan:太原王氏']], + clan_wangmingshan:['male','wei',3,['clantanque','clanshengmo','clanzhongliu'],['clan:太原王氏']], }, characterSort:{ clan:{ clan_wu:['clan_wuxian','clan_wuban','clan_wukuang','clan_wuqiao'], clan_xun:['clan_xunshu','clan_xunchen','clan_xuncai','clan_xuncan','clan_xunyou'], clan_han:['clan_hanshao','clan_hanrong'], - clan_wang:['clan_wangling','clan_wangyun','clan_wanghun','clan_wanglun','clan_wangguang'], + clan_wang:['clan_wangling','clan_wangyun','clan_wanghun','clan_wanglun','clan_wangguang','clan_wangmingshan'], clan_zhong:['clan_zhongyan','clan_zhonghui','clan_zhongyu'], }, }, /** @type { importCharacterConfig['skill'] } */ skill:{ + //族王明山 + clantanque:{ + audio:2, + trigger:{player:'useCardAfter'}, + usable:1, + filter(event,player){ + const evt=lib.skill.dcjianying.getLastUsed(player,event); + if(!evt||!evt.card) return false; + const curCard=event.card,prevCard=evt.card; + const curNum=get.number(curCard),prevNum=get.number(prevCard); + if(typeof curNum!='number'||typeof prevNum!='number') return false; + const delNum=Math.abs(curNum-prevNum); + if(delNum===0) return false; + return game.hasPlayer(current=>{ + return current.getHp()===delNum; + }); + }, + locked:false, + async cost(event,trigger,player){ + const evt=lib.skill.dcjianying.getLastUsed(player,trigger); + const curCard=trigger.card,prevCard=evt.card; + const curNum=get.number(curCard),prevNum=get.number(prevCard); + const delNum=Math.abs(curNum-prevNum); + event.result=await player.chooseTarget(get.prompt('clantanque'),`对一名体力值为${delNum}的角色造成1点伤害`,(card,player,target)=>{ + return target.getHp()===get.event('delNum'); + }).set('delNum',delNum).set('ai',target=>{ + return get.damageEffect(target,get.player(),get.player()); + }).forResult(); + }, + async content(event,trigger,player){ + const target=event.targets[0]; + await target.damage(); + await game.asyncDelayx(); + }, + mod:{ + aiOrder(player,card,num){ + if(typeof card!='object') return; + const evt=lib.skill.dcjianying.getLastUsed(player); + if(!evt||!evt.card) return; + const curNum=get.number(card),prevNum=get.number(evt.card); + if(typeof curNum!='number'||typeof prevNum!='number') return; + const pairs=game.filterPlayer().map(current=>{ + return [current.getHp(),get.damageEffect(current,player,player)]; + }).filter(pair=>pair[1]>0); + if(!pairs.length) return; + const delNum=Math.abs(curNum-prevNum); + for(const [hp,eff] of pairs){ + if(hp!=delNum) continue; + return num+10+(pairs.filter(pair=>pair[0]===hp).sort((a,b)=>b[1]-a[1])[0][1])/20; + } + }, + } + }, + clanshengmo:{ + audio:2, + enable:'chooseToUse', + hiddenCard(player,name){ + if(get.type(name)!='basic') return false; + if(!player.getStorage('clanshengmo').includes(name)&&(get.event('clanshengmo_cards')||[]).length>0) return true; + }, + filter(event,player){ + if(event.responded) return false; + const names=lib.inpile.filter(name=>get.type(name)=='basic'&&!player.getStorage('clanshengmo').includes(name)),cards=get.event('clanshengmo_cards')||[]; + return cards.length>0&&names.some(name=>{ + return event.filterCard({name,isCard:true},player,event); + }); + }, + onChooseToUse(event){ + if(game.online) return; + if(!event.clanshengmo_cards){ + let cards=[]; + game.checkGlobalHistory('cardMove',evt=>{ + if(evt.name!='cardsDiscard'&&(evt.name!='lose'||evt.position!=ui.discardPile)) return; + cards.addArray(evt.cards.filter(card=>get.position(card,true)=='d')); + }); + const numbers=cards.map(card=>get.number(card,false)).unique(); + const [min,max]=[Math.min(...numbers),Math.max(...numbers)]; + event.set('clanshengmo_cards',cards.filter(card=>{ + const num=get.number(card,false); + return num>min&&num get.type(name) == 'basic' && !player.getStorage('clanshengmo').includes(name)), cards = evt.clanshengmo_cards; + const links = await player.chooseButton(['剩墨:获得其中一张牌', cards], true).set('ai', button => { + return get.value(button.link); + }).forResultLinks(); + if (!links || !links.length) return; + const list = []; + for (const name of names) { + const card = { name, isCard: true }; + if (evt.filterCard(card, player, evt)) { + list.push(['基本', '', name]); + } + if (name == 'sha') { + for (const nature of lib.inpile_nature) { + card.nature = nature; + if (evt.filterCard(card, player, evt)) { + list.push(['基本', '', name, nature]); + } + } + } + } + if (!list.length) return; + const links2 = await player.chooseButton(['视为使用一张未以此法使用过的基本牌', [list, 'vcard']], true).set('ai', button => { + return get.player().getUseValue(button.link) + 1; + }).forResultLinks(); + const name = links2[0][2], nature = links2[0][3]; + game.broadcastAll((name, nature, toGain) => { + lib.skill.clanshengmo_backup.viewAs = { + name, + nature, + isCard: true, + }; + lib.skill.clanshengmo_backup.prompt = `选择${get.translation(nature)}【${get.translation(name)}】的目标`; + lib.skill.clanshengmo_backup.cardToGain = toGain; + }, name, nature, links[0]); + evt.set('_backupevent', 'clanshengmo_backup'); + evt.backup('clanshengmo_backup'); + evt.set('openskilldialog', `选择${get.translation(nature)}【${get.translation(name)}】的目标`); + evt.set('norestore', true); + evt.set('custom', { + add: {}, + replace: { window() { } } + }); + evt.goto(0); + }, + marktext:'墨', + intro:{ + content:'已以此法使用过$' + }, + subSkill:{ + backup:{ + precontent(){ + delete event.result.skill; + event.result.card.storage.clanshengmo = true; + player.markAuto('clanshengmo',event.result.card.name); + player.gain(lib.skill.clanshengmo_backup.cardToGain, 'gain2'); + }, + filterCard:()=>false, + selectCard:-1, + }, + }, + ai:{ + order:3, + result:{ + player(player){ + if(get.event().dying) return get.attitude(player, get.event().dying); + if(get.event().type!='phase') return 1; + const names=get.event(`clanshengmo_${player.playerid}_enabled_names`); + return names.some(name=>{ + return player.getUseValue({name})>0; + }); + } + } + } + }, //族贝斯塔[doge] clanlilun:{ audio:2, @@ -575,21 +735,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content(){ 'step 0' player.unmarkSkill('clanyuzhi'); - var num1=0,num2=0,num3=0,bool=true; - var history=player.actionHistory; - for(var i=history.length-2;i>=0;i--){ - for(var evt of history[i].gain){ - if(evt.getParent().name=='draw'&&evt.getParent(2).name=='clanyuzhi'){ - if(bool) num1+=evt.cards.length; - else num2+=evt.cards.length; - } - } - if(bool) num3+=history[i].useCard.length; - if(history[i].isRound){ - if(bool) bool=false; - else break; - } - } + var num1=player.getRoundHistory('gain',evt=>{ + return evt.getParent().name=='draw'&&evt.getParent(2).name=='clanyuzhi'; + },1).reduce((sum,evt)=>sum+evt.cards.length,0); + var num2=player.getRoundHistory('gain',evt=>{ + return evt.getParent().name=='draw'&&evt.getParent(2).name=='clanyuzhi'; + },2).reduce((sum,evt)=>sum+evt.cards.length,0); + var num3=player.getRoundHistory('useCard',evt=>{ + return evt.cards&&evt.cards.length; + },1).reduce((sum,evt)=>sum+evt.cards.length,0); event.num1=num1; if(num1>0&&(num2>0&&num1>num2)||num1>num3){ player.logSkill('clanyuzhi'); @@ -607,15 +761,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 2' if(!player.countCards('h')) event.finish(); 'step 3' - player.chooseToDiscard('迂志:请弃置一张手牌','摸此牌牌名字数的牌。下一轮开始时,若本轮你使用的牌数或上一轮你以此法摸的牌数小于此牌牌名字数,则你失去1点体力。',true,function(card,player){ + player.chooseCard('迂志:请展示一张手牌','摸此牌牌名字数的牌。下一轮开始时,若本轮你使用的牌数或上一轮你以此法摸的牌数小于此牌牌名字数,则你失去1点体力。',function(card,player){ var num=get.cardNameLength(card); return typeof num=='number'&&num>0; - }).set('logSkill','clanyuzhi').set('ai',function(card){ + },true).set('logSkill','clanyuzhi').set('ai',function(card){ if(_status.event.dying&&_status.event.num>0&&get.cardNameLength(card)>_status.event.num) return 1/get.cardNameLength(card);//怂 return get.cardNameLength(card);//勇 }).set('dying',player.hp+player.countCards('hs',{name:['tao','jiu']})<1).set('num',event.num1); 'step 4' if(result.bool){ + player.logSkill('clanyuzhi'); + player.showCards(result.cards,get.translation(player)+'发动了【迂志】'); player.draw(get.cardNameLength(result.cards[0])); player.storage.clanyuzhi=get.cardNameLength(result.cards[0]); player.markSkill('clanyuzhi'); @@ -632,7 +788,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, trigger:{player:'damageEnd',source:'damageSource'}, filter(event,player){ - if(!event.card||player.isLinked()) return false; + if(!event.card/*||player.isLinked()*/) return false; if(game.getGlobalHistory('everything',evt=>{ if(evt.name!='damage'||!evt.card) return false; return evt.player==player||(evt.source&&evt.source==player); @@ -645,7 +801,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 0' var num=get.cardNameLength(trigger.card),str=''; if(player.getDamagedHp()>0) str+=('并摸'+get.cnNumber(player.getDamagedHp())+'张牌'); - player.chooseToDiscard(get.prompt('clanxieshu'),'横置武将牌,弃置'+get.cnNumber(num)+'张牌'+str,'he',num).set('ai',function(card){ + player.chooseToDiscard(get.prompt('clanxieshu'),/*'横置武将牌,'+*/'弃置'+get.cnNumber(num)+'张牌'+str,'he',num).set('ai',function(card){ var player=_status.event.player; var num=_status.event.num; var num2=player.getDamagedHp(); @@ -655,7 +811,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }).set('num',num).logSkill='clanxieshu'; 'step 1' if(result.bool){ - player.link(true); + //player.link(true); if(player.getDamagedHp()>0) player.draw(player.getDamagedHp()); } }, @@ -1396,7 +1552,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, clanzhongliu:{ audio:2, - audioname:['clan_wangling','clan_wangyun','clan_wanghun','clan_wanglun','clan_wangguang'], + audioname:['clan_wangling','clan_wangyun','clan_wanghun','clan_wanglun','clan_wangguang','clan_wangmingshan'], trigger:{player:'useCard'}, forced:true, clanSkill:true, @@ -1555,7 +1711,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 3' if(result.bool){ target.recast(result.cards); - if(get.color(cards[0])!=get.color(result.cards[0])) lib.skill.chenliuwushi.change(target,-1); + if(get.color(cards[0])===get.color(result.cards[0])) lib.skill.chenliuwushi.change(target,1); } event.finish(); 'step 4' @@ -1588,7 +1744,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool) cards.push(result.card); if(targets.length>0) event.goto(6); 'step 8' - if(cards.length>1&&get.color(cards)!='none') lib.skill.chenliuwushi.change(target,1); + if (cards.length > 1) { + const color = get.color(cards[0], false); + if (color != 'none') { + for (let i = 1; i < cards.length; i++) { + const color2 = get.color(cards[i], false); + if (color !== color2 && color2 !== 'none') { + lib.skill.chenliuwushi.change(target, -1); + break; + } + } + } + } }, ai:{ order:4.1, @@ -1989,16 +2156,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, filter(event,player){ if(!game.hasPlayer(current=>current!=player)) return false; - var card=event.card,type=get.type2(card); - for(var i=player.actionHistory.length-1; i>=0; i--){ - var history=player.actionHistory[i].useCard; - for(var evt of history){ - if(evt==event) continue; - if(get.type2(evt.card)==type) return false; - } - if(player.actionHistory[i].isRound) break; - } - return true; + const type=get.type2(event.card); + return player.getRoundHistory('useCard',evt=>get.type2(evt.card)==type).indexOf(event)==0; }, getNum(player){ return (player.countCards('ej')>0)+(player.isDamaged())+(Math.max(0,player.hp)=0; i--){ - var history=player.actionHistory[i].useCard; - for(var evt of history){ - if(evt==event) continue; - if(get.suit(evt.card)==suit) return false; - } - if(player.actionHistory[i].isRound) break; - } - return event.targets&&event.targets.length==1&&!event.targets[0].isLinked()|| - player.hasCard(card=>get.suit(card)==get.suit(event.card)&&player.canRecast(card),'h'); + const suit=get.suit(event.card); + if(player.getRoundHistory('useCard',evt=>get.suit(evt.card)==suit).indexOf(event)!=0) return false; + return event.targets&&event.targets.length==1&&!event.targets[0].isLinked()||player.hasCard(card=>get.suit(card)==get.suit(event.card)&&player.canRecast(card),'h'); }, content(){ 'step 0' @@ -2514,37 +2665,49 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 1' if(event.link&&event.recast) player.draw(); }, - group:['clandianzhan_count','clandianzhan_clear'], + group:'clandianzhan_count', subSkill:{ count:{ + charlotte:true, trigger:{player:'useCardAfter'}, filter(event,player){ let suit=get.suit(event.card); return lib.suits.includes(suit)&&!player.getStorage('clandianzhan').includes(suit); }, + forced:true, silent:true, - charlotte:true, content(){ - player.storage.clandianzhan=[]; - for(let i=player.actionHistory.length-1; i>=0; i--){ - let history=player.actionHistory[i].useCard; - for(let evt of history){ - player.storage.clandianzhan.add(get.suit(evt.card)); - } - if(player.actionHistory[i].isRound) break; + let suits=player.getRoundHistory('useCard',evt=>{ + return lib.suits.includes(get.suit(evt.card)); + }).reduce((list,evt)=>{ + return list.add(get.suit(evt.card)); + },[]).sort((a,b)=>lib.suits.indexOf(a)-lib.suits.indexOf(b)); + if(!player.storage.clandianzhan){ + player.when({global:'roundStart'}).then(()=>{ + delete player.storage.clandianzhan; + player.unmarkSkill('clandianzhan'); + }); } + player.storage.clandianzhan=suits; player.markSkill('clandianzhan'); }, - sub:true }, - clear:{ - trigger:{global:'roundStart'}, - silent:true, - charlotte:true, - content(){ - player.unmarkSkill('clandianzhan'); - }, - sub:true + }, + init(player){ + let suits=player.getRoundHistory('useCard',evt=>{ + return lib.suits.includes(get.suit(evt.card)); + }).reduce((list,evt)=>{ + return list.add(get.suit(evt.card)); + },[]).sort((a,b)=>lib.suits.indexOf(a)-lib.suits.indexOf(b)); + if(suits.length){ + if(!player.storage.clandianzhan){ + player.when({global:'roundStart'}).then(()=>{ + delete player.storage.clandianzhan; + player.unmarkSkill('clandianzhan'); + }); + } + player.storage.clandianzhan=suits; + player.markSkill('clandianzhan'); } } }, @@ -2829,6 +2992,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ wanglun:'王沦(233年-257年)字太冲,出身太原晋阳王姓世族(今山西省太原市),王昶三子,王浑、王深之弟,王湛之兄。醇粹简远,崇尚老庄之学,心思平淡。二十多时被举荐为孝廉,没有前往,后任大将军参军。257年,诸葛诞不满司马氏篡权而在寿春起义,王沦跟随司马昭征讨,遭遇疾疫去世,时年二十五,时人惜之,司马昭为他流泪。其兄著诔文《表德论》,表述其德行,说“因为畏惧帝王的典章制度,不能写墓志铭,于是撰写过往的事迹,刻在墓的背面。”', wuqiao:'吴乔,西晋人物,蜀车骑将军吴懿之孙。李雄建立成汉政权,他沦落益州,长达三十年,始终不向李雄屈服。', clan_wangguang:'王广,三国时期曹魏太原祁县人,哲学家。东汉司徒王允从孙,魏太尉王凌之子。有志尚学,官至尚书。魏时随父亲在朝作官,屯骑校尉,机智有谋。当得知司马懿篡夺曹魏政权时,王凌与外甥令狐愚合谋立楚王为魏主,王广劝其父不可,王凌没有接受儿子的谏言,结果计谋泄而被害。', + wangmingshan:'王明山,王凌的小儿子,太原祁(今山西省祁县)人,三国魏书法家,最知名善画,多技艺,人得其书,皆以为法。太尉王凌参与谋划废立,事情泄露,被太傅司马懿领兵平定。', }, dynamicTranslate:{ clanlianzhu(player){ @@ -2915,7 +3079,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ clanhuanjia_info:'出牌阶段结束时,你可以与一名角色拼点。赢的角色可以使用一张拼点牌。然后若此牌:未造成过伤害,你获得另一张拼点牌;造成过伤害,你失去一个技能。', clan_wukuang:'族吴匡', clanlianzhu:'联诛', - clanlianzhu_info:'转换技。每名角色A的出牌阶段限一次。阴:A可以重铸一张牌,然后你可以重铸一张牌。若这两张牌颜色不同,则你的手牌上限-1;阳:A可以令你选择一名在你或A攻击范围内的另一名其他角色B,然后A和你可依次选择是否对B使用一张【杀】。若这两张【杀】颜色相同,则你的手牌上限+1。', + clanlianzhu_info:'转换技。每名角色A的出牌阶段限一次。阴:A可以重铸一张牌,然后你可以重铸一张牌。若这两张牌颜色相同,则你的手牌上限+1;阳:A可以令你选择一名在你或A攻击范围内的另一名其他角色B,然后A和你可依次选择是否对B使用一张【杀】。若这两张【杀】颜色不同,则你的手牌上限-1。', clan_wangling:'族王淩', clanbolong:'驳龙', clanbolong_info:'出牌阶段限一次。你可以令一名其他角色选择一项:1.你交给其一张牌,然后视为对其使用一张雷【杀】;2.交给你等同于你手牌数的牌,然后视为对你使用一张【酒】。', @@ -2940,9 +3104,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ clanchenya_info:'当一名角色发动“出牌阶段限一次”的技能后,你可以令其重铸任意张牌名字数为X的牌(X为其手牌数)。', clan_zhonghui:'族钟会', clanyuzhi:'迂志', - clanyuzhi_info:'锁定技。新的一轮开始时,你依次执行以下项:①若你上一轮使用的牌数或你上上轮因〖迂志〗摸的牌数小于你上轮因〖迂志〗摸的牌数,你失去1点体力或失去〖保族〗。②你弃置一张手牌,然后摸X张牌(X为此牌牌名字数)。', + clanyuzhi_info:'锁定技。新的一轮开始时,你依次执行以下项:①若你上一轮使用的牌数或你上上轮因〖迂志〗摸的牌数小于你上轮因〖迂志〗摸的牌数,你失去1点体力或失去〖保族〗。②你展示一张手牌,然后摸X张牌(X为此牌牌名字数)。', clanxieshu:'挟术', - clanxieshu_info:'当你每回合首次因牌造成或受到伤害后,你可以横置武将牌,然后弃置Y张牌并摸你已损失体力值张牌(Y为此牌牌名字数)。', + clanxieshu_info:'当你每回合首次因牌造成或受到伤害后,你可以弃置Y张牌并摸你已损失体力值张牌(Y为此牌牌名字数)。', clan_zhongyu:'族钟毓', clanjiejian:'捷谏', clanjiejian_info:'当你于一回合使用第X张牌指定第一个目标后,若此牌不为装备牌,则你可以令一名目标角色摸X张牌。(X为此牌牌名字数)', @@ -2965,6 +3129,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ clanlilun_info:'出牌阶段限一次,你可以重铸两张手牌(不能是你本回合以此法重铸过的牌名的牌),然后使用其中的一张牌。', clanjianji:'见机', clanjianji_info:'限定技,一名角色的结束阶段,若其上下家均未于本回合:使用过牌,则你可以与其各摸一张牌;成为过牌的目标,则你可以视为使用一张【杀】。', + clan_wangmingshan:'族王明山', + clan_wangmingshan_prefix:'族', + clantanque:'弹雀', + clantanque_info:'每回合限一次。当你使用牌结算结束后,你可以对一名体力值为X且不为0的角色造成1点伤害(X为此牌点数与你上一张使用的牌的点数之差)。', + clanshengmo:'剩墨', + clanshengmo_info:'当你需要使用一张未以此法使用过的基本牌时,你可以获得一张于本回合进入弃牌堆且点数不为这些牌中最大且不为这些牌中最小的牌,视为你使用需要使用的牌。', clan_wu:'陈留·吴氏', clan_xun:'颍川·荀氏', diff --git a/character/extra.js b/character/extra.js index c85d11811..5aef112a9 100755 --- a/character/extra.js +++ b/character/extra.js @@ -13,7 +13,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ extra_yin:['shen_liubei','shen_luxun'], extra_lei:['shen_ganning','shen_zhangliao'], extra_key:['key_kagari','key_shiki','db_key_hina'], - extra_decade:['shen_jiangwei','shen_machao','shen_zhangfei','shen_zhangjiao','shen_dengai','shen_xuzhu'], + extra_decade:['shen_jiangwei','shen_machao','shen_zhangfei','shen_zhangjiao','shen_dengai','shen_xuzhu','dc_shen_huatuo'], extra_ol:['ol_zhangliao','shen_caopi','shen_zhenji','shen_sunquan'], extra_mobilezhi:['shen_guojia','shen_xunyu'], extra_mobilexin:['shen_taishici','shen_sunce'], @@ -23,6 +23,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, character:{ + dc_shen_huatuo:['male','shen',3,['jingyu','lvxin','huandao'],['qun']], shen_xuzhu:['male','shen',5,['zhengqing','zhuangpo'],['wei']], shen_lusu:['male','shen',3,['dingzhou','tamo','zhimeng'],['wu']], shen_huatuo:['male','shen',3,['wuling','youyi'],['qun']], @@ -79,6 +80,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ shen_jiaxu:['le_shen_jiaxu','shen_jiaxu'], shen_caocao:['shen_caocao','old_caocao'], shen_zhangjiao:['shen_zhangjiao','junk_zhangjiao'], + shen_huatuo:['dc_shen_huatuo','shen_huatuo'], }, characterFilter:{ shen_diaochan(mode){ @@ -95,6 +97,217 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, /** @type { importCharacterConfig['skill'] } */ skill:{ + //十周年神华佗 + jingyu:{ + audio:2, + trigger:{ + global:['useSkill','logSkillBegin','useCard','respond'], + }, + filter(event,player){ + if(['global','equip'].includes(event.type)) return false; + let skill=event.sourceSkill||event.skill; + if(!skill||skill==='jingyu') return false; + let info=get.info(skill); + while(true){ + if(!info||info.charlotte) return false; + if(info&&!info.sourceSkill) break; + skill=info.sourceSkill; + info=get.info(skill); + } + return !player.getStorage('jingyu_used').includes(skill); + }, + forced:true, + async content(event,trigger,player){ + if (!player.storage.jingyu_used){ + player.when({global:'roundStart'}).assign({ + firstDo: true, + }).then(() => delete player.storage.jingyu_used); + } + player.markAuto('jingyu_used', trigger.sourceSkill || trigger.skill); + await player.draw(); + }, + ai:{ + threaten:6, + }, + }, + lvxin:{ + audio:2, + enable:'phaseUse', + usable:1, + filterCard:true, + filterTarget:lib.filter.notMe, + delay:false, + discard:false, + lose:false, + async content(event,trigger,player){ + const { target, cards } = event, round = Math.min(5, game.roundNumber); + const name = get.translation(target); + await player.give(cards, target); + const result = await player.chooseControl(['摸牌', '弃牌']).set('choiceList', [ + `令${name}摸${get.cnNumber(round)}张牌`, + `令${name}随机弃置${get.cnNumber(round)}张手牌` + ]).set('prompt', '滤心:请选择一项').forResult(); + let cards2 = []; + if (result.index === 0) { + cards2 = await target.draw(round).forResult(); + } + else { + const cards = target.getCards('h', card => { + return lib.filter.cardDiscardable(card, target, 'lvxin'); + }); + if (cards.length > 0){ + const evt = await target.discard(cards.randomGets(round)).set('discarder', target); + cards2 = evt.done.cards2; + } + } + const cardName = get.name(cards[0], player); + if (cards2.some(card => { + return get.name(card, target) === cardName; + })) { + target.addSkill('lvxin_lose'); + target.addMark('lvxin_lose', 1, false); + } + }, + subSkill:{ + lose:{ + trigger:{ + player:['useSkill','logSkillBegin','useCard','respond'], + }, + filter(event,player){ + if(['global','equip'].includes(event.type)) return false; + const skill=event.sourceSkill||event.skill; + const info=get.info(skill); + return info&&!info.charlotte; + }, + forced:true, + onremove:true, + charlotte:true, + async content(event,trigger,player){ + player.loseHp(player.countMark('lvxin_lose')); + player.removeSkill('lvxin_lose'); + }, + intro:{ + content:'下次发动技能时失去#点体力', + }, + } + } + }, + huandao:{ + audio:2, + enable:'phaseUse', + usable:1, + limited:true, + filterTarget:lib.filter.notMe, + skillAnimation:true, + animationColor:'metal', + async content(event,trigger,player){ + player.awakenSkill('huandao'); + const { target } = event; + await target.turnOver(false); + await target.link(false); + let names = [target.name1||target.name]; + if (target.name2) names.add(target.name2); + names = names.map(name => get.rawName(name)); + if (!_status.characterlist) lib.skill.pingjian.initList(); + _status.characterlist.randomSort(); + let ownedSkills = target.getSkills(null, false, false), ownedSkillsName = ownedSkills.map(skill => get.translation(skill)); + let skillToGain = null; + outer: for (const name of _status.characterlist){ + const info = lib.character[name]; + if (!names.includes(get.rawName(name))) continue; + const skills = info[3].slice().randomSort(); + while (skills.length) { + const skill = skills.shift(), skillName = get.translation(skill); + if (!ownedSkillsName.includes(skillName)) { + skillToGain = skill; + break outer; + } + } + } + if (!skillToGain) return; + player.popup(skillToGain); + player.line(target, 'green'); + let prompt2 = '若你选择是,则你于获得此技能后须失去一个其他技能。

'; + if(lib.skill[skillToGain].nobracket){ + prompt2 += `
${get.translation(skillToGain)}
${get.skillInfoTranslation(skillToGain)}


`; + } + else{ + const translation=lib.translate[skillToGain+'_ab'] || get.translation(skillToGain).slice(0, 2); + prompt2 += `
【${translation}】
${get.skillInfoTranslation(skillToGain)}


`; + } + const bool = await target.chooseBool(`寰道:是否获得技能〖${get.translation(skillToGain)}〗?`, prompt2) + .set('choice', (() => { + const rank = get.skillRank(skillToGain, 'inout') + 1; + return ownedSkills.some(skill => { + const info = get.info(skill); + if (info) { + if (target.awakenedSkills.includes(skill) && (info.limited || info.juexingji || info.dutySkill)) return true; + if (info.ai && (info.ai.neg || info.ai.halfneg)) return true; + } + return get.skillRank(skill, 'inout') < rank; + }); + })()) + .forResultBool(); + if (!bool) { + target.chat('拒绝'); + game.log(target, '拒绝获得技能', `#g【${get.translation(skillToGain)}】`) + await game.asyncDelay(); + return; + } + await target.addSkills(skillToGain); + ownedSkills = target.getSkills(null, false, false).filter(skill => { + if (skill === skillToGain) return false; + const info = get.info(skill); + if(!info || info.charlotte || !get.skillInfoTranslation(skill, player).length) return false; + return true; + }); + if (!ownedSkills) return; + const control = await target.chooseControl(ownedSkills).set('choiceList', ownedSkills.map(skill => { + return `
【${get.translation(lib.translate[skill + '_ab'] || get.translation(skill).slice(0, 2))}】
${get.skillInfoTranslation(skill, target)}
`; + })).set('displayIndex', false).set('prompt', '寰道:选择失去一个技能').set('ai', () => { + return get.event('choice'); + }).set('choice', (() => { + const uselessSkills = ownedSkills.filter(skill => { + const info = get.info(skill); + if (!info) return false; + if (target.awakenedSkills.includes(skill) && (info.limited || info.juexingji || info.dutySkill)) return true; + if (info.ai && (info.ai.neg || info.ai.halfneg)) return true; + return false; + }); + if (uselessSkills.length) return uselessSkills.randomGet(); + return ownedSkills.sort((a, b) => { + return get.skillRank(a, 'inout') - get.skillRank(b, 'inout'); + })[0]; + })()).forResultControl(); + await target.removeSkills(control); + }, + ai:{ + order:5, + result:{ + target(player,target){ + if(game.roundNumber*game.countPlayer()<=1.5*game.countPlayer2()/Math.sqrt(player.getDamagedHp()+1)) return 0; + const ownedSkills=target.getSkills(null,false,false).filter(skill=>{ + const info=get.info(skill); + if(!info||info.charlotte||!get.skillInfoTranslation(skill,player).length) return false; + return true; + }); + const uselessSkills=ownedSkills.filter(skill=>{ + const info=get.info(skill); + if(!info) return false; + if(target.awakenedSkills.includes(skill)&&(info.limited||info.juexingji||info.dutySkill)) return true; + if(info.ai&&(info.ai.neg||info.ai.halfneg)) return true; + return false; + }); + if(uselessSkills.length) return 3; + let names=[target.name1||target.name]; + if(target.name2) names.add(target.name2); + names=names.map(name=>get.rawName(name)); + if(_status.characterlist.some(name=>names.includes(get.rawName(name)))) return 1; + return 0; + }, + }, + }, + }, //神许褚 zhengqing:{ audio:2, @@ -7595,70 +7808,65 @@ game.import('character',function(lib,game,ui,get,ai,_status){ drlt_zhiti:{ audio:2, locked:true, - group:["drlt_zhiti_1","drlt_zhiti_2","drlt_zhiti_3","drlt_zhiti_4","drlt_zhiti_5"], + group:['drlt_zhiti_damage','drlt_zhiti_compare','drlt_zhiti_juedou'], global:'g_drlt_zhiti', subSkill:{ - '1':{ - audio:"drlt_zhiti", - trigger:{ - global:'juedouAfter' - }, - forced:true, - filter(event,player){ - return event.targets&&event.targets.includes(player)&&event.turn!=player&&player.hasDisabledSlot(); - }, - content(){ - player.chooseToEnable(); - }, - }, - '2':{ + juedou:{ audio:"drlt_zhiti", trigger:{ player:'juedouAfter', + target:'juedouAfter', }, - forced:true, - filter(event,player){ - return event.turn!=player&&player.hasDisabledSlot(); + forced: true, + filter(event,player) { + if (event.turn === player || !player.hasDisabledSlot()) return false; + const opposite = (event.player === player ? event.target : event.player); + return opposite && opposite.isIn() && opposite.inRangeOf(player); }, content(){ player.chooseToEnable(); }, }, - '3':{ + compare:{ audio:"drlt_zhiti", trigger:{ - player:'chooseToCompareAfter' + player:['chooseToCompareAfter','compareMultipleAfter'], + target:['chooseToCompareAfter','compareMultipleAfter'] + }, + filter(event,player){ + if (event.preserve || !player.hasDisabledSlot()) return false; + let opposite; + if (player === event.player){ + if (event.num1 > event.num2){ + opposite = event.target; + } + else { + return false; + } + } + else{ + if (event.num1 < event.num2){ + opposite = event.player; + } + else{ + return false; + } + } + return opposite && opposite.isIn() && opposite.inRangeOf(player); }, forced:true, - filter(event,player){ - return event.result.bool==true&&player.hasDisabledSlot(); - }, - content(){ - 'step 0' - player.chooseToEnable(); - }, - }, - '4':{ - audio:"drlt_zhiti", - trigger:{ - global:'chooseToCompareAfter' - }, - forced:true, - filter(event,player){ - return (event.targets!=undefined&&event.targets.includes(player)||event.target==player)&&event.result.bool==false&&player.hasDisabledSlot(); - }, content(){ player.chooseToEnable(); }, }, - '5':{ - audio:"drlt_zhiti", - trigger:{ - player:['damageEnd'] - }, + damage:{ + audio:'drlt_zhiti', + trigger:{player:'damageEnd'}, forced:true, - filter(event,player){ - return player.hasDisabledSlot(); + filter(event,player) { + if (!player.hasDisabledSlot()) return false; + const opposite = event.source; + return opposite && opposite.isIn() && opposite.inRangeOf(player); }, content(){ player.chooseToEnable(); @@ -7669,9 +7877,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ g_drlt_zhiti:{ mod:{ maxHandcard (player,num){ - if(player.maxHp>player.hp&&game.countPlayer(function(current){ + if(player.isDamaged()) return num-game.countPlayer(function(current){ return current!=player&¤t.hasSkill('drlt_zhiti')&¤t.inRange(player); - })) return num-1; + }); }, }, }, @@ -8242,7 +8450,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ "drlt_duorui":"夺锐", "drlt_duorui_info":"当你于出牌阶段内对一名其他角色造成伤害后,你可以废除你装备区内的一个装备栏(若已全部废除则可以跳过此步骤),然后获得该角色的一个技能直到其的下回合结束或其死亡(觉醒技,限定技,主公技,隐匿技,使命技等特殊技能除外)。若如此做,该角色该技能失效且你不能再发动〖夺锐〗直到你失去以此法获得的技能。", "drlt_zhiti":"止啼", - "drlt_zhiti_info":"锁定技,你攻击范围内已受伤的其他角色手牌上限-1;当你拼点或【决斗】胜利,或受到伤害后,你恢复一个装备栏。", + "drlt_zhiti_info":"锁定技。①你攻击范围内已受伤的其他角色手牌上限-1;②当你拼点或【决斗】胜利/或受到伤害后,若对方/伤害来源在你的攻击范围内,则你恢复一个装备栏。", shen_zhaoyun:'神赵云', shen_zhaoyun_prefix:'神', @@ -8544,8 +8752,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ jxlianpo_info:'锁定技。①若场上最大阵营为:反贼,其他角色的手牌上限-1,所有角色使用【杀】的次数上限和攻击范围+1;主忠,其他角色不能对其以外的角色使用【桃】。其他角色死亡后,若有多个最大阵营,来源摸两张牌并回复1点体力。②一轮游戏开始时,你展示一张未加入游戏或已死亡角色的身份牌,本轮视为该身份对应阵营的角色数+1。', jxzhaoluan:'兆乱', jxzhaoluan_info:'限定技。一名角色死亡前,若其此次进入过濒死状态,你可以取消之,令其加3点体力上限并失去所有非锁定技,回复体力至3点,摸四张牌。然后你获得如下效果:出牌阶段,你可以令一名成为过你〖兆乱〗目标的角色减1点体力上限,然后对一名此阶段未以此法选择过的角色造成1点伤害。', - shen_huatuo:'神华佗', - shen_huatuo_prefix:'神', + shen_huatuo:'手杀神华佗', + shen_huatuo_prefix:'手杀神', wuling:'五灵', wuling_info:'①出牌阶段限两次。你可以选择一名没有“五禽戏”的角色,按照你选择的顺序向其传授“五禽戏”,且其获得如下效果:其获得你选择的第一种“五禽戏”的效果,并在其每个准备阶段移除当前“五禽戏”的效果并切换为下一种。②当你死亡时,你令场上的角色失去你传授的“五禽戏”。', wuling_wuqinxi:'五禽戏', @@ -8571,6 +8779,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ zhengqing_info:'锁定技。一轮游戏开始时,你移去所有角色的“擎”标记,令上一轮于一回合内造成伤害值最多的角色各获得X枚“擎”,且你与这些角色各摸一张牌(X为这些角色该回合内造成的伤害值)。若该角色为你且本次获得的“擎”数为本局游戏最多的一次,你改为摸X张牌(至多摸五张)。', zhuangpo:'壮魄', zhuangpo_info:'你可以将牌名为【杀】或牌面信息中包含“【杀】”的牌当【决斗】使用,然后你获得如下效果:1.当此【决斗】指定目标后,若你有“擎”,你可以移去任意枚“擎”,令目标角色弃置等量的牌;2.当你造成渠道为此牌的伤害时,若此牌的所有目标角色中存在有“擎”的角色,此伤害+1。', + dc_shen_huatuo:'神华佗', + dc_shen_huatuo_prefix:'神', + jingyu:'静域', + jingyu_info:'锁定技。每个技能每轮限一次,当一名角色发动不为〖静域〗的技能时,你摸一张牌。', + lvxin:'滤心', + lvxin_info:'出牌阶段限一次。你可以交给一名其他角色一张手牌并选择一项:⒈令其摸X张牌;⒉令其随机弃置X张手牌(X为游戏轮数,至多为5)。然后若其以此法得到/弃置了与你交给其的牌牌名相同的牌,其于其下次发动技能时回复/失去1点体力。', + huandao:'寰道', + huandao_info:'限定技。出牌阶段,你可以选择一名其他角色。你令其复原武将牌,系统随机生成一个与其同名的武将的武将牌上的一个与其拥有的技能均不同名的技能。其可以选择获得此技能,然后选择失去一个其他技能。', extra_feng:'神话再临·风', extra_huo:'神话再临·火', diff --git a/character/huicui.js b/character/huicui.js index 0689c9478..5d7867579 100644 --- a/character/huicui.js +++ b/character/huicui.js @@ -111,8 +111,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ sp_caizijiaren:['dc_kongrong','re_dongbai','re_sunluyu','heyan','zhaoyan','wangtao','wangyue','zhangxuan','tengyin','zhangyao','xiahoulingnv','dc_sunru','pangshanmin','kuaiqi'], sp_zhilan:['dc_liuli','liuyong','wanniangongzhu','zhanghu','lvlingqi','tenggongzhu','panghui','dc_zhaotongzhaoguang','yuantanyuanxiyuanshang','yuechen','dc_lingcao'], sp_guixin:['zangba','re_kanze','re_chendeng','caimaozhangyun','dc_lvkuanglvxiang','dc_gaolan','yinfuren','chengui','chenjiao','dc_sp_jiaxu','qinlang','dc_dongzhao'], - sp_daihan:['mamidi','dc_jiling','zhangxun','dc_yuejiu','wanglie','leibo','qiaorui','dongwan','yuanyin'], - sp_jianghu:['guanning','huzhao','dc_huangchengyan','mengjie'], + sp_daihan:['mamidi','dc_jiling','zhangxun','dc_yuejiu','leibo','qiaorui','dongwan','yuanyin'], + sp_jianghu:['guanning','huzhao','dc_huangchengyan','mengjie','wanglie'], sp_zongheng:['huaxin','luyusheng','re_xunchen','re_miheng','fengxi','re_dengzhi','dc_yanghu','zongyu'], sp_taiping:['guanhai','liupi','peiyuanshao','zhangchu','zhangkai','dc_zhangmancheng'], sp_yanhan:['dc_liuba','dc_huangquan','furongfuqian','xianglang','dc_huojun','gaoxiang','dc_wuban','jiangfei'], @@ -393,11 +393,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, forced:true, notUseOrRespond(event,player){ - if(event.name==='cardsDiscard') return false; - const evtx=event.getParent(); - if(evtx.name==='orderingDiscard') return false; - const evt2=(evtx.relatedEvent||evtx.getParent()); - return !['useCard','respond'].includes(evt2.name)||evt2.player!==player; + if (event.name !== 'cardsDiscard') return true; + const evtx = event.getParent(); + if (evtx.name !== 'orderingDiscard') return true; + const evt2 = (evtx.relatedEvent || evtx.getParent()); + return !['useCard', 'respond'].includes(evt2.name) || evt2.player !== player; }, async content(event,trigger,player){ const cards=[]; @@ -3551,56 +3551,56 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, dcrihui:{ - audio:2, - trigger:{player:'useCardAfter'}, - usable:1, - filter:function(event,player){ - if(!event.targets||event.targets.length!=1||event.targets[0]==player) return false; - var card=event.card; - var target=event.targets[0]; - var marked=target.hasMark('dcjizhong'); - return (get.type(card)=='trick'||get.color(card)=='black'&&get.type(card)=='basic')&& - (marked||!marked&&game.hasPlayer(current=>current.hasMark('dcjizhong'))); + audio: 2, + trigger: { player: 'useCardAfter' }, + usable: 1, + filter: function (event, player) { + if (!event.targets || event.targets.length != 1 || event.targets[0] == player) return false; + var card = event.card; + var target = event.targets[0]; + var marked = target.hasMark('dcjizhong'); + return (get.type(card) == 'trick' || get.color(card) == 'black' && get.type(card) == 'basic') && + (marked || !marked && game.hasPlayer(current => current.hasMark('dcjizhong'))); }, - direct:true, - content:function(){ - 'step 0' - var target=trigger.targets[0]; - var card={name:trigger.card.name,nature:trigger.card.nature,isCard:true}; - event.target=target; - event.card=card; - if(target.hasMark('dcjizhong')) player.gainPlayerCard(get.prompt('dcrihui',target),target,'hej').set('logSkill',['dcrihui',target]); - else{ - player.chooseBool(get.prompt('dcrihui',target),'令所有有“信众”的角色依次视为对其使用一张'+get.translation(card)).set('ai',()=>{ - return _status.event.bool; - }).set('bool',function(){ - var eff=0; - game.countPlayer(current=>{ - if(!current.hasMark('dcjizhong')) return; - eff+=get.effect(target,card,current,player); - }); - return eff>0; - }()); + logTarget: event => event.targets[0], + prompt2(event, player) { + const target = event.targets[0]; + if (target.hasMark('dcjizhong')) return '获得该角色区域内的一张牌'; + else { + const card = { name: event.card.name, nature: event.card.nature, isCard: true }; + return '令所有有“信众”的角色依次视为对其使用一张' + get.translation(card); } - 'step 1' - if(!result.bool){ - player.storage.counttrigger.dcrihui--; - event.finish(); - return; + }, + check(event, player) { + const target = event.targets[0]; + if (target.hasMark('dcjizhong')) { + return get.effect(target, { name: 'shunshou_copy' }, event, player) > 0; } - if(target.hasMark('dcjizhong')) event.finish(); - else{ - player.logSkill('dcrihui',target); - event.targets=game.filterPlayer(current=>current.hasMark('dcjizhong')); - event.targets.sortBySeat(_status.currentPhase); + else { + const card = { name: event.card.name, nature: event.card.nature, isCard: true }; + let eff = 0; + game.countPlayer(current => { + if (!current.hasMark('dcjizhong') || !current.canUse(card, player, false)) return; + eff += get.effect(target, card, current, player); + }); + return eff > 0; } - 'step 2' - var current=event.targets.shift(); - if(current.canUse(card,target,false)){ - current.useCard(card,target,false); + }, + async content(event, trigger, player) { + const target = trigger.targets[0]; + if (target.hasMark('dcjizhong')) { + await player.gainPlayerCard(target, 'hej', true) } - if(event.targets.length) event.redo(); - } + else { + const card = { name: trigger.card.name, nature: trigger.card.nature, isCard: true }; + const targets = game.filterPlayer(current => current.hasMark('dcjizhong')).sortBySeat(_status.currentPhase); + for (const current of targets) { + if (target.isIn() && current.isIn() && current.canUse(card, target, false)) { + await current.useCard(card, target, false); + } + } + } + }, }, dcguangshi:{ audio:2, @@ -5104,29 +5104,23 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, trigger:{target:'useCardToTargeted'}, usable:2, - direct:true, filter:function(event,player){ return event.player!=player&&(get.type(event.card)=='trick'||event.card.name=='sha')&&player.countCards('he')>1; }, - content:function(){ - 'step 0' - var str=',若重铸的牌中没有'+get.translation(get.type2(trigger.card))+'牌,你于'+get.translation(trigger.cards)+'进入弃牌堆后获得之'; - player.chooseCard(get.prompt('dcqianzheng'),'重铸两张牌'+(trigger.cards.length?str:'')+'。',2,'he',lib.filter.cardRecastable).set('ai',card=>{ - var val=get.value(card); - if(get.type2(card)==_status.event.type) val+=0.5; - return 6-val; - }).set('type',get.type2(trigger.card)); - 'step 1' - if(result.bool){ - var cards=result.cards; - player.logSkill('dcqianzheng'); - player.recast(cards); - if(cards.every(card=>get.type2(card)!=get.type2(trigger.card))){ - trigger.getParent().dcqianzheng=true; - player.addTempSkill('dcqianzheng_gain'); - } + async cost(event, trigger, player) { + const str = ',若重铸的牌中没有' + get.translation(get.type2(trigger.card)) + '牌,你于' + get.translation(trigger.cards) + '进入弃牌堆后获得之'; + event.result = await player.chooseCard(get.prompt('dcqianzheng'), '重铸两张牌' + (trigger.cards.length ? str : '') + '。', 2, 'he', lib.filter.cardRecastable).set('ai', card => { + var val = get.value(card); + if (get.type2(card) == _status.event.type) val += 0.5; + return 6 - val; + }).set('type', get.type2(trigger.card)).forResult(); + }, + async content(event, trigger, player) { + if (event.cards.every(card => get.type2(card) != get.type2(trigger.card))) { + trigger.getParent().dcqianzheng = true; + player.addTempSkill('dcqianzheng_gain'); } - else player.storage.counttrigger.dcqianzheng--; + await player.recast(event.cards); }, subSkill:{ gain:{ @@ -5347,7 +5341,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 1' var num=player.getDamagedHp(); if(!player.isIn()||!num) event.finish(); - else player.chooseTarget('御关:令'+get.cnNumber(num)+'名角色将手牌摸至体力上限',Math.min(game.countPlayer(),[1,num]),true).set('ai',target=>{ + else player.chooseTarget('御关:令至多'+get.cnNumber(num)+'名角色将手牌摸至体力上限',Math.min(game.countPlayer(),[1,num]),true).set('ai',target=>{ return get.attitude(_status.event.player,target)*Math.max(0.1,target.maxHp-target.countCards('h')); }); 'step 2' @@ -6254,24 +6248,22 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return event.player!=player&&get.color(event.card)=='black'; }, usable:2, - direct:true, - content:function(){ - 'step 0' - if(player.countCards('h')1); - }else{ - player.chooseToDiscard(get.prompt('dcqingyan'),'弃置一张手牌令你的手牌上限+1').set('ai',card=>6-get.value(card)).set('logSkill','dcqingyan'); + async cost(event, trigger, player) { + if (player.countCards('h') < player.hp) { + event.result = await player.chooseBool(get.prompt('dcqingyan'), '将手牌摸至体力上限(摸' + get.cnNumber(player.maxHp - player.countCards('h')) + '张牌)').set('ai', () => 1).forResult(); } - 'step 1' - if(result.bool){ - if(result.cards&&result.cards.length){ - lib.skill.dcxieshou.change(player,1); - }else{ - player.logSkill('dcqingyan'); - player.drawTo(player.maxHp); - } - } else player.storage.counttrigger.dcqingyan--; - } + else { + event.result = await player.chooseToDiscard(get.prompt('dcqingyan'), '弃置一张手牌令你的手牌上限+1', 'chooseonly').set('ai', card => 6 - get.value(card)).forResult(); + } + }, + async content(event, trigger, player) { + if (event.cards && event.cards.length) { + await player.dicard(cards); + lib.skill.dcxieshou.change(player, 1); + } else { + player.drawTo(player.maxHp); + } + }, }, dcqizi:{ mod:{ @@ -6633,8 +6625,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ global:['gainAfter','loseAsyncAfter'], }, usable:1, - filter:function(event,player){ - return lib.skill.dcyingtu.filterx(event,player,player.getNext())||lib.skill.dcyingtu.filterx(event,player,player.getPrevious()); + getIndex(event, player){ + var targets=[]; + if(lib.skill.dcyingtu.filterx(event,player,player.getNext())) targets.add(player.getNext()); + if(lib.skill.dcyingtu.filterx(event,player,player.getPrevious())) targets.add(player.getPrevious()); + return targets.sortBySeat(_status.currentPhase); }, filterx:function(event,player,target){ var evt=event.getParent('phaseDraw'); @@ -6643,41 +6638,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return lib.filter.canBeGained(card,target,player) },'he'); }, - logTarget:'player', - direct:true, - checkx:function(player,source){ + logTarget(event, player, triggername, target){ + return target; + }, + check(event, player, triggername, source){ var target=(source==player.getNext()?player.getPrevious():player.getNext()); return Math.min(0,get.attitude(player,target))>=get.attitude(player,source); }, + prompt2:'获得该角色的一张牌,然后将一张牌交给该角色的对位角色。若你给出的是装备牌,则其使用其得到的牌。', content:function(){ 'step 0' - var targets=[]; - event.targets=targets; - if(lib.skill.dcyingtu.filterx(trigger,player,player.getNext())) targets.add(player.getNext()); - if(lib.skill.dcyingtu.filterx(trigger,player,player.getPrevious())) targets.add(player.getPrevious()); - 'step 1' - var target=targets.shift(); + var target=event.targets[0]; event.target=target; - player.chooseBool( - get.prompt('dcyingtu',target), - '获得该角色的一张牌,然后将一张牌交给该角色的对位角色。若你给出的是装备牌,则其使用其得到的牌。' - ).set('goon',lib.skill.dcyingtu.checkx(player,target)).set('ai',function(){ - return _status.event.goon; - }); - 'step 2' - if(result.bool){ - player.logSkill('dcyingtu',target); - var next=game.createEvent('dcyingtu_insert'); - next.player=player; - next.target=target; - next.setContent(lib.skill.dcyingtu.contentx); - event.finish(); - } - else if(targets.length>0) event.goto(1); - else player.storage.counttrigger.dcyingtu--; - }, - contentx:function(){ - 'step 0' event.side=(target==player.getPrevious()?'getNext':'getPrevious'); player.gainPlayerCard(target,true,'he'); 'step 1' @@ -6705,7 +6677,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, trigger:{global:'useCardAfter'}, forced:true, - locked:false, filter:function(event,player){ return get.type(event.card,null,false)=='equip'&&event.player.isMaxEquip(); }, @@ -6872,8 +6843,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){ disable:{ charlotte:true, mod:{ - cardEnabled2:function(card){ - if(get.position(card)=='h') return false; + cardEnabled(card, player){ + if (card.cards) { + const hs = player.getCards('h'); + if (card.cards.some(card => hs.includes(card))) return false; + } + }, + cardSavable(card, player){ + if (card.cards) { + const hs = player.getCards('h'); + if (card.cards.some(card => hs.includes(card))) return false; + } }, }, mark:true, @@ -9537,7 +9517,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.chooseControl(lib.suit,'cancel2').set('prompt',get.prompt('huguan',trigger.player)).set('prompt2','令某种花色的手牌不计入其本回合的手牌上限').set('ai',function(){ var player=_status.event.player,target=_status.event.getTrigger().player,att=get.attitude(player,target); if(att <= 0){ - if (!player.hasSkill('yaopei') || player.hasAllHistory('useSkill',function(evt){ + if (!player.hasSkill('yaopei') || player.hasHistory('useSkill',function(evt){ return evt.skill=='huguan'&&evt.targets.includes(target); }) || target.needsToDiscard() - target.needsToDiscard(-target.countCards('h') / 4) > (att>-2?1.6:1)) return 'cancel2'; } @@ -10284,46 +10264,44 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(player==event.player||event.targets.length!=1) return false; return player.countCards('h')>=2; }, - direct:true, usable:2, - content:function(){ - 'step 0' - player.chooseToDiscard('he',[2,Infinity],get.prompt('reshejian',trigger.player),'
弃置至少两张手牌,然后选择一项:
⒈弃置其等量的牌。⒉对其造成1点伤害。
').set('ai',function(card){ - if(_status.event.goon&&ui.selected.cards.length<2) return 5.6-get.value(card); + async cost(event, trigger, player) { + event.result = await player.chooseToDiscard('he', [2, Infinity], get.prompt('reshejian', trigger.player), '
弃置至少两张手牌,然后选择一项:
⒈弃置其等量的牌。⒉对其造成1点伤害。
').set('ai', function (card) { + if (_status.event.goon && ui.selected.cards.length < 2) return 5.6 - get.value(card); return 0; - }).set('goon',function(){ - var target=trigger.player; - if(get.damageEffect(target,player,player)>0) return true; - if(target.countCards('he',function(card){ - return get.value(card,target)>6; - })>=2) return true; + }, 'chooseonly').set('goon', function () { + var target = trigger.player; + if (get.damageEffect(target, player, player) > 0) return true; + if (target.countCards('he', function (card) { + return get.value(card, target) > 6; + }) >= 2) return true; return false; - }()).logSkill=['reshejian',trigger.player]; + }()).forResult(); + }, + logTarget: 'player', + content: function () { + 'step 0' + player.discard(cards); 'step 1' - if(!result.bool){ - player.storage.counttrigger.reshejian--; - event.finish(); - return; - } - var num=result.cards.length; - event.num=num; - var target=trigger.player,str=get.translation(target); - event.target=target; - if(!target.isIn()) event.finish(); - else if(!target.hasCard(function(card){ - return lib.filter.canBeDiscarded(card,player,target); - },'he')) event._result={index:1}; - else player.chooseControl().set('choiceList',[ - '弃置'+str+'的'+get.cnNumber(num)+'张牌', - '对'+str+'造成1点伤害', - ]).set('ai',function(){ - var player=_status.event.player; - var eff0=get.effect(target,{name:'guohe_copy2'},player,player)*Math.min(1.7,target.countCards('he')); - var eff1=get.damageEffect(target,player,player); - return eff0>eff1?0:1; + var num = cards.length; + event.num = num; + var target = targets[0], str = get.translation(target); + event.target = target; + if (!target.isIn()) event.finish(); + else if (!target.hasCard(function (card) { + return lib.filter.canBeDiscarded(card, player, target); + }, 'he')) event._result = { index: 1 }; + else player.chooseControl().set('choiceList', [ + '弃置' + str + '的' + get.cnNumber(num) + '张牌', + '对' + str + '造成1点伤害', + ]).set('ai', function () { + var player = _status.event.player; + var eff0 = get.effect(target, { name: 'guohe_copy2' }, player, player) * Math.min(1.7, target.countCards('he')); + var eff1 = get.damageEffect(target, player, player); + return eff0 > eff1 ? 0 : 1; }); 'step 2' - if(result.index==0) player.discardPlayerCard(target,num,true,'he'); + if (result.index == 0) player.discardPlayerCard(target, num, true, 'he'); else target.damage(); }, }, @@ -10389,34 +10367,35 @@ game.import('character',function(lib,game,ui,get,ai,_status){ rewangzu:{ audio:2, trigger:{player:'damageBegin1'}, - direct:true, filter:function(event,player){ return event.source&&player!=event.source&&player.hasCard((card)=>lib.filter.cardDiscardable(card,player,'rewangzu'),'h'); }, usable:1, - content:function(){ + async cost(event, trigger, player) { 'step 0' - var num=player.getFriends().length; - if(!game.hasPlayer(function(current){ - return current!=player&¤t.getFriends().length>num; - })){ - player.chooseToDiscard('h',get.prompt('rewangzu'),'弃置一张牌并令伤害-1').set('ai',function(card){ - return 7-get.value(card); - }).logSkill='rewangzu'; + var num = player.getFriends().length; + if (!game.hasPlayer(function (current) { + return current != player && current.getFriends().length > num; + })) { + player.chooseToDiscard('h', get.prompt('rewangzu'), '弃置一张牌并令伤害-1', 'chooseonly').set('ai', function (card) { + return 7 - get.value(card); + }); } - else{ - player.chooseBool(get.prompt('rewangzu'),'随机弃置一张牌并令伤害-1'); + else { + player.chooseBool(get.prompt('rewangzu'), '随机弃置一张牌并令伤害-1'); } 'step 1' - if(result.bool){ - trigger.num--; - if(!result.cards||!result.cards.length){ - player.logSkill('rewangzu'); - var cards=player.getCards('h',(card)=>lib.filter.cardDiscardable(card,player,'rewangzu')); - if(cards.length) player.discard(cards.randomGet()); - } + event.result = result; + }, + async content(event, trigger, player) { + trigger.num--; + if (!event.cards || !event.cards.length) { + const cards = player.getCards('h', (card) => lib.filter.cardDiscardable(card, player, 'rewangzu')); + if (cards.length) player.discard(cards.randomGet()); + } + else { + player.discard(event.cards); } - else player.storage.counttrigger.rewangzu--; }, }, //万年公主 @@ -11231,59 +11210,50 @@ game.import('character',function(lib,game,ui,get,ai,_status){ spwanggui:{ audio:'wanggui', trigger:{source:'damageSource'}, - direct:true, usable:1, filter:function(event,player){ return game.hasPlayer(function(current){ return current.group!=player.group; }); }, - content:function(){ - 'step 0' - player.chooseTarget(get.prompt('spwanggui'),'对一名势力不同的其他角色造成1点伤害',function(card,player,target){ + async cost(event, trigger, player){ + event.result = await player.chooseTarget(get.prompt('spwanggui'),'对一名势力不同的其他角色造成1点伤害',function(card,player,target){ return target.group!=player.group; }).set('ai',function(target){ var player=_status.event.player; return get.damageEffect(target,player,player); - }); - 'step 1' - if(result.bool){ - var target=result.targets[0]; - player.logSkill('spwanggui',target); - target.damage(); - } - else player.storage.counttrigger.spwanggui--; + }).forResult(); + }, + async content(event, trigger, player){ + const target = event.targets[0]; + target.damage(); }, group:'spwanggui_draw', subSkill:{ draw:{ trigger:{player:'damageEnd'}, - direct:true, - content:function(){ - 'step 0' - player.chooseTarget(get.prompt('spwanggui'),'令自己摸一张牌,或和一名势力相同的其他角色各摸一张牌',function(card,player,target){ + async cost(event, trigger, player){ + event.result = await player.chooseTarget(get.prompt('spwanggui'),'令自己摸一张牌,或和一名势力相同的其他角色各摸一张牌',function(card,player,target){ return target.group==player.group; }).set('ai',function(target){ var player=_status.event.player,att=get.attitude(player,target); if(target!=player) att*=2; if(target.hasSkillTag('nogain')) att/=1.7; return att; - }); - 'step 1' - if(result.bool){ - var target=result.targets[0]; - player.logSkill('spwanggui',target); - if(player==target){ - player.draw(); - event.finish(); - } - else{ - var list=[player,target].sortBySeat(); - game.asyncDraw(list); - } + }).forResult(); + }, + content:function(){ + 'step 0' + var target=targets[0]; + if(player==target){ + player.draw(); + event.finish(); } - else event.finish(); - 'step 2' + else{ + var list=[player,target].sortBySeat(); + game.asyncDraw(list); + } + 'step 1' game.delayx(); }, }, @@ -12530,7 +12500,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ translate:{ re_panfeng:'潘凤', xinkuangfu:'狂斧', - xinkuangfu_info:'出牌阶段限一次,你可选择:1,弃置装备区里的一张牌,你使用无对应实体牌的普【杀】。若此【杀】造成伤害,你摸两张牌。2,弃置一名其他角色装备区里的一张牌,你使用无对应实体牌的普【杀】。若此【杀】未造成伤害,你弃置两张手牌。', + xinkuangfu_info:'出牌阶段限一次,你可选择:1,弃置装备区里的一张牌,你使用无对应实体牌的普【杀】。若此【杀】造成伤害,你摸两张牌。2,弃置一名其他角色装备区里的一张牌,你使用无对应实体牌的普【杀】。若此【杀】未造成伤害,你弃置两张手牌。(均无距离和次数限制)', xingdaorong:'邢道荣', xuxie:'虚猲', xuxie_info:'出牌阶段开始时,你可以减1点体力上限并选择所有距离1以内的角色,弃置这些角色的各一张牌或令这些角色各摸一张牌。出牌阶段结束时,若你的体力上限不为全场最多,则你加1点体力上限,然后回复1点体力或摸两张牌。', @@ -12594,7 +12564,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ huguan:'护关', huguan_info:'一名角色于出牌阶段内使用第一张牌时,若此牌为红色,则你可以声明一种花色。该花色的牌不计入其本回合的手牌上限。', yaopei:'摇佩', - yaopei_info:'其他角色的弃牌阶段结束时,若你本局游戏内对其发动过〖护关〗,则你可以弃置一张与其于此阶段弃置的牌花色均不相同的牌。然后你选择一项:①其摸两张牌,你回复1点体力。②其回复1点体力,你摸两张牌。', + yaopei_info:'其他角色的弃牌阶段结束时,若你本回合内对其发动过〖护关〗,则你可以弃置一张与其于此阶段弃置的牌花色均不相同的牌。然后你选择一项:①其摸两张牌,你回复1点体力。②其回复1点体力,你摸两张牌。', mingluan:'鸣鸾', mingluan_info:'其他角色的结束阶段开始时,若有角色于本回合内回复过体力,则你可以弃置任意张牌,然后摸X张牌(X为当前角色的手牌数,且至多摸至5张)。', zhangxuan:'张嫙', @@ -12647,8 +12617,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ zhtongyuan_info:'锁定技。①当你使用红色锦囊牌后,你于〖摧坚〗后增加“若其手牌中没有【闪】,则你摸两张牌”;②当你使用或打出红色基本牌后,你删除〖摧坚〗中的“,然后你交给其等量的牌”。③当你使用红色的普通锦囊牌/基本牌时,若你已发动过〖摧坚①〗和〖摧坚②〗,则此牌不可被响应/可额外增加一个目标。', lvlingqi:'吕玲绮', guowu:'帼舞', - guowu_info:'出牌阶段开始时,你可以展示全部手牌,根据你展示的类型数,你获得对应效果:至少一类,从弃牌堆获得一张【杀】;至少两类,此阶段使用牌无距离限制;至少三类,此阶段使用【杀】或普通锦囊牌可以多指定两个目标。', - guowu_info_guozhan:'出牌阶段开始时,你可以展示全部手牌,根据你展示的类型数,你获得对应效果:至少一类,从弃牌堆获得一张【杀】;至少两类,此阶段使用牌无距离限制;至少三类,此阶段使用【杀】可以多指定两个目标。', + guowu_info:'出牌阶段开始时,你可以展示全部手牌,根据你展示的类型数,你获得对应效果:至少一类,从弃牌堆获得一张【杀】;至少两类,此阶段使用牌无距离限制;至少三类,此阶段使用【杀】或普通锦囊牌可以多指定至多两个目标。', + guowu_info_guozhan:'出牌阶段开始时,你可以展示全部手牌,根据你展示的类型数,你获得对应效果:至少一类,从弃牌堆获得一张【杀】;至少两类,此阶段使用牌无距离限制;至少三类,此阶段使用【杀】可以多指定至多两个目标。', zhuangrong:'妆戎', zhuangrong_info:'觉醒技,一名角色的回合结束时,若你的体力值或手牌数为1,你减1点体力上限并回复体力至上限,将手牌摸至体力上限,然后获得〖神威〗和〖无双〗。', llqshenwei:'神威', @@ -12666,10 +12636,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ refenglve:'锋略', refenglve_info:'出牌阶段限一次,你可以和一名其他角色进行拼点。若你赢,其将区域内的两张牌交给你;若平局,则你令此技能于本阶段内的发动次数上限+1;若你输,其获得你的拼点牌。', anyong:'暗涌', - anyong_info:'当一名角色于其回合内第一次对其他角色造成伤害后,若伤害值为1,则你可弃置一张牌,并对受伤角色造成1点伤害。', + anyong_info:'当一名角色于其回合内第一次对另一名其他角色造成伤害后,若伤害值为1,则你可弃置一张牌,并对受伤角色造成1点伤害。', wanniangongzhu:'万年公主', zhenge:'枕戈', - zhenge_info:'准备阶段,你可以选择一名角色。该角色本局游戏的攻击范围+1(至多+5)。然后若所有其他角色都在该角色的攻击范围内,则你可以令其视为对另一名角色使用一张【杀】。', + zhenge_info:'准备阶段,你可以选择一名角色。该角色本局游戏的攻击范围+1(至多+5)。然后若除其外的所有角色都在该角色的攻击范围内,则你可以令其视为对另一名角色使用一张【杀】。', xinghan:'兴汉', xinghan_info:'锁定技,每回合的第一张【杀】造成伤害后,若此【杀】的使用者成为过〖枕戈〗的目标,则你摸一张牌。若你的手牌数不是全场唯一最多的,则改为摸X张牌(X为该角色的攻击范围且最多为5)。', re_chendeng:'陈登', @@ -12682,8 +12652,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ re_miheng:'祢衡', rekuangcai:'狂才', rekuangcai_info:'锁定技。①你于回合内使用牌无距离和次数限制。②弃牌阶段开始时,若你本回合内:未使用过牌,则你本局游戏的手牌上限+1;使用过牌但未造成过伤害,则你本局游戏的手牌上限-1。③结束阶段开始时,你摸X张牌(X为你本回合内造成的伤害且至多为5)。', - reshejian:'舌箭', - reshejian_info:'当你成为其他角色使用牌的唯一目标后,你可以弃置至少两张手牌。若如此做,你选择一项:⒈弃置其等量的牌。⒉对其造成1点伤害。', + reshejian:'舌剑', + reshejian_info:'每回合限两次。当你成为其他角色使用牌的唯一目标后,你可以弃置至少两张手牌。若如此做,你选择一项:⒈弃置其等量的牌。⒉对其造成1点伤害。', fengxi:'冯熙', yusui:'玉碎', yusui_info:'当你成为其他角色使用黑色牌的目标后,你可以失去1点体力,然后选择一项:⒈令其将手牌数弃置至与你相同;⒉令其失去Y点体力(Y为其的体力值减去你的体力值,不为正时不可选择)。', @@ -12700,7 +12670,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ zhengding:'正订', zhengding_info:'锁定技。当你于回合外使用或打出牌响应其他角色使用的牌时,若这两张牌颜色相同,则你加1点体力上限并回复1点体力。', dc_jiben:'吉本', - xunli:'寻疠', + xunli:'询疠', xunli_info:'锁定技。①当有黑色牌因弃置而进入弃牌堆后,若X大于0,则你将其中的X张牌置于武将牌上作为“疠”(X=min(这些牌的数量,9-Y),Y=你的“疠”数)。②出牌阶段开始时,你可以用任意张黑色手牌交换等量的“疠”。', zhishi:'指誓', zhishi_info:'结束阶段,你可选择一名角色。当该角色于你的下回合开始前{成为【杀】的目标后或进入濒死状态时},你可移去任意张“疠”,然后其摸等量的牌。', @@ -12768,14 +12738,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ dcyongbi_info:'限定技。出牌阶段,你可以将所有手牌交给一名其他男性角色。你将〖媵予〗的发动时机改为“准备阶段和结束阶段开始时”。然后若这些牌中包含的花色数:大于1,则你与其本局游戏的手牌上限+2;大于2,则当你或其于本局游戏内受到大于1的伤害时,此伤害-1。', dc_huangquan:'黄权', dcquanjian:'劝谏', - dcquanjian_info:'出牌阶段每项各限一次。你可以选择一项流程并选择一名其他角色A:⒈令A对其攻击范围内的另一名角色B造成1点伤害。⒉令A将手牌数调整至手牌上限(至多摸至五张),且其本回合内不能使用或打出手牌。然后A选择一项:⒈执行此流程。⒉本回合下次受到的伤害+1。', + dcquanjian_info:'出牌阶段每项各限一次。你可以选择一项流程并选择一名其他角色A:⒈令A对其攻击范围内的另一名角色B造成1点伤害。⒉令A将手牌数调整至手牌上限(至多摸至五张),且其本回合内不能使用手牌。然后A选择一项:⒈执行此流程。⒉本回合下次受到的伤害+1。', dctujue:'途绝', dctujue_info:'限定技。当你进入濒死状态时,你可以将所有牌交给一名其他角色。然后你回复等量的体力并摸等量的牌。', chengui:'陈珪', dcyingtu:'营图', dcyingtu_info:'每回合限一次。当你的上家/下家于摸牌阶段外得到牌后,你可以获得其一张牌,然后将一张牌交给你的下家/上家。若你给出的牌为装备牌,则其使用之。', dccongshi:'从势', - dccongshi_info:'一名角色使用的装备牌结算结束后,若其装备区内的牌数为全场最多,则你摸一张牌。', + dccongshi_info:'锁定技。一名角色使用的装备牌结算结束后,若其装备区内的牌数为全场最多,则你摸一张牌。', wanglie:'王烈', dcchongwang:'崇望', dcchongwang_info:'其他角色使用基本牌或普通锦囊牌时,若你是本局游戏内上一张被使用的牌的使用者,则你可以选择一项:⒈令其于此牌结算结束后收回此牌对应的所有实体牌;⒉取消此牌的所有目标。', diff --git a/character/mobile.js b/character/mobile.js index 4c86ae3e3..9a67a51a4 100644 --- a/character/mobile.js +++ b/character/mobile.js @@ -6,7 +6,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ connect:true, characterSort:{ mobile:{ - mobile_default:['xin_huojun','muludawang','mb_chengui','mb_huban','mb_xianglang','yanxiang','xin_wuban','laimin','baoxin','jiangji','liwei','xin_guozhao',"miheng","taoqian","lingcao","sunru","lifeng","zhuling","liuye","zhaotongzhaoguang","majun","simazhao","wangyuanji","pangdegong","shenpei","hujinding","zhangyì","jiakui","yangbiao","chendeng","dongcheng","yangyi","dengzhi","zhengxuan","sp_sufei","furong","dingyuan","simashi","yanghuiyu","hucheer","gongsunkang","nanhualaoxian","zhouqun","qiaozhou","fuqian","simafu","mayuanyi","yanpu","sunhanhua","sp_maojie","peixiu","sp_jianggan","ruanhui","xin_mamidi","sp_caosong","yangfu","wangjun","sp_pengyang","qianzhao",'shichangshi','yangfeng'], + mobile_default:['mb_sp_guanqiujian','mb_caomao','chengji','lizhaojiaobo','xin_huojun','muludawang','mb_chengui','mb_huban','mb_xianglang','yanxiang','xin_wuban','laimin','baoxin','jiangji','liwei','xin_guozhao',"miheng","taoqian","lingcao","sunru","lifeng","zhuling","liuye","zhaotongzhaoguang","majun","simazhao","wangyuanji","pangdegong","shenpei","hujinding","zhangyì","jiakui","yangbiao","chendeng","dongcheng","yangyi","dengzhi","zhengxuan","sp_sufei","furong","dingyuan","simashi","yanghuiyu","hucheer","gongsunkang","nanhualaoxian","zhouqun","qiaozhou","fuqian","simafu","mayuanyi","yanpu","sunhanhua","sp_maojie","peixiu","sp_jianggan","ruanhui","xin_mamidi","sp_caosong","yangfu","wangjun","sp_pengyang","qianzhao",'shichangshi','yangfeng'], mobile_yijiang:["yj_zhanghe","yj_zhangliao","yj_xuhuang","yj_ganning",'yj_huangzhong','yj_weiyan','yj_zhoubuyi'], mobile_standard:["xin_xiahoudun","xin_zhangfei"], mobile_shenhua_feng:['re_xiaoqiao',"xin_zhoutai"], @@ -26,6 +26,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, character:{ + mb_sp_guanqiujian:['male','wei',4,['mbcuizhen','mbkuili']], + mb_caomao:['male','wei',3,['mbqianlong','mbweitong'],['zhu']], + chengji:['male','wei',4,['mbkuangli','mbxiongsi']], + lizhaojiaobo:['male','wei',4,['mbzuoyou','mbshishou']], yangfeng:['male','qun',4,['mbxuetu','mbweiming']], xin_huojun:['male','shu',4,['sidai','jieyu'],['character:tw_huojun','die_audio:tw_huojun']], muludawang:['male','qun','3/3/1',['shoufa','zhoulin','yuxiang']], @@ -179,6 +183,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ scs_gaowang:['male','qun','',['scsmiaoyu'],['unseen','sex:male_castrated']], }, characterIntro:{ + lizhaojiaobo:'李昭(?—约公元260年),三国时期曹魏官吏,官拜冗从仆射,为魏帝曹髦的亲信。
焦伯,三国时期人物,魏帝曹髦护卫,官拜黄门从官。
曹髦见自己权力威势日渐削弱,感到不胜忿恨,于公元260年(甘露五年)五月初六夜里,令李昭和焦伯等在陵云台布署甲士,出讨司马昭,但最终失败,曹髦为成济所弑,李昭和焦伯等应该也战死。在《三国演义》里,焦伯挺枪出战成济,亦被成济所杀。', + chengji:'成济(?~260年6月21日),三国时期曹魏官员。官至太子舍人。在魏帝曹髦起兵讨司马昭时,受到司马昭之心腹贾充指使,刺死曹髦。司马昭为平息众怒,将成倅、成济兄弟二人杀死。', yangfeng:'杨奉(?-197年/198年),东汉末年将领。杨奉早年参加白波军起义,曾经帮助李傕对抗郭汜,后来背叛李傕。兴平二年,加号兴义将军,护送汉献帝刘协东归雒阳,颇有功勋,加号车骑将军,屯兵于梁县。建安元年,随着汉献帝迁都许县,失去权力,先后依附于袁术、吕布,劫掠徐州和扬州地区。建安二年(一说三年),带兵进犯刘备领地,被刘备诱杀。', muludawang:'古典小说《三国演义》中的虚构人物,八纳洞主,孟获盟友。擅驱兽法,能行风雨,控制猛兽并指挥它们作战。在法术帮助下最初对蜀军取得一些胜利,但在诸葛亮的喷火木兽将他的动物吓跑后战败,最后死于乱军之中。', laimin:'来敏(165年—261年),字敬达,义阳新野人,东汉太中大夫来歙之后,司空来艳之子,三国时期蜀汉官员。东汉末年,逢董卓之乱,来敏跟随姐夫黄琬到荆州避难,黄琬是刘璋祖母的侄子,来敏又与姐姐来氏入蜀,被刘璋引为宾客。来敏喜欢读书,尤其喜欢《左氏春秋》。刘备平定益州后,以来敏为典学校尉,后立太子,来敏为家令。刘禅继位后,任命来敏为虎贲中郎将,诸葛亮驻汉中,请来敏为军祭酒、辅军将军。却因其口出狂言而被罢官,诸葛亮死后,来敏历任大长秋、光禄大夫、执慎将军等职,期间多次因说错话而被免官,蜀汉景耀年间,来敏去世,时年九十七岁。', @@ -396,6 +402,734 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, skill:{ + //李昭焦伯 + mbzuoyou:{ + audio:2, + enable:'phaseUse', + usable:1, + zhuanhuanji:true, + filterTarget(card,player,target){ + if(player.storage.mbzuoyou) return target.countCards('h'); + return true; + }, + async content(event,trigger,player){ + const storage = player.storage.mbzuoyou, target = event.target; + if (event.name === 'mbzuoyou') player.changeZhuanhuanji('mbzuoyou'); + if (!storage) { + await target.draw(3); + await target.chooseToDiscard(2,true,'he'); + } + else { + await target.chooseToDiscard(target===player ? '佐佑' : `${get.translation(player)}对你发动了【佐佑】`, '请弃置一张手牌,然后获得1点护甲', true); + await target.changeHujia(1, null, true); + } + }, + mark:true, + marktext:'☯', + intro:{ + content(storage,player){ + if(!storage) return '转换技。出牌阶段限一次,你可以令一名角色摸三张牌,然后其弃置两张牌。'; + return '转换技。出牌阶段限一次,你可以令一名角色弃置一张手牌,然后其获得1点护甲。'; + } + }, + ai:{ + order(item,player){ + if(player.storage.mbzuoyou&&game.hasPlayer(current=>{ + return current!==player&&get.effect(current,'mbzuoyou',player,player)>0; + })) return get.order({name:'zengbin'})+0.1; + return 2; + }, + result:{ + target(player,target){ + let eff=0; + if(player.storage.mbzuoyou) eff=target.hujia<5?1:0; + else eff=1; + if(target===player&&player.hasSkill('mbshishou')) eff/=10; + return eff; + }, + } + }, + }, + mbshishou:{ + audio:2, + forced:true, + trigger:{player:'useSkillAfter'}, + filter(event,player){ + return event.skill==='mbzuoyou'&&!event.targets.includes(player); + }, + forced:true, + async content(event,trigger,player){ + await lib.skill.mbzuoyou.content({ + target: player, + }, {}, player); + }, + }, + //成济 + mbkuangli:{ + audio:2, + trigger:{player:'phaseUseBegin'}, + filter(event,player){ + return game.hasPlayer(current=>current!==player); + }, + forced:true, + group:['mbkuangli_target','mbkuangli_remove'], + async content(event,trigger,player){ + let targets = game.filterPlayer(current => current !== player).randomSort(); + targets = targets.slice(0, Math.ceil(Math.random() * targets.length)); + targets.sortBySeat(); + player.line(targets, 'thunder'); + targets.forEach(current => { + current.addSkill('mbkuangli_mark'); + }); + await game.asyncDelayx(); + }, + subSkill:{ + target:{ + audio:'mbkuangli', + trigger:{player:'useCardToPlayered'}, + filter(event,player){ + return event.target.hasSkill('mbkuangli_mark')&&[player,event.target].some(current=>current.countCards('he')); + }, + forced:true, + logTarget:'target', + usable:2, + async content(event,trigger,player){ + const target = trigger.target; + const playerCards = player.getCards('he', card => { + return lib.filter.cardDiscardable(card, player, 'mbkuangli'); + }); + if(playerCards.length>0) await player.discard(playerCards.randomGet()); + const targetCards = target.getCards('he', card => { + return lib.filter.cardDiscardable(card, target, 'mbkuangli'); + }); + if(targetCards.length>0) await target.discard(targetCards.randomGet()); + await game.asyncDelayx(); + await player.draw(); + await game.asyncDelayx(); + }, + ai:{ + effect:{ + player(card,player,target,current){ + if(!target) return; + const counttrigger=player.storage.counttrigger; + if(counttrigger&&counttrigger.mbkuangli_target&&counttrigger.mbkuangli_target>=lib.skill.mbkuangli_target.usable) return; + if(target.hasSkill('mbkuangli_mark')){ + if(get.attitude(player,target)>0) return 0.75; + return 1.25; + } + } + } + }, + }, + remove:{ + audio:'mbkuangli', + trigger:{player:'phaseEnd'}, + filter(event,player){ + return game.hasPlayer(current=>current.hasSkill('mbkuangli_mark')); + }, + forced:true, + async content(event,trigger,player){ + game.countPlayer(current=>{ + if(current.hasSkill('mbkuangli_mark')){ + player.line(current); + current.removeSkill('mbkuangli_mark'); + } + }); + }, + }, + mark:{ + mark:true, + marktext:'戾', + charlotte:true, + intro:{ + name:'狂戾', + name2:'狂戾', + content:'已拥有“狂戾”标记', + } + }, + }, + }, + mbxiongsi:{ + audio:2, + enable:'phaseUse', + filter(event,player){ + return player.countCards('h')>=3; + }, + limited:true, + skillAnimation:true, + animationColor:'fire', + filterCard:true, + selectCard:[-1,-2], + async content(event,trigger,player){ + player.awakenSkill('mbxiongsi'); + const targets = game.filterPlayer(current => current !== player); + for (const target of targets) { + player.line(target, 'thunder'); + await target.loseHp(); + } + }, + ai:{ + order(item,player){ + if(get.effect(player,'mbxiongsi',player)<=0) return 1; + if(player.countCards('h')>3&&player.countCards('h',card=>{ + return player.hasValueTarget(card); + })>0) return 0.1; + return 8; + }, + result:{ + player(player){ + let eff=0; + game.countPlayer(current=>{ + let effx=get.effect(current,{name:'losehp'},player,player); + if(get.attitude(player,current)<-6&¤t.getHp()<=1) effx*=1.3; + eff+=effx; + }); + eff*=player.getHp()+player.countCards('hs',card=>player.canSaveCard(card,player))<=2?1.5:0.35; + eff-=player.getCards('h').map(card=>{ + if(lib.filter.cardDiscardable(card,player,'mbxiongsi')) return get.value(card); + return 0; + }).reduce((p,c)=>p+c,0); + if(eff>0) return 2; + return -1; + }, + }, + }, + }, + //SP母兵脸 + mbcuizhen:{ + trigger:{ + global:'phaseBefore', + player:'enterGame', + }, + filter(event,player){ + return (event.name!='phase'||game.phaseNumber==0)&&game.hasPlayer(current=>{ + return current!==player&¤t.hasEnabledSlot(1); + }); + }, + async cost(event,trigger,player){ + event.result = await player.chooseTarget(get.prompt('mbcuizhen'), '废除至多两名其他角色的武器栏', [1, 2], (card, player, target) => { + return target !== player && target.hasEnabledSlot(1); + }).set('ai', target => { + return -get.attitude(get.player(), target); + }).forResult(); + }, + group:['mbcuizhen_inphase','mbcuizhen_draw'], + async content(event,trigger,player){ + const targets = event.targets.slice().sortBySeat(); + for (const target of targets) { + await target.disableEquip(1); + } + await game.asyncDelay(); + }, + subSkill:{ + inphase:{ + audio:'mbcuizhen', + trigger:{ + player:'useCardToPlayered', + }, + filter(event,player){ + if(!player.isPhaseUsing()) return false; + if(!get.tag(event.card,'damage')) return false; + const target=event.target; + return target!==player&&target.countCards('h')>=target.getHp()&&target.hasEnabledSlot(1); + }, + prompt2:'废除其的武器栏', + logTarget:'target', + check(event,player){ + return get.attitude(player,event.target)<=0; + }, + async content(event,trigger,player){ + await trigger.target.disableEquip(1); + await game.asyncDelayx(); + }, + }, + draw:{ + audio:'mbcuizhen', + trigger:{player:'phaseDrawBegin2'}, + forced:true, + locked:false, + filter(event,player){ + return !event.numFixed&&game.hasPlayer(current=>{ + return current.hasDisabledSlot(1); + }); + }, + async content(event,trigger,player){ + trigger.num += Math.min(2, game.countPlayer(current => { + return current.countDisabledSlot(1); + })); + }, + }, + }, + }, + mbkuili:{ + audio:2, + trigger:{ + player:'damageEnd', + }, + filter(event,player){ + return player.countCards('h')>0||event.source&&event.source.isIn()&&event.source.hasDisabledSlot(1); + }, + forced:true, + async content(event,trigger,player){ + if (player.countCards('h') > 0) { + await player.chooseToDiscard(`溃离:请弃置${get.cnNumber(trigger.num)}张手牌`, trigger.num, true); + } + const source = trigger.source; + if (source && source.isIn() && source.hasDisabledSlot(1)) { + player.line(source, 'green'); + await source.enableEquip(1, player); + } + }, + ai:{ + neg:true, + } + }, + //曹髦 史?! + mbqianlong:{ + audio:6, + trigger:{ + player:['mbqianlong_beginAfter','mbqianlong_addAfter','mbweitongAfter'], + }, + filter(event,player){ + let skills=[]; + if(player.additionalSkills&&player.additionalSkills.mbqianlong) skills.addArray(player.additionalSkills.mbqianlong); + return player.countMark('mbqianlong')>=25*skills.length; + }, + forced:true, + locked:false, + beginMarkCount:20, + maxMarkCount:100, + derivation:['mbcmqingzheng','mbcmjiushi','mbcmfangzhu','mbjuejin'], + addMark(player,num){ + num = Math.min(num, lib.skill.mbqianlong.maxMarkCount - player.countMark('mbqianlong')); + player.addMark('mbqianlong', num); + }, + group:['mbqianlong_begin','mbqianlong_add'], + async content(event,trigger,player){ + player.addAdditionalSkill('mbqianlong', lib.skill.mbqianlong.derivation.slice(0, Math.floor(player.countMark('mbqianlong') / 25))); + }, + marktext:'道', + intro:{ + name:'道心(潜龙)', + name2:'道心', + content:'当前道心数为#', + }, + subSkill:{ + begin:{ + audio:'mbqianlong', + trigger:{ + global:'phaseBefore', + player:'enterGame', + }, + filter(event,player){ + return (event.name!='phase'||game.phaseNumber==0); + }, + forced:true, + locked:false, + async content(event,trigger,player){ + lib.skill.mbqianlong.addMark(player, lib.skill.mbqianlong.beginMarkCount); + }, + }, + add:{ + audio:'mbqianlong', + trigger:{ + player:['gainAfter','damageEnd'], + source:'damageSource', + global:'loseAsyncAfter', + }, + filter(event,player){ + if(player.countMark('mbqianlong')>=lib.skill.mbqianlong.maxMarkCount) return false; + if(event.name==='damage') return event.num>0; + return event.getg(player).length>0; + }, + getIndex(event,player,triggername){ + if(event.name==='damage') return event.num; + return 1; + }, + forced:true, + locked:false, + async content(event,trigger,player){ + let toAdd = 5 * (1 + (trigger.name === 'damage') + (event.triggername === 'damageSource')); + lib.skill.mbqianlong.addMark(player, toAdd); + }, + }, + }, + }, + mbweitong:{ + audio:1, + trigger:{ + global:'phaseBefore', + player:'enterGame', + }, + filter(event,player){ + return (event.name!='phase'||game.phaseNumber==0)&&game.hasPlayer(current=>{ + return current!==player&¤t.group==='wei'&&player.hasZhuSkill('mbweitong',current); + }); + }, + zhuSkill:true, + forced:true, + locked:false, + async content(event,trigger,player){ + lib.skill.mbqianlong.addMark(player, 20 * game.countPlayer(current => { + return current !== player && current.group === 'wei' && player.hasZhuSkill('mbweitong', current); + })); + }, + }, + mbcmqingzheng:{ + audio:'sbqingzheng', + audioname:['mb_caomao'], + trigger:{player:'phaseUseBegin'}, + filter(event,player){ + return player.countCards('h')>0; + }, + direct:true, + content(){ + 'step 0' + var num=2; + var prompt='###'+get.prompt('sbqingzheng')+'###弃置'+get.cnNumber(num)+'种花色的所有牌'; + var next=player.chooseButton([prompt,[lib.suit.map(i=>['','','lukai_'+i]),'vcard']],num); + next.set('filterButton',button=>{ + var player=_status.event.player; + var cards=player.getCards('h',{suit:button.link[2].slice(6)}); + return cards.length>0&&cards.filter(card=>lib.filter.cardDiscardable(card,player,'sbqingzheng')).length==cards.length; + }); + next.set('ai',button=>{ + var player=_status.event.player; + return 15-player.getCards('h',{suit:button.link[2].slice(6)}).map(i=>get.value(i)).reduce((p,c)=>p+c,0); + }); + next.set('custom',{ + replace:{ + button:function(button){ + if(!_status.event.isMine()) return; + if(button.classList.contains('selectable')==false) return; + var cards=_status.event.player.getCards('h',{suit:button.link[2].slice(6)}); + if(cards.length){ + var chosen=cards.filter(i=>ui.selected.cards.includes(i)).length==cards.length; + if(chosen){ + ui.selected.cards.removeArray(cards); + cards.forEach(card=>{ + card.classList.remove('selected'); + card.updateTransform(false); + }); + }else{ + ui.selected.cards.addArray(cards); + cards.forEach(card=>{ + card.classList.add('selected'); + card.updateTransform(true); + }); + } + } + if(button.classList.contains('selected')){ + ui.selected.buttons.remove(button); + button.classList.remove('selected'); + if(_status.multitarget||_status.event.complexSelect){ + game.uncheck(); + game.check(); + } + } + else{ + button.classList.add('selected'); + ui.selected.buttons.add(button); + } + var custom=_status.event.custom; + if(custom&&custom.add&&custom.add.button){ + custom.add.button(); + } + game.check(); + } + }, + add:next.custom.add + }); + 'step 1' + if(result.bool){ + var cards=result.cards; + if(!cards.length){ + var suits=result.links.map(i=>i[2].slice(6)); + cards=player.getCards('h',card=>suits.includes(get.suit(card,player))); + } + event.cards=cards; + if(!cards.length) event.finish(); + else player.chooseTarget('清正:观看一名其他角色的手牌并弃置其中一种花色的所有牌',(card,player,target)=>{ + return target!=player&&target.countCards('h'); + }).set('ai',target=>{ + var player=_status.event.player,att=get.attitude(player,target); + if(att>=0) return 0; + return 1-att/2+Math.sqrt(target.countCards('h')); + }); + } else event.finish(); + 'step 2' + if(result.bool){ + var target=result.targets[0]; + event.target=target; + player.logSkill('sbqingzheng',target); + player.discard(cards); + var list=[]; + var dialog=['清正:弃置'+get.translation(target)+'一种花色的所有牌']; + for(var suit of lib.suit.concat('none')){ + if(target.countCards('h',{suit:suit})){ + dialog.push('
'+get.translation(suit+'2')+'牌
'); + dialog.push(target.getCards('h',{suit:suit})); + list.push(suit); + } + } + if(list.length){ + player.chooseControl(list).set('dialog',dialog).set('ai',()=>{ + return _status.event.control; + }).set('control',(()=>{ + var getv=(cards)=>cards.map(i=>get.value(i)).reduce((p,c)=>p+c,0); + return list.sort((a,b)=>{ + return getv(target.getCards('h',{suit:b}))-getv(target.getCards('h',{suit:a})); + })[0]; + })()); + } + } else event.finish(); + 'step 3' + var cards2=target.getCards('h',{suit:result.control}); + event.cards2=cards2; + target.discard(cards2,'notBySelf').set('discarder',player); + 'step 4' + if(event.cards2.lengthcurrent!==player); + }, + usable:1, + chooseButton:{ + dialog(){ + const dialog=ui.create.dialog('放逐:令一名其他角色...','hidden'); + dialog.add([[ + [1,'不能使用手牌中的非锦囊牌直到其回合结束'], + [2,'非Charlotte技能失效直到其回合结束'], + ],'textbutton']); + return dialog; + }, + check(button){ + const player=get.player(); + if(button.link===2){ + if(game.hasPlayer(target=>{ + if(target.hasSkill('mbcmfangzhu_ban')||target.hasSkill('fengyin')||target.hasSkill('baiban')) return false; + return get.attitude(player,target)<0&&['name','name1','name2'].map((sum,name)=>{ + if(target[name]&&(name!='name1'||target.name!=target.name1)){ + if(get.character(target[name])) return get.rank(target[name],true); + } + return 0; + }).reduce((p,c)=>{ + return p+c; + },0)>5; + })) return 6; + } + return button.link===1?1:0; + }, + backup(links,player){ + return { + num:links[0], + audio:'sbfangzhu', + filterCard:()=>false, + selectCard:-1, + filterTarget(card,player,target){ + if(target==player) return false; + const num=lib.skill.mbcmfangzhu_backup.num,storage=target.getStorage('mbcmfangzhu_ban'); + return num!=1||!storage.length; + }, + async content(event,trigger,player){ + const target=event.target; + const num=lib.skill.mbcmfangzhu_backup.num; + switch(num){ + case 1: + target.addTempSkill('mbcmfangzhu_ban',{player:'phaseEnd'}); + target.markAuto('mbcmfangzhu_ban',['trick']); + break; + case 2: + target.addTempSkill('mbcmfangzhu_baiban',{player:'phaseEnd'}); + break; + } + }, + ai:{ + result:{ + target(player,target){ + switch(lib.skill.mbcmfangzhu_backup.num){ + case 1: + return -target.countCards('h',card=>get.type(card)!='trick')-1; + case 2: + return -target.getSkills(null,null,false).reduce((sum,skill)=>{ + return sum+Math.max(get.skillRank(skill,'out'),get.skillRank(skill,'in')); + },0); + } + }, + }, + }, + } + }, + prompt(links,player){ + const str='###放逐###'; + switch(links[0]){ + case 1: + return str+'令一名其他角色不能使用手牌中的非锦囊牌直到其回合结束'; + case 2: + return str+'令一名其他角色的非Charlotte技能失效直到其回合结束'; + } + } + }, + ai:{ + order:10, + result:{ + player(player){ + return game.hasPlayer(current=>get.attitude(player,current)<0)?1:0; + }, + }, + }, + subSkill:{ + backup:{}, + baiban:{ + inherit:'baiban', + marktext:'逐', + }, + ban:{ + charlotte:true, + onremove:true, + mark:true, + marktext:'禁', + intro:{ + markcount:()=>0, + content(storage){ + if(storage.length>1) return '不能使用手牌'; + return '不能使用手牌中的非'+get.translation(storage[0])+'牌'; + }, + }, + mod:{ + cardEnabled(card,player){ + const storage=player.getStorage('mbcmfangzhu_ban'); + const hs=player.getCards('h'),cards=[card]; + if(Array.isArray(card.cards)) cards.addArray(card.cards); + if(cards.containsSome(...hs)&&!storage.includes(get.type2(card))) return false; + }, + cardSavable(card,player){ + const storage=player.getStorage('mbcmfangzhu_ban'); + const hs=player.getCards('h'),cards=[card]; + if(Array.isArray(card.cards)) cards.addArray(card.cards); + if(cards.containsSome(...hs)&&!storage.includes(get.type2(card))) return false; + }, + }, + }, + }, + }, + mbjuejin:{ + audio:2, + enable:'phaseUse', + limited:true, + skillAnimation:true, + animationColor:'thunder', + filterCard:()=>false, + selectCard:[-1,-2], + filterTarget:true, + selectTarget:-1, + multiline:true, + async contentBefore(event,trigger,player){ + player.awakenSkill('mbjuejin'); + }, + async content(event,trigger,player){ + const target = event.target; + const delt = target.getHp(true) - 1, num = Math.abs(delt); + await target[delt > 0 ? 'loseHp' : 'recover'](num); + if (num > 0) await target.changeHujia(num, null ,true); + }, + async contentAfter(event,trigger,player){ + game.addGlobalSkill('mbjuejin_xiangsicunwei'); + player.$fullscreenpop('向死存魏!', 'thunder'); + }, + ai:{ + order:0.1, + result:{ + player(player){ + let eff=1; + game.countPlayer(current=>{ + const att=get.attitude(player,current),num=Math.abs(current.getHp(true)-1); + const delt=Math.max(0,num+current.hujia-5); + eff-=att*delt; + }); + return eff>0?1:0; + }, + }, + }, + subSkill:{ + xiangsicunwei:{ + trigger:{ + global:['loseAfter','equipAfter','loseAsyncAfter','cardsDiscardAfter'], + }, + forced:true, + silent:true, + firstDo:true, + filter(event,player){ + const nameList=['shan','tao','jiu']; + return event.getd().some(card=>{ + return nameList.includes(get.name(card,false))&&get.position(card,true)==='d'; + }); + }, + async content(event,trigger,player){ + const nameList = ['shan','tao','jiu']; + const cards = trigger.getd().filter(card => { + return nameList.includes(get.name(card, false)) && get.position(card, true) === 'd'; + }); + await game.cardsGotoSpecial(cards); + game.log(cards, '被移出了游戏'); + } + }, + }, + }, //杨奉 mbxuetu:{ audio:2, @@ -1690,6 +2424,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, }, + ai:{ + combo:'twjichou' + } }, //李遗 jiaohua:{ @@ -15899,6 +16636,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return '转换技。出牌阶段限一次,阴:你可以回复1点体力,然后令一名角色弃置两张牌;阳:你可以摸一张牌,然后对一名角色造成1点伤害。'; } }, + mbzuoyou(player){ + const mbzuoyou = player.storage.mbzuoyou; + if (mbzuoyou) return '转换技。出牌阶段限一次,阴:你可以令一名角色摸三张牌,然后其弃置两张牌;阳:你可以令一名角色弃置一张手牌,然后其获得1点护甲。' + return '转换技。出牌阶段限一次,阴:你可以令一名角色摸三张牌,然后其弃置两张牌;阳:你可以令一名角色弃置一张手牌,然后其获得1点护甲。' + } }, perfectPair:{ simazhao:['simayi','jin_simayi','jin_wangyuanji'], @@ -16790,6 +17532,36 @@ game.import('character',function(lib,game,ui,get,ai,_status){ mbxuetu_fail_info:'转换技。出牌阶段限一次,阴:你可以回复1点体力,然后令一名角色弃置两张牌;阳:你可以摸一张牌,然后对一名角色造成1点伤害。', mbweiming:'威命', mbweiming_info:'使命技,锁定技。①出牌阶段开始时,你记录一名未以此法记录过的角色。②成功:当你杀死一名未被〖威命①〗记录过的角色后,修改〖血途〗为成功版本。③失败:当一名被〖威命①〗记录过的角色死亡后,你修改〖血途〗为失败版本。', + lizhaojiaobo:'李昭焦伯', + mbzuoyou:'佐佑', + mbzuoyou_info:'转换技。出牌阶段限一次,阴:你可以令一名角色摸三张牌,然后其弃置两张牌;阳:你可以令一名角色弃置一张手牌,然后其获得1点护甲。', + mbshishou:'侍守', + mbshishou_info:'锁定技。当你发动〖佐佑〗后,若目标角色不为你,你执行〖佐佑〗中目标角色未执行的一项。', + chengji:'成济', + mbkuangli:'狂戾', + mbkuangli_info:'锁定技。①出牌阶段开始时,你随机令场上任意名其他角色获得“狂戾”标记。②出牌阶段限两次。当你使用牌指定有“狂戾”的角色为目标后,你与其各随机弃置一张牌,然后你摸一张牌。③回合结束时,你移除所有角色的“狂戾”。', + mbxiongsi:'凶肆', + mbxiongsi_info:'限定技。出牌阶段,若你的手牌数不少于三张,你可以弃置所有手牌,然后令所有其他角色依次失去1点体力。', + mb_sp_guanqiujian:'SP毌丘俭', + mb_sp_guanqiujian_prefix:'SP', + mbcuizhen:'摧阵', + mbcuizhen_info:'①游戏开始时,你可以废除至多两名其他角色的武器栏。②当你于出牌阶段使用伤害类牌指定其他角色为目标后,若目标角色的手牌数不小于体力值,你可以废除其武器栏。③摸牌阶段,你令额定摸牌数+X(X为所有角色被废除的武器栏数之和,至多为2)。', + mbkuili:'溃离', + mbkuili_info:'锁定技。当你受到伤害后,你弃置等同于伤害值的手牌;若来源有被废除的武器栏,你令其恢复武器栏。', + mb_caomao:'手杀曹髦', + mb_caomao_prefix:'手杀', + mbqianlong:'潜龙', + mbqianlong_info:'①游戏开始时,你获得20枚“道心”标记。②当你得到牌后/受到1点伤害后/造成1点伤害后,你获得5/10/15枚“道心”(上限为100枚)。③若你的“道心”数不小于25/50/75/100,你视为拥有〖清正〗/〖酒诗〗/〖放逐〗/〖决进〗。', + mbcmqingzheng:'清正', + mbcmqingzheng_info:'出牌阶段开始时,你可以弃置两种花色的所有手牌,并观看一名有手牌的其他角色的手牌,你弃置其中一种花色的所有牌。若其被弃置的牌数小于你以此法弃置的牌数,你对其造成1点伤害。', + mbcmjiushi:'酒诗', + mbcmjiushi_info:'①当你需要使用【酒】时,若你的武将牌正面向上,你可以翻面,视为使用一张【酒】。②当你受到伤害后,若你的武将牌背面向上,你可以翻面。③当你翻面后,你获得牌堆里的一张锦囊牌。', + mbcmfangzhu:'放逐', + mbcmfangzhu_info:'出牌阶段限一次。你可以选择一名其他角色,选择一项:⒈令其不能使用手牌中的非锦囊牌直到其回合结束;⒉令其所有非Charlotte技能失效直到其回合结束。', + mbjuejin:'决进', + mbjuejin_info:'限定技。出牌阶段,你可以令所有角色依次将体力回复或失去至1并获得X点护甲(X为一名角色以此法变化的体力值)。然后你增加如下“向死存魏”的全局技能:当有牌进入弃牌堆后,系统将这些牌中的【闪】、【桃】和【酒】移出游戏。', + mbweitong:'卫统', + mbweitong_info:'主公技。游戏开始时,若你有〖潜龙〗,你获得20X枚“道心”(X为其他魏势力角色数)。', mobile_standard:'手杀异构·标准包', mobile_shenhua_feng:'手杀异构·其疾如风', diff --git a/character/onlyOL.js b/character/onlyOL.js index d19a3af1a..f5f2e18d4 100644 --- a/character/onlyOL.js +++ b/character/onlyOL.js @@ -1093,7 +1093,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'phaseJieshuBegin'}, prompt2:function(event,player){ var str='获得技能'; - var num=lib.skill.olsbranji.getNum(event,player); + var num=lib.skill.olsbranji.getNum(player); if(num>=player.getHp()) str+='【困奋】'; if(num==player.getHp()) str+='和'; if(num<=player.getHp()) str+='【诈降】'; @@ -1109,7 +1109,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return str; }, check:function(event,player){ - var num=lib.skill.olsbranji.getNum(event,player); + var num=lib.skill.olsbranji.getNum(player); if(num==player.getHp()) return true; return player.getHandcardLimit()-player.countCards('h')>=3||player.getDamagedHp()>=2; }, @@ -1120,7 +1120,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var player=map.player; var trigger=map.trigger; player.awakenSkill('olsbranji'); - var num=lib.skill.olsbranji.getNum(trigger,player); + var num=lib.skill.olsbranji.getNum(player); const skills = []; if(num>=player.getHp()){ skills.push('kunfen'); @@ -1159,8 +1159,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ getList:function(event){ return event.getParent().phaseList.map(list=>list.split('|')[0]); }, - getNum:function(event,player){ - return lib.skill.olsbranji.getList(event).slice(0,event.getParent().num).filter(name=>player.getHistory('useCard',evt=>evt.getParent(name).name==name).length).length; + getNum:function(player){ + return player.getHistory('useCard',evt=>{ + return lib.phaseName.some(name=>{ + return evt.getParent(name).name==name; + }); + }).reduce((list,evt)=>{ + return list.add(evt.getParent(lib.phaseName.find(name=>evt.getParent(name).name==name))); + },[]).length; }, subSkill:{ norecover:{ diff --git a/character/rank.js b/character/rank.js index 1c658a254..d0ec80e6c 100644 --- a/character/rank.js +++ b/character/rank.js @@ -138,6 +138,9 @@ window.noname_character_rank={ 'dc_simashi', 'dc_sb_simayi', 'caofang', + 'dc_shen_huatuo', + 'sp_zhenji', + 'wu_guanyu', ], a:[ 'star_caoren', @@ -373,6 +376,7 @@ window.noname_character_rank={ 'shen_lusu', 'huzun', 'star_zhangchunhua', + 'mb_caomao', ], am:[ 'tw_yanliang', @@ -687,6 +691,7 @@ window.noname_character_rank={ 'dc_caoshuang', 'clan_wangling', 'clan_wangguang', + 'lizhaojiaobo', ], bp:[ 'xin_huojun', @@ -1081,6 +1086,8 @@ window.noname_character_rank={ 'sb_gaoshun', 're_wangyi', 'ol_wangyi', + 'chengji', + 'mb_sp_guanqiujian', ], b:[ 'junk_guanyu', @@ -1402,6 +1409,7 @@ window.noname_character_rank={ 'jsrg_liuyong', 'jsrg_sunjun', 'xia_shie', + 'clan_wangmingshan', ], bm:[ 'kongrong', @@ -1900,6 +1908,7 @@ window.noname_character_rank={ 'dc_guansuo', 'dc_xujing', 'caoxian', + 'wu_guanyu', ], epic:[ 'dc_caoshuang', @@ -2181,6 +2190,9 @@ window.noname_character_rank={ 'bailingyun', 'dc_sb_simayi', 'caofang', + 'mb_caomao', + 'dc_shen_huatuo', + 'sp_zhenji', ], rare:[ 're_wangyi', @@ -2670,6 +2682,10 @@ window.noname_character_rank={ 'ol_dingshangwan', 'ol_liwan', 'dc_sb_lusu', + 'clan_wangmingshan', + 'chengji', + 'mb_sp_guanqiujian', + 'lizhaojiaobo', ], junk:[ 'ol_sb_guanyu', diff --git a/character/refresh.js b/character/refresh.js index 005ca5042..d27297616 100755 --- a/character/refresh.js +++ b/character/refresh.js @@ -5593,6 +5593,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.loseMaxHp(); player.addSkills('xinpaiyi'); }, + ai:{ + combo:'xinquanji' + } }, xinpaiyi:{ audio:2, @@ -9325,6 +9328,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, rejiushi:{ audio:2, + audioname:['mb_caomao'], group:['rejiushi1','rejiushi2','rejiushi3','rejiushi_gain'], subfrequent:['gain'], subSkill:{ @@ -9351,6 +9355,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return false; }, audio:'rejiushi', + audioname:['mb_caomao'], enable:'chooseToUse', filter:function(event,player){ if(player.classList.contains('turnedover')) return false; diff --git a/character/sb.js b/character/sb.js index a252e5a31..4694db8ba 100644 --- a/character/sb.js +++ b/character/sb.js @@ -429,6 +429,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ animate:'giveAuto', gaintag:['sbquhu'], }).setContent(lib.skill.sbquhu.addToExpansionMultiple); + debugger await game.asyncDelay(1.5); const isMin=minLength>myCards.length; const sortedList=lose_list.filter(list=>list[0]!=player).sort((a,b)=>{ @@ -544,7 +545,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return; } "step 2"; + var loopedCount=0,mapLength=Object.keys(event.gaining_map).length; for(var j in event.gaining_map){ + loopedCount++; var map={}; var player=(_status.connectMode?lib.playerOL:game.playerMap)[j],cards=event.gaining_map[j]; var hs=player.getCards('x'); @@ -567,20 +570,20 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.$draw(cards.length); if(event.log) game.log(player,'将',get.cnNumber(cards.length),'张牌置于了武将牌上'); game.pause(); - setTimeout((player,cards)=>{ + setTimeout((player,cards,resume)=>{ player.$addToExpansion(cards,null,event.gaintag); for(var i of event.gaintag) player.markSkill(i); - game.resume(); - },get.delayx(500,500),player,cards); + if(resume) game.resume(); + },get.delayx(500,500),player,cards,loopedCount===mapLength); } else if(event.animate=='gain'){ player.$gain(cards,false); game.pause(); - setTimeout((player,cards)=>{ + setTimeout((player,cards,resume)=>{ player.$addToExpansion(cards,null,event.gaintag); for(var i of event.gaintag) player.markSkill(i); - game.resume(); - },get.delayx(700,700),player,cards); + if(resume) game.resume(); + },get.delayx(700,700),player,cards,loopedCount===mapLength); } else if(event.animate=='gain2'||event.animate=='draw2'){ var gain2t=300; @@ -588,11 +591,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ gain2t=500; } game.pause(); - setTimeout((player,cards)=>{ + setTimeout((player,cards,resume)=>{ player.$addToExpansion(cards,null,event.gaintag); for(var i of event.gaintag) player.markSkill(i); - game.resume(); - },get.delayx(gain2t,gain2t),player,cards); + if(resume) game.resume(); + },get.delayx(gain2t,gain2t),player,cards,loopedCount===mapLength); } else if(event.animate=='give'||event.animate=='giveAuto'){ var evtmap=event.losing_map; @@ -632,20 +635,20 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } } game.pause(); - setTimeout((player,cards)=>{ + setTimeout((player,cards,resume)=>{ player.$addToExpansion(cards,null,event.gaintag); for(var i of event.gaintag) player.markSkill(i); - game.resume(); - },get.delayx(500,500),player,cards); + if(resume) game.resume(); + },get.delayx(500,500),player,cards,loopedCount===mapLength); } else if(typeof event.animate=='function'){ var time=event.animate(event); game.pause(); - setTimeout((player,cards)=>{ + setTimeout((player,cards,resume)=>{ player.$addToExpansion(cards,null,event.gaintag); for(var i of event.gaintag) player.markSkill(i); - game.resume(); - },get.delayx(time,time),player,cards); + if(resume) game.resume(); + },get.delayx(time,time),player,cards,loopedCount===mapLength); } else{ player.$addToExpansion(cards,null,event.gaintag); @@ -760,8 +763,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{threaten:2.5}, getLimit:9, getNum(num){ - if(typeof num!='number'||!Array.from({length:9}).map((_,i)=>i+1).includes(num)) return 0; - return [2,2,5,5,1,2,2,3,3][num-1]; + const list=[2,2,5,5,1,2,2,3,3,2]; + if(typeof num!='number'||!Array.from({length:list.length}).map((_,i)=>i+1).includes(num)) return 0; + return list[num-1]; }, getEffect(player,num){ if(!player||typeof num!='number') return 0; @@ -772,8 +776,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return get.attitude(player,target)>0&&target.isTurnedOver(); })) return 10; return 0; - case 2://-2,摸min(5,max(1,阵亡角色数))的牌 - return Math.min(5,(Math.max(1,game.dead.length))); + case 2://-2,摸min(5,max(2,阵亡角色数))的牌 + return Math.min(5,(Math.max(2,game.dead.length))); case 3://-5,加上限加血+复原装备栏 if(!game.hasPlayer(target=>{ return get.attitude(player,target)>0&&target.maxHp<10; @@ -812,6 +816,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return get.attitude(player,target)<0; })) return 2.5; return 0; + case 10://-2,封印锦囊牌外的手牌 + if(game.hasPlayer(target=>{ + return get.attitude(player,target)<0; + })) return 1.5; + return 0; default://其他 return 0; } @@ -833,7 +842,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var dialog=ui.create.dialog('行殇:请选择你要执行的一项','hidden'); dialog.add([[ [1,'移去2个“颂”标记,复原一名角色的武将牌'], - [2,'移去2个“颂”标记,令一名角色摸'+get.cnNumber(Math.min(5,Math.max(1,game.dead.length)))+'张牌'], + [2,'移去2个“颂”标记,令一名角色摸'+get.cnNumber(Math.min(5,Math.max(2,game.dead.length)))+'张牌'], [3,'移去5个“颂”标记,令一名体力上限小于10的角色加1点体力上限并回复1点体力,然后随机恢复一个被废除的装备栏'], [4,'移去5个“颂”标记,获得一名已阵亡角色的所有技能,然后失去〖行殇〗〖放逐〗〖颂威〗'], ],'textbutton']); @@ -881,14 +890,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ async content(event,trigger,player){ const target=event.targets[0]; const num=lib.skill.sbxingshang_use_backup.num; - player.removeMark('sbxingshang',num); + player.removeMark('sbxingshang',get.info('sbxingshang').getNum(num)); switch(num){ case 1: if(target.isLinked()) target.link(false); if(target.isTurnedOver()) target.turnOver(); break; case 2: - target.draw(Math.min(5,Math.max(1,game.dead.length))); + target.draw(Math.min(5,Math.max(2,game.dead.length))); break; case 3: target.gainMaxHp(); @@ -951,7 +960,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ case 1: return str+'移去2个“颂”标记,复原一名角色的武将牌'; case 2: - return str+'移去2个“颂”标记,令一名角色摸'+get.cnNumber(Math.min(5,Math.max(1,game.dead.length)))+'张牌'; + return str+'移去2个“颂”标记,令一名角色摸'+get.cnNumber(Math.min(5,Math.max(2,game.dead.length)))+'张牌'; case 3: return str+'移去5个“颂”标记,令一名体力上限小于10的角色加1点体力上限并回复1点体力,然后随机恢复一个被废除的装备栏'; case 4: @@ -963,7 +972,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ order(_,player){ const info=get.info('sbxingshang'); const goon=(player.hasSkill('sbfangzhu')&&(player.getStat('skill').sbfangzhu||0)<(get.info('sbfangzhu').usable||Infinity)); - let list=Array.from({length:goon?9:4}).map((_,i)=>i+1); + let list=Array.from({length:goon?10:4}).map((_,i)=>i+1); list=list.filter(num=>player.countMark('sbxingshang')>=info.getNum(num)); list.sort((a,b)=>info.getEffect(player,b)-info.getEffect(player,a)); return (Array.from({length:4}).map((_,i)=>i+1).includes(list[0])&&info.getEffect(player,list[0])>0)?1:0; @@ -976,6 +985,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, sbfangzhu:{ audio:2, + audioname:['mb_caomao'], enable:'phaseUse', filter(event,player){ return player.hasMark('sbxingshang'); @@ -989,7 +999,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ [2,'移去2个“颂”标记,令一名其他角色的非Charlotte技能失效直到其回合结束'], [3,'移去2个“颂”标记,令一名其他角色不能响应除其外的角色使用的牌直到其回合结束'], [4,'移去3个“颂”标记,令一名其他角色将武将牌翻面'], - [5,'移去3个“颂”标记,令一名其他角色于手牌中只能使用装备牌直到其回合结束'] + [5,'移去3个“颂”标记,令一名其他角色于手牌中只能使用装备牌直到其回合结束'], + [6,'移去2个“颂”标记,令一名其他角色于手牌中只能使用锦囊牌直到其回合结束'], ],'textbutton']); return dialog; }, @@ -998,12 +1009,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return game.hasPlayer(target=>{ if(target==player) return false; const num=button.link,storage=target.getStorage('sbfangzhu_ban'); - return !((num==1&&storage.includes('basic'))||(num==5&&storage.includes('equip'))); + return !((num==1&&storage.includes('basic'))||(num==5&&storage.includes('equip'))||(num==6&&storage.includes('trick'))); }); }, check(button){ const player=get.event('player'),info=get.info('sbxingshang'); - let list=Array.from({length:5}).map((_,i)=>i+1); + let list=Array.from({length:6}).map((_,i)=>i+1); list=list.filter(num=>player.countMark('sbxingshang')>=info.getNum(num+4)); const num=list.sort((a,b)=>info.getEffect(player,b+4)-info.getEffect(player,a+4))[0]-4; return (button.link==num)?10:0; @@ -1012,25 +1023,23 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return { num:links[0], audio:'sbfangzhu', + audioname:['mb_caomao'], filterCard:()=>false, selectCard:-1, filterTarget(card,player,target){ if(target==player) return false; const num=lib.skill.sbfangzhu_backup.num,storage=target.getStorage('sbfangzhu_ban'); - return !((num==1&&storage.includes('basic'))||(num==5&&storage.includes('equip'))); + return !((num==1&&storage.includes('basic'))||(num==5&&storage.includes('equip'))||(num==6&&storage.includes('trick'))); }, async content(event,trigger,player){ const target=event.target; const num=lib.skill.sbfangzhu_backup.num; player.removeMark('sbxingshang',get.info('sbxingshang').getNum(num+4)); switch(num){ - case 1: + case 1: case 2: case 6: + const type=['basic','equip','trick'][[1,2,6].indexOf(num)]; target.addTempSkill('sbfangzhu_ban',{player:'phaseEnd'}); - target.markAuto('sbfangzhu_ban',['basic']); - break; - case 2: - target.removeSkill('baiban'); - target.addTempSkill('baiban',{player:'phaseEnd'}); + target.markAuto('sbfangzhu_ban',[type]); break; case 3: target.addTempSkill('sbfangzhu_kill',{player:'phaseEnd'}); @@ -1062,6 +1071,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 0; case 5: return -target.countCards('h',card=>get.type(card)!='equip')-3; + case 6: + return -target.countCards('h',card=>get.type2(card)!='trick')-2; } }, }, @@ -1081,6 +1092,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return str+'移去3个“颂”标记,令一名其他角色将武将牌翻面'; case 5: return str+'移去3个“颂”标记,令一名其他角色于手牌中只能使用装备牌直到其回合结束'; + case 6: + return str+'移去2个“颂”标记,令一名其他角色于手牌中只能使用锦囊牌直到其回合结束'; } } }, @@ -1088,10 +1101,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ order(_,player){ const info=get.info('sbxingshang'); const goon=(player.hasSkill('sbxingshang')&&(player.getStat('skill').sbxingshang_use||0)<(info.subSkill.use.usable||Infinity)); - let list=Array.from({length:goon?9:5}).map((_,i)=>i+(goon?1:5)); + let list=Array.from({length:goon?10:6}).map((_,i)=>i+(goon?1:5)); list=list.filter(num=>player.countMark('sbxingshang')>=info.getNum(num)); list.sort((a,b)=>info.getEffect(player,b)-info.getEffect(player,a)); - return (Array.from({length:5}).map((_,i)=>i+5).includes(list[0])&&info.getEffect(player,list[0])>0)?1:0; + return (Array.from({length:6}).map((_,i)=>i+5).includes(list[0])&&info.getEffect(player,list[0])>0)?1:0; }, result:{player:1}, }, @@ -1150,7 +1163,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, locked:false, async content(event,trigger,player){ - player.addMark('sbxingshang',Math.min(get.info('sbxingshang').getLimit-player.countMark('sbxingshang'),game.countPlayer(target=>target.group=='wei'&&target!=player))); + player.addMark('sbxingshang',Math.min(get.info('sbxingshang').getLimit-player.countMark('sbxingshang'),2*game.countPlayer(target=>target.group=='wei'&&target!=player))); }, group:'sbsongwei_delete', subSkill:{ @@ -4973,6 +4986,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, sbqingzheng:{ audio:2, + audioname:['mb_caomao'], trigger:{player:'phaseUseBegin'}, filter:function(event,player){ return player.countCards('h')>0; @@ -7069,11 +7083,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ sb_caopi:'谋曹丕', sb_caopi_prefix:'谋', sbxingshang:'行殇', - sbxingshang_info:'①当一名角色受到伤害后(每回合限一次)或死亡时,你获得2个“颂”标记(你至多拥有9个“颂”标记)。②出牌阶段限两次,你可以:1.移去2个“颂”标记,令一名角色复原武将牌;2.移去2个“颂”标记,令一名角色摸X张牌(X为场上阵亡角色数,且X至少为1,至多为5);3.移去5个“颂”标记,令一名体力上限小于10的角色加1点体力上限,回复1点体力,随机恢复一个已废除的装备栏;4.移去5个“颂”标记,获得一名阵亡角色武将牌上的所有技能,然后你失去〖行殇〗〖放逐〗〖颂威〗。', + sbxingshang_info:'①当一名角色受到伤害后(每回合限一次)或死亡时,你获得2个“颂”标记(你至多拥有9个“颂”标记)。②出牌阶段限两次,你可以:1.移去2个“颂”标记,令一名角色复原武将牌;2.移去2个“颂”标记,令一名角色摸X张牌(X为场上阵亡角色数,且X至少为2,至多为5);3.移去5个“颂”标记,令一名体力上限小于10的角色加1点体力上限,回复1点体力,随机恢复一个已废除的装备栏;4.移去5个“颂”标记,获得一名阵亡角色武将牌上的所有技能,然后你失去〖行殇〗〖放逐〗〖颂威〗。', sbfangzhu:'放逐', - sbfangzhu_info:'出牌阶段限一次,你可以:1.移去1个“颂”标记,令一名其他角色于手牌中只能使用基本牌直到其回合结束;2.移去2个“颂”标记,令一名其他角色的非Charlotte技能失效直到其回合结束;3.移去2个“颂”标记,令一名其他角色不能响应除其以外的角色使用的牌直到其回合结束;4.移去3个“颂”标记,令一名其他角色将武将牌翻面;5.移去3个“颂”标记,令一名其他角色于手牌中只能使用装备牌直到其回合结束。', + sbfangzhu_info:'出牌阶段限一次,你可以:1.移去1个“颂”标记,令一名其他角色于手牌中只能使用基本牌直到其回合结束;2.移去2个“颂”标记,令一名其他角色的非Charlotte技能失效直到其回合结束;3.移去2个“颂”标记,令一名其他角色不能响应除其以外的角色使用的牌直到其回合结束;4.移去3个“颂”标记,令一名其他角色将武将牌翻面;5.移去3个“颂”标记,令一名其他角色于手牌中只能使用装备牌直到其回合结束;6.移去2个“颂”标记,令一名其他角色于手牌中只能使用锦囊牌直到其回合结束。', sbsongwei:'颂威', - sbsongwei_info:'主公技。①出牌阶段开始时,你获得Y个“颂”标记(Y为场上其他魏势力角色数)。②每局游戏限一次,出牌阶段,你可以令一名其他魏势力角色失去所有武将牌的技能。', + sbsongwei_info:'主公技。①出牌阶段开始时,你获得Y个“颂”标记(Y为场上其他魏势力角色数的两倍)。②每局游戏限一次,出牌阶段,你可以令一名其他魏势力角色失去所有武将牌的技能。', sb_xunyu:'谋荀彧', sb_xunyu_prefix:'谋', sbquhu:'驱虎', diff --git a/character/shenhua.js b/character/shenhua.js index f6ff37797..7a04f3e48 100755 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -1974,6 +1974,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ target.addMark('nzry_huaiju',1); target.addSkill('nzry_huaiju_ai'); }, + ai:{ + combo:'nzry_huaiju' + } }, "nzry_zhenglun":{ audio:2, @@ -1990,6 +1993,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger.cancel(); player.addMark('nzry_huaiju',1); }, + ai:{ + combo:'nzry_huaiju' + } }, "nzry_kuizhu":{ audio:2, @@ -7759,7 +7765,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ zuoci:['zuoci','re_zuoci'], caiwenji:['caiwenji','ol_caiwenji','re_caiwenji'], xuyou:['xuyou','sp_xuyou','jsrg_xuyou','yj_xuyou','junk_xuyou'], - guanqiujian:['guanqiujian','re_guanqiujian','tw_guanqiujian','old_guanqiujian'], + guanqiujian:['guanqiujian','re_guanqiujian','tw_guanqiujian','mb_sp_guanqiujian','old_guanqiujian'], chendao:['chendao','ns_chendao','old_chendao'], zhugezhan:['zhugezhan','old_zhugezhan'], ol_lusu:['re_lusu','ol_lusu','dc_sb_lusu'], diff --git a/character/sp.js b/character/sp.js index acfcf080f..edc16e233 100755 --- a/character/sp.js +++ b/character/sp.js @@ -6,7 +6,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ characterSort:{ sp:{ sp_tianji:["sunhao","liuxie","caoang","hetaihou","sunluyu",'ol_wangrong',"zuofen","ol_bianfuren","qinghegongzhu","tengfanglan","ruiji",'caoxiancaohua'], - sp_sibi:["yangxiu",'guotu',"chenlin","chengyu","shixie","fuwan","wangyun","zhugejin","simalang","maliang","buzhi","dongyun","kanze","sunqian","xizhicai","sunshao",'duxi',"jianggan",'ol_dengzhi','ol_yangyi','ol_dongzhao','ol_chendeng','jin_yanghu','wangyan','xiahouxuan','quhuang','zhanghua','wangguan','sunhong','caoxi','tianchou'], + sp_sibi:['ol_lukai',"yangxiu",'guotu',"chenlin","chengyu","shixie","fuwan","wangyun","zhugejin","simalang","maliang","buzhi","dongyun","kanze","sunqian","xizhicai","sunshao",'duxi',"jianggan",'ol_dengzhi','ol_yangyi','ol_dongzhao','ol_chendeng','jin_yanghu','wangyan','xiahouxuan','quhuang','zhanghua','wangguan','sunhong','caoxi','tianchou'], sp_tianzhu:['liyi','zhangyan','niujin','hejin','hansui',"wutugu","yanbaihu","shamoke","zhugedan",'huangzu','gaogan',"tadun","fanjiangzhangda","ahuinan","dongtuna",'ol_wenqin'], sp_nvshi:['ol_dingshangwan',"lingju","guanyinping","zhangxingcai","mayunlu","dongbai","zhaoxiang",'ol_zhangchangpu',"daxiaoqiao","jin_guohuai",'ol_hujinding'], sp_shaowei:["simahui","zhangbao","zhanglu","zhugeguo","xujing","zhangling",'huangchengyan','zhangzhi','lushi'], @@ -18,7 +18,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ sp_zhongdan:["cuiyan","huangfusong"], sp_guozhan2:["sp_dongzhuo","liqueguosi","zhangren"], sp_others:["hanba","caiyang"], - sp_waitforsort:['ol_luyusheng','ol_pengyang','ol_tw_zhangji','ol_liwan','ol_liuyan','caoyu','liupan','ol_lukai','ol_liupi'], + sp_waitforsort:['ol_luyusheng','ol_pengyang','ol_tw_zhangji','ol_liwan','ol_liuyan','caoyu','liupan','ol_liupi'], }, }, characterFilter:{ @@ -58,7 +58,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ol_mengda:['male','shu',4,['olgoude']], ol_wanglang:['male','wei',3,['gushe','oljici']], ol_liuyan:['male','qun','4/6',['olpianan','olyinji','olkuisi']], - lushi:['female','qun',3,['olzhuyan','olleijie']], + lushi:['female','qun',3,['olzhuyan','releijie']], zhangshiping:['male','shu',3,['olhongji','olxinggu']], sunhong:['male','wu',3,['olxianbi','olzenrun']], luoxian:['male','shu',4,['oldaili']], @@ -1718,56 +1718,86 @@ game.import('character',function(lib,game,ui,get,ai,_status){ usable:1, logTarget:()=>_status.currentPhase, async content(event,trigger,player){ - player.when({global:'phaseEnd'}).then(()=>{ + player.when({global:'phaseEnd'}) + .then(()=>{ if(target&&target.isIn()){ var num=target.countCards('h')-player.countCards('h'); if(num){ if(num>0){ if(player.countCards('h')<5) player.draw(Math.min(5-player.countCards('h'),num)); + event.finish(); } else player.chooseToDiscard(-num,'h',true); } + else event.finish(); } - }).vars({target:_status.currentPhase}); + else event.finish(); + }) + .then(()=>{ + if(result.bool&&result.cards.length>1){ + if(player.isDamaged()) player.recover(); + } + }) + .vars({target:_status.currentPhase}); }, }, olxiangzuo:{ audio:2, trigger:{player:'dying'}, filter(event,player){ - if(!_status.currentPhase||!_status.currentPhase.isIn()) return false; - return player.countCards('he'); + return player.countCards('he')&&game.hasPlayer(target=>target!=player); + }, + async cost(event,trigger,player){ + event.result=await player.chooseCardTarget({ + prompt:get.prompt2('olxiangzuo'), + filterCard:true, + selectCard:[1,Infinity], + filterTarget:lib.filter.notMe, + complexCard:true, + complexTarget:true, + complexSelect:true, + ai1(card){ + const player=get.event('player'); + if(!ui.selected.targets.length) return 0; + const target=ui.selected.targets[0]; + if(player.getHistory('useSkill',evt=>{ + return evt.skill=='olgongjie'&&(evt.targets||[evt.target]).includes(target); + }).length&&player.getHistory('useSkill',evt=>{ + return evt.skill=='olxiangxv'&&(evt.targets||[evt.target]).includes(target); + }).length){ + if(get.attitude(player,target)>0) return 1; + if(player.canSaveCard(card,player)) return 0; + if(ui.selected.cards.length+player.hp>=player.maxHp) return 0; + return 20-get.value(card); + } + if(get.attitude(player,target)>0&&!player.countCards('he',cardx=>player.canSaveCard(cardx,player))) return 1; + return 0; + }, + ai2(target){ + const player=get.event('player'); + const goon=(player.getHistory('useSkill',evt=>{ + return evt.skill=='olgongjie'&&(evt.targets||[evt.target]).includes(target); + }).length&&player.getHistory('useSkill',evt=>{ + return evt.skill=='olxiangxv'&&(evt.targets||[evt.target]).includes(target); + }).length),att=get.attitude(player,target); + if(goon) return 5*att; + if(!!player.countCards('he',cardx=>player.canSaveCard(cardx,player))) return att; + return 0; + }, + }).forResult(); }, - direct:true, limited:true, skillAnimation:true, animationColor:'water', async content(event,trigger,player){ - var target=_status.currentPhase,num=player.countCards('he'); - var {result:{bool,cards}}=await player.chooseToGive(get.prompt2('olxiangzuo',target),[1,num],'he').set('ai',card=>{ - var player=_status.event.player,target=_status.event.target; - if(player.getHistory('useSkill',evt=>{ - return evt.skill=='olgongjie'&&evt.targets.includes(target); - }).length&&player.getHistory('useSkill',evt=>{ - return evt.skill=='olxiangxv'&&evt.targets.includes(target); - }).length){ - if(get.attitude(player,target)>0) return 1; - if(player.canSaveCard(card,player)) return 0; - if(ui.selected.cards.length+player.hp>=player.maxHp) return 0; - return 20-get.value(card); - } - else{ - if(get.attitude(player,target)>0&&!player.countCards('he',cardx=>player.canSaveCard(cardx,player))) return 1; - return 0; - } - }).set('target',target).set('complexCard',true).set('logSkill',['olxiangzuo',target]); - if(!bool) return; + const target=event.targets[0],cards=event.cards; player.awakenSkill('olxiangzuo'); + await player.give(cards,target); if(player.getHistory('useSkill',evt=>{ return evt.skill=='olgongjie'&&evt.targets.includes(target); }).length&&player.getHistory('useSkill',evt=>{ return evt.skill=='olxiangxv'&&evt.targets.includes(target); - }).length) player.recover(cards.length); + }).length) await player.recover(cards.length); }, }, //OL飞扬 @@ -3473,13 +3503,26 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return order; }, }, - trigger:{player:'useCard'}, - filter:function(event){ + trigger:{player:['useCard','useCardAfter']}, + filter:function(event,player,name){ + if(name=='useCardAfter'){ + if(player.isTempBanned('olxiaofan')) return false; + return player.getHistory('useCard',evt=>{ + return !player.getHistory('sourceDamage',evt2=>{ + return evt2.card&&evt2.card==evt.card; + }).length&&get.tag(evt.card,'damage'); + }).indexOf(event)>=2; + } return [1,11,12,13].includes(get.number(event.card)); }, forced:true, content:function(){ 'step 0' + if(event.triggername=='useCardAfter'){ + player.tempBanSkill('olxiaofan'); + event.finish(); + return; + } trigger.targets.length=0; trigger.all_excluded=true; game.log(trigger.card,'被无效了'); @@ -5267,7 +5310,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ subSkill:{ record:{ trigger:{ - global:['phaseZhunbeiAfter','phaseBefore','enterGame'], + global:['phaseJieshuAfter','phaseBefore','enterGame'], }, lastDo:true, charlotte:true, @@ -5337,6 +5380,49 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } } }, + releijie:{ + audio:'olleijie', + enable:'phaseUse', + filterTarget:true, + usable:1, + async content(event,trigger,player){ + const target=event.target,result=await target.judge(card=>{ + var number=get.number(card); + if(get.suit(card)=='spade'&&number>=2&&number<=9) return -4; + return 2; + }).set('judge2',result=>{ + return result.bool===false?true:false; + }).forResult(); + if(result.bool) await target.draw(2); + else{ + const card=new lib.element.VCard({name:'sha',nature:'thunder'}); + if(player.canUse(card,target,false)){ + for(let i=1;i<=2;i++){ + await player.useCard(card,target,false); + } + } + } + }, + ai:{ + order:1, + result:{ + target(player,target){ + let sgn=0,eff=0,num=get.attitude(player,target); + const card=new lib.element.VCard({name:'sha',nature:'thunder'}); + game.countPlayer(current=>{ + if(!current.hasSkillTag('rejudge')) return; + sgn=get.sgnAttitude(player,current); + }); + if(sgn>0&&player.canUse(card,target,false)){ + eff+=get.effect(target,card,player,player)*2; + return eff*get.sgn(num); + } + else if(sgn==0) return num*get.sgn(num); + return 0; + }, + }, + }, + }, //张世平 olhongji:{ audio:2, @@ -17199,8 +17285,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } if(list.length){ var skill=list.randomGet(); - trigger.player.popup(skill); - trigger.player.disableSkill('chuanxin_disable',skill,true); + trigger.player.removeSkills(skill) } } else{ @@ -27624,9 +27709,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ olxinggu_info:'①游戏开始时,你将牌堆中的三张坐骑牌扣置于武将牌上。②结束阶段,你可以将一张〖行贾①〗牌置于一名其他角色的装备区,然后你从牌堆获得一张♦牌。', lushi:'卢氏', olzhuyan:'驻颜', - olzhuyan_info:'每名角色每项各限一次。结束阶段,你可以令一名角色将以下一项调整至与其上一个准备阶段结束后相同:1.体力值;2.手牌数(体力值至多失去至1,手牌数至多摸至5;若其未执行过准备阶段则改为游戏开始时)。', + olzhuyan_info:'每名角色每项各限一次。结束阶段,你可以令一名角色将以下一项调整至与其上一个结束阶段结束后相同:1.体力值;2.手牌数(体力值至多失去至1,手牌数至多摸至5;若其未执行过准备阶段则改为游戏开始时)。', olleijie:'雷劫', olleijie_info:'准备阶段,你可以令一名角色判定,若结果为♠2~9,其受到2点雷电伤害,否则其摸两张牌。', + releijie:'雷劫', + releijie_info:'出牌阶段限一次,你可以令一名角色判定,若结果为黑桃2~9,则你视为依次对其使用两张雷【杀】,否则其摸两张牌。', ol_liuyan:'OL刘焉', ol_liuyan_prefix:'OL', olpianan:'偏安', @@ -27700,7 +27787,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ olxiaofan:'嚣翻', olxiaofan_info:'当你需要使用不为【无懈可击】的牌时,你可以观看牌堆底的X+1张牌并使用其中的一张。此牌结算结束时,你依次弃置以下前X个区域中的所有牌:⒈判定区、⒉装备区、⒊手牌区(X为本回合你使用过的牌中包含的类型数)。', oltuishi:'侻失', - oltuishi_info:'锁定技。①你不能使用【无懈可击】。②当你使用点数为字母的牌时,你令此牌无效并摸一张牌,且你对手牌数小于你的角色使用的下一张牌无距离和次数限制。', + oltuishi_info:'锁定技。①你不能使用【无懈可击】。②当你使用点数为字母的牌时,你令此牌无效并摸一张牌,且你对手牌数小于你的角色使用的下一张牌无距离和次数限制。③当你使用伤害类卡牌结算完毕后,若此牌为你本回合使用的第三张或以上未造成伤害的卡牌,则你令本回合〖器翻〗失效。', ol_tw_zhangji:'张既', skill_zhangji_A:'技能', skill_zhangji_A_info:'出牌阶段限X次(X为你的体力值),当你使用牌指定一名其他角色为目标后,你可以观看其手牌,然后你选择一项:
1.弃置其一张牌,然后若弃置的牌是能造成火焰伤害的牌,你摸一张牌。
2.重铸其手牌中的所有【杀】和【决斗】。
3.若其没有【闪】,你与其互相对对方造成1点伤害。', @@ -27746,9 +27833,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ olgongjie:'恭节', olgongjie_info:'每轮的首个回合开始时,你可以令任意名角色获得你的一张牌,然后你摸X张牌(X为你本次失去的花色数)。', olxiangxv:'相胥', - olxiangxv_info:'当你的手牌数变为全场最少时,你可以获得以下效果:本回合结束时,将手牌数调整至与当前回合角色手牌数相同(至多摸至五张)。', + olxiangxv_info:'当你的手牌数变为全场最少时,你可以获得以下效果:本回合结束时,将手牌数调整至与当前回合角色手牌数相同(至多摸至五张),然后若你以此法弃置了至少两张手牌,则你回复1点体力。', olxiangzuo:'襄胙', - olxiangzuo_info:'限定技,当你进入濒死状态时,你可以交给当前回合角色任意张牌,若如此做,若你本回合已对其发动过〖恭节〗和〖相胥〗,你回复等量的体力。', + olxiangzuo_info:'限定技,当你进入濒死状态时,你可以交给一名其他角色任意张牌,然后若你本回合已对其发动过〖恭节〗和〖相胥〗,你回复等量的体力。', liyi:'李异', olchanshuang:'缠双', olchanshuang_info:'①出牌阶段限一次,你可以选择一名其他角色。你与其依次选择〖缠双③〗的一项,然后你与其依次执行各自选择的项。②结束阶段,若X大于0,你执行〖缠双③〗的前X项(X为你本回合以任意形式执行过的〖缠双③〗的选项数)。③选项:1.重铸一张牌;2.使用一张【杀】;3.弃置两张牌。', diff --git a/character/sp2.js b/character/sp2.js index 63fe3f59c..81edb89e9 100644 --- a/character/sp2.js +++ b/character/sp2.js @@ -3865,7 +3865,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, charlotte:true, filter:function(event,player){ - return event.skill=='xiongmang'&&!player.hasHistory('sourceDamage',function(evt){ + return player.maxHp>1&&event.skill=='xiongmang'&&!player.hasHistory('sourceDamage',function(evt){ return evt.card==event.card; }); }, @@ -4289,18 +4289,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{source:'damageBegin1'}, direct:true, filter:function(event,player){ - return player.countCards('he')>0&&player.isPhaseUsing()&&!player.hasSkill('chaofeng2'); + return player.countCards('h')>0&&player.isPhaseUsing()&&!player.hasSkill('chaofeng2'); }, content:function(){ 'step 0' - var str='弃置一张牌并摸一张牌',color,type; + var str='弃置一张手牌并摸一张牌',color,type; if(trigger.card){ type=get.type2(trigger.card,false); color=get.color(trigger.card,false); if(color!='none') str+=';若弃置'+get.translation(color)+'牌则改为摸两张牌'; if(type) str+=';若弃置类型为'+get.translation(type)+'的牌则伤害+1'; } - var next=player.chooseToDiscard('he',get.prompt('chaofeng',trigger.player),str); + var next=player.chooseToDiscard('h',get.prompt('chaofeng',trigger.player),str); next.set('ai',function(card){ var player=_status.event.player,att=_status.event.att; var val=4.2-get.value(card); @@ -6243,7 +6243,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ direct:true, charlotte:true, filter:function(event,player){ - if(player!=_status.currentPhase) return false; + if(player!=_status.currentPhase||event.targets.length!=1) return false; var card=event.card; if(card.name!='sha'&&get.type(card)!='trick')return false; var info=get.info(card); @@ -11389,7 +11389,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ hfjieying:'节应', hfjieying2:'节应', hfjieying3:'节应', - hfjieying_info:'结束阶段,你可以选择一名其他角色,该角色下回合使用【杀】或普通锦囊牌无距离限制且可多指定一个目标,且当其造成伤害后,其无法再使用牌直到回合结束。', + hfjieying_info:'结束阶段,你可以选择一名其他角色,该角色下回合使用目标数为1的【杀】或普通锦囊牌无距离限制且可多指定一个目标,且当其造成伤害后,其无法再使用牌直到回合结束。', weipo:'危迫', weipo_info:'锁定技,其他角色使用【杀】或普通锦囊牌指定你为目标后,若你的手牌数小于X,则你将手牌摸至X张,并记录摸牌事件结算后的手牌数Y。此牌结算结束后,若你的手牌数小于Y,则你将一张手牌交给此牌的使用者,且此技能失效直到你的下回合开始。(X为你的体力上限且至多为5)', zhaozhong:'赵忠', @@ -11499,7 +11499,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ fengshi_info:'当你使用牌指定第一个目标后,你可弃置你与其中一名手牌数小于你的目标角色的各一张牌,并令此牌对其造成的伤害+1;当你成为其他角色使用牌的目标后,若你的手牌数小于其,则你可以弃置你与其的各一张牌,并令此牌对你造成的伤害+1。', tongyuan:'童渊', chaofeng:'朝凤', - chaofeng_info:'出牌阶段限一次。当你造成伤害时,你可以弃置一张牌,然后摸一张牌。若此伤害的渠道为牌且你弃置的牌:与此牌颜色相同,则你改为摸两张牌;与此牌类型相同,则此伤害+1。', + chaofeng_info:'出牌阶段限一次。当你造成伤害时,你可以弃置一张手牌,然后摸一张牌。若此伤害的渠道为牌且你弃置的牌:与此牌颜色相同,则你改为摸两张牌;与此牌类型相同,则此伤害+1。', chuanshu:'传术', chuanshu_info:'限定技。准备阶段,若你已受伤;或当你死亡时,你可令一名其他角色获得〖朝凤〗。然后你获得〖龙胆〗、〖从谏〗和〖穿云〗。', chuanyun:'穿云', @@ -11526,7 +11526,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ yinyi_info:'锁定技。每回合限一次,当你受到非属性伤害时,若你的手牌数和体力值与伤害来源均不相同,则你防止此伤害。', haomeng:'郝萌', xiongmang:'雄莽', - xiongmang_info:'你可将任意张花色各不相同的手牌当做目标数上限为X的【杀】使用(X为此【杀】对应的实体牌数)。此【杀】使用结算结束后,若你未造成过渠道为此牌的伤害,则你减1点体力上限。', + xiongmang_info:'你可将任意张花色各不相同的手牌当做目标数上限为X的【杀】使用(X为此【杀】对应的实体牌数)。此【杀】使用结算结束后,若你未造成过渠道为此牌的伤害且体力上限大于1,则你减1点体力上限。', yanfuren:'严夫人', channi:'谗逆', channi_info:'出牌阶段限一次。你可将任意张手牌交给一名其他角色,然后其可以将至多等量的手牌当做【决斗】使用。若其因此【决斗】造成了伤害,则其摸X张牌(X为此【决斗】对应的实体牌数)。若其因此【决斗】受到过伤害,则你弃置所有手牌。', @@ -11572,7 +11572,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ dcruizhan:'锐战', dcruizhan_info:'其他角色的准备阶段开始时,若其的手牌数不小于其体力值,则你可以和其拼点。若你赢或拼点牌中有【杀】,则你视为对其使用一张【杀】。然后若此【杀】造成了伤害且以上两个条件均被满足,则你获得其一张牌。', dcshilie:'示烈', - dcshilie_info:'①出牌阶段限一次。你可以选择一项:⒈回复1点体力,将两张牌置于武将牌上作为“示烈”。若“示烈”牌数大于存活人数,则你将最早的多余牌置入弃牌堆;⒉失去1点体力,获得两张“示烈”牌。(满血则不回血,无牌则不移动)②当你死亡时,你可以将所有“示烈”牌交给一名其他角色。', + dcshilie_info:'①出牌阶段限一次。你可以选择一项:⒈回复1点体力,将两张牌置于武将牌上作为“示烈”。若“示烈”牌数大于存活人数,则你将最早的多余牌置入弃牌堆;⒉失去1点体力,获得两张“示烈”牌。(满血则不回血,无牌则不移动)②当你死亡时,你可以将所有“示烈”牌交给一名不为伤害来源的其他角色。', dc_zhaoyǎn:'赵俨', dcfuning:'抚宁', dcfuning_info:'当你使用牌时,你可以摸两张牌,然后弃置X张牌(X为你本回合内发动过〖抚宁〗的次数)。', diff --git a/character/tw.js b/character/tw.js index 33583336d..20d136399 100644 --- a/character/tw.js +++ b/character/tw.js @@ -369,7 +369,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ backup:{ viewAs:{name:'juedou'}, position:'he', - filterCard:true, + filterCard(card,player){ + const cardx=get.autoViewAs({name:'juedou'},[card]); + return lib.filter.targetEnabledx(cardx,player,get.event('sourcex')); + }, check(card){ if(get.name(card)=='sha') return 5-get.value(card); return 8-get.value(card); @@ -712,7 +715,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, popup:false, async content(event,trigger,player){ - player.logSkill('twxiayong'+(trigger.player===player?'1':'2'),trigger.player); + await player.logSkill('twxiayong'+(trigger.player===player?'1':'2'),trigger.player); if(trigger.player===player){ const cards=player.getCards('h',card=>{ return lib.filter.cardDiscardable(card,player,'twxiayong'); @@ -16738,6 +16741,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ twjuexing:'绝行', twjuexing_info:'出牌阶段限一次。你可以视为对一名其他角色使用一张【决斗】。此牌对一名角色生效时,你与其将所有手牌扣置于武将牌上,然后各摸等同于当前体力值的牌。此牌结算结束后,你与所有目标角色弃置本次以此法摸的牌,然后获得扣置于武将牌上的牌。历战:当你因〖绝行〗摸牌时,摸牌数+1。', twxiayong:'狭勇', + twxiayong1:'狭勇', + twxiayong2:'狭勇', twxiayong_info:'锁定技。当你使用的【决斗】或目标角色包括你的【决斗】造成伤害时,若受伤角色为你,则你随机弃置一张手牌;否则你令此伤害+1。', twqiaosi:'峭嗣', twqiaosi_info:'结束阶段,你可以获得由其他角色区域直接置入或经由处理区置入弃牌堆的所有牌,然后若你以此法获得的牌数小于你的体力值,则你失去1点体力。', diff --git a/character/xianding.js b/character/xianding.js index 45df206b7..887e8623a 100644 --- a/character/xianding.js +++ b/character/xianding.js @@ -4,6 +4,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ name:'xianding', connect:true, character:{ + sp_zhenji:['female','qun',3,['dcjijie','dchuiji']], + wu_guanyu:['male','shu',5,['dcjuewu','dcwuyou','dcyixian']], caofang:['male','wei',4,['dczhimin','dcjujian'],['zhu']], dc_sb_simayi:['male','wei',3,['dcsbquanmou','dcsbpingliao']], chendong:['male','wu',4,['dcduanxie','fenming']], @@ -114,7 +116,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ sp2_yuxiu:['dongguiren','dc_tengfanglan','zhangjinyun','zhoubuyi','dc_xujing'], sp2_qifu:['dc_guansuo','xin_baosanniang','dc_zhaoxiang'], sp2_gaoshan:['wanglang','liuhui','zhangjian'], - sp2_wumiao:['wu_zhugeliang','wu_luxun'], + sp2_wumiao:['wu_zhugeliang','wu_luxun','wu_guanyu'], sp2_mouding:['dc_sb_lusu','dc_sb_zhouyu','dc_sb_simayi'], } }, @@ -123,6 +125,514 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ], }, skill:{ + //武关羽 + dcjuewu:{ + audio:2, + enable:'chooseToUse', + filter(event,player){ + if(!player.hasCard(card=>{ + return _status.connectMode||get.number(card)===2; + },'hes')) return false; + for(const name of ['shuiyanqijuny'].concat(lib.inpile)){ + if(player.getStorage('dcjuewu_used').includes(name)) continue; + const card=get.autoViewAs({name},'unsure'); + if(!get.tag(card,'damage')) continue; + if(event.filterCard(card,player,event)) return true; + if(name==='sha'){ + for(const nature of lib.inpile_nature){ + card.nature=nature; + if(event.filterCard(card,player,event)) return true; + } + } + } + return false; + }, + hiddenCard(player,name){ + if(!lib.inpile.includes(name)) return false; + if(player.getStorage('dcjuewu_used').includes(name)) return false; + if(!player.hasCard(card=>{ + return _status.connectMode||get.number(card)===2; + },'hes')) return false; + return get.tag({name},'damage'); + }, + group:'dcjuewu_inTwo', + chooseButton:{ + dialog(event,player){ + let list=get.inpileVCardList(info=>{ + return get.tag({name:info[2]},'damage'); + }); + if(!list.some(info=>info[2]==='shuiyanqijuny')) list.add(['锦囊','','shuiyanqijuny']); + list=list.filter(info=>{ + const name=info[2],nature=info[3]; + if(player.getStorage('dcjuewu_used').includes(name)) return false; + const card=get.autoViewAs({name,nature},'unsure'); + return event.filterCard(card,player,event); + }); + return ui.create.dialog('绝武',[list,'vcard']); + }, + check(button){ + if(get.event().getParent().type!='phase') return 1; + const player=get.player(); + return player.getUseValue({ + name:button.link[2], + nature:button.link[3], + }); + }, + backup(links,player){ + return { + audio:'dcjuewu', + filterCard(card,player){ + return get.number(card)===2; + }, + position:'hes', + check(card){ + return 8-get.value(card); + }, + popname:true, + viewAs:{ + name:links[0][2], + nature:links[0][3] + }, + precontent(){ + if (!player.storage.dcjuewu_used){ + player.when({global:'phaseAfter'}).then(() => { + delete player.storage.dcjuewu_used; + }); + } + player.markAuto('dcjuewu_used', event.result.card.name); + }, + } + }, + prompt(links,player){ + return '将一张点数为2的牌当'+(get.translation(links[0][3])||'')+get.translation(links[0][2])+'使用'; + } + }, + subSkill:{ + backup:{}, + inTwo:{ + audio:'dcjuewu', + trigger:{ + player:'gainAfter', + global:'loseAsyncAfter', + }, + filter(event,player){ + const cards=event.getg(player); + if(!cards.length) return false; + return game.hasPlayer(current=>{ + if(current===player) return false; + const evt=event.getl(current); + return evt&&evt.hs.length+evt.es.length+evt.js.length>0; + }); + }, + forced:true, + locked:false, + async content(event,trigger,player){ + player.addGaintag(trigger.getg(player),'dcjuewu_two'); + player.addSkill('dcjuewu_two'); + }, + }, + two:{ + charlotte:true, + mod:{ + cardnumber(card){ + if(card.hasGaintag('dcjuewu_two')) return 2; + }, + }, + }, + }, + ai:{ + fireAttack:true, + respondSha:true, + skillTagFilter(player){ + if(!player.hasCard(card=>{ + return _status.connectMode||get.number(card)===2; + },'hes')) return false; + }, + order:1, + result:{ + player(player){ + if(get.event('dying')) return get.attitude(player,get.event('dying')); + return 1; + }, + }, + }, + }, + dcwuyou:{ + audio:2, + global:'dcwuyou_g', + subSkill:{ + g:{ + audio:'dcwuyou', + enable:'phaseUse', + usable:1, + filter(event,player){ + if(!player.countCards('h')) return false; + return game.hasPlayer(current=>{ + return current.hasSkill('dcwuyou'); + }); + }, + filterCard:true, + filterTarget(card,player,target){ + return target.hasSkill('dcwuyou'); + }, + selectTarget(){ + const count=game.countPlayer(current=>{ + return current.hasSkill('dcwuyou'); + }); + return count>1?1:-1; + }, + check(card){ + const player=get.player(); + const hasFriend=game.hasPlayer(current=>{ + return current.hasSkill('dcwuyou')&&get.attitude(player,current)>0; + }); + return (hasFriend?7:1)-get.value(card); + }, + prompt(){ + const player=get.player(),list=game.filterPlayer(current=>{ + return current.hasSkill('dcwuyou'); + }),list2=list.filter(current=>current!==player); + const moreThanOne=list.length>1,includesMe=list.includes(player); + let str='选择一张手牌,'; + if(includesMe) str+=`点击“确定”,${moreThanOne?'或':''}`; + if(moreThanOne||!includesMe) str+=`将此牌交给${get.translation(list2)}${list2.length>1?'中的一人':''},`; + str+='然后执行后续效果。'; + return str; + }, + discard:false, + lose:false, + delay:false, + async content(event,trigger,player){ + const { target } = event; + const isMe = target === player; + let { cards } = event; + if (!isMe) await player.give(cards, target); + const names = lib.inpile.filter(name => { + return get.type2(name) !== 'equip'; + }).randomGets(5); + if (names.includes('sha')) names.splice(names.indexOf('sha') + 1, 0, ...lib.inpile_nature.map(nature => ['sha', nature])); + const vcard = names.map(namex => { + let name = namex, nature; + if (Array.isArray(namex)) [name, nature] = namex; + const info = [get.type(name), '', name, nature]; + return info; + }); + const links = await target.chooseButton(['武佑:选择一个牌名', [vcard, 'vcard']], true) + .set('user', player) + .set('ai', button => { + const player = get.player(), user = get.event('user'); + return user.getUseValue({name: button.link[2], nature: button.link[3]}) * get.attitude(player, user); + }) + .forResultLinks(); + if (!links || !links.length) return; + const viewAs = {name: links[0][2], nature: links[0][3]}; + if (!isMe) { + cards = await target.chooseToGive(player, true).forResultCards(); + } + const card = cards[0]; + if (!target.storage.dcwuyou_transfer) target.storage.dcwuyou_transfer = {}; + target.storage.dcwuyou_transfer[card.cardid] = viewAs; + target.addGaintag(cards, 'dcwuyou_transfer'); + target.addSkill('dcwuyou_transfer'); + }, + ai:{ + order:10, + result:{ + player(player,target){ + if(get.attitude(player,target)>0) return 2; + return 1; + }, + target:0.5, + }, + }, + }, + transfer:{ + trigger:{player:'useCard1'}, + forced:true, + popup:false, + charlotte:true, + filter(event,player){ + if(event.addCount===false) return false; + return player.hasHistory('lose',evt=>{ + if(evt.getParent()!=event) return false; + for(const i in evt.gaintag_map){ + if(evt.gaintag_map[i].includes('dcwuyou_transfer')) return true; + } + return false; + }); + }, + async content(event,trigger,player){ + trigger.addCount = false; + const stat = player.getStat().card, name = trigger.card.name; + if (typeof stat[name] === 'number') stat[name]--; + }, + mod:{ + cardname(card,player){ + const map=player.storage.dcwuyou_transfer; + if(map&&map[card.cardid]&&get.itemtype(card)=='card'&&card.hasGaintag('dcwuyou_transfer')) return map[card.cardid].name; + }, + cardnature(card,player){ + const map=player.storage.dcwuyou_transfer; + if(map&&map[card.cardid]&&get.itemtype(card)=='card'&&card.hasGaintag('dcwuyou_transfer')) return map[card.cardid].nature||false; + }, + cardUsable(card){ + if(!card.cards) return; + if(card.cards.some(card=>card.hasGaintag('dcwuyou_transfer'))) return Infinity; + }, + }, + }, + } + }, + dcyixian:{ + audio:2, + enable:'phaseUse', + limited:true, + skillAnimation:true, + animationColor:'metal', + chooseButton:{ + dialog(event,player){ + const dialog=ui.create.dialog('义贤:你可以选择一项','hidden'); + dialog.add([[ + ['field','获得场上的所有装备牌'], + ['discardPile','获得弃牌堆中的所有装备牌'] + ],'textbutton']); + return dialog; + }, + check(button){ + const player=get.player(); + if(button.link=='field') return game.filterPlayer().map(current=>{ + const cards=current.getCards('e'),att=get.sgnAttitude(player,current); + return cards.map(card=>{ + return Math.max(player.hasSkill('dcjuewu')?5:0,get.value(card,player))-get.value(card,current)*att; + }).reduce((p,c)=>p+c,0); + }).reduce((p,c)=>p+c,0); + if(button.link=='discardPile') return Array.from(ui.discardPile.childNodes).filter(card=>{ + return get.type(card)==='equip'; + }).map(card=>{ + return Math.max(player.hasSkill('dcjuewu')?5:0,get.value(card,player)); + }).reduce((p,c)=>p+c,0); + return 0.1; + }, + backup(links){ + return { + filterCard:()=>false, + selectCard:-1, + pos:links[0], + filterTarget:()=>false, + selectTarget:-1, + popup:false, + direct:true, + async content(event,trigger,player){ + await player.logSkill('dcyixian'); + player.awakenSkill('dcyixian'); + const position = lib.skill.dcyixian_backup.pos; + let cards = []; + if (position === 'field') { + cards.addArray(game.filterPlayer().map(current => current.getCards('e')).flat()); + } + else { + cards.addArray(Array.from(ui.discardPile.childNodes).filter(card => { + return get.type(card) === 'equip'; + })); + } + if (!cards.length) return; + await player.gain(cards, position === 'field'? 'give' : 'gain2'); + const pairs = game.filterPlayer().map(current => { + let lostNum = 0; + current.checkHistory('lose', evt => { + if (evt.getParent(2) === event) lostNum += evt.cards2.length; + }); + return [current, lostNum]; + }); + for (const pair of pairs) { + const [target, num] = pair; + if (!num) continue; + const bool = await player.chooseBool(`是否令${get.translation(target)}摸${get.cnNumber(num)}张牌并回复1点体力?`) + .set('choice', get.effect(target, {name: 'draw'}, player, player) + get.recoverEffect(target, player, player) / 5 > 0) + .forResultBool(); + if (bool) { + player.line(target, 'green'); + await target.draw(num); + await target.recover(); + } + if (!event.isMine() && !event.isOnline()) await game.asyncDelayx(); + } + }, + } + }, + prompt(links){ + return `点击“确定”,从${links[0]==='field'?'场上':'弃牌堆中'}获得所有装备牌`; + }, + }, + subSkill:{ + backup:{}, + }, + ai:{ + order:10, + threaten:2.9, + result:{ + player(player){ + const enemies=game.filterPlayer(current=>{ + return get.rawAttitude(player,current)<0&&get.attitude(player,current)>=0; + }),knownEnemies=game.filterPlayer(current=>{ + return get.attitude(player,current)<0; + }); + if(!knownEnemies.length&&player.countCards('e')>1||player.getHp()>3&&enemies.length>0&&knownEnemies.length<2&&knownEnemies.lengthget.attitude(player,enemy)<=-9)) return 0; + const val1=game.filterPlayer().map(current=>{ + const cards=current.getCards('e'),att=get.sgnAttitude(player,current); + return cards.map(card=>{ + return Math.max(player.hasSkill('dcjuewu')?5:0,get.value(card,player))-get.value(card,current)*att; + }).reduce((p,c)=>p+c,0); + }).reduce((p,c)=>p+c,0); + const val2=Array.from(ui.discardPile.childNodes).filter(card=>{ + return get.type(card)==='equip'; + }).map(card=>{ + return Math.max(player.hasSkill('dcjuewu')?5:0,get.value(card,player)); + }).reduce((p,c)=>p+c,0); + return Math.max(val1,val2)>20?4:0; + }, + }, + }, + }, + //SP甄宓 + dcjijie:{ + audio:2, + trigger:{ + global:['gainAfter','loseAsyncAfter','recoverAfter'], + }, + getIndex(event,player){ + if (event.name!=='loseAsync') return [[event.player]]; + return [game.filterPlayer(current=>{ + return current!==player&&_status.currentPhase!==current&&event.getg(current).length>0; + }).sortBySeat()]; + }, + filter(event,player,triggername,targets){ + if(event.name==='recover') return targets[0]!==player&&_status.currentPhase!==targets[0]&&player.isDamaged(); + return targets.some(current=>{ + return current!==player&&_status.currentPhase!==current&&event.getg(current).length>0; + }); + }, + forced:true, + usable:1, + logTarget(event,player,triggername,targets){ + return targets; + }, + async content(event,trigger,player){ + if (trigger.name === 'recover') { + await player.recover(trigger.num); + } + else{ + const count = game.countPlayer(current => { + if(current === player || _status.currentPhase === current) return 0; + return trigger.getg(current).length; + }); + await player.draw(count); + } + }, + }, + dchuiji:{ + audio:2, + enable:'phaseUse', + usable:1, + filterTarget:true, + chooseButton:{ + dialog(event,player){ + const name=get.translation(event.result.targets[0]); + const dialog=ui.create.dialog( + `惠济:请选择要令${name}执行的选项`, + [[['draw','令其摸两张牌'],['equip','令其随机使用牌堆中的一张装备牌']],'textbutton'], + 'hidden' + ); + return dialog; + }, + filter(button,player){ + const target=get.event().getParent().result.targets[0]; + const link=button.link; + if(button.link==='equip'&&target.isMin()) return false; + return true; + }, + check(button){ + const player=get.player(),target=get.event().getParent().result.targets[0]; + const link=button.link; + const att=get.attitude(player,target)/5; + const hs=target.countCards('h'); + if(link==='draw'){ + return (2-(hs+2>game.countPlayer())*hs)*att; + } + return (1.1-(hs>game.countPlayer())*hs)*att; + }, + backup(links){ + return { + audio:'dchuiji', + target:get.event().result.targets[0], + link:links[0], + filterTarget(card,player,target){ + return target===lib.skill.dchuiji_backup.target; + }, + selectTarget:-1, + async content(event,trigger,player){ + const link = lib.skill.dchuiji_backup.link; + const { target } = event; + if (link === 'draw') await target.draw(2); + else { + const card = get.cardPile2(card => { + if (get.type(card) !== 'equip') return false; + return target.canUse(card, target) && !get.cardtag(card, 'gifts'); + }); + if (card) await target.chooseUseTarget(card, true).set('nopopup', true); + else { + game.log('但是牌堆里没有', target, '的装备!'); + await game.asyncDelayx(); + } + } + if (target.countCards('h') <= game.countPlayer()) return; + player.when({global: 'wuguRemained'}).filter(evt => { + return evt.getParent(3) === event; + }).vars({originalOwner: target}).then(() => { + const remained = trigger.remained.filterInD('d'); + if (!remained.length) return event.finish(); + player.line(originalOwner); + originalOwner.gain(remained, 'gain2'); + }); + await target.chooseUseTarget({ + name: 'wugu', + storage: { + fixedShownCards: target.getCards('h'), + }, + }, true); + } + }; + }, + prompt(links){ + return '点击“确定”以执行效果'; + }, + }, + subSkill:{ + backup:{}, + }, + ai:{ + order(item,player){ + if(!game.hasPlayer(current=>current!==player&&get.attitude(player,current)>0)&&game.hasPlayer(current=>get.attitude(player,current)<=0)) return 10; + if(game.hasPlayer(current=>{ + const del=player.countCards('h')-current.countCards('h'),toFind=[2,4].find(num=>Math.abs(del)===num); + if(toFind===4&&del<0&&get.attitude(player,current)<=0){ + return true; + } + return false; + })) return 10; + return 1; + }, + result:{ + target(player,target){ + const del=player.countCards('h')-target.countCards('h'),toFind=[2,4].find(num=>Math.abs(del)===num); + if(toFind){ + return -del*(get.attitude(player,target)*Math.min(3,target.countCards('h')))*toFind/10; + } + return -1; + }, + }, + }, + }, //曹芳 dczhimin:{ audio:2, @@ -1288,7 +1798,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, trigger:{player:'useCardToPlayered'}, filter:function(event,player){ - return event.isFirstTarget; + return event.isFirstTarget && event.targets.some(target => target != player); }, usable:1, direct:true, @@ -1985,42 +2495,59 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!event.source||!event.source.isIn()) return false; return event.player.getExpansions('dcxiaoyin').length; }, - direct:true, - content:function*(event,map){ - var player=map.player,trigger=map.trigger; - var source=trigger.source,target=trigger.player; - var cards=target.getExpansions('dcxiaoyin'); - if(trigger.hasNature('fire')){ - var types=cards.map(i=>get.type2(i,false)); - var str=get.translation(types).replace(/(.*)、/, '$1或'); - var result=yield source.chooseCard(`硝引:是否弃置一张${str}牌?`,`若如此做,将${get.translation(target)}的所有“硝引”牌置入弃牌堆,令你对其造成的伤害+1`,'he',function(card,player){ - if(!get.event('types').includes(get.type2(card))) return false; - return lib.filter.cardDiscardable.apply(this,arguments); - }).set('types',types).set('ai',card=>{ - if(get.event('goon')) return 7-get.value(card); + //direct:true, + async cost(event, trigger, player){ + const source = trigger.source, target = trigger.player; + const cards = target.getExpansions('dcxiaoyin'); + if (trigger.hasNature('fire')) { + const types = cards.map(i => get.type2(i, false)); + const str = get.translation(types).replace(/(.*)、/, '$1或'); + event.result = await source.chooseCard(`硝引:是否弃置一张${str}牌?`, `若如此做,将${get.translation(target)}的对应的“硝引”牌置入弃牌堆,令你对其造成的伤害+1`, 'he', function (card, player) { + if (!get.event('types').includes(get.type2(card))) return false; + return lib.filter.cardDiscardable.apply(this, arguments); + }).set('types', types).set('ai', card => { + if (get.event('goon')) return 7 - get.value(card); return 0; - }).set('goon',get.damageEffect(target,player,player,'fire')>0&&get.attitude(player,target)<=0); - if(result.bool){ - player.logSkill('dcxiaoyin_damage',source); - source.line(target,'fire'); - source.discard(result.cards).discarder=source; - game.delayex(); - target.loseToDiscardpile(cards); - trigger.addNumber('num',1); - } + }).set('goon', get.damageEffect(target, player, player, 'fire') > 0 && get.attitude(player, target) <= 0).forResult(); } - else{ - var result=yield source.chooseBool(`###是否响应${get.translation(player)}的【硝引】?###获得${get.translation(target)}的“硝引”牌(${get.translation(cards)}),然后将你对其造成的此次伤害改为火焰伤害。`).set('choice',(()=>{ - if(get.damageEffect(target,source,source,'fire')get.value(i)).reduce((p,c)=>p+c,0)>0) return true; + else { + event.result = await source.chooseBool(`###是否响应${get.translation(player)}的【硝引】?###获得${get.translation(target)}的一张“硝引”牌(${get.translation(cards)}),然后将你对其造成的此次伤害改为火焰伤害。`).set('choice', (() => { + if (get.damageEffect(target, source, source, 'fire') < get.damageEffect(target, source, source) - 5) return false; + if (cards.map(i => get.value(i)).reduce((p, c) => p + c, 0) > 0) return true; return false; - })()); - if(result.bool){ - player.logSkill('dcxiaoyin_damage',source); - source.line(target,'fire'); - source.gain(cards,target,'give'); - game.setNature(trigger,'fire'); + })()).forResult(); + } + }, + async content(event, trigger, player){ + const source = trigger.source, target = trigger.player; + if (trigger.hasNature('fire')) { + source.line(target, 'fire'); + const type = get.type2(event.cards[0]); + await source.discard(event.cards).set('discarder', source); + //await game.asyncDelayx(); + const cardsToDiscard = target.getExpansions('dcxiaoyin').filter(card => get.type2(card, false) === type); + if (cardsToDiscard.length === 1) await target.loseToDiscardpile(cardsToDiscard); + else if (cardsToDiscard.length > 1) { + const result = await source.chooseButton([ + `请选择移去${get.translation(source)}的一张“硝引”牌`, + cardsToDiscard + ], true).forResult(); + await target.loseToDiscardpile(result.links); } + trigger.addNumber('num', 1); + } + else { + source.line(target, 'fire'); + const cards = target.getExpansions('dcxiaoyin'); + if (cards.length === 1) await source.gain(cards, target, 'give'); + else if (cards.length > 1) { + const result = await source.chooseButton([ + `请选择获得${get.translation(source)}的一张“硝引”牌`, + cards + ], true).forResult(); + await source.gain(result.links, target, 'give'); + } + game.setNature(trigger, 'fire'); } }, }, @@ -14315,6 +14842,43 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, card:{ + //武关羽的兵临城下水淹七军 + shuiyanqijuny:{ + audio:'shuiyanqijun', + fullskin:true, + cardimage:'shuiyanqijunx', + enable:true, + filterTarget:true, + type:'trick', + selectTarget:[1,2], + targetprompt:['受伤弃牌','受伤摸牌'], + contentBefore(){ + var evt=event.getParent(),target=evt.stocktargets[0]; + evt.shuiyanqijun_target=target; + }, + content(){ + target.damage('thunder'); + if(target!=event.getParent().shuiyanqijun_target) target.draw(); + else target.chooseToDiscard('he',true); + }, + ai:{ + order:6, + value:4, + useful:2, + tag:{ + damage:1, + thunderDamage:1, + natureDamage:1, + loseCard:1, + }, + result:{ + target:function(player,target){ + if(!ui.selected.targets.length) return -1.5; + return -0.5 + } + } + } + }, pyzhuren_heart:{ fullskin:true, derivation:'puyuan', @@ -14628,6 +15192,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ dingshangwan:['dingshangwan','ol_dingshangwan'], qinghegongzhu:['qinghegongzhu','dc_qinghegongzhu'], caofang:['caofang','jsrg_caofang'], + caomao:['caomao','mb_caomao'], + sp_zhenji:['sp_zhenji','jsrg_zhenji'], }, translate:{ puyuan:'蒲元', @@ -14805,7 +15371,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ zhushi_info:'主公技。每回合限一次,其他魏势力角色于回合内回复体力时,其可令你摸一张牌。', laiyinger:'来莺儿', xiaowu:'绡舞', - xiaowu_info:'出牌阶段限一次,你可以选择任意名座位连续且包含你的上家/下家的角色。这些角色依次选择一项:⒈令你摸一张牌;⒉其摸一张牌。然后若选择选项一的角色数大于选项二的角色数,则你获得一枚“沙”;若选择选项二的角色数大于选项一的角色数,则你对这些角色依次造成1点伤害。', + xiaowu_info:'出牌阶段限一次,你可以选择任意名座位连续且包含你的上家/下家的其他角色。这些角色依次选择一项:⒈令你摸一张牌;⒉其摸一张牌。然后若选择选项一的角色数大于选项二的角色数,则你获得一枚“沙”;若选择选项二的角色数大于选项一的角色数,则你对这些角色依次造成1点伤害。', huaping:'化萍', huaping_info:'限定技。①一名其他角色死亡时,你可获得其当前拥有的所有不带有「Charlotte」标签的技能,然后你失去〖绡舞〗,移去所有“沙”并摸等量的牌。②当你死亡时,你可令一名其他角色获得〖沙舞〗和你的所有“沙”。', shawu:'沙舞', @@ -14915,7 +15481,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ dcmengchi:'蒙斥', dcmengchi_info:'锁定技。若你未于当前回合得到过牌:你不能使用牌;当你横置前,取消之;当你受到无属性伤害后,回复1点体力。', dcfangdu:'芳妒', - dcfangdu_info:'锁定技。当你于回合外受到伤害后,若此次伤害为你于本回合受到的:第一次无属性伤害,你回复1点体力;第一次属性伤害,你随机获得伤害来源的一张牌。', + dcfangdu_info:'锁定技。当你于回合外受到伤害后,若此次伤害为你于本回合受到的:第一次无属性伤害,你回复1点体力;第一次属性伤害,你随机获得伤害来源的一张手牌。', dcjiexing:'节行', dcjiexing_info:'当你受到伤害后、失去体力后或回复体力后,你可以摸一张牌,且此牌不计入本回合的手牌上限。', dongguiren:'董贵人', @@ -15109,7 +15675,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ dclima:'骊马', dclima_info:'锁定技。你计算至其他角色的距离-X(X为场上的坐骑牌数且至少为1)。', dcxiaoyin:'硝引', - dcxiaoyin_info:'①准备阶段,你可以亮出牌堆顶的Y张牌(Y为你距离1以内的角色数),获得其中的红色牌,将其中任意张黑色牌置于等量名座次连续的其他角色的武将牌上,称为“硝引”。②当一名有“硝引”牌的角色受到伤害时,若此伤害为:火焰伤害,来源可以弃置一张其“硝引”牌包含的类型的牌,将其“硝引”置入弃牌堆,令此伤害+1;非火焰伤害,来源可以获得其“硝引”牌,将此伤害改为火焰伤害。', + dcxiaoyin_info:'①准备阶段,你可以亮出牌堆顶的Y张牌(Y为你距离1以内的角色数),获得其中的红色牌,将其中任意张黑色牌置于等量名座次连续的其他角色的武将牌上,称为“硝引”。②当一名有“硝引”牌的角色受到伤害时,若此伤害为:火焰伤害,来源可以弃置其“硝引”牌包含的类型的牌,将一张对应的“硝引”置入弃牌堆,令此伤害+1;非火焰伤害,来源可以获得一张“硝引”牌,将此伤害改为火焰伤害。', dchuahuo:'花火', dchuahuo_info:'出牌阶段限一次。你可以将一张红色手牌当不计入次数的火【杀】使用。然后当你使用此牌指定第一个目标后,若目标角色有“硝引”牌,你可以将此【杀】的目标改为所有有“硝引”牌的角色。', caoyi:'曹轶', @@ -15138,7 +15704,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ dcsbronghuo:'融火', dcsbronghuo_info:'锁定技,当你使用火【杀】或【火攻】时,此牌伤害基值改为场上势力数。', dcsbyingmou:'英谋', - dcsbyingmou_info:'转换技,每回合限一次,当你使用牌指定第一个目标后,你可以选择一名目标角色:阴,你将手牌数摸至与其相同(至多摸五张),然后视为对其使用一张【火攻】;阳,令一名手牌数为全场最大的角色对其使用手牌中所有的【杀】和伤害类锦囊牌(若其没有可使用的牌则将手牌数弃至与你相同)。', + dcsbyingmou_info:'转换技,每回合限一次,当你使用牌指定其他角色为目标后,你可以选择一名目标角色:阴,你将手牌数摸至与其相同(至多摸五张),然后视为对其使用一张【火攻】;阳,令一名手牌数为全场最大的角色对其使用手牌中所有的【杀】和伤害类锦囊牌(若其没有可使用的牌则将手牌数弃至与你相同)。', caoxian:'曹宪', dclingxi:'灵犀', dclingxi_info:'出牌阶段开始和结束时,你可以将至多X张牌称为“翼”置于你的武将牌上(X为你的体力上限)。当你失去武将牌上的“翼”时,你将手牌数调整至Y张(Y为你武将牌上的“翼”所含有的花色数的两倍)。', @@ -15192,6 +15758,23 @@ game.import('character',function(lib,game,ui,get,ai,_status){ dczhimin_info:'锁定技。①一轮游戏开始时,你选择至多X名其他角色(X为你的体力值),获得这些角色各自手牌中的随机一张点数最小的牌。②当你于你的回合外得到牌后,你将这些牌标记为“民”。③当你失去“民”后,你将手牌补至体力上限。', dcjujian:'拒谏', dcjujian_info:'主公技。出牌阶段限一次,你可以令一名其他魏势力角色摸一张牌,然后你令其于本轮内使用的普通锦囊牌对你无效。', + wu_guanyu:'武关羽', + wu_guanyu_prefix:'武', + dcjuewu:'绝武', + dcjuewu_two:'2点', + dcjuewu_info:'①每回合每种牌名限一次。你可以将一张点数为2的牌当任意伤害类牌使用(包括【水淹七军】)。②当你得到其他角色区域内的牌后,你令这些牌的点数均视为2直到你失去这些牌。', + dcwuyou:'武佑', + dcwuyou_info:'①出牌阶段限一次。你可以选择一张手牌,从系统随机生成的五个非装备牌牌名中选择一个,令此牌的牌名与属性视为与你选择的相同。②其他角色的出牌阶段限一次。其可以交给你一张手牌,你从系统随机生成的五个非装备牌牌名中选择一个,然后交给其一张手牌,令此牌的牌名与属性视为与你选择的相同(一名角色使用〖武佑〗转化的牌无距离且无任何次数限制)。', + dcyixian:'义贤', + dcyixian_info:'限定技。出牌阶段,你可以选择一项:⒈获得场上的所有装备牌;⒉获得弃牌堆中的所有装备牌。然后你依次选择是否令被你以此法获得牌的角色摸X张牌并回复1点体力(X为其以此法失去的牌数)。', + shuiyanqijuny:'水淹七军', + shuiyanqijuny_info:'出牌阶段,对至多两名角色使用。目标角色受到1点雷属性伤害,然后若其:是此牌的使用者选择的第一个目标,其弃置一张牌;不是第一个目标,其摸一张牌。', + sp_zhenji:'SP甄宓', + sp_zhenji_prefix:'SP', + dcjijie:'己诫', + dcjijie_info:'锁定技。每回合限一次,当其他角色于其回合外得到牌后/回复体力后,你摸等量的牌/回复等量的体力。', + dchuiji:'惠济', + dchuiji_info:'出牌阶段限一次。你可以令一名角色摸两张牌或从牌堆中随机使用一张不为赠物的装备牌,然后若其手牌数不小于存活角色数,其视为使用一张【五谷丰登】。系统不于此牌使用准备工作结束时执行亮出牌堆顶的牌的动作,改为你令其将所有手牌置于处理区,然后令所有目标角色依次获得其中一张牌。当这些牌因执行【五谷丰登】的执行动作而置于弃牌堆后,你令其获得这些牌。', sp2_yinyu:'隐山之玉', sp2_huben:'百战虎贲', diff --git a/character/yijiang.js b/character/yijiang.js index 1d1c20aea..2a3e9df98 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -806,6 +806,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.addExpose(0.1); } }, + ai:{ + combo:'duwang' + }, subSkill:{ fullyReady:{ trigger:{global:'phaseEnd'}, @@ -10956,6 +10959,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ "step 1" player.loseMaxHp(); player.addSkills('paiyi'); + }, + ai:{ + combo:'quanji' } }, paiyi:{ diff --git a/character/yingbian.js b/character/yingbian.js index 382e2aaf8..a403db602 100644 --- a/character/yingbian.js +++ b/character/yingbian.js @@ -3795,7 +3795,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ huishi:'慧识', huishi_info:'摸牌阶段,你可以放弃摸牌,改为观看牌堆顶的X张牌,获得其中的一半(向下取整),然后将其余牌置入牌堆底。(X为牌堆数量的个位数)', qingleng:'清冷', - qingleng_info:'一名角色的回合结束时,若其体力值与手牌数之和不小于X,则你可将一张牌当无距离限制的冰属性【杀】对其使用(X为牌堆数量的个位数)。若这是你本局游戏内首次其发动过此技能,则你摸一张牌。', + qingleng_info:'一名角色的回合结束时,若其体力值与手牌数之和不小于X,则你可将一张牌当无距离限制的冰属性【杀】对其使用(X为牌堆数量的个位数)。若这是你本局游戏内首次对其发动此技能,则你摸一张牌。', xuanmu:'宣穆', xuanmu2:'宣穆', xuanmu_info:'锁定技,隐匿技。你于其他角色的回合登场时,防止你受到的伤害直到回合结束。', @@ -3849,7 +3849,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ jin_xiahouhui:'晋夏侯徽', jin_xiahouhui_prefix:'晋', baoqie:'宝箧', - baoqie_info:'隐匿技,锁定技。你登场后,从牌堆中获得一张不为赠物的宝物牌。若此牌在你的手牌区内为宝物牌,则你可以使用此牌。', + baoqie_info:'隐匿技,锁定技。你登场后,从牌堆或弃牌堆中获得一张不为赠物的宝物牌。若此牌在你的手牌区内为宝物牌,则你可以使用此牌。', jyishi:'宜室', jyishi_info:'每回合限一次,当有其他角色于其出牌阶段内因弃置而失去手牌后,你可令其获得这些牌中位于弃牌堆的一张,然后你获得其余位于弃牌堆的牌。', shiduo:'识度', diff --git a/game/package.js b/game/package.js index ff755200c..2179706eb 100644 --- a/game/package.js +++ b/game/package.js @@ -35,13 +35,13 @@ window.noname_package={ card:{ standard:'标准', extra:'军争', - sp:'忠胆英杰', guozhan:'国战', - zhulu:'逐鹿天下', yingbian:'应变篇', yongjian:'用间篇', - zhenfa:'阵法', + sp:'忠胆英杰', + zhulu:'逐鹿天下', yunchou:'运筹帷幄', + zhenfa:'阵法', swd:'轩辕剑', gujian:'古剑奇谭', hearth:'炉石传说', diff --git a/game/pinyinjs.js b/game/pinyinjs.js index 18071ddb5..20aa02846 100644 --- a/game/pinyinjs.js +++ b/game/pinyinjs.js @@ -66,6 +66,7 @@ var pinyin_dict_polyphone = { "库特莉亚芙卡": " kǎ", "露娜": "lù ", // 技能名 + "弹雀": "tán què", "重身": "chóng ", "畜鸣": "chù ", "聆乐": " yuè", diff --git a/image/character/clan_wangmingshan.jpg b/image/character/clan_wangmingshan.jpg new file mode 100644 index 000000000..6c505c90f Binary files /dev/null and b/image/character/clan_wangmingshan.jpg differ diff --git a/image/character/clan_wuxian.jpg b/image/character/clan_wuxian.jpg index 68aa486dd..a6bd0e933 100644 Binary files a/image/character/clan_wuxian.jpg and b/image/character/clan_wuxian.jpg differ diff --git a/image/character/clan_xunchen.jpg b/image/character/clan_xunchen.jpg index 155cd0f45..d1d5bfc1f 100644 Binary files a/image/character/clan_xunchen.jpg and b/image/character/clan_xunchen.jpg differ diff --git a/image/character/clan_xunshu.jpg b/image/character/clan_xunshu.jpg index 531ab668e..cfd6aedcf 100644 Binary files a/image/character/clan_xunshu.jpg and b/image/character/clan_xunshu.jpg differ diff --git a/image/character/dc_jiangji.jpg b/image/character/dc_jiangji.jpg new file mode 100644 index 000000000..0e5dd6ee9 Binary files /dev/null and b/image/character/dc_jiangji.jpg differ diff --git a/image/character/default_silhouette_double.jpg b/image/character/default_silhouette_double.jpg new file mode 100644 index 000000000..7ed0ccb0b Binary files /dev/null and b/image/character/default_silhouette_double.jpg differ diff --git a/image/character/fanjiangzhangda.jpg b/image/character/fanjiangzhangda.jpg index f551a03b9..0abfa88df 100644 Binary files a/image/character/fanjiangzhangda.jpg and b/image/character/fanjiangzhangda.jpg differ diff --git a/image/character/gongsunxiu.jpg b/image/character/gongsunxiu.jpg new file mode 100644 index 000000000..39543b4e4 Binary files /dev/null and b/image/character/gongsunxiu.jpg differ diff --git a/image/character/lvboshe.jpg b/image/character/lvboshe.jpg index 76a118405..3ca8be2e3 100644 Binary files a/image/character/lvboshe.jpg and b/image/character/lvboshe.jpg differ diff --git a/image/character/ol_lukai.jpg b/image/character/ol_lukai.jpg index ed8ce8938..7e1c4da9b 100644 Binary files a/image/character/ol_lukai.jpg and b/image/character/ol_lukai.jpg differ diff --git a/image/character/xia_shie.jpg b/image/character/xia_shie.jpg new file mode 100644 index 000000000..0a5faa078 Binary files /dev/null and b/image/character/xia_shie.jpg differ diff --git a/image/character/xia_shitao.jpg b/image/character/xia_shitao.jpg new file mode 100644 index 000000000..93dfe7ec0 Binary files /dev/null and b/image/character/xia_shitao.jpg differ diff --git a/mode/doudizhu.js b/mode/doudizhu.js index c96b92544..b24ea7ad8 100644 --- a/mode/doudizhu.js +++ b/mode/doudizhu.js @@ -1851,8 +1851,6 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ binglin_neihong_info:'锁定技,当你杀死队友后,你所在的阵营视为游戏失败。', baiyidujiang:'白衣渡江', baiyidujiang_info:'出牌阶段,对地主使用。你选择一项:①令其将手牌数摸至全场最多。②令其将手牌数弃置至全场最少。', - shuiyanqijuny:'水淹七军', - shuiyanqijuny_info:'出牌阶段,对至多两名角色使用。目标角色受到1点雷属性伤害,然后若其:是此牌的使用者选择的第一个目标,其弃置一张牌;不是第一个目标,其摸一张牌。', luojingxiashi:'落井下石', luojingxiashi_info:'出牌阶段,对所有其他的已受伤角色使用。目标角色受到1点伤害。', binglinchengxia:'兵临城下', @@ -2787,41 +2785,6 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } } }, - shuiyanqijuny:{ - fullskin:true, - cardimage:'shuiyanqijunx', - enable:true, - filterTarget:true, - type:'trick', - selectTarget:[1,2], - targetprompt:['受伤弃牌','受伤摸牌'], - contentBefore:function(){ - var evt=event.getParent(),target=evt.stocktargets[0]; - evt.shuiyanqijun_target=target; - }, - content:function(){ - target.damage('thunder'); - if(target!=event.getParent().shuiyanqijun_target) target.draw(); - else target.chooseToDiscard('he',true); - }, - ai:{ - order:6, - value:4, - useful:2, - tag:{ - damage:1, - thunderDamage:1, - natureDamage:1, - loseCard:1, - }, - result:{ - target:function(player,target){ - if(!ui.selected.targets.length) return -1.5; - return -0.5 - } - } - } - }, luojingxiashi:{ fullskin:true, enable:true, diff --git a/mode/guozhan.js b/mode/guozhan.js index 9ae298bf2..ddc811867 100644 --- a/mode/guozhan.js +++ b/mode/guozhan.js @@ -518,7 +518,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ gz_zoushi:['female','qun',3,['huoshui','new_qingcheng']], gz_dengai:['male','wei',4,['tuntian','ziliang','gzjixi'],['gzskin','die_audio']], - gz_caohong:['male','wei',4,['gzhuyuan','heyi'],['gzskin']], + gz_caohong:['male','wei',4,['fakehuyuan','heyi'],['gzskin']], gz_jiangfei:['male','shu',3,['shengxi','gzshoucheng']], gz_jiangwei:['male','shu',4,['tiaoxin','yizhi','tianfu'],['gzskin']], gz_xusheng:['male','wu',4,['fakeyicheng'],['gzskin']], @@ -569,7 +569,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ gz_wangping:['male','shu',4,['jianglue'],['gzskin']], gz_fazheng:['male','shu',3,['gzxuanhuo','gzenyuan'],['gzskin']], gz_wuguotai:['female','wu',3,['gzbuyi','ganlu'],['gzskin']], - gz_lukang:['male','wu',4,['fakejueyan','keshou'],['gzskin']], + gz_lukang:['male','wu',4,['fakejueyan','fakekeshou'],['gzskin']], gz_yuanshu:['male','qun',4,['gzweidi','gzyongsi'],['gzskin']], gz_zhangxiu:['male','qun',4,['gzfudi','gzcongjian'],['gzskin']], gz_jun_caocao:['male','wei',4,['jianan','huibian','gzzongyu','wuziliangjiangdao'],[]], @@ -1449,7 +1449,6 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } if(goon){ event.tochange.push(_status.characterlist[i]); - if(event.tochange.length==event.num) break; } } event.tochange=event.tochange.filter(character=>{ @@ -1457,7 +1456,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ const doublex=get.is.double(character,true); const group=(doublex?doublex:[get.character(character,1)]); return !group.some(j=>groups.includes(j)); - }); + }).randomGets(event.num); if(!event.tochange.length) event.finish(); else{ if(event.tochange.length==1) event._result={ @@ -2115,13 +2114,36 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ },'he'); }, filterCard(card,player){ + if(!lib.suit.includes(get.suit(card))) return false; return lib.filter.cardDiscardable(card,player)&&!player.getStorage('fakezhufu_effect').includes(get.suit(card)); }, position:'he', check(card){ const player=get.event('player'); - if(player.hasUseTarget(card,true,true)) return 0; - return 5+3*Math.random()-get.value(card); + let cards=player.getCards('hs',card=>player.hasValueTarget(card,true,true)); + let discards=player.getCards('he',card=>get.info('fakezhufu').filterCard(card,player)); + for(let i=1;iget.suit(card)==get.suit(discards[i]))) discards.splice(i--,1); + } + cards.removeArray(discards); + if(!cards.length||!discards.length) return 0; + cards.sort((a,b)=>{ + return (player.getUseValue(b,true,true)>0?get.order(b):0)-(player.getUseValue(a,true,true)>0?get.order(a):0); + }); + const cardx=cards[0]; + if(get.order(cardx,player)>0&&discards.includes(card)){ + if((get.suit(card)=='heart'&&get.type(cardx)!='equip'&&(function(card,player){ + const num=get.info('fakezhufu').getMaxUseTarget(card,player); + return num!=-1&&game.countPlayer(target=>player.canUse(card,target,true,true)&&get.effect(target,card,player,player)>0)>num; + }(cardx,player))&&game.hasPlayer(target=>{ + return target.isFriendOf(player)&&target.hasCard(cardy=>{ + return lib.filter.cardDiscardable(cardy,target)&&get.type2(cardy)==get.type2(cardx); + },'h'); + }))||(get.suit(card)=='diamond'&&get.type(cardx)!='equip'&&!game.hasPlayer(target=>{ + return target.countCards('h')>player.countCards('h')-(get.position(card)=='h'?1:0)-(get.position(cardx)=='h'?1:0); + }))||(get.suit(card)=='spade'&&player.getHp()==1)||(get.suit(card)=='club'&&get.tag(cardx,'damage')&&player.countCards('h')-(get.position(card)=='h'?1:0)-(get.position(cardx)=='h'?1:0)==0)) return 1/(getvalue(card)||0.5); + } + return 0; }, async content(event,trigger,player){ const suit=get.suit(event.cards[0],player); @@ -2129,8 +2151,74 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ player.markAuto('fakezhufu_effect',[[suit,false]]); }, ai:{ - order:7, - result:{player:1}, + order(item,player){ + let cards=player.getCards('hs',card=>player.hasValueTarget(card,true,true)); + let discards=player.getCards('he',card=>get.info('fakezhufu').filterCard(card,player)); + for(let i=1;iget.suit(card)==get.suit(discards[i]))) discards.splice(i--,1); + } + cards.removeArray(discards); + if(!cards.length||!discards.length) return 0; + cards.sort((a,b)=>{ + return (player.getUseValue(b,true,true)>0?get.order(b):0)-(player.getUseValue(a,true,true)>0?get.order(a):0); + }); + const cardx=cards[0]; + return (get.order(cardx,player)>0&&((discards.some(card=>{ + return get.suit(card)=='heart'; + })&&get.type(cardx)!='equip'&&(function(card,player){ + const num=get.info('fakezhufu').getMaxUseTarget(card,player); + return num!=-1&&game.countPlayer(target=>player.canUse(card,target,true,true)&&get.effect(target,card,player,player)>0)>num; + }(cardx,player))&&game.hasPlayer(target=>{ + return target.isFriendOf(player)&&target.hasCard(cardy=>{ + return lib.filter.cardDiscardable(cardy,target)&&get.type2(cardy)==get.type2(cardx); + },'h'); + }))||(get.type(cardx)!='equip'&&discards.some(card=>{ + return get.suit(card)=='diamond'&&!game.hasPlayer(target=>{ + return target.countCards('h')>player.countCards('h')-(get.position(card)=='h'?1:0)-(get.position(cardx)=='h'?1:0); + }); + }))||(discards.some(card=>{ + return get.suit(card)=='spade'; + })&&player.getHp()==1)||(get.tag(cardx,'damage')&&discards.some(card=>{ + return get.suit(card)=='club'&&player.countCards('h')-(get.position(card)=='h'?1:0)-(get.position(cardx)=='h'?1:0)==0; + }))))?(get.order(cardx,player)+0.00001):0; + }, + result:{ + player(player,target){ + let cards=player.getCards('hs',card=>player.hasValueTarget(card,true,true)); + let discards=player.getCards('he',card=>get.info('fakezhufu').filterCard(card,player)); + discards=discards.sort((a,b)=>get.value(a)-get.value(b)); + for(let i=1;iget.suit(card)==get.suit(discards[i]))) discards.splice(i--,1); + } + cards.removeArray(discards); + if(!cards.length||!discards.length) return 0; + if((discards.some(card=>{ + return get.suit(card)=='heart'; + })&&cards.some(card=>{ + return get.type(card)!='equip'&&(function(card,player){ + const num=get.info('fakezhufu').getMaxUseTarget(card,player); + return num!=-1&&game.countPlayer(target=>player.canUse(card,target,true,true)&&get.effect(target,card,player,player)>0)>num; + }(card,player))&&game.hasPlayer(target=>{ + return target.isFriendOf(player)&&target.hasCard(cardx=>{ + return lib.filter.cardDiscardable(cardx,target)&&get.type2(cardx)==get.type2(card); + },'h'); + }); + }))||discards.some(card=>{ + return get.suit(card)=='diamond'&&cards.some(cardx=>{ + return get.type(cardx)!='equip'&&!game.hasPlayer(target=>{ + return target.countCards('h')>player.countCards('h')-(get.position(card)=='h'?1:0)-(get.position(cardx)=='h'?1:0); + }); + }); + })||(discards.some(card=>{ + return get.suit(card)=='spade'; + })&&player.getHp()==1)||discards.some(card=>{ + return get.suit(card)=='club'&&cards.some(cardx=>{ + return get.tag(cardx,'damage')&&player.countCards('h')-(get.position(card)=='h'?1:0)-(get.position(cardx)=='h'?1:0)==0; + }); + })) return 1; + return 0; + }, + }, }, subSkill:{ effect:{ @@ -2144,7 +2232,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ let str=''; str+='
  • 已弃置过的花色:'; str+=suits; - if(used.length){ + if(usedSuits.length){ str+='
  • 已触发过的花色:'; str+=usedSuits; } @@ -2157,22 +2245,67 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ return player.getStorage('fakezhufu_effect').some(list=>!list[1]); }, forced:true, - content(){ - if(!Array.isArray(trigger.temporaryYingbian)) trigger.temporaryYingbian=[]; - trigger.forceYingbian=true - trigger.temporaryYingbian.addArray(player.getStorage('fakezhufu_effect').filter(list=>{ - return !list[1]; - }).map(list=>{ - return get.info('fakezhufu').YingBianMap[list[0]]; - })); + firstDo:true, + async content(event,trigger,player){ + const list=player.getStorage('fakezhufu_effect').filter(i=>!i[1]); + const forced=(function(trigger,player){ + if(trigger.forceYingbian||player.hasSkillTag('forceYingbian')) return true; + const list=(trigger.temporaryYingbian||[]); + return list.includes('force')||get.cardtag(trigger.card,'yingbian_force'); + }(trigger,player)); + if(forced){ + player.popup('yingbian_force_tag',lib.yingbian.condition.color.get('force')); + game.log(player,'触发了','#g【注傅】','为',trigger.card,'添加的应变条件'); + } + const hasYingBian=(trigger.temporaryYingbian||[]),map=get.info('fakezhufu').YingBianMap; + for(const j of list){ + player.storage.fakezhufu_effect[player.getStorage('fakezhufu_effect').indexOf(j)][1]=true; + const tag=map[j[0]][0],eff=map[j[0]][1]; + if(get.cardtag(trigger.card,`yingbian_${tag}`)) continue; + if(j[0]=='heart'){ + if(!forced&&!hasYingBian.includes('add')){ + const {result}=await lib.yingbian.condition.complex.get('zhuzhan')(trigger); + if(result.bool){ + game.log(player,'触发了','#g【注傅】','为',trigger.card,'添加的应变条件(','#g'+get.translation(j[0]),')'); + trigger.yingbian_addTarget=true; + player.addTempSkill('yingbian_changeTarget'); + } + } + else{ + if(!forced){ + game.log(player,'触发了','#g【注傅】','为',trigger.card,'添加的应变条件(','#g'+get.translation(j[0]),')'); + } + trigger.yingbian_addTarget=true; + player.addTempSkill('yingbian_changeTarget'); + } + } + else{ + const goon=(hasYingBian.includes(eff)||lib.yingbian.condition.simple.get(tag)(trigger)); + if(!forced&&goon){ + player.popup('yingbian_force_tag',lib.yingbian.condition.color.get(eff)); + game.log(player,'触发了','#g【注傅】','为',trigger.card,'添加的应变条件(','#g'+get.translation(j[0]),')'); + } + if(forced||goon) await game.yingbianEffect(trigger,lib.yingbian.effect.get(eff)); + } + } }, }, }, YingBianMap:{ - 'heart':'yingbian_zhuzhan', - 'diamond':'yingbian_fujia', - 'spade':'yingbian_canqu', - 'club':'yingbian_kongchao', + 'heart':['zhuzhan','add'], + 'diamond':['fujia','hit'], + 'spade':['canqu','draw'], + 'club':['kongchao','damage'], + }, + getMaxUseTarget(card,player){ + let range; + const select=get.copy(get.info(card).selectTarget); + if(select==undefined) range=[1,1]; + else if(typeof select=='number') range=[select,select]; + else if(get.itemtype(select)=='select') range=select; + else if(typeof select=='function') range=select(card,player); + game.checkMod(card,player,range,'selectTarget',player); + return range; }, }, fakeguishu:{ @@ -2329,7 +2462,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ fakeqizhi:{ audio:'qizhi', inherit:'qizhi', - trigger:{player:'useCard'}, + trigger:{player:'useCard1'}, filter(event,player){ if(!event.targets||!event.targets.length) return false; if(_status.currentPhase!=player) return false; @@ -2350,11 +2483,10 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ async content(event,trigger,player){ const target=event.targets[0]; const {result:{bool,cards}}=await player.discardPlayerCard(target,'he',true); - if(get.is.yingbianConditional(trigger.card)&&bool){ + if(bool){ + await target.draw(); if(cards.some(i=>get.suit(i,target)==get.suit(trigger.card))){ - player.when('yingbian') - .filter(evt=>evt.card==trigger.card) - .then(()=>trigger.forceYingbian=true); + trigger.forceYingbian=true; } } }, @@ -3312,7 +3444,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ },event).indexOf(event)==0; }, async cost(event,trigger,player){ - event.result=await player.chooseTarget(get.prompt('fakebaoqie'),'获得一名角色的宝物牌,然后你可以使用此牌',(card,player,target)=>{ + event.result=await player.chooseTarget(get.prompt('fakebaoqie'),'获得一名角色装备区里所有的宝物牌,然后你可以使用其中的一张牌',(card,player,target)=>{ return target.getGainableCards(player,'e').some(card=>get.subtype(card)=='equip5'); }).set('ai',target=>{ const player=get.event('player'); @@ -3327,10 +3459,10 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ await player.gain(cards,target,'giveAuto'); cards=cards.filter(i=>get.owner(i)==player&&get.position(i)=='h'&&player.hasUseTarget(i)); if(cards.length){ - const {result:{bool,links}}=await player.chooseButton(['宝箧:是否使用其中一张宝物牌?',cards]).set('ai',button=>{ + const {result:{bool,links}}=await player.chooseButton(['宝箧:是否使用其中的一张宝物牌?',cards]).set('ai',button=>{ return get.equipValue(button.link,get.event('player')); }); - if(bool) await player.chooseUseTarget(card,true); + if(bool) await player.chooseUseTarget(links[0],true); } }, ai:{mingzhi_no:true}, @@ -4046,6 +4178,116 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ }, }, }, + fakehuyuan:{ + audio:'yuanhu', + trigger:{player:'phaseJieshuBegin'}, + filter(event,player){ + return player.countCards('he',card=>{ + if(get.position(card)=='h'&&_status.connectMode) return true; + return get.type(card)=='equip'; + })>0; + }, + async cost(event,trigger,player){ + event.result=await player.chooseCardTarget({ + prompt:get.prompt2('yuanhu'), + filterCard(card){ + return get.type(card)=='equip'; + }, + position:'he', + filterTarget(card,player,target){ + return target.canEquip(card); + }, + ai1(card){ + return 6-get.value(card); + }, + ai2(target){ + return get.attitude(_status.event.player,target)-3; + }, + }).set('hiddenSkill','fakehuyuan').forResult(); + }, + preHidden:true, + async content(event,trigger,player){ + const card=event.cards[0],target=event.targets[0]; + if(target!=player) player.$give(card,target,false); + await target.equip(card); + }, + group:'fakehuyuan_discard', + subSkill:{ + discard:{ + trigger:{global:'equipEnd'}, + filter(event,player){ + return _status.currentPhase==player&&game.hasPlayer(target=>{ + return get.distance(event.player,target)<=1&&target!=event.player&&target.countCards('hej'); + }); + }, + async cost(event,trigger,player){ + event.result=await player.chooseTarget(get.prompt('fakehuyuan'),'弃置一名与'+get.translation(trigger.player)+'距离为1以内的另一名角色区域里的一张牌',(card,player,target)=>{ + const trigger=get.event().getTrigger(); + return get.distance(trigger.player,target)<=1&&target!=trigger.player&&target.countCards('hej'); + }).set('ai',target=>{ + const player=get.event('player'); + return get.effect(target,{name:'guohe'},player,player); + }).set('hiddenSkill','fakehuyuan').forResult(); + }, + popup:false, + async content(event,trigger,player){ + const target=event.targets[0]; + player.logSkill('fakehuyuan',target); + await player.discardPlayerCard(target,'hej',true); + }, + }, + }, + }, + fakekeshou:{ + audio:'keshou', + trigger:{player:'damageBegin3'}, + filter(event,player){ + return event.num>0; + }, + preHidden:true, + async cost(event,trigger,player){ + event.result=await player.chooseToDiscard(get.prompt('fakekeshou'),'弃置两张颜色相同的牌,令即将受到的伤害-1','he',2,card=>{ + return !ui.selected.cards.length||get.color(card)==get.color(ui.selected.cards[0]); + }).set('logSkill','fakekeshou').set('complexCard',true).setHiddenSkill('fakekeshou').set('ai',card=>{ + if(!_status.event.check) return 0; + var player=_status.event.player; + if(player.hp==1){ + if(!player.countCards('h',function(card){return get.tag(card,'save')})&&!player.hasSkillTag('save',true)) return 10-get.value(card); + return 7-get.value(card); + } + return 6-get.value(card); + }).set('check',(player.countCards('h',{color:'red'})>1||player.countCards('h',{color:'black'})>1)).forResult(); + }, + popup:false, + async content(event,trigger,player){ + trigger.num--; + }, + group:'fakekeshou_draw', + subSkill:{ + draw:{ + audio:'keshou', + trigger:{ + player:'loseAfter', + global:'loseAsyncAfter', + }, + filter(event,player){ + if(event.type!='discard'||event.getlx===false) return false; + if(!(!player.isUnseen()&&!game.hasPlayer(current=>{ + return current!=player&¤t.isFriendOf(player); + }))) return false; + const evt=event.getl(player); + return evt&&evt.cards2&&evt.cards2.length>1; + }, + prompt2:'进行一次判定,若为红色,则你摸一张牌', + async content(event,trigger,player){ + const result=await player.judge(card=>{ + return get.color(card)=='red'?1:0; + }).forResult(); + if(result.judge>0) await player.draw(); + }, + }, + }, + }, //国战典藏2023补充 //吕范 gzdiaodu:{ @@ -14525,7 +14767,7 @@ return event.junling=='junling5'?1:0;}); if(content&&content.length){ dialog.addSmall(content); } - dialog.addText('
    • 每名吴势力角色的出牌阶段限一次,该角色可以将一张装备牌置于“缘江烽火图”上,称之为“烽火”。
    • 根据“烽火”的数量,所有吴势力角色可于其准备阶段开始时选择并获得其中一个技能直到回合结束:一张以上~英姿;两张以上~好施;三张以上~涉猎;四张以上~度势;五张以上~可额外选择一项。
    • 锁定技,当你受到【杀】或锦囊牌造成的伤害后,你将一张“烽火”置入弃牌堆。',false) + dialog.addText('
      • 每名吴势力角色的出牌阶段限一次,该角色可以将一张装备牌置于“缘江烽火图”上,称之为“烽火”。
      • 根据“烽火”的数量,所有吴势力角色可于其准备阶段选择并获得其中一个技能直到回合结束:一张以上~英姿;两张以上~好施;三张以上~涉猎;四张以上~度势;五张以上~可额外选择一项。
      • 锁定技,当你受到【杀】或锦囊牌造成的伤害后,你将一张“烽火”置入弃牌堆。',false) } } }, @@ -17867,7 +18109,7 @@ return event.junling=='junling5'?1:0;}); gzjiancai:'荐才', gzjiancai_info:'副将技,此武将牌上单独的阴阳鱼个数-1。与你势力相同的角色即将受到伤害而进入濒死状态时,你可以防止此伤害,若如此做,你须变更副将;与你势力相同的角色变更副将时,其额外获得两张备选武将牌。', gzzhuhai:'诛害', - gzzhuhai_info:'其他角色的结束阶段开始时,若其本回合内造成过伤害,则你可以对其使用一张【杀】(无距离限制)。若其本回合内对与你势力相同的角色造成过伤害,则此【杀】无视防具,且当其抵消此【杀】后,其须弃置一张牌。', + gzzhuhai_info:'其他角色的结束阶段,若其本回合内造成过伤害,则你可以对其使用一张【杀】(无距离限制)。若其本回合内对与你势力相同的角色造成过伤害,则此【杀】无视防具,且当其抵消此【杀】后,其须弃置一张牌。', gzzhuosheng:'擢升', gzzhuosheng2:'擢升', gzzhuosheng_info:'当一名与你势力相同的角色受到伤害后,你可令其摸一张牌。然后直到其下个结束阶段前,其使用此牌根据类型执行以下效果:1. 基本牌,不计入次数且无距离限制;2. 普通锦囊牌,此牌目标可+1或-1;3. 装备牌,可摸一张牌。', @@ -17879,7 +18121,7 @@ return event.junling=='junling5'?1:0;}); gzhuaiyi:'怀异', gzhuaiyi_info:'出牌阶段限一次,你可以展示所有手牌。若其中包含两种颜色,则你可以弃置其中一种颜色的所有牌,然后获得至多等量名角色的各一张牌。然后你将以此法得到的装备牌置于武将牌上,称为“异”。', gzzisui:'恣睢', - gzzisui_info:'锁定技,摸牌阶段,你多摸X张牌。结束阶段开始时,若X大于你的体力上限,你死亡(X为“异”数)。', + gzzisui_info:'锁定技,摸牌阶段,你多摸X张牌。结束阶段,若X大于你的体力上限,你死亡(X为“异”数)。', gz_tangzi:'唐咨', gz_mengda:'孟达', @@ -17928,17 +18170,17 @@ return event.junling=='junling5'?1:0;}); gzjuejue:'决绝', gzjuejue_info:'①弃牌阶段开始时,你可失去1点体力。然后若你于此阶段内弃置过你的牌,则你令其他角色各选择一项:1.将X张手牌置入弃牌堆(X为你于此阶段内弃置过的牌数);2.受到你造成的1点伤害。②你杀死与你势力相同的角色不执行奖惩。', gzfangyuan:'方圆', - gzfangyuan_info:'阵法技,若你在一个围攻关系中:①是围攻角色,则所有围攻角色的手牌上限+1且被围攻角色手牌上限-1;②是被围攻角色,则结束阶段开始时,你视为对一名围攻角色使用【杀】。', + gzfangyuan_info:'阵法技,若你在一个围攻关系中:①是围攻角色,则所有围攻角色的手牌上限+1且被围攻角色手牌上限-1;②是被围攻角色,则结束阶段,你视为对一名围攻角色使用【杀】。', daming:'达命', daming_info:'一名己方角色A的出牌阶段开始时,你可弃置一张锦囊牌,横置一名角色并摸X张牌(X为拥有横置角色的势力数)。然后你选择一项:①令A回复1点体力;②令A视为对由你选择的另一名角色使用一张雷【杀】。', xiaoni:'嚣逆', xiaoni_info:'锁定技,当你使用牌时,或成为其他角色使用牌的目标后,若场上存在其他己方角色且这些角色的手牌数均不大于你,则目标角色/你不可响应此牌。', gztongduo:'统度', - gztongduo_info:'己方角色的结束阶段开始时,其可以摸X张牌(X为其本回合弃牌阶段弃置的牌数且至多为3)。', + gztongduo_info:'己方角色的结束阶段,其可以摸X张牌(X为其本回合弃牌阶段弃置的牌数且至多为3)。', qingyin:'清隐', qingyin_info:'限定技,出牌阶段,你可令所有己方角色将体力值回满,然后移除此武将牌。', gzlianpian:'联翩', - gzlianpian_info:'①结束阶段开始时,若你于此回合内弃置过所有角色的牌数之和大于你的体力值,你可令一名与你势力相同的角色将手牌补至X张(X为其体力上限)。②其他角色的结束阶段开始时,若其于此回合内弃置过所有角色的牌数之和大于你的体力值,其可选择:1.弃置你的一张牌;2.令你回复1点体力。', + gzlianpian_info:'①结束阶段,若你于此回合内弃置过所有角色的牌数之和大于你的体力值,你可令一名与你势力相同的角色将手牌补至X张(X为其体力上限)。②其他角色的结束阶段,若其于此回合内弃置过所有角色的牌数之和大于你的体力值,其可选择:1.弃置你的一张牌;2.令你回复1点体力。', gzyusui:'玉碎', gzyusui_info:'当你成为其他势力的角色使用黑色牌的目标后,你可以失去1点体力,然后选择一项:①令其弃置X张手牌(X为其体力上限);②令其失去Y点体力(Y为其的体力值减去你的体力值,不为正时不可选择)。', gzboyan:'驳言', @@ -17950,10 +18192,10 @@ return event.junling=='junling5'?1:0;}); gzduwu:'黩武', gzduwu_info:'限定技,出牌阶段,你可以选择一个“军令”。你令攻击范围内所有的非己方角色选择是否执行。若有角色选择否,则你对其造成1点伤害且你摸一张牌。若有角色于此技能结算过程中进入濒死状态且存活,则你失去1点体力。', gzxishe:'袭射', - gzxishe_info:'其他角色的准备阶段开始时,你可将装备区内的一张牌当做【杀】对其使用且可重复此流程。若你的体力值大于该角色,则此【杀】不可被响应。若该角色于此技能的结算流程中死亡,则你可以变更副将(不展示)。', + gzxishe_info:'其他角色的准备阶段,你可将装备区内的一张牌当做【杀】对其使用且可重复此流程。若你的体力值大于该角色,则此【杀】不可被响应。若该角色于此技能的结算流程中死亡,则你可以变更副将(不展示)。', gzcongcha:'聪察', gzcongcha2:'聪察', - gzcongcha_info:'①准备阶段开始时,你可以选择一名未确定势力的其他角色。当其于你的下回合开始前首次明置武将牌后,若其:与你势力相同,则你与其各摸两张牌;与你势力不同,则其失去1点体力。②摸牌阶段开始时,若场上所有角色均有明置的武将牌,则你可以令额定摸牌数+2。', + gzcongcha_info:'①准备阶段,你可以选择一名未确定势力的其他角色。当其于你的下回合开始前首次明置武将牌后,若其:与你势力相同,则你与其各摸两张牌;与你势力不同,则其失去1点体力。②摸牌阶段开始时,若场上所有角色均有明置的武将牌,则你可以令额定摸牌数+2。', gzchenglve:'成略', gzchenglve_info:'己方角色使用牌结算结束后,若此牌的目标数大于1,则你可以令其摸一张牌。若你受到过渠道为此牌的伤害,则你可以令一名没有国战标记的己方角色获得一枚“阴阳鱼”。', gzbaolie:'豹烈', @@ -17967,7 +18209,7 @@ return event.junling=='junling5'?1:0;}); qiuan_info:'当你受到伤害后,若此伤害的渠道有对应的实体牌且你的武将牌上没有“函”,则你可以防止此伤害并将这些牌置于你的武将牌上,称为“函”。', liangfan:'量反', liangfan2:'量反', - liangfan_info:'锁定技,准备阶段开始时,若你的武将牌上有“函”,则你获得这些牌,然后失去1点体力。当你于此回合内因使用实体牌中包含“函”的牌且执行这些牌的效果而对目标角色造成伤害时,你可以获得目标角色的一张牌。', + liangfan_info:'锁定技,准备阶段,若你的武将牌上有“函”,则你获得这些牌,然后失去1点体力。当你于此回合内因使用实体牌中包含“函”的牌且执行这些牌的效果而对目标角色造成伤害时,你可以获得目标角色的一张牌。', gzwenji:'问计', gzwenji_info:'出牌阶段开始时,你可令一名其他角色交给你一张牌。然后若该角色:未确定势力或势力与你相同,则你于本回合内使用实体牌包含“问计”牌的牌无距离和次数限制,且不可被其他角色响应。与你势力不同,则你交给其一张不为“问计”牌的牌或令其摸一张牌。', gztunjiang:'屯江', @@ -17981,9 +18223,9 @@ return event.junling=='junling5'?1:0;}); gzbiluan:'避乱', gzbiluan_info:'锁定技。其他角色计算至你的距离时+X(X为你装备区内的牌数)。', gzrelixia:'礼下', - gzrelixia_info:'锁定技。与你势力不同的角色的准备阶段开始时,若你不在其攻击范围内,则其选择一项:①弃置你装备区内的一张牌并失去1点体力。②令你摸一张牌。', + gzrelixia_info:'锁定技。与你势力不同的角色的准备阶段,若你不在其攻击范围内,则其选择一项:①弃置你装备区内的一张牌并失去1点体力。②令你摸一张牌。', gzlixia:'礼下', - gzlixia_info:'与你势力不同的角色的准备阶段开始时,其可弃置你装备区内的一张牌,然后其选择一项:①弃置两张手牌。②失去1点体力。③令你摸两张牌。', + gzlixia_info:'与你势力不同的角色的准备阶段,其可弃置你装备区内的一张牌,然后其选择一项:①弃置两张手牌。②失去1点体力。③令你摸两张牌。', gzrekuangcai:'狂才', gzrekuangcai_info:'锁定技,你于回合内使用牌无距离和次数限制;弃牌阶段开始时,若你本回合内:未使用过牌,则你本局游戏的手牌上限+1;使用过牌但未造成过伤害,则你本局游戏的手牌上限-1。', gzkuangcai:'狂才', @@ -18022,7 +18264,7 @@ return event.junling=='junling5'?1:0;}); gzfengying_info:'限定技,你可以将所有手牌当【挟天子以令诸侯】使用(无视大势力限制),然后所有与你势力相同的角色将手牌补至体力上限。', gz_yujin:'于禁', gzjieyue:'节钺', - gzjieyue_info:'准备阶段开始时,你可以将一张手牌交给一名非魏势力角色,然后选择一个“军令”并令其选择一项:执行该军令,然后你摸一张牌;或令你于此回合摸牌阶段额外摸三张牌。', + gzjieyue_info:'准备阶段,你可以将一张手牌交给一名非魏势力角色,然后选择一个“军令”并令其选择一项:执行该军令,然后你摸一张牌;或令你于此回合摸牌阶段额外摸三张牌。', gz_wangping:'王平', jianglue:'将略', jianglue_info:'限定技,出牌阶段,你可以选择一个“军令”,然后与你势力相同的其他角色可以执行该军令(未确定势力角色可以在此时明置一张单势力武将牌)。你与所有执行该军令的角色增加1点体力上限,然后回复1点体力,然后你摸X张牌(X为以此法回复了体力的角色数)。', @@ -18058,7 +18300,7 @@ return event.junling=='junling5'?1:0;}); wuziliangjiangdao:'五子良将纛', wuziliangjiangdao_ab:'将纛', wuziliangjiangdao_bg:'纛', - wuziliangjiangdao_info:'魏势力角色的准备阶段开始时,其可以弃置一张牌。若如此做,其选择一张暗置的武将牌(若没有,则选择一张暗置),然后获得下列技能中的一项(其他角色已有的技能无法选择)且不能明置选择的武将牌直到你的下个回合开始:〖突袭〗,〖巧变〗,〖骁果〗,〖节钺〗,〖断粮〗。', + wuziliangjiangdao_info:'魏势力角色的准备阶段,其可以弃置一张牌。若如此做,其选择一张暗置的武将牌(若没有,则选择一张暗置),然后获得下列技能中的一项(其他角色已有的技能无法选择)且不能明置选择的武将牌直到你的下个回合开始:〖突袭〗,〖巧变〗,〖骁果〗,〖节钺〗,〖断粮〗。', huibian:'挥鞭', huibian_info:'出牌阶段限一次,你可以选择一名魏势力角色和另一名已受伤的魏势力角色。若如此做,你对前者造成1点伤害,然后其摸两张牌,然后后者回复1点体力。', gzzongyu:'总御', @@ -18121,7 +18363,7 @@ return event.junling=='junling5'?1:0;}); "baka_hunshang":"魂殇", "baka_hunshang_info":"副将技,此武将牌减少半个阴阳鱼;准备阶段,若你的体力值不大于1,则你获得〖英姿〗和〖英魂〗直到回合结束。", "baka_yinghun":"英魂", - "baka_yinghun_info":"准备阶段开始时,你可令一名其他角色执行一项:摸X张牌,然后弃置一张牌;或摸一张牌,然后弃置X张牌(X为你已损失的体力值)。", + "baka_yinghun_info":"准备阶段,你可令一名其他角色执行一项:摸X张牌,然后弃置一张牌;或摸一张牌,然后弃置X张牌(X为你已损失的体力值)。", "baka_yingzi":"英姿", "baka_yingzi_info":"锁定技,摸牌阶段摸,你多摸一张牌;你的手牌上限+X(X为你已损失的体力值)。", gzyiji:"遗计", @@ -18182,19 +18424,19 @@ return event.junling=='junling5'?1:0;}); gzxiongsuan:'凶算', gzxiongsuan_info:'限定技,出牌阶段,你可以弃置一张手牌并选择与你势力相同的一名角色,对其造成1点伤害,然后你摸三张牌。若该角色有已发动的限定技,则你选择其中一个限定技,此回合结束后视为该限定技未发动过。', gzhuashen:'化身', - gzhuashen_info:'准备阶段开始时,若你的“化身”不足两张,则你可以观看剩余武将牌堆中的五张牌,然后扣置其中至多两张武将牌在你的武将旁,称为“化身”;若“化身”有两张以上,则你可以用剩余武将牌堆顶的一张牌替换一张“化身”。你可以于相应的时机明置并发动“化身”的一个技能,技能结算完成后将该“化身”放回剩余武将牌堆。你每个时机只能发动一张“化身”的技能,且不能发动带有技能类型的技能(锁定技、限定技等)。', + gzhuashen_info:'准备阶段,若你的“化身”不足两张,则你可以观看剩余武将牌堆中的五张牌,然后扣置其中至多两张武将牌在你的武将旁,称为“化身”;若“化身”有两张以上,则你可以用剩余武将牌堆顶的一张牌替换一张“化身”。你可以于相应的时机明置并发动“化身”的一个技能,技能结算完成后将该“化身”放回剩余武将牌堆。你每个时机只能发动一张“化身”的技能,且不能发动带有技能类型的技能(锁定技、限定技等)。', gzxinsheng:'新生', gzxinsheng_info:'当你受到伤害后,你可以从剩余武将牌堆中扣置一张牌加入到“化身”牌中。', jubao:'聚宝', - jubao_info:'锁定技,你装备区里的宝物牌不能被其他角色获得。结束阶段开始时,若场上或弃牌堆有【定澜夜明珠】,则你摸一张牌,然后获得装备区里有【定澜夜明珠】角色的一张牌。', + jubao_info:'锁定技,你装备区里的宝物牌不能被其他角色获得。结束阶段,若场上或弃牌堆有【定澜夜明珠】,则你摸一张牌,然后获得装备区里有【定澜夜明珠】角色的一张牌。', jiahe:'嘉禾', jiahe_info:'君主技,只要此武将牌处于明置状态,你便拥有“缘江烽火图”。', jiahe_put:'烽火', jiahe_put_info:'出牌阶段限一次,你可以将一张装备牌置于“缘江烽火图”上,称之为“烽火”。', jiahe_skill:'缘江烽火图', yuanjiangfenghuotu:'缘江烽火图', - yuanjiangfenghuotu_info:'每名吴势力角色的出牌阶段限一次,该角色可以将一张装备牌置于“缘江烽火图”上,称之为“烽火”。
        根据“烽火”的数量,所有吴势力角色可于其准备阶段开始时选择并获得其中一个技能直到回合结束:一张以上:〖英姿〗;两张以上:〖好施〗;三张以上:〖涉猎〗;四张以上:〖度势〗;五张以上:可额外选择一项。
        锁定技,当你受到【杀】或锦囊牌造成的伤害后,你将一张“烽火”置入弃牌堆。', + yuanjiangfenghuotu_info:'每名吴势力角色的出牌阶段限一次,该角色可以将一张装备牌置于“缘江烽火图”上,称之为“烽火”。
        根据“烽火”的数量,所有吴势力角色可于其准备阶段选择并获得其中一个技能直到回合结束:一张以上:〖英姿〗;两张以上:〖好施〗;三张以上:〖涉猎〗;四张以上:〖度势〗;五张以上:可额外选择一项。
        锁定技,当你受到【杀】或锦囊牌造成的伤害后,你将一张“烽火”置入弃牌堆。', yuanjiangfenghuotu_ab:'江图', yuanjiangfenghuotu_bg:'图', wuxin:'悟心', @@ -18202,7 +18444,7 @@ return event.junling=='junling5'?1:0;}); hongfa:'弘法', hongfa_use:'天兵', hongfa_respond:'天兵', - hongfa_info:'君主技,锁定技,此武将牌明置时,你获得“黄巾天兵符”;准备阶段开始时,若没有“天兵”,你将牌堆顶的X张牌置于“黄巾天兵符”上,称为“天兵”(X为群势力角色的数量)。', + hongfa_info:'君主技,锁定技,此武将牌明置时,你获得“黄巾天兵符”;准备阶段,若没有“天兵”,你将牌堆顶的X张牌置于“黄巾天兵符”上,称为“天兵”(X为群势力角色的数量)。', wendao:'问道', wendao_info:'出牌阶段限一次,你可以弃置一张不为【太平要术】的红色牌,然后获得弃牌堆或场上的一张【太平要术】。', huangjintianbingfu:'黄巾天兵符', @@ -18243,7 +18485,7 @@ return event.junling=='junling5'?1:0;}); gzyongjue:'勇决', gzyongjue_info:'与你势力相同的一名角色于其回合内使用【杀】结算完成后,若此牌是其本回合内使用的第一张牌,则其可以获得此牌对应的所有实体牌。', gzqianxi:'潜袭', - gzqianxi_info:'准备阶段开始时,你可以进行判定,然后你选择距离为1的一名角色,直到回合结束,该角色不能使用或打出与结果颜色相同的手牌。', + gzqianxi_info:'准备阶段,你可以进行判定,然后你选择距离为1的一名角色,直到回合结束,该角色不能使用或打出与结果颜色相同的手牌。', gzshangyi:'尚义', gzshangyi_info:'出牌阶段限一次,你可以令一名其他角色观看你的手牌。若如此做,你选择一项:1.观看其手牌并可以弃置其中的一张黑色牌;2.观看其所有暗置的武将牌。', niaoxiang:'鸟翔', @@ -18262,11 +18504,11 @@ return event.junling=='junling5'?1:0;}); gzjixi:'急袭', gzjixi_info:'主将技,此武将牌减少半个阴阳鱼。你可以将一张“田”当作【顺手牵羊】使用。', huyuan:'护援', - huyuan_info:'结束阶段开始时,你可以将一张装备牌置入一名角色的装备区,然后你可以弃置该角色距离为1的一名角色的一张牌。', + huyuan_info:'结束阶段,你可以将一张装备牌置入一名角色的装备区,然后你可以弃置该角色距离为1的一名角色的一张牌。', heyi:'鹤翼', heyi_info:'阵法技。与你处于同一队列的角色视为拥有技能〖飞影〗。', gzhuyuan:'护援', - gzhuyuan_info:'结束阶段开始时,你可以选择一项:⒈将一张非装备牌交给一名其他角色。⒉将一张装备牌置入其他角色的装备区内,然后你可以弃置场上的一张牌。', + gzhuyuan_info:'结束阶段,你可以选择一项:⒈将一张非装备牌交给一名其他角色。⒉将一张装备牌置入其他角色的装备区内,然后你可以弃置场上的一张牌。', gz_shibing1wei:'魏兵', gz_shibing2wei:'魏兵', gz_shibing1shu:'蜀兵', @@ -18298,7 +18540,7 @@ return event.junling=='junling5'?1:0;}); duoshi:'度势', duoshi_info:'出牌阶段限四次,你可以将一张红色手牌当做【以逸待劳】使用。', gzxiaoguo:'骁果', - gzxiaoguo_info:'其他角色的结束阶段开始时,你可以弃置一张基本牌,令该角色选择一项:1.弃置一张装备牌;2.受到你对其造成的1点伤害。', + gzxiaoguo_info:'其他角色的结束阶段,你可以弃置一张基本牌,令该角色选择一项:1.弃置一张装备牌;2.受到你对其造成的1点伤害。', gzdangxian:'当先', gzdangxian_info:'锁定技。当你首次明置此武将牌时,你获得一枚“先驱”标记。回合开始时,你获得一个额外的出牌阶段。', @@ -18335,10 +18577,10 @@ return event.junling=='junling5'?1:0;}); gzlisi:'离思', gzlisi_info:'一名己方角色死亡后,你可以选择〖诏颂〗中的一个已发动过的选项,令其视为未发动过。', gzcaiyuan:'才媛', - gzcaiyuan_info:'锁定技。结束阶段开始时,若你的手牌数大于本回合开始时的手牌数,则你摸两张牌或回复1点体力。', + gzcaiyuan_info:'锁定技。结束阶段,若你的手牌数大于本回合开始时的手牌数,则你摸两张牌或回复1点体力。', gzwanyi:'婉嫕', gzwanyi_info:'出牌阶段每项各限一次。你可以将一张带有“合纵”标签的牌当做【联军盛宴】/【火烧连营】/【挟天子以令诸侯】/【戮力同心】使用。', - gzwanyi_info_yingbian:'出牌阶段每项各限一次。你可以将一张带有“应变”标签的牌当做【逐近弃远】/【洞烛先机】/【水淹七军】/【出其不意】使用。', + gzwanyi_info_guozhan_yingbian:'出牌阶段每项各限一次。你可以将一张带有“应变”标签的牌当做【逐近弃远】/【洞烛先机】/【水淹七军】/【出其不意】使用。', gzmaihuo:'埋祸', gzmaihuo_info:'限定技。当有己方角色成为【杀】的目标时,你可以取消此【杀】的所有目标。然后此【杀】的使用者下回合开始时,其视为对你使用一张【杀】。若此【杀】对你造成伤害,则你防止此伤害,摸两张牌并移除此武将牌(若此武将牌为副将则改为变更副将)。', gzzhenxi:'震袭', @@ -18394,7 +18636,7 @@ return event.junling=='junling5'?1:0;}); gzrebushi:'布施', gzrebushi_info:'①回合结束后,你获得X个“义舍”标记(X为你的体力值)。②其他角色的准备阶段,你可以失去1个“义舍”标记,交给其一张牌并摸两张牌。③准备阶段,你须弃置Y张牌,然后失去所有“义舍”标记(Y为场上存活人数-你的体力值-2)。', gzremidao:'米道', - gzremidao_info:'①结束阶段开始时,若你的武将牌上没有“米”,则你可以摸两张牌。若如此做,你将两张牌置于武将牌上,称为“米”。②一名角色的判定牌生效前,你可以打出一张“米”作为新的判定牌,然后你获得原判定牌。', + gzremidao_info:'①结束阶段,若你的武将牌上没有“米”,则你可以摸两张牌。若如此做,你将两张牌置于武将牌上,称为“米”。②一名角色的判定牌生效前,你可以打出一张“米”作为新的判定牌,然后你获得原判定牌。', jiahe_reyingzi:'英姿', jiahe_haoshi:'好施', jiahe_shelie:'涉猎', @@ -18462,7 +18704,7 @@ return event.junling=='junling5'?1:0;}); fakepaiyi:'排异', fakepaiyi_info:'出牌阶段限一次,你可以选择一名角色,然后选择一个军令令其选择是否执行。若其执行,则你摸X张牌,然后将一张“权”置入弃牌堆;若其不执行,则你可以对至多X名与其势力相同的角色各造成1点伤害,然后将等量的“权”置入弃牌堆。(X为你武将牌上的“权”数)', fakeshilu:'嗜戮', - fakeshilu_info:'①出牌阶段结束时,若你有副将且本阶段未发动过副将武将牌上的非锁定技,则你更换副将并将原副将称为“戮”置于武将牌上。②准备阶段,你弃置X张手牌,然后摸X张牌(X为你武将牌上的“戮”数,少牌全弃,无牌不弃)。', + fakeshilu_info:'①出牌阶段结束时,若你有副将且本阶段未发动过副将武将牌上的非锁定技,则你更换副将至你武将牌上的“戮”未包含的势力并将原副将称为“戮”置于武将牌上。②准备阶段,你弃置X张手牌,然后摸X张牌(X为你武将牌上的“戮”数,少牌全弃,无牌不弃)。', fakexiongnve:'凶虐', fakexiongnve_info:'①当你使用【杀】造成伤害时或受到【杀】造成的伤害时,若你武将牌上的“戮”包含伤害来源的势力,则你令此伤害+1。②当你受到不为【杀】造成的伤害时,若你武将牌上的“戮”包含伤害来源的势力,则此伤害-1。', fakehuaiyi:'怀异', @@ -18488,7 +18730,7 @@ return event.junling=='junling5'?1:0;}); fakedujin:'独进', fakedujin_info:'①摸牌阶段,你可以额外摸X张牌(X为你装备区的牌数的一半,向上取整)。②当你首次明置此武将牌时,若你为你们势力第一个明置武将牌的角色,则你获得1个“先驱”标记。', fakezhufu:'注傅', - fakezhufu_info:'出牌阶段,你可以弃置一张本阶段未以此法弃置过的花色的牌,然后根据此牌的花色为你使用的下一张牌添加对应的应变效果(无视条件触发):红桃——助战;方片——富甲;黑桃——残躯;草花——空巢。', + fakezhufu_info:'出牌阶段,你可以弃置一张本阶段未以此法弃置过的花色的牌,然后根据此牌的花色为你使用的下一张牌添加对应的应变效果:红桃,助战、目标+1;方片,富甲、不可被响应;黑桃,残躯、摸一张牌;草花,空巢、伤害+1。', fakeguishu:'鬼术', fakeguishu_info:'出牌阶段限一次,你可以将一张黑桃手牌当作【知己知彼】或【远交近攻】使用。若你本局游戏内已经发动过了〖鬼术〗,则你必须选择与上次不同的选项。', fakeyuanyu:'远域', @@ -18496,7 +18738,7 @@ return event.junling=='junling5'?1:0;}); fakemibei:'秘备', fakemibei_info:'①准备阶段,若你的手牌数不为全场最多,则你须选择一名手牌数为全场最多的角色,令其对你发起军令。②当你执行军令后,你将手牌数摸至与发起者相同(至多摸五张)。③当你拒绝执行军令后,你展示一至三张牌,然后你本回合可以将其中一张牌当作另一张基本牌或非延时锦囊牌使用一次。', fakeqizhi:'奇制', - fakeqizhi_info:'当你于回合内使用非装备牌A时,你可以弃置不是此牌目标的一名角色的一张牌B,然后其摸一张牌。若A具有应变效果,且A和B的花色相同,则你无视条件触发A的应变效果。', + fakeqizhi_info:'当你于回合内声明使用非装备牌A时,你可以弃置不是此牌目标的一名角色的一张牌B,然后其摸一张牌。若A具有应变效果,且A和B的花色相同,则你无视条件触发A的应变效果。', fakejinqu:'进趋', fakejinqu_info:'结束阶段,你可以摸两张牌,然后你将手牌弃置至X张(X为你本回合发动过〖奇制〗的次数)。', fakejuzhan:'拒战', @@ -18536,7 +18778,7 @@ return event.junling=='junling5'?1:0;}); fakeqimei:'齐眉', fakeqimei_info:'准备阶段,你可以选择一名其他角色。若如此做,直到回合结束:当你或其获得牌/失去手牌后,若你与其手牌数相等,则另一名角色回复1点体力;当你或其的体力值变化后,若你与其体力值相等,则另一名角色摸一张牌。', fakebaoqie:'宝箧', - fakebaoqie_info:'①当你受到伤害时,若此武将牌未明置过,则你可以明置此武将牌并防止此伤害。②当你首次明置此武将牌时,你可以获得一名角色的宝物牌,然后你可以使用其中的一张牌。', + fakebaoqie_info:'①当你受到伤害时,若此武将牌未明置过,则你可以明置此武将牌并防止此伤害。②当你首次明置此武将牌时,你可以获得一名角色装备区里所有的宝物牌,然后你可以使用其中的一张牌。', fakeciwei:'慈威', fakeciwei_info:'其他角色于一回合内使用第偶数张牌时,你可以弃置一张牌并取消此牌的所有目标,然后若此牌为装备牌,你可以获得之且你可以使用之。', fakehuirong:'慧容', @@ -18557,6 +18799,10 @@ return event.junling=='junling5'?1:0;}); fakecaiwang_info:'①你可以助战自己。②每回合每项各限一次,当你响应助战后,若你弃置的牌和被强化的牌:颜色相同,你可以弃置一名其他角色的一张牌;颜色不同,你摸一张牌。', fakenaxiang:'纳降', fakenaxiang_info:'锁定技。①当你对与你势力不同的角色造成伤害后,或受到与你势力不同的角色对你造成的伤害后。你对其发起军令,若其不执行,则你不能对其发动〖纳降①〗直到你的下个回合开始。②你响应助战弃牌无类别限制,且你触发具有应变的卡牌的条件均视为助战。', + fakehuyuan:'护援', + fakehuyuan_info:'①你的回合内,当一张装备牌进入一名角色的装备区后,你可以弃置与其距离为1以内的另一名角色区域里的一张牌。②结束阶段,你可以将一张装备牌置入一名角色的装备区。', + fakekeshou:'恪守', + fakekeshou_info:'①当你受到伤害时,你可以弃置两张颜色相同的牌并令此伤害-1。②当你因弃置而一次性失去至少两张牌后,若你的势力已确定且场上没有与你势力相同的其他角色,则你可以进行判定,若结果判定为红色,你摸一张牌。', guozhan_default:"国战标准", guozhan_zhen:"君临天下·阵", diff --git a/node_modules/@types/noname-typings/nonameModules/game/codemirror.d.ts b/node_modules/@types/noname-typings/nonameModules/game/codemirror.d.ts index 83b5c8a9a..5caf2e315 100644 --- a/node_modules/@types/noname-typings/nonameModules/game/codemirror.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/game/codemirror.d.ts @@ -1,2 +1,5 @@ -import codemirror from 'codemirror/index'; -export = codemirror; +export default CodeMirror; +/** + * @type { typeof import('codemirror/index') } + */ +declare var CodeMirror: typeof import('codemirror/index'); diff --git a/node_modules/@types/noname-typings/nonameModules/game/jszip.d.ts b/node_modules/@types/noname-typings/nonameModules/game/jszip.d.ts deleted file mode 100644 index cd478141f..000000000 --- a/node_modules/@types/noname-typings/nonameModules/game/jszip.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import * as jszip from 'jszip' -export = jszip; \ No newline at end of file diff --git a/node_modules/@types/noname-typings/nonameModules/noname.d.ts b/node_modules/@types/noname-typings/nonameModules/noname.d.ts index b13e2d614..24d68dcae 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname.d.ts @@ -1,8 +1,8 @@ -export { GNC as gnc } from "./noname/gnc/index.js"; -export { AI as ai } from "./noname/ai/index.js"; -export { Game as game } from "./noname/game/index.js"; -export { Get as get } from "./noname/get/index.js"; -export { Library as lib } from "./noname/library/index.js"; -export { status as _status } from "./noname/status/index.js"; -export { UI as ui } from "./noname/ui/index.js"; -export { boot } from "./noname/init/index.js"; +export { GNC, gnc, setGNC } from './noname/gnc/index.js'; +export { AI, ai, setAI } from './noname/ai/index.js'; +export { Game, game, setGame } from './noname/game/index.js'; +export { Get, get, setGet } from './noname/get/index.js'; +export { Library, lib, setLibrary } from './noname/library/index.js'; +export { status, _status, setStatus } from './noname/status/index.js'; +export { UI, ui, setUI } from './noname/ui/index.js'; +export { boot } from './noname/init/index.js'; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts index 40dc8f424..3195ed436 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts @@ -1,11 +1,11 @@ -export class Basic extends Uninstantable { +export class Basic { /** * @param { ( * button: Button, * buttons?: Button[] * ) => number } check */ - static chooseButton(check: (button: Button, buttons?: Button[]) => number): boolean; + chooseButton(check: (button: any, buttons?: Button[]) => number): boolean | undefined; /** * @param { ( * card?: Card, @@ -13,13 +13,12 @@ export class Basic extends Uninstantable { * ) => number } check * @returns { boolean | undefined } */ - static chooseCard(check: (card?: Card, cards?: Card[]) => number): boolean | undefined; + chooseCard(check: (card?: any, cards?: Card[]) => number): boolean | undefined; /** * @param { ( * target?: Player, * targets?: Player[] * ) => number } check */ - static chooseTarget(check: (target?: Player, targets?: Player[]) => number): boolean; + chooseTarget(check: (target?: any, targets?: Player[]) => number): boolean | undefined; } -import { Uninstantable } from "../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts index 038a291c6..a5e8109d6 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts @@ -1,9 +1,8 @@ -export class AI extends Uninstantable { - static basic: typeof Basic; - static get: typeof get; +export class AI { + basic: Basic; + get: import("../get/index.js").Get; } -export const ai: typeof AI; +export let ai: AI; +export function setAI(instance?: AI | undefined): void; export { Basic }; -import { Uninstantable } from "../util/index.js"; import { Basic } from './basic.js'; -import { Get as get } from '../get/index.js'; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/game/check.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/game/check.d.ts new file mode 100644 index 000000000..cf0668041 --- /dev/null +++ b/node_modules/@types/noname-typings/nonameModules/noname/game/check.d.ts @@ -0,0 +1,26 @@ +export class Check { + processSelection({ type, items, event, useCache, isSelectable }: { + type: any; + items: any; + event: any; + useCache: any; + isSelectable: any; + }): { + ok: boolean; + auto: boolean | undefined; + }; + button(event: any, useCache: any): { + ok: boolean; + auto: boolean | undefined; + }; + card(event: any, useCache: any): { + ok: boolean; + auto: boolean | undefined; + }; + target(event: any, useCache: any): { + ok: boolean; + auto: boolean | undefined; + }; + skill(event: any): void; + confirm(event: any, confirm: any): void; +} diff --git a/node_modules/@types/noname-typings/nonameModules/noname/game/dynamic-style/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/game/dynamic-style/index.d.ts index 64e1ceb64..46cb93dc8 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/game/dynamic-style/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/game/dynamic-style/index.d.ts @@ -37,7 +37,7 @@ export class DynamicStyle { */ get(name: string): { [x: string]: string | number; - }; + } | null; /** * Callback of `DynamicStyle#find`, getting the rule wanted. * `DynamicStyle#find`的回调函数,用于获取符合要求的规则 diff --git a/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts index f1902d74d..1b1d03e9b 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts @@ -1,39 +1,39 @@ -export class Game extends Uninstantable { - static online: boolean; - static onlineID: any; - static onlineKey: any; +export class Game { + online: boolean; + onlineID: null; + onlineKey: null; /** * @type {Player[]} */ - static players: Player[]; + players: Player[]; /** * @type {Player[]} */ - static dead: Player[]; - static imported: any[]; + dead: Player[]; + imported: any[]; /** * @type { { [key: string]: Player } } */ - static playerMap: { - [key: string]: import("../library/element/player.js").Player; + playerMap: { + [key: string]: any; }; - static phaseNumber: number; - static roundNumber: number; - static shuffleNumber: number; - static promises: typeof GamePromises; + phaseNumber: number; + roundNumber: number; + shuffleNumber: number; + promises: GamePromises; /** * @type { string } */ - static layout: string; + layout: string; /** * @type { Player } */ - static me: Player; + me: any; /** * @type { boolean } */ - static chess: boolean; - static globalEventHandlers: { + chess: boolean; + globalEventHandlers: { _handlers: {}; getHandler(name: any, type: any): any; ensureHandlerList(name: any, type: any): any; @@ -42,29 +42,29 @@ export class Game extends Uninstantable { getDefaultHandlerType(name: any): string; addHandlerToEvent(event: any): void; }; - static setStratagemBuffCost(cardName: any, cost: any): void; - static setStratagemBuffEffect(cardName: any, effect: any): void; - static setStratagemBuffPrompt(cardName: any, prompt: any): void; + setStratagemBuffCost(cardName: any, cost: any): void; + setStratagemBuffEffect(cardName: any, effect: any): void; + setStratagemBuffPrompt(cardName: any, prompt: any): void; /** * 添加新的属性杀 */ - static addNature(nature: any, translation: any, config: any): any; + addNature(nature: any, translation: any, config: any): any; /** * 判断卡牌信息/事件是否有某个属性 */ - static hasNature(item: any, nature: any, player: any): boolean; + hasNature(item: any, nature: any, player: any): boolean; /** * 设置卡牌信息/事件的属性 */ - static setNature(item: any, nature: any, addNature: any): any; + setNature(item: any, nature: any, addNature: any): any; /** * 洗牌 */ - static washCard(): false | any[] | import("../library/index.js").GameEventPromise; + washCard(): any; /** * 基于钩子的添加势力方法 */ - static addGroup(id: any, short: any, name: any, config: any): any; + addGroup(id: any, short: any, name: any, config: any): any; /** * @typedef {import("../library/hooks/interface.js").NonameHookType} NonameHookType */ @@ -76,13 +76,13 @@ export class Game extends Uninstantable { * @param {Name} name * @param {Parameters} args */ - static callHook(name: Name, args: Parameters): void; - static yingbianEffect(event: any, content: any, ...args: any[]): import("../library/index.js").GameEventPromise; - static setYingbianConditionColor(yingbianCondition: any, color: any): void; - static setComplexYingbianCondition(yingbianCondition: any, condition: any): void; - static setSimpleYingbianCondition(yingbianCondition: any, condition: any): void; - static setYingbianEffect(yingbianEffect: any, effect: any): void; - static setYingbianPrompt(yingbian: any, prompt: any): void; + callHook(name: Name, args: Parameters): void; + yingbianEffect(event: any, content: any, ...args: any[]): any; + setYingbianConditionColor(yingbianCondition: any, color: any): void; + setComplexYingbianCondition(yingbianCondition: any, condition: any): void; + setSimpleYingbianCondition(yingbianCondition: any, condition: any): void; + setYingbianEffect(yingbianEffect: any, effect: any): void; + setYingbianPrompt(yingbian: any, prompt: any): void; /** * Dynamic Style Manager * 动态CSS管理对象 @@ -127,49 +127,49 @@ export class Game extends Uninstantable { * textAlign: "center" * }); */ - static dynamicStyle: DynamicStyle; + dynamicStyle: DynamicStyle; /** * Add a background music to the config option * * 在设置选项中添加一首背景音乐 */ - static addBackgroundMusic(link: any, musicName: any, aozhan: any): void; + addBackgroundMusic(link: any, musicName: any, aozhan: any): void; /** * Remove a background music from the config option * * 从设置选项中移除一首背景音乐 */ - static removeBackgroundMusic(link: any, aozhan: any): void; - static updateBackground(): void; + removeBackgroundMusic(link: any, aozhan: any): void; + updateBackground(): void; /** * Generate a beatmap using the given BPM, beats, and offset * * 用给定的BPM、节拍和偏移生成谱面 */ - static generateBeatmapTimeleap(bpm: any, beats: any, offset: any): any; - static updateRenku(): void; + generateBeatmapTimeleap(bpm: any, beats: any, offset: any): any; + updateRenku(): void; /** * 为牌添加知情者 * @param { Card[] | Card } cards * @param { Player[] } players */ - static addCardKnower(cards: Card[] | Card, players: Player[]): void; + addCardKnower(cards: Card[] | Card, players: Player[]): void; /** * 移除牌的所有知情者。 * @param { Card[] | Card } cards */ - static clearCardKnowers(cards: Card[] | Card): void; + clearCardKnowers(cards: Card[] | Card): void; /** * @param { { [key: string]: any } } [arg] */ - static loseAsync(arg?: { + loseAsync(arg?: { [key: string]: any; - }): import("../library/index.js").GameEventPromise; - static callFuncUseStepCache(prefix: any, func: any, params: any): any; + } | undefined): any; + callFuncUseStepCache(prefix: any, func: any, params: any): any; /** * @param {string} name */ - static getRarity(name: string): "legend" | "epic" | "rare" | "junk" | "common"; + getRarity(name: string): "legend" | "epic" | "rare" | "junk" | "common"; /** * @template { keyof GameHistory } T * @param { T } key @@ -177,7 +177,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { boolean } */ - static hasGlobalHistory(key: T, filter: (event: GameEventPromise) => boolean, last?: GameEventPromise): boolean; + hasGlobalHistory(key: T, filter: (event: any) => boolean, last?: any): boolean; /** * @template { keyof GameHistory } T * @param { T } key @@ -185,12 +185,12 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { void } */ - static checkGlobalHistory(key: T_1, filter: (event: GameEventPromise) => boolean, last?: GameEventPromise): void; + checkGlobalHistory(key: T_1, filter: (event: any) => boolean, last?: any): void; /** * @overload * @returns { GameHistory } */ - static getGlobalHistory(): GameHistory; + getGlobalHistory(): GameHistory; /** * @template { keyof GameHistory } T * @overload @@ -199,7 +199,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ - static getGlobalHistory(key: T_2, filter?: (event: GameEventPromise) => boolean, last?: GameEventPromise): GameHistory[T_2]; + getGlobalHistory(key: T_2, filter?: ((event: any) => boolean) | undefined, last?: any): GameHistory[T_2]; /** * @template { keyof GameHistory } T * @param { T } key @@ -207,7 +207,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { boolean } */ - static hasAllGlobalHistory(key: T_3, filter: (event: GameEventPromise) => boolean, last?: GameEventPromise): boolean; + hasAllGlobalHistory(key: T_3, filter: (event: any) => boolean, last?: any): boolean; /** * @template { keyof GameHistory } T * @param { T } key @@ -215,12 +215,12 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { void } */ - static checkAllGlobalHistory(key: T_4, filter: (event: GameEventPromise) => boolean, last?: GameEventPromise): void; + checkAllGlobalHistory(key: T_4, filter: (event: any) => boolean, last?: any): void; /** * @overload * @returns { GameHistory[] } */ - static getAllGlobalHistory(): GameHistory[]; + getAllGlobalHistory(): GameHistory[]; /** * @template { keyof GameHistory } T * @overload @@ -229,60 +229,60 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ - static getAllGlobalHistory(key: T_5, filter?: (event: GameEventPromise) => boolean, last?: GameEventPromise): GameHistory[T_5]; + getAllGlobalHistory(key: T_5, filter?: ((event: any) => boolean) | undefined, last?: any): GameHistory[T_5]; /** * @overload * @returns { void } */ - static cardsDiscard(): void; + cardsDiscard(): void; /** * @overload * @param { Card } cards * @returns { GameEventPromise } */ - static cardsDiscard(cards: Card): GameEventPromise; + cardsDiscard(cards: any): any; /** * @overload * @param {Card[]} cards * @returns { GameEventPromise } */ - static cardsDiscard(cards: Card[]): GameEventPromise; + cardsDiscard(cards: Card[]): any; /** * @overload * @returns { void } */ - static cardsGotoOrdering(): void; + cardsGotoOrdering(): void; /** * @overload * @param { Card } cards * @returns { GameEventPromise } */ - static cardsGotoOrdering(cards: Card): GameEventPromise; + cardsGotoOrdering(cards: any): any; /** * @overload * @param {Card[]} cards * @returns { GameEventPromise } */ - static cardsGotoOrdering(cards: Card[]): GameEventPromise; + cardsGotoOrdering(cards: Card[]): any; /** * @overload * @returns { void } */ - static cardsGotoSpecial(): void; + cardsGotoSpecial(): void; /** * @overload * @param { Card } cards * @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库 * @returns { GameEventPromise } */ - static cardsGotoSpecial(cards: Card, bool?: 'toRenku' | false): GameEventPromise; + cardsGotoSpecial(cards: any, bool?: false | "toRenku" | undefined): any; /** * @overload * @param {Card[]} cards * @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库 * @returns { GameEventPromise } */ - static cardsGotoSpecial(cards: Card[], bool?: 'toRenku' | false): GameEventPromise; + cardsGotoSpecial(cards: Card[], bool?: false | "toRenku" | undefined): any; /** * * @param {...( @@ -294,49 +294,49 @@ export class Game extends Uninstantable { * )} args * @returns */ - static cardsGotoPile(...args: (Card[] | Card | Function | 'insert' | 'washCard' | 'triggeronly' | [ + cardsGotoPile(...args: (Card[] | Card | Function | 'insert' | 'washCard' | 'triggeronly' | [ string, any - ])[]): import("../library/index.js").GameEventPromise; + ])[]): any; /** * @param { GameEventPromise } event */ - static $cardsGotoPile(event: GameEventPromise): void; + $cardsGotoPile(event: any): void; /** * @param { false } [pause] */ - static showHistory(pause?: false): void; + showHistory(pause?: false | undefined): void; /** * @param { string } src * @param { true } [blur] */ - static createBackground(src: string, blur?: true): HTMLDivElement; + createBackground(src: string, blur?: true | undefined): HTMLDivElement; /** * * @param { string } url * @param { Player } [player] */ - static changeLand(url: string, player?: Player): void; + changeLand(url: string, player?: any): void; /** * @param { string[] } updates * @param { Function } proceed */ - static checkFileList(updates: string[], proceed: Function): void; + checkFileList(updates: string[], proceed: Function): void; /** * @param {...(Player[] | Player)} args */ - static replaceHandcards(...args: (Player[] | Player)[]): void; + replaceHandcards(...args: (Player[] | Player)[]): void; /** * @param { string } name */ - static removeCard(name: string): void; + removeCard(name: string): void; /** * @param { 'hidden' } [type] */ - static randomMapOL(type?: 'hidden'): void; - static closeMenu(): void; - static closeConnectMenu(): void; - static closePopped(): void; + randomMapOL(type?: "hidden" | undefined): void; + closeMenu(): void; + closeConnectMenu(): void; + closePopped(): void; /** * @template { keyof typeof lib.message.client } T * @overload @@ -344,7 +344,7 @@ export class Game extends Uninstantable { * @param { ...Parameters } args * @returns { void } */ - static broadcast(func: T_6, ...args: Parameters<{ + broadcast(func: T_6, ...args: Parameters<{ log: (arr: any) => void; opened: () => void; onconnection: (id: any) => void; @@ -368,7 +368,7 @@ export class Game extends Uninstantable { createDialog: (id: any, ...args: any[]) => void; gameStart: () => void; updateWaiting: (map: any) => void; - }[T_6]>): void; + }[T_6]> | undefined): void; /** * @template { any[] } T * @overload @@ -376,7 +376,7 @@ export class Game extends Uninstantable { * @param { ...T } args * @returns { void } */ - static broadcast(func: (...args: T_6) => void, ...args: T_6): void; + broadcast(func: (...args: T_6) => void, ...args: T_6 | undefined): void; /** * @template { keyof typeof lib.message.client } T * @overload @@ -384,7 +384,7 @@ export class Game extends Uninstantable { * @param { ...Parameters } args * @returns { void } */ - static broadcastAll(func: T_7, ...args: Parameters<{ + broadcastAll(func: T_7, ...args: Parameters<{ log: (arr: any) => void; opened: () => void; onconnection: (id: any) => void; @@ -408,7 +408,7 @@ export class Game extends Uninstantable { createDialog: (id: any, ...args: any[]) => void; gameStart: () => void; updateWaiting: (map: any) => void; - }[T_7]>): void; + }[T_7]> | undefined): void; /** * @template { any[] } T * @overload @@ -416,36 +416,36 @@ export class Game extends Uninstantable { * @param { ...T } args * @returns { void } */ - static broadcastAll(func: (...args: T_7) => void, ...args: T_7): void; - static syncState(): void; - static updateWaiting(): void; + broadcastAll(func: (...args: T_7) => void, ...args: T_7 | undefined): void; + syncState(): void; + updateWaiting(): void; /** * @param { Function } func */ - static waitForPlayer(func: Function): void; + waitForPlayer(func: Function): void; /** * @param { number } time * @param { Function } [onEnd] */ - static countDown(time: number, onEnd?: Function): void; - static countChoose(clear: any): void; - static stopCountChoose(): void; + countDown(time: number, onEnd?: Function | undefined): void; + countChoose(clear: any): void; + stopCountChoose(): void; /** * @param { string } ip * @param { (result: boolean) => any } callback */ - static connect(ip: string, callback: (result: boolean) => any): void; - static send(...args: any[]): void; + connect(ip: string, callback: (result: boolean) => any): void; + send(...args: any[]): void; /** * @param { string } id * @param {*} message */ - static sendTo(id: string, message: any): import("../library/element/client.js").Client; - static createServer(): void; + sendTo(id: string, message: any): import("../library/element/client.js").Client; + createServer(): void; /** * @returns { HTMLAudioElement } */ - static playAudio(...args: any[]): HTMLAudioElement; + playAudio(...args: any[]): HTMLAudioElement; /** * 根据skill中的audio,audioname,audioname2和player来获取音频地址列表 * @typedef {[string,number]|string|number|boolean} audioInfo @@ -484,13 +484,13 @@ export class Game extends Uninstantable { * //如果key中包含发动技能的角色名player,则直接改用info.audioname2[player]来播放语音 * ``` */ - static parseSkillAudio(skill: string, player?: Player | string, skillInfo?: { + parseSkillAudio(skill: string, player?: Player | string, skillInfo?: { audio: string | number | boolean | [string, number]; - audioname?: string[]; + audioname?: string[] | undefined; audioname2?: { [playerName: string]: string | number | boolean | [string, number]; - }; - } | (string | number | boolean | [string, number])): string[]; + } | undefined; + } | (string | number | boolean | [string, number]) | undefined): string[]; /** * * @param { string } skill @@ -500,19 +500,19 @@ export class Game extends Uninstantable { * @param { ['lib']['skill'] } [skillInfo] * @returns */ - static trySkillAudio(skill: string, player: Player | string, directaudio?: boolean, nobroadcast?: boolean, skillInfo?: any): HTMLAudioElement; + trySkillAudio(skill: string, player: Player | string, directaudio?: boolean | undefined, nobroadcast?: boolean | undefined, skillInfo?: any): HTMLAudioElement | undefined; /** * @param { string } name * @param { number } [index] * @returns */ - static playSkillAudio(name: string, index?: number, ...args: any[]): void; + playSkillAudio(name: string, index?: number | undefined, ...args: any[]): void; /** * @param { string | Card } card * @param { Player | Sex } sex */ - static playCardAudio(card: string | Card, sex: Player | Sex): void; - static playBackgroundMusic(): void; + playCardAudio(card: string | Card, sex: Player | Sex): void; + playBackgroundMusic(): void; /** * @overload * @param { 'character' } type @@ -526,7 +526,7 @@ export class Game extends Uninstantable { * ) => importCharacterConfig } content * @param {*} [url] */ - static import(type: 'character', content: (lib: Library, game: typeof Game, ui: UI, get: Get, ai: AI, _status: Status) => importCharacterConfig, url?: any): any; + import(type: 'character', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importCharacterConfig, url?: any): any; /** * @overload * @param { 'card' } type @@ -540,7 +540,7 @@ export class Game extends Uninstantable { * ) => importCardConfig } content * @param {*} [url] */ - static import(type: 'card', content: (lib: Library, game: typeof Game, ui: UI, get: Get, ai: AI, _status: Status) => importCardConfig, url?: any): any; + import(type: 'card', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importCardConfig, url?: any): any; /** * @overload * @param { 'mode' } type @@ -554,7 +554,7 @@ export class Game extends Uninstantable { * ) => importModeConfig } content * @param {*} [url] */ - static import(type: 'mode', content: (lib: Library, game: typeof Game, ui: UI, get: Get, ai: AI, _status: Status) => importModeConfig, url?: any): any; + import(type: 'mode', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importModeConfig, url?: any): any; /** * @overload * @param { 'player' } type @@ -568,7 +568,7 @@ export class Game extends Uninstantable { * ) => importPlayerConfig } content * @param {*} [url] */ - static import(type: 'player', content: (lib: Library, game: typeof Game, ui: UI, get: Get, ai: AI, _status: Status) => importPlayerConfig, url?: any): any; + import(type: 'player', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importPlayerConfig, url?: any): any; /** * @overload * @param { 'extension' } type @@ -582,59 +582,67 @@ export class Game extends Uninstantable { * ) => importExtensionConfig } content * @param {*} [url] */ - static import(type: 'extension', content: (lib: Library, game: typeof Game, ui: UI, get: Get, ai: AI, _status: Status) => importExtensionConfig, url?: any): any; - static loadExtension(object: any): Promise; + import(type: 'extension', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importExtensionConfig, url?: any): any; + loadExtension(object: any): Promise; /** * 下载文件 - * @type { (url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void) => void, dev?: 'nodev', onprogress?: Function) => void } + * @type { undefined | ((url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void, dev?: 'nodev', onprogress?: Function) => void) } */ - static download: (url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void) => void; + download: ((url: string, folder: string, onsuccess?: Function, onerror?: ((e: Error) => void) | undefined, dev?: 'nodev', onprogress?: Function) => void) | undefined; /** * 读取文件为arraybuffer - * @type { (filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void } + * @type { undefined | ((filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void) } */ - static readFile: (filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void; + readFile: ((filename: string, callback?: ((data: Buffer | ArrayBuffer) => any) | undefined, onerror?: ((e: Error) => void) | undefined) => void) | undefined; /** * 读取文件为文本 - * @type { (filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void } + * @type { undefined | ((filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void) } */ - static readFileAsText: (filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void; + readFileAsText: ((filename: string, callback?: ((data: string) => any) | undefined, onerror?: ((e: Error) => void) | undefined) => void) | undefined; /** * 将数据写入文件 - * @type { (data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void } + * @type { undefined | ((data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void) } */ - static writeFile: (data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void; + writeFile: ((data: File | ArrayBuffer, path: string, name: string, callback?: ((e: Error) => void) | undefined) => void) | undefined; /** * 移除文件 - * @type { (filename: string, callback?: (e: Error) => void) => void } + * @type { undefined | ((filename: string, callback?: (e: Error) => void) => void) } */ - static removeFile: (filename: string, callback?: (e: Error) => void) => void; + removeFile: ((filename: string, callback?: ((e: Error) => void) | undefined) => void) | undefined; /** * 获取文件列表 - * @type { (dir: string, success: (folders: string[], files: string[]) => any, failure: (e: Error) => void) => void } + * @type { undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure: (e: Error) => void) => void) } */ - static getFileList: (dir: string, success: (folders: string[], files: string[]) => any, failure: (e: Error) => void) => void; + getFileList: ((dir: string, success: (folders: string[], files: string[]) => any, failure: (e: Error) => void) => void) | undefined; /** * 按路径依次创建文件夹 - * @type { (list: string | string[], callback: Function, file?: boolean) => void } + * @type { undefined | ((list: string | string[], callback: Function, file?: boolean) => void) } */ - static ensureDirectory: (list: string | string[], callback: Function, file?: boolean) => void; + ensureDirectory: ((list: string | string[], callback: Function, file?: boolean) => void) | undefined; /** * 创建文件夹 - * @type { (directory: string, successCallback?: Function, errorCallback?: Function) => void } + * @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) } */ - static createDir: (directory: string, successCallback?: Function, errorCallback?: Function) => void; + createDir: ((directory: string, successCallback?: Function, errorCallback?: Function) => void) | undefined; /** * 删除文件夹 - * @type { (directory: string, successCallback?: Function, errorCallback?: Function) => void } + * @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) } */ - static removeDir: (directory: string, successCallback?: Function, errorCallback?: Function) => void; - static importExtension(data: any, finishLoad: any, exportExtension: any, extensionPackage: any): Promise; + removeDir: ((directory: string, successCallback?: Function, errorCallback?: Function) => void) | undefined; + /** + * @type { (forcecheck?: boolean | null, dev?: boolean) => Promise } + */ + checkForUpdate: (forcecheck?: boolean | null, dev?: boolean) => Promise; + /** + * @type { () => Promise } + */ + checkForAssetUpdate: () => Promise; + importExtension(data: any, finishLoad: any, exportExtension: any, extensionPackage: any): Promise; /** * @param { string } textToWrite * @param { string } [name] */ - static export(textToWrite: string, name?: string): void; + export(textToWrite: string, name?: string | undefined): void; /** * @param { string[] } list * @param { Function } [onsuccess] @@ -643,7 +651,7 @@ export class Game extends Uninstantable { * @param { Function } [process] * @param {*} [dev] */ - static multiDownload2(list: string[], onsuccess?: Function, onerror?: Function, onfinish?: Function, process?: Function, dev?: any): void; + multiDownload2(list: string[], onsuccess?: Function | undefined, onerror?: Function | undefined, onfinish?: Function | undefined, process?: Function | undefined, dev?: any): void; /** * @param { string[] } list * @param { Function } onsuccess @@ -652,24 +660,24 @@ export class Game extends Uninstantable { * @param { Function } [process] * @param {*} [dev] */ - static multiDownload(list: string[], onsuccess: Function, onerror: Function, onfinish: Function, process?: Function, dev?: any, ...args: any[]): void; + multiDownload(list: string[], onsuccess: Function, onerror: Function, onfinish: Function, process?: Function | undefined, dev?: any, ...args: any[]): void; /** * @param { string } url * @param { Function } onload * @param { Function } [onerror] * @param { Function } [onprogress] */ - static fetch(url: string, onload: Function, onerror?: Function, onprogress?: Function): void; + fetch(url: string, onload: Function, onerror?: Function | undefined, onprogress?: Function | undefined): void; /** * @param { string } time * @param { string } mode */ - static playVideo(time: string, mode: string): void; + playVideo(time: string, mode: string): void; /** * @param { Videos } video */ - static playVideoContent(video: Videos): void; - static videoContent: { + playVideoContent(video: Videos): void; + videoContent: { arrangeLib: (content: any) => void; $syncDisable: (player: any, map: any) => void; $syncExpand: (player: any, map: any) => void; @@ -792,50 +800,50 @@ export class Game extends Uninstantable { swapPlayer: (player: any, hs: any) => void; over: (str: any) => void; }; - static reload(): void; - static reload2(): void; - static exit(): void; + reload(): void; + reload2(): void; + exit(): void; /** * @param { string } url */ - static open(url: string): void; - static reloadCurrent(): void; + open(url: string): void; + reloadCurrent(): void; /** * @param { Function } func */ - static update(func: Function): Function; + update(func: Function): Function; /** * @param { Function } func */ - static unupdate(func: Function): void; - static stop(): void; - static run(): void; + unupdate(func: Function): void; + stop(): void; + run(): void; /** * @param { string } type * @param { Player } player * @param { any } [content] * @returns */ - static addVideo(type: string, player: Player, content?: any): void; + addVideo(type: string, player: any, content?: any): void; /** * @param { Function } func */ - static draw(func: Function): void; + draw(func: Function): void; /** * @param { number } [time] */ - static vibrate(time?: number): void; - static prompt(...args: any[]): void; - static alert(str: any): void; - static print(...args: any[]): void; - static animate: { + vibrate(time?: number | undefined): void; + prompt(...args: any[]): void; + alert(str: any): void; + print(...args: any[]): void; + animate: { window: (num: any) => void; flame: (x: any, y: any, duration: any, type: any) => void; }; /** * @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path */ - static linexy(path: [number, string | number | { + linexy(path: [number, string | number | { opacity: any; color: any; dashed: any; @@ -844,7 +852,7 @@ export class Game extends Uninstantable { /** * @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path */ - static _linexy(path: [number, string | number | { + _linexy(path: [number, string | number | { opacity: any; color: any; dashed: any; @@ -857,7 +865,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } event * @returns { GameEventPromise } */ - static createTrigger(name: string, skill: string, player: Player, event: GameEventPromise, indexedData: any): GameEventPromise; + createTrigger(name: string, skill: string, player: any, event: any, indexedData: any): any; /** * @legacy Use {@link lib.element.GameEvent.constructor} instead. * @@ -865,12 +873,12 @@ export class Game extends Uninstantable { * @param { false } [trigger] * @param { GameEventPromise } [triggerEvent] */ - static createEvent(name: string, trigger?: false, triggerEvent?: GameEventPromise): import("../library/index.js").GameEventPromise; + createEvent(name: string, trigger?: false | undefined, triggerEvent?: any): any; /** * @param { string } name * @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information */ - static addCharacter(name: string, information: { + addCharacter(name: string, information: { extension: string; sex: Sex; group: string; @@ -883,9 +891,9 @@ export class Game extends Uninstantable { * @param { { mode?: string, forbid?: any, character: { [key: string]: Character }, skill: { [key: string]: object }, [key: string]: any } } pack * @param { string } [packagename] */ - static addCharacterPack(pack: { + addCharacterPack(pack: { [key: string]: any; - mode?: string; + mode?: string | undefined; forbid?: any; character: { [key: string]: Character; @@ -893,13 +901,13 @@ export class Game extends Uninstantable { skill: { [key: string]: any; }; - }, packagename?: string): void; + }, packagename?: string | undefined): void; /** * @param { string } name * @param { Card } info * @param { { extension: string, translate: string, description: string, number?: number, color?: string } } info2 */ - static addCard(name: string, info: Card, info2: { + addCard(name: string, info: any, info2: { extension: string; translate: string; description: string; @@ -910,18 +918,18 @@ export class Game extends Uninstantable { * @param { { extension: string, mode?: string[], forbid?: string[], list: any[], card: {[key: string]: Card}, skill: { [key: string]: object } } } pack * @param { string } [packagename] */ - static addCardPack(pack: { + addCardPack(pack: { extension: string; - mode?: string[]; - forbid?: string[]; + mode?: string[] | undefined; + forbid?: string[] | undefined; list: any[]; card: { - [key: string]: import("../library/element/card.js").Card; + [key: string]: any; }; skill: { [key: string]: any; }; - }, packagename?: string): void; + }, packagename?: string | undefined): void; /** * @param { string } name * @param { { [key: string]: object } } info @@ -930,15 +938,15 @@ export class Game extends Uninstantable { * @param { string } [appendInfo] * @param { string } [abInfo] */ - static addSkill(name: string, info: { + addSkill(name: string, info: { [key: string]: any; - }, translate?: string, description?: string, appendInfo?: string, abInfo?: string): boolean; + }, translate?: string | undefined, description?: string | undefined, appendInfo?: string | undefined, abInfo?: string | undefined): boolean; /** * @param { string } name * @param {*} info * @param { { translate: string, config: { [key: string]: object } } } info2 */ - static addMode(name: string, info: any, info2: { + addMode(name: string, info: any, info2: { translate: string; config: { [key: string]: any; @@ -948,40 +956,40 @@ export class Game extends Uninstantable { * @param { string } skill * @param { Player } [player] */ - static addGlobalSkill(skill: string, player?: Player): boolean; + addGlobalSkill(skill: string, player?: any): boolean; /** * @param { string } skill */ - static removeGlobalSkill(skill: string): void; - static resetSkills(): void; + removeGlobalSkill(skill: string): void; + resetSkills(): void; /** * @param { string } extensionName */ - static hasExtension(extensionName: string): any; + hasExtension(extensionName: string): any; /** * @param { string } extensionName */ - static hasExtensionInstalled(extensionName: string): any; + hasExtensionInstalled(extensionName: string): any; /** * @param { string } extensionName */ - static hasExtensionLoaded(extensionName: string): any; + hasExtensionLoaded(extensionName: string): any; /** * @param { string } extensionName * @param { Function } runnable */ - static runAfterExtensionLoaded(extensionName: string, runnable: Function): void; + runAfterExtensionLoaded(extensionName: string, runnable: Function): void; /** * @param { string } extensionName * @param { boolean } [keepFile] */ - static removeExtension(extensionName: string, keepFile?: boolean): void; - static addRecentCharacter(...args: any[]): void; + removeExtension(extensionName: string, keepFile?: boolean | undefined): void; + addRecentCharacter(...args: any[]): void; /** * @overload * @returns { Card } */ - static createCard(): Card; + createCard(): any; /** * @overload * @param { Card | string } name @@ -989,12 +997,12 @@ export class Game extends Uninstantable { * @param { number | string } [number] * @param { string } [nature] */ - static createCard(name: Card | string, suit?: string, number?: number | string, nature?: string): any; + createCard(name: Card | string, suit?: string | undefined, number?: string | number | undefined, nature?: string | undefined): any; /** * @overload * @returns { Card } */ - static createCard2(): Card; + createCard2(): any; /** * @overload * @param { Card | string } name @@ -1002,18 +1010,18 @@ export class Game extends Uninstantable { * @param { number } number * @param { string } nature */ - static createCard2(name: Card | string, suit: string, number: number, nature: string): any; + createCard2(name: Card | string, suit: string, number: number, nature: string): any; /** * @param { boolean } bool * @param { Function } callback */ - static forceOver(bool: boolean, callback: Function): void; + forceOver(bool: boolean, callback: Function): void; /** * @param { boolean | string } [result] * @param { boolean } [bool] * @returns */ - static over(result?: boolean | string, bool?: boolean, ...args: any[]): void; + over(result?: string | boolean | undefined, bool?: boolean | undefined, ...args: any[]): void; /** * @type { Map> } * @@ -1021,35 +1029,35 @@ export class Game extends Uninstantable { * * 但是需要事件结果的除外 */ - static executingAsyncEventMap: Map>; + executingAsyncEventMap: Map>; /** * @type { GameEventPromise[] } */ - static belongAsyncEventList: GameEventPromise[]; + belongAsyncEventList: GameEventPromise[]; /** * @param { GameEventPromise } [belongAsyncEvent] */ - static loop(belongAsyncEvent?: GameEventPromise): Promise; + loop(belongAsyncEvent?: any): Promise; /** * @param { GameEventPromise } [belongAsyncEvent] */ - static runContent(belongAsyncEvent?: GameEventPromise): Promise; - static pause(): void; - static pause2(): void; - static resume(): void; - static resume2(): void; - static delaye(...args: any[]): import("../library/index.js").GameEventPromise; - static delayex(...args: any[]): import("../library/index.js").GameEventPromise; + runContent(belongAsyncEvent?: any): Promise; + pause(): void; + pause2(): void; + resume(): void; + resume2(): void; + delaye(...args: any[]): any; + delayex(...args: any[]): any; /** * @param { number } [time] * @param { number } [time2] */ - static delay(time?: number, time2?: number): void; + delay(time?: number | undefined, time2?: number | undefined): void; /** * @param { number } [time] * @param { number } [time2] */ - static delayx(time?: number, time2?: number): void; + delayx(time?: number | undefined, time2?: number | undefined): void; /** * 在async content中对game.delay的代替使用方法 * @@ -1058,7 +1066,7 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static asyncDelay(time?: number, time2?: number): Promise; + asyncDelay(time?: number | undefined, time2?: number | undefined): Promise; /** * 在async content中对game.delayx的代替使用方法 * @@ -1067,39 +1075,13 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static asyncDelayx(time?: number, time2?: number): Promise; + asyncDelayx(time?: number | undefined, time2?: number | undefined): Promise; /** * @param { GameEventPromise } [event] */ - static check(event?: GameEventPromise): boolean; - static Check: { - new (): {}; - processSelection({ type, items, event, useCache, isSelectable }: { - type: any; - items: any; - event: any; - useCache: any; - isSelectable: any; - }): { - ok: boolean; - auto: boolean; - }; - button(event: any, useCache: any): { - ok: boolean; - auto: boolean; - }; - card(event: any, useCache: any): { - ok: boolean; - auto: boolean; - }; - target(event: any, useCache: any): { - ok: boolean; - auto: boolean; - }; - skill(event: any): void; - confirm(event: any, confirm: any): void; - }; - static uncheck(...args: any[]): void; + check(event?: any): boolean; + Check: Check; + uncheck(...args: any[]): void; /** * @param { Player } player1 * @param { Player } player2 @@ -1107,79 +1089,79 @@ export class Game extends Uninstantable { * @param { boolean } [behind] * @param { boolean } [noanimate] */ - static swapSeat(player1: Player, player2: Player, prompt?: boolean, behind?: boolean, noanimate?: boolean): void; + swapSeat(player1: any, player2: any, prompt?: boolean | undefined, behind?: boolean | undefined, noanimate?: boolean | undefined): void; /** * @param { Player } player1 * @param { Player } [player2] */ - static swapPlayer(player: any, player2?: Player): void; + swapPlayer(player: any, player2?: any): void; /** * @param { Player } player */ - static swapControl(player: Player): void; - static swapPlayerAuto(player: any): void; + swapControl(player: any): void; + swapPlayerAuto(player: any): void; /** * @param { Player } player */ - static findNext(player: Player): import("../library/element/player.js").Player; + findNext(player: any): any; /** * @param { string } name * @param { Function } callback */ - static loadModeAsync(name: string, callback: Function): void; + loadModeAsync(name: string, callback: Function): void; /** * @param { string } name * @param {*} configx */ - static switchMode(name: string, configx: any): void; + switchMode(name: string, configx: any): void; /** * @param { string } mode */ - static loadMode(mode: string): void; + loadMode(mode: string): void; /** * @param {...string} args */ - static loadPackage(...args: string[]): void; + loadPackage(...args: string[]): void; /** * @param { Player } player */ - static phaseLoop(player: Player): void; + phaseLoop(player: any): void; /** * @param { Player } [player] */ - static gameDraw(player?: Player, num?: number): import("../library/index.js").GameEventPromise; - static chooseCharacterDouble(...args: any[]): void; - static updateRoundNumber(): void; + gameDraw(player?: any, num?: number): any; + chooseCharacterDouble(...args: any[]): void; + updateRoundNumber(): void; /** * @param { Player[] } players * @param { number | number[] | (player: Player) => number } num * @param { { drawDeck: boolean } } [drawDeck] * @param { boolean } [bottom] */ - static asyncDraw(players: Player[], num: number | number[] | ((player: Player) => number), drawDeck?: { + asyncDraw(players: Player[], num: number | number[] | ((player: any) => number), drawDeck?: { drawDeck: boolean; - }, bottom?: boolean): void; + } | undefined, bottom?: boolean | undefined): void; /** * @param { Player[] } players * @param { number | number[] | (player: Player) => number } num * @param { { drawDeck: boolean } } [drawDeck] */ - static asyncDrawAuto(players: Player[], num: number | number[] | ((player: Player) => number), drawDeck?: { + asyncDrawAuto(players: Player[], num: number | number[] | ((player: any) => number), drawDeck?: { drawDeck: boolean; - }, ...args: any[]): void; - static finishSkill(i: any, sub: any): void; - static finishCards(): void; + } | undefined, ...args: any[]): void; + finishSkill(i: any, sub: any): void; + finishCards(): void; /** * 这玩意至少19种重载了吧 */ - static checkMod(...args: any[]): any; + checkMod(...args: any[]): any; /** * @param { number } num */ - static prepareArena(num: number): void; - static clearArena(): void; - static clearConnect(): void; - static log(...args: any[]): void; + prepareArena(num: number): void; + clearArena(): void; + clearConnect(): void; + log(...args: any[]): void; /** * @param { Player } player * @param { string | Card[] } card @@ -1188,7 +1170,7 @@ export class Game extends Uninstantable { * @param { boolean } [forced] * @param { string } [logvid] */ - static logv(player: Player, card: string | Card[], targets?: Player[], event?: GameEventPromise, forced?: boolean, logvid?: string): HTMLDivElement; + logv(player: any, card: string | Card[], targets?: any[] | undefined, event?: any, forced?: boolean | undefined, logvid?: string | undefined): HTMLDivElement | undefined; /** * @param { string } storeName * @param { string } idbValidKey @@ -1196,7 +1178,7 @@ export class Game extends Uninstantable { * @param { Function } [onSuccess] * @param { Function } [onError] */ - static putDB(storeName: string, idbValidKey: string, value: any, onSuccess?: Function, onError?: Function): Promise; + putDB(storeName: string, idbValidKey: string, value: any, onSuccess?: Function | undefined, onError?: Function | undefined): Promise; /** * * @param { string } storeName @@ -1204,129 +1186,129 @@ export class Game extends Uninstantable { * @param { Function } [onSuccess] * @param { Function } [onError] */ - static getDB(storeName: string, query?: string | null, onSuccess?: Function, onError?: Function): Promise; + getDB(storeName: string, query?: string | null | undefined, onSuccess?: Function | undefined, onError?: Function | undefined): Promise; /** * @param { string } storeName * @param { string } [query] * @param { Function } [onSuccess] * @param { Function } [onError] */ - static deleteDB(storeName: string, query?: string, onSuccess?: Function, onError?: Function): Promise; + deleteDB(storeName: string, query?: string | undefined, onSuccess?: Function | undefined, onError?: Function | undefined): Promise; /** * @param { string } key * @param { * } [value] * @param { string } [mode] */ - static save(key: string, value?: any, mode?: string): void; - static showChangeLog(): void; + save(key: string, value?: any, mode?: string | undefined): void; + showChangeLog(): void; /** * @param { string } str * @param { string } [extname] */ - static showExtensionChangeLog(str: string, extname?: string): void; + showExtensionChangeLog(str: string, extname?: string | undefined): void; /** * @param { string } key * @param { * } [value] * @param { string | boolean } [local] * @param { Function } [callback] */ - static saveConfig(key: string, value?: any, local?: string | boolean, callback?: Function): void; + saveConfig(key: string, value?: any, local?: string | boolean | undefined, callback?: Function | undefined): void; /** * @param { string } key */ - static saveConfigValue(key: string): void; + saveConfigValue(key: string): void; /** * @param { string } extension * @param { string } key * @param { * } [value] */ - static saveExtensionConfig(extension: string, key: string, value?: any): void; + saveExtensionConfig(extension: string, key: string, value?: any): void; /** * @param { string } extension * @param { string } key */ - static saveExtensionConfigValue(extension: string, key: string): void; + saveExtensionConfigValue(extension: string, key: string): void; /** * @param { string } extension * @param { string } key */ - static getExtensionConfig(extension: string, key: string): any; + getExtensionConfig(extension: string, key: string): any; /** * @param { string } mode */ - static clearModeConfig(mode: string): void; + clearModeConfig(mode: string): void; /** * @param { number } position * @param { string } [character] * @param { string } [character2] */ - static addPlayer(position: number, character?: string, character2?: string): import("../library/element/player.js").Player; + addPlayer(position: number, character?: string | undefined, character2?: string | undefined): import("../library/element/player.js").Player; /** * @param { number } position * @param { string } [character] * @param { string } [animation] */ - static addFellow(position: number, character?: string, animation?: string): import("../library/element/player.js").Player; + addFellow(position: number, character?: string | undefined, animation?: string | undefined): import("../library/element/player.js").Player; /** * @param { Player } player */ - static triggerEnter(player: Player): import("../library/index.js").GameEventPromise; + triggerEnter(player: any): any; /** * @param { Player } player */ - static restorePlayer(player: Player): import("../library/element/player.js").Player; + restorePlayer(player: any): any; /** * @param { Player } player */ - static removePlayer(player: Player): import("../library/element/player.js").Player; + removePlayer(player: any): any; /** * @param { Player } player * @param { string } [character] * @param { string } [character2] */ - static replacePlayer(player: Player, character?: string, character2?: string): import("../library/element/player.js").Player; - static arrangePlayers(): void; + replacePlayer(player: any, character?: string | undefined, character2?: string | undefined): import("../library/element/player.js").Player; + arrangePlayers(): void; /** * @param { string[] } skills * @param { Player } player * @param { string[] } exclude */ - static filterSkills(skills: string[], player: Player, exclude: string[]): string[]; + filterSkills(skills: string[], player: any, exclude: string[]): string[]; /** * @param { string[] } skills */ - static expandSkills(skills: string[]): string[]; + expandSkills(skills: string[]): string[]; /** * @param { { [key:string]: any } } style */ - static css(style: { + css(style: { [key: string]: any; }): void; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static hasPlayer(func: (player: Player) => boolean, includeOut?: boolean): boolean; + hasPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): boolean; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static hasPlayer2(func: (player: Player) => boolean, includeOut?: boolean): boolean; + hasPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): boolean; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static countPlayer(func: (player: Player) => boolean, includeOut?: boolean): number; + countPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): any; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static countPlayer2(func: (player: Player) => boolean, includeOut?: boolean): number; + countPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): any; /** * @overload * @returns { Player[] } */ - static filterPlayer(): Player[]; + filterPlayer(): Player[]; /** * @overload * @param { (player: Player) => boolean } func @@ -1334,12 +1316,12 @@ export class Game extends Uninstantable { * @param { boolean } [includeOut] * @returns { Player[] } */ - static filterPlayer(func: (player: Player) => boolean, list?: Player[], includeOut?: boolean): Player[]; + filterPlayer(func: (player: any) => boolean, list?: any[] | undefined, includeOut?: boolean | undefined): Player[]; /** * @overload * @returns { Player[] } */ - static filterPlayer2(): Player[]; + filterPlayer2(): Player[]; /** * @overload * @param { (player: Player) => boolean } func @@ -1347,29 +1329,29 @@ export class Game extends Uninstantable { * @param { boolean } [includeOut] * @returns { Player[] } */ - static filterPlayer2(func: (player: Player) => boolean, list?: Player[], includeOut?: boolean): Player[]; + filterPlayer2(func: (player: any) => boolean, list?: any[] | undefined, includeOut?: boolean | undefined): Player[]; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static findPlayer(func: (player: Player) => boolean, includeOut?: boolean): import("../library/element/player.js").Player; + findPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): any; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static findPlayer2(func: (player: Player) => boolean, includeOut?: boolean): import("../library/element/player.js").Player; + findPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): any; /** * @param { (player: Player) => boolean } func * @param { boolean } [all] */ - static findCards(func: (player: Player) => boolean, all?: boolean): string[]; - static countGroup(): number; + findCards(func: (player: any) => boolean, all?: boolean | undefined): string[]; + countGroup(): any; /** * 此函数用于计算函数的时间消耗。 * @param {function} 测试的函数 * @returns {number} 消耗的时间 */ - static testRunCost(func: any): number; + testRunCost(func: any): number; /** * 此方法用于对所有targets按顺序执行一个async函数。 * @@ -1377,9 +1359,10 @@ export class Game extends Uninstantable { * @param { (player: Player, i: number) => Promise } asyncFunc 需要执行的async方法 * @param { (a: Player, b: Player) => number } sort 排序器,默认为lib.sort.seat */ - static doAsyncInOrder(targets: Player[], asyncFunc: (player: Player, i: number) => Promise, sort: (a: Player, b: Player) => number): Promise; + doAsyncInOrder(targets: Player[], asyncFunc: (player: any, i: number) => Promise, sort: (a: any, b: any) => number): Promise; } -export const game: typeof Game; +export let game: Game; +export function setGame(instance?: Game | undefined): void; export type GameHistory = { cardMove: GameEventPromise[]; custom: GameEventPromise[]; @@ -1402,8 +1385,8 @@ export type Videos = { video: Video; win: boolean; }; -import { Uninstantable } from "../util/index.js"; import { GamePromises } from "./promises.js"; import { DynamicStyle } from "./dynamic-style/index.js"; -import { Library as lib } from '../library/index.js'; +import { lib } from '../library/index.js'; +import { Check } from "./check.js"; import { delay } from "../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts index ea25d45cb..2f4e24fbc 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts @@ -1,28 +1,18 @@ -export class GamePromises extends Uninstantable { +export class GamePromises { /** - * 模仿h5的prompt,用于显示可提示用户进行输入的对话框 - * - * 注: 由于参数列表是随意的,在这里我准备限制一下这个函数的参数顺序 - * - * @type {{ - * (title: string): Promise; - * (title: string, forced: true): Promise; - * (alertOption: 'alert', title: string): Promise; - * }} - * - * @param { string } [title] 设置prompt标题与input内容 - * @param { boolean } [forced] 为true的话将没有"取消按钮" - * @param { string } alertOption 设置prompt是否模拟alert - * @example - * ```js - * // 只设置标题(但是input的初始值就变成了undefined) - * game.promises.prompt('###prompt标题').then(value => console.log(value)); - * // 设置标题和input初始内容 - * game.promises.prompt('###prompt标题###input初始内容').then(value => console.log(value)); - * ``` - * @returns { Promise } + * @overload + * @param { string } title + * @returns { Promise } */ - static prompt(alertOption: string, title?: string, forced?: boolean): Promise; + prompt(title: string): Promise; + /** + * @overload + * @param { string } title + * @param { boolean } [forced] + * @returns { Promise } + * + */ + prompt(title: string, forced?: boolean | undefined): Promise; /** * 模仿h5的alert,用于显示信息的对话框 * @@ -33,14 +23,13 @@ export class GamePromises extends Uninstantable { * ``` * @returns { Promise } */ - static alert(title: string): Promise; - static download(url: any, folder: any, dev: any, onprogress: any): Promise; - static readFile(filename: any): Promise; - static readFileAsText(filename: any): Promise; - static writeFile(data: any, path: any, name: any): Promise; - static ensureDirectory(list: any, callback: any, file: any): Promise; - static createDir(directory: any): Promise; - static removeFile(filename: any): Promise; - static removeDir(directory: any): Promise; + alert(title: string): Promise; + download(url: any, folder: any, dev: any, onprogress: any): Promise; + readFile(filename: any): Promise; + readFileAsText(filename: any): Promise; + writeFile(data: any, path: any, name: any): Promise; + ensureDirectory(list: any, callback: any, file: any): Promise; + createDir(directory: any): Promise; + removeFile(filename: any): Promise; + removeDir(directory: any): Promise; } -import { Uninstantable } from "../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts index 57e9de1ae..e2aaa5672 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts @@ -1,5 +1,6 @@ -export class Get extends Uninstantable { - static is: typeof Is; +export class Get { + is: Is; + promises: Promises; /** * 获取当前内核版本信息 * @@ -9,59 +10,59 @@ export class Get extends Uninstantable { * * @returns {["firefox" | "chrome" | "safari" | "other", number, number, number]} */ - static coreInfo(): ["firefox" | "chrome" | "safari" | "other", number, number, number]; + coreInfo(): ["firefox" | "chrome" | "safari" | "other", number, number, number]; /** * 返回 VCard[] 形式的所有牌,用于印卡将遍历 * @param {Function} filter * @returns {string[][]} */ - static inpileVCardList(filter: Function): string[][]; + inpileVCardList(filter: Function): string[][]; /** * 根据(Player的)座次数n(从1开始)获取对应的“n号位”翻译 * @param {number | Player} seat */ - static seatTranslation(seat: number | Player): string; + seatTranslation(seat: number | Player): string; /** * @param {number} numberOfPlayers * @returns {string[]} */ - static identityList(numberOfPlayers: number): string[]; + identityList(numberOfPlayers: number): string[]; /** * Generate an object URL from the Base64-encoded octet stream * * 从Base64编码的八位字节流生成对象URL */ - static objectURL(octetStream: any): any; + objectURL(octetStream: any): any; /** * Get the card name length * * 获取此牌的字数 */ - static cardNameLength(card: any, player: any): number; + cardNameLength(card: any, player: any): number; /** * Get the Yingbian conditions (of the card) * * 获取(此牌的)应变条件 */ - static yingbianConditions(card: any): string[]; - static complexYingbianConditions(card: any): string[]; - static simpleYingbianConditions(card: any): string[]; + yingbianConditions(card: any): string[]; + complexYingbianConditions(card: any): string[]; + simpleYingbianConditions(card: any): string[]; /** * Get the Yingbian effects (of the card) * * 获取(此牌的)应变效果 */ - static yingbianEffects(card: any): string[]; + yingbianEffects(card: any): string[]; /** * Get the default Yingbian effect of the card * * 获取此牌的默认应变效果 */ - static defaultYingbianEffect(card: any): any; + defaultYingbianEffect(card: any): any; /** * 优先度判断 */ - static priority(skill: any): any; + priority(skill: any): any; /** * 新装备栏相关 * @@ -73,49 +74,49 @@ export class Get extends Uninstantable { * @param { false | Player } [player] * @returns { string[] } */ - static subtypes(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string[]; + subtypes(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string[]; /** * @returns { string[] } */ - static pinyin(chinese: any, withTone: any): string[]; - static yunmu(str: any): any; + pinyin(chinese: any, withTone: any): string[]; + yunmu(str: any): any; /** * 用于将参数转换为字符串,作为缓存的key。 */ - static paramToCacheKey(...args: any[]): string; - static yunjiao(str: any): string; + paramToCacheKey(...args: any[]): string; + yunjiao(str: any): string | null; /** * @param { string } skill * @param { Player } player * @returns { string[] } */ - static skillCategoriesOf(skill: string, player: Player): string[]; - static numOf(obj: any, item: any): any; - static connectNickname(): any; - static zhinangs(filter: any): any; - static sourceCharacter(str: any): any; - static isLuckyStar(player: any): boolean; - static infoHp(hp: any): number; - static infoMaxHp(hp: any): number; - static infoHujia(hp: any): number; - static bottomCards(num: any, putBack: any): any; - static discarded(): any; - static cardOffset(): number; - static colorspan(str: any): any; - static evtprompt(next: any, str: any): void; - static autoViewAs(card: any, cards: any): import("../library/element/vcard.js").VCard; + skillCategoriesOf(skill: string, player: any): string[]; + numOf(obj: any, item: any): any; + connectNickname(): any; + zhinangs(filter: any): any; + sourceCharacter(str: any): any; + isLuckyStar(player: any): any; + infoHp(hp: any): number; + infoMaxHp(hp: any): number; + infoHujia(hp: any): number; + bottomCards(num: any, putBack: any): any; + discarded(): any; + cardOffset(): number; + colorspan(str: any): any; + evtprompt(next: any, str: any): void; + autoViewAs(card: any, cards: any): import("../library/element/vcard.js").VCard; /** * @deprecated */ - static _autoViewAs(card: any, cards: any): any; - static max(list: any, func: any, type: any): any; - static min(list: any, func: any, type: any): any; + _autoViewAs(card: any, cards: any): any; + max(list: any, func: any, type: any): any; + min(list: any, func: any, type: any): any; /** * @overload * @param { string } name * @returns { Character } */ - static character(name: string): Character; + character(name: string): Character; /** * @template { 0 | 1 | 2 | 3 | 4 } T * @overload @@ -123,24 +124,30 @@ export class Get extends Uninstantable { * @param { T } num * @returns { Character[T] } */ - static character(name: string, num: T): Character[T]; - static characterInitFilter(name: any): string[]; - static characterIntro(name: any): any; - static bordergroup(info: any, raw: any): any; - static groupnature(group: any, method: any): any; - static sgn(num: any): 0 | 1 | -1; - static rand(num: any, num2: any): any; - static sort(arr: any, method: any, arg: any): any; - static sortSeat(arr: any, target: any): any; - static zip(callback: any): void; - static delayx(num: any, max: any): number; - static prompt(skill: any, target: any, player: any): string; - static prompt2(skill: any, target: any, player: any, ...args: any[]): any; - static url(master: any): string; - static round(num: any, f: any): number; - static playerNumber(): number; - static benchmark(func1: any, func2: any, iteration: any, arg: any): number; - static stringify(obj: any, level: any): any; + character(name: string, num: T): Character[T]; + characterInitFilter(name: any): string[]; + characterIntro(name: any): any; + bordergroup(info: any, raw: any): any; + groupnature(group: any, method: any): any; + sgn(num: any): 0 | 1 | -1; + rand(num: any, num2: any): any; + sort(arr: any, method: any, arg: any): any; + sortSeat(arr: any, target: any): any; + /** + * @param { (zip: JSZip) => any } callback + */ + zip(callback: (zip: JSZip) => any): void; + delayx(num: any, max: any): number; + prompt(skill: any, target: any, player: any): string; + prompt2(skill: any, target: any, player: any, ...args: any[]): string; + url(master: any): string; + round(num: any, f: any): number; + playerNumber(): number; + benchmark(func1: any, func2: any, iteration: any, arg: any): number | undefined; + /** + * @param {any} obj + */ + stringify(obj: any, level?: number): any; /** * 深拷贝函数(虽然只处理了部分情况) * @@ -152,25 +159,25 @@ export class Get extends Uninstantable { * @param {WeakMap} [map] - 拷贝用的临时存储,用于处理循环引用(请勿自行赋值) * @returns {T} - 深拷贝后的对象,若传入值不是对象则为传入值 */ - static copy(obj: T_1, copyKeyDeep?: boolean, map?: WeakMap): T_1; - static inpilefull(type: any): { + copy(obj: T_1, copyKeyDeep?: boolean | undefined, map?: WeakMap | undefined): T_1; + inpilefull(type: any): { name: any; suit: any; number: any; nature: any; }[]; - static inpile(type: any, filter: any): any[]; - static inpile2(type: any): any[]; - static typeCard(type: any, filter: any): string[]; - static libCard(filter: any): string[]; - static ip(): string; - static modetrans(config: any, server: any): string; - static charactersOL(func: any): number[]; - static trimip(str: any): any; - static mode(): any; - static idDialog(id: any): import("../library/element/dialog.js").Dialog; - static arenaState(): { - number: string; + inpile(type: any, filter: any): any[]; + inpile2(type: any): any[]; + typeCard(type: any, filter: any): string[]; + libCard(filter: any): string[]; + ip(): any; + modetrans(config: any, server: any): string; + charactersOL(func: any): number[]; + trimip(str: any): any; + mode(): any; + idDialog(id: any): any; + arenaState(): { + number: string | undefined; players: {}; mode: any; dying: any[]; @@ -181,312 +188,313 @@ export class Get extends Uninstantable { inpile_nature: any[]; renku: any[]; }; - static skillState(player: any): { + skillState(player: any): { global: string[]; }; - static id(): string; - static zhu(player: any, skill: any, group: any): any; - static config(item: any, mode: any): any; - static coinCoeff(list: any): number; - static rank(name: any, num: any): number | "x" | "s" | "b" | "c" | "d" | "a" | "ap" | "am" | "bp" | "bm" | "sp"; - static skillRank(skill: any, type: any, grouped: any): number; - static targetsInfo(targets: any): any[]; - static infoTargets(infos: any): import("../library/element/player.js").Player[]; - static cardInfo(card: any): any[]; - static cardsInfo(cards?: any[]): any[][]; - static infoCard(info: any): import("../library/element/card.js").Card; - static infoCards(infos: any): import("../library/element/card.js").Card[]; - static cardInfoOL(card: any): string; - static infoCardOL(info: any): any; - static cardsInfoOL(cards: any): string[]; - static infoCardsOL(infos: any): any[]; - static playerInfoOL(player: any): string; - static infoPlayerOL(info: any): any; - static playersInfoOL(players: any): string[]; - static infoPlayersOL(infos: any): any[]; - static funcInfoOL(func: any): any; - static infoFuncOL(info: any): any; - static eventInfoOL(item: any, level: any, noMore: any): string; + id(): string; + zhu(player: any, skill: any, group: any): any; + config(item: any, mode: any): any; + coinCoeff(list: any): number; + rank(name: any, num: any): number | "x" | "s" | "c" | "d" | "b" | "a" | "ap" | "am" | "bp" | "bm" | "sp"; + skillRank(skill: any, type: any, grouped: any): number; + targetsInfo(targets: any): any[]; + infoTargets(infos: any): any[]; + cardInfo(card: any): any[]; + cardsInfo(cards?: any[]): any[][]; + infoCard(info: any): import("../library/element/card.js").Card; + infoCards(infos: any): import("../library/element/card.js").Card[]; + cardInfoOL(card: any): string; + infoCardOL(info: any): any; + cardsInfoOL(cards: any): string[]; + infoCardsOL(infos: any): any[]; + playerInfoOL(player: any): string; + infoPlayerOL(info: any): any; + playersInfoOL(players: any): string[]; + infoPlayersOL(infos: any): any[]; + funcInfoOL(func: any): any; + infoFuncOL(info: any): any; + eventInfoOL(item: any, level: any, noMore: any): string; /** * @param {string} item */ - static infoEventOL(item: string): string | import("../library/element/gameEvent.js").GameEvent; - static stringifiedResult(item: any, level: any, nomore: any): any; - static parsedResult(item: any): any; - static verticalStr(str: any, sp: any): string; - static numStr(num: any, method: any): any; - static rawName(str: any): any; + infoEventOL(item: string): import("../library/element/gameEvent.js").GameEvent; + stringifiedResult(item: any, level: any, nomore: any): any; + parsedResult(item: any): any; + verticalStr(str: any, sp: any): string; + numStr(num: any, method: any): any; + rawName(str: any): any; /** * 作用修改:只读前缀 不读_ab */ - static rawName2(str: any): any; - static slimNameHorizontal(str: any): any; + rawName2(str: any): any; + slimNameHorizontal(str: any): any; /** * @param {string} prefix * @param {string} name * @returns {string} */ - static prefixSpan(prefix: string, name: string): string; - static slimName(str: any): string; - static time(): number; - static utc(): number; - static evtDistance(e1: any, e2: any): number; - static xyDistance(from: any, to: any): number; + prefixSpan(prefix: string, name: string): string; + slimName(str: any): string; + time(): number; + utc(): number; + evtDistance(e1: any, e2: any): number; + xyDistance(from: any, to: any): number; /** * @overload * @returns { void } */ - static itemtype(): void; + itemtype(): void; /** * @overload * @param { string } obj * @returns { 'position' | 'natures' | 'nature' } */ - static itemtype(obj: string): 'position' | 'natures' | 'nature'; + itemtype(obj: string): 'position' | 'natures' | 'nature'; /** * @overload * @param { Player[] } obj * @returns { 'players' } */ - static itemtype(obj: Player[]): 'players'; + itemtype(obj: Player[]): 'players'; /** * @overload * @param { Card[] } obj * @returns { 'cards' } */ - static itemtype(obj: Card[]): 'cards'; + itemtype(obj: Card[]): 'cards'; /** * @overload * @param { [number, number] } obj * @returns { 'select' } */ - static itemtype(obj: [number, number]): 'select'; + itemtype(obj: [number, number]): 'select'; /** * @overload * @param { [number, number, number, number] } obj * @returns { 'divposition' } */ - static itemtype(obj: [number, number, number, number]): 'divposition'; + itemtype(obj: [number, number, number, number]): 'divposition'; /** * @overload * @param { Button } obj * @returns { 'button' } */ - static itemtype(obj: Button): 'button'; + itemtype(obj: any): 'button'; /** * @overload * @param { Card } obj * @returns { 'card' } */ - static itemtype(obj: Card): 'card'; + itemtype(obj: any): 'card'; /** * @overload * @param { Player } obj * @returns { 'player' } */ - static itemtype(obj: Player): 'player'; + itemtype(obj: any): 'player'; /** * @overload * @param { Dialog } obj * @returns { 'dialog' } */ - static itemtype(obj: Dialog): 'dialog'; + itemtype(obj: any): 'dialog'; /** * @overload * @param { GameEvent | GameEventPromise } obj * @returns { 'event' } */ - static itemtype(obj: GameEvent | GameEventPromise): 'event'; - static equipNum(card: any): number; - static objtype(obj: any): "object" | "div" | "array" | "table" | "tr" | "td" | "fragment"; - static type(obj: any, method: any, player: any): any; - static type2(card: any, player: any): any; + itemtype(obj: GameEvent | GameEventPromise): 'event'; + equipNum(card: any): number; + objtype(obj: any): "div" | "object" | "array" | "table" | "tr" | "td" | "fragment" | undefined; + type(obj: any, method: any, player: any): any; + type2(card: any, player: any): any; /** * * @param { string | Card | VCard | CardBaseUIData } obj * @param { false | Player } [player] * @returns { string } */ - static subtype(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string; - static equiptype(card: any, player: any): number; + subtype(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string; + equiptype(card: any, player: any): number; /** * * @param { Card | VCard | CardBaseUIData } card * @param { false | Player } [player] * @returns { string } */ - static name(card: Card | VCard | CardBaseUIData, player?: false | Player): string; + name(card: Card | VCard | CardBaseUIData, player?: false | Player): string; /** * @param {Card | VCard | Card[] | VCard[]} card * @param {false | Player} [player] * @returns {string} */ - static suit(card: Card | VCard | Card[] | VCard[], player?: false | Player): string; + suit(card: Card | VCard | Card[] | VCard[], player?: false | Player): string; /** * @param {Card | VCard | Card[] | VCard[]} card * @param {false | Player} [player] * @returns {string} */ - static color(card: Card | VCard | Card[] | VCard[], player?: false | Player): string; + color(card: Card | VCard | Card[] | VCard[], player?: false | Player): string; /** * @param {Card | VCard} card * @param {false | Player} [player] * @returns {number} */ - static number(card: Card | VCard, player?: false | Player): number; + number(card: Card | VCard, player?: false | Player): number; /** * 返回一张杀的属性。如有多种属性则用`lib.natureSeparator`分割开来。例:火雷【杀】的返回值为`fire|thunder` * @param {string | string[] | Card | VCard} card * @param {false | Player} [player] * @returns {string} */ - static nature(card: string | string[] | Card | VCard, player?: false | Player): string; + nature(card: string | string[] | Card | VCard, player?: false | Player): string; /** * 返回包含所有属性的数组 * @param {string[] | string} card * @param {false | Player} [player] * @returns {string[]} */ - static natureList(card: string[] | string, player?: false | Player): string[]; - static cards(num: any, putBack: any): any; - static judge(card: any): any; - static judge2(card: any): any; - static distance(from: any, to: any, method: any): number; + natureList(card: string[] | string, player?: false | Player): string[]; + cards(num: any, putBack: any): any; + judge(card: any): any; + judge2(card: any): any; + distance(from: any, to: any, method: any): number; /** * @overload * @param { string } item * @returns { Skill } */ - static info(item: string): Skill; + info(item: string): Skill; /** * @overload * @param { Card | VCard | CardBaseUIData } item * @param { Player | false } [player] * @returns { any } */ - static info(item: Card | VCard | CardBaseUIData, player?: Player | false): any; + info(item: Card | VCard | CardBaseUIData, player?: Player | false): any; /** * @param { number | Select | (()=>Select) } [select] * @returns { Select } */ - static select(select?: number | Select | (() => Select)): Select; - static card(original: any): any; + select(select?: number | Select | (() => Select) | undefined): Select; + card(original: any): any; /** * @overload * @returns {GameEvent} */ - static event(): GameEvent; + event(): any; /** * @template { keyof GameEvent } T * @overload * @param {T} key * @returns {GameEvent[T]} */ - static event(key: T_2): import("../library/element/gameEvent.js").GameEvent[T_2]; - static player(): import("../library/element/player.js").Player; - static players(sort: any, dead: any, out: any): import("../library/element/player.js").Player[]; - static position(card: any, ordering: any): number | "x" | "s" | "e" | "j" | "h" | "c" | "d" | "o"; - static skillTranslation(str: any, player: any): string; - static skillInfoTranslation(name: any, player: any): any; + event(key: T_2): any; + player(): any; + players(sort: any, dead: any, out: any): any[]; + position(card: any, ordering: any): number | "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o" | null | undefined; + skillTranslation(str: any, player: any): string; + skillInfoTranslation(name: any, player: any): any; /** * @returns {string} */ - static translation(str: any, arg: any): string; - static menuZoom(): any; - static strNumber(num: any): any; - static cnNumber(num: any, ordinal: any): any; + translation(str: any, arg: any): string; + menuZoom(): any; + strNumber(num: any): any; + cnNumber(num: any, ordinal: any): any; /** * 遍历子元素 * @param {HTMLElement} node * @returns {Iterable} 迭代器 */ - static iterableChildNodes(node: HTMLElement, ...args: any[]): Iterable; + iterableChildNodes(node: HTMLElement, ...args: any[]): Iterable; /** * @param {((a: Button, b: Button) => number)} [sort] 排序函数 * @returns { Button[] } */ - static selectableButtons(sort?: (a: Button, b: Button) => number): Button[]; + selectableButtons(sort?: ((a: any, b: any) => number) | undefined): Button[]; /** * @param {((a: Card, b: Card) => number)} [sort] 排序函数 * @returns { Card[] } */ - static selectableCards(sort?: (a: Card, b: Card) => number): Card[]; + selectableCards(sort?: ((a: any, b: any) => number) | undefined): Card[]; /** * @returns { string[] } 技能名数组 */ - static skills(): string[]; - static gainableSkills(func: any, player: any): any[]; - static gainableSkillsName(name: any, func: any): any[]; - static gainableCharacters(func: any): string[]; + skills(): string[]; + gainableSkills(func: any, player: any): any[]; + gainableSkillsName(name: any, func: any): any[]; + gainableCharacters(func: any): string[]; /** * @param {((a: Player, b: Player) => number)} [sort] 排序函数 * @returns { Player[] } */ - static selectableTargets(sort?: (a: Player, b: Player) => number): Player[]; - static filter(filter: any, i: any): any; - static cardCount(card: any, player: any): any; - static skillCount(skill: any, player: any): any; - static owner(card: any, method: any): import("../library/element/player.js").Player; - static noSelected(): boolean; - static population(identity: any): number; - static totalPopulation(identity: any): number; + selectableTargets(sort?: ((a: any, b: any) => number) | undefined): Player[]; + filter(filter: any, i: any): any; + cardCount(card: any, player: any): any; + skillCount(skill: any, player: any): any; + owner(card: any, method: any): any; + noSelected(): boolean; + population(identity: any): number; + totalPopulation(identity: any): number; /** * @param { Card | VCard } item */ - static cardtag(item: Card | VCard, tag: any): any; - static tag(item: any, tag: any, item2: any, bool: any): any; - static sortCard(sort: any): (card: any) => any; - static difficulty(): 2 | 1 | 3; - static cardPile(name: any, create: any): any; - static cardPile2(name: any): any; - static discardPile(name: any): any; - static aiStrategy(): 2 | 1 | 3 | 4 | 5 | 6; - static skillintro(name: any, learn: any, learn2: any): string; - static intro(name: any): string; - static storageintro(type: any, content: any, player: any, dialog: any, skill: any): any; - static nodeintro(node: any, simple: any, evt: any): import("../library/element/dialog.js").Dialog; - static linkintro(dialog: any, content: any, player: any): void; - static groups(): string[]; - static types(): any[]; - static links(buttons: any): any[]; - static threaten(target: any, player: any, hp: any): number; - static condition(player: any): any; - static attitude(from: any, to: any, ...args: any[]): any; - static sgnAttitude(...args: any[]): 0 | 1 | -1; - static useful_raw(card: any, player: any): any; - static useful(card: any, player: any): any; - static unuseful(card: any): number; - static unuseful2(card: any): number; - static unuseful3(card: any): number; - static value(card: any, player: any, method: any): any; - static equipResult(player: any, target: any, name: any): number; - static equipValue(card: any, player: any): number; - static equipValueNumber(card: any): number; - static disvalue(card: any, player: any): number; - static disvalue2(card: any, player: any): number; - static skillthreaten(skill: any, player: any, target: any): number | void; - static cacheOrder(item: any): number; + cardtag(item: Card | VCard, tag: any): any; + tag(item: any, tag: any, item2: any, bool: any): any; + sortCard(sort: any): ((card: any) => any) | undefined; + difficulty(): 2 | 1 | 3; + cardPile(name: any, create: any): any; + cardPile2(name: any): any; + discardPile(name: any): any; + aiStrategy(): 2 | 1 | 3 | 4 | 5 | 6; + skillintro(name: any, learn: any, learn2: any): string; + intro(name: any): string; + storageintro(type: any, content: any, player: any, dialog: any, skill: any): any; + nodeintro(node: any, simple: any, evt: any): import("../library/element/dialog.js").Dialog | undefined; + linkintro(dialog: any, content: any, player: any): void; + groups(): string[]; + types(): any[]; + links(buttons: any): any[]; + threaten(target: any, player: any, hp: any): number; + condition(player: any): any; + attitude(from: any, to: any, ...args: any[]): any; + sgnAttitude(...args: any[]): 0 | 1 | -1; + useful_raw(card: any, player: any): any; + useful(card: any, player: any): any; + unuseful(card: any): number; + unuseful2(card: any): number; + unuseful3(card: any): number; + value(card: any, player: any, method: any): any; + equipResult(player: any, target: any, name: any): number; + equipValue(card: any, player: any): any; + equipValueNumber(card: any): any; + disvalue(card: any, player: any): number; + disvalue2(card: any, player: any): number; + skillthreaten(skill: any, player: any, target: any): number | void; + cacheOrder(item: any): number; /** * @returns { number } */ - static order(item: any, player?: import("../library/element/player.js").Player): number; - static result(item: any, skill: any): any; - static cacheEffectUse(target: any, card: any, player: any, player2: any, isLink: any): number; - static effect_use(target: any, card: any, player: any, player2: any, isLink: any): number; - static cacheEffect(target: any, card: any, player: any, player2: any, isLink: any): number; - static effect(target: any, card: any, player: any, player2: any, isLink: any): number; - static damageEffect(target: any, player: any, viewer: any, nature: any): any; + order(item: any, player?: any): number; + result(item: any, skill: any): any; + cacheEffectUse(target: any, card: any, player: any, player2: any, isLink: any): number; + effect_use(target: any, card: any, player: any, player2: any, isLink: any): number; + cacheEffect(target: any, card: any, player: any, player2: any, isLink: any): number; + effect(target: any, card: any, player: any, player2: any, isLink: any): number; + damageEffect(target: any, player: any, viewer: any, nature: any): any; /** * * @param {any} source 如果参数是function,执行此函数并返回结果,传参为此方法剩余的参数。如果参数不是function,直接返回结果。 * @returns 返回的结果 */ - static dynamicVariable(source: any, ...args: any[]): any; - static recoverEffect(target: any, player: any, viewer: any): number; - static buttonValue(button: any): number; - static attitude2(to: any): any; + dynamicVariable(source: any, ...args: any[]): any; + recoverEffect(target: any, player: any, viewer: any): number; + buttonValue(button: any): number; + attitude2(to: any): any; } -export const get: typeof Get; -export { Is }; -import { Uninstantable } from "../util/index.js"; +export let get: Get; +export function setGet(instance?: Get | undefined): void; import { Is } from "./is.js"; +import { Promises } from "./promises.js"; +export { Is, Promises }; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts index 59caba09a..45add36bd 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts @@ -1,89 +1,89 @@ -export class Is extends Uninstantable { +export class Is { /** * 判断是否为进攻坐骑 * @param { Card | VCard } card * @param { false | Player } [player] * @returns { boolean } */ - static attackingMount(card: Card | VCard, player?: false | Player): boolean; + attackingMount(card: Card | VCard, player?: false | Player): boolean; /** * 判断是否为防御坐骑 * @param { Card | VCard } card * @param { false | Player } [player] * @returns { boolean } */ - static defendingMount(card: Card | VCard, player?: false | Player): boolean; + defendingMount(card: Card | VCard, player?: false | Player): boolean; /** * 判断坐骑栏是否被合并 * @returns { boolean } */ - static mountCombined(): boolean; + mountCombined(): boolean; /** * 判断传入的参数的属性是否相同(参数可以为卡牌、卡牌信息、属性等) * @param {...} infos 要判断的属性列表 * @param {boolean} every 是否判断每一个传入的属性是否完全相同而不是存在部分相同 */ - static sameNature(...args: any[]): boolean; + sameNature(...args: any[]): boolean; /** * 判断传入的参数的属性是否不同(参数可以为卡牌、卡牌信息、属性等) * @param ...infos 要判断的属性列表 * @param every {boolean} 是否判断每一个传入的属性是否完全不同而不是存在部分不同 */ - static differentNature(...args: any[]): boolean; + differentNature(...args: any[]): boolean; /** * 判断一张牌是否为明置手牌 * @param { Card } card */ - static shownCard(card: Card): boolean; + shownCard(card: any): boolean; /** * 是否是虚拟牌 * @param { Card | VCard } card */ - static virtualCard(card: Card | VCard): boolean; + virtualCard(card: Card | VCard): boolean; /** * 是否是转化牌 * @param { Card | VCard } card */ - static convertedCard(card: Card | VCard): boolean; + convertedCard(card: Card | VCard): boolean; /** * 是否是实体牌 * @param { Card | VCard } card */ - static ordinaryCard(card: Card | VCard): boolean; + ordinaryCard(card: Card | VCard): any; /** * 押韵判断 * @param { string } str1 * @param { string } str2 */ - static yayun(str1: string, str2: string): boolean; + yayun(str1: string, str2: string): boolean; /** * @param { string } skill 技能id * @param { Player } player 玩家 * @returns */ - static blocked(skill: string, player: Player): boolean; + blocked(skill: string, player: any): boolean; /** * 是否是双势力武将 * @param { string } name * @param { string[] } array * @returns { boolean | string[] } */ - static double(name: string, array: string[]): boolean | string[]; + double(name: string, array: string[]): boolean | string[]; /** * Check if the card has a Yingbian condition * * 检测此牌是否具有应变条件 * @param { Card | VCard } card */ - static yingbianConditional(card: Card | VCard): boolean; + yingbianConditional(card: Card | VCard): boolean; /** * @param { Card | VCard } card */ - static complexlyYingbianConditional(card: Card | VCard): boolean; + complexlyYingbianConditional(card: Card | VCard): boolean; /** * @param { Card | VCard } card */ - static simplyYingbianConditional(card: Card | VCard): boolean; + simplyYingbianConditional(card: Card | VCard): boolean; /** * Check if the card has a Yingbian effect * @@ -91,104 +91,103 @@ export class Is extends Uninstantable { * * @param { Card | VCard } card */ - static yingbianEffective(card: Card | VCard): boolean; + yingbianEffective(card: Card | VCard): boolean; /** * @param { Card | VCard } card */ - static yingbian(card: Card | VCard): boolean; + yingbian(card: Card | VCard): boolean; /** * @param { string } [substring] */ - static emoji(substring?: string): boolean; + emoji(substring?: string | undefined): boolean; /** * @param { string } str */ - static banWords(str: string): boolean; + banWords(str: string): boolean; /** * @param { GameEventPromise } event */ - static converted(event: GameEventPromise): boolean; - static safari(): boolean; + converted(event: any): boolean; + safari(): boolean; /** * @param { (Card | VCard)[]} cards */ - static freePosition(cards: (Card | VCard)[]): boolean; + freePosition(cards: (Card | VCard)[]): boolean; /** * @param { string } name * @param { boolean } item */ - static nomenu(name: string, item: boolean): boolean; - static altered(skillName: any): boolean; + nomenu(name: string, item: boolean): boolean; + altered(skillName: any): boolean; /** * @param { any } obj * @returns { boolean } */ - static node(obj: any): boolean; + node(obj: any): boolean; /** * @param { any } obj */ - static div(obj: any): boolean; + div(obj: any): boolean; /** * @param { any } obj */ - static map(obj: any): boolean; + map(obj: any): boolean; /** * @param { any } obj */ - static set(obj: any): boolean; + set(obj: any): boolean; /** * @param { any } obj */ - static object(obj: any): boolean; + object(obj: any): boolean; /** * @overload * @param { Function } func * @returns { false } */ - static singleSelect(func: Function): false; + singleSelect(func: Function): false; /** * @overload * @param { number | [number, number] } func * @returns { boolean } */ - static singleSelect(func: number | [number, number]): boolean; + singleSelect(func: number | [number, number]): boolean; /** * @param { string | Player } name */ - static jun(name: string | Player): boolean; - static versus(): boolean; - static changban(): boolean; - static single(): boolean; + jun(name: string | Player): boolean; + versus(): boolean; + changban(): boolean; + single(): boolean; /** * @param { Player } [player] */ - static mobileMe(player?: Player): boolean; - static newLayout(): boolean; - static phoneLayout(): boolean; - static singleHandcard(): any; + mobileMe(player?: any): any; + newLayout(): boolean; + phoneLayout(): boolean; + singleHandcard(): any; /** * @param { Player } player */ - static linked2(player: Player): boolean; + linked2(player: any): boolean; /** * @param { {} } obj */ - static empty(obj: {}): boolean; + empty(obj: {}): boolean; /** * @param { string } str */ - static pos(str: string): boolean; + pos(str: string): boolean; /** * @param { string } skill * @param { Player } player * @returns */ - static locked(skill: string, player: Player): any; + locked(skill: string, player: any): any; /** * @param { string } skill * @param { Player } player * @returns */ - static zhuanhuanji(skill: string, player: Player): boolean; + zhuanhuanji(skill: string, player: any): boolean; } -import { Uninstantable } from "../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/get/promises.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/get/promises.d.ts new file mode 100644 index 000000000..ac2e2754e --- /dev/null +++ b/node_modules/@types/noname-typings/nonameModules/noname/get/promises.d.ts @@ -0,0 +1,6 @@ +export class Promises { + /** + * @returns { Promise } + */ + zip(): Promise; +} diff --git a/node_modules/@types/noname-typings/nonameModules/noname/gnc/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/gnc/index.d.ts index 1a367b43b..b2143da90 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/gnc/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/gnc/index.d.ts @@ -1,12 +1,12 @@ -export class GNC extends Uninstantable { +export class GNC { /** * @param {GeneratorFunction} fn * @returns */ - static of(fn: GeneratorFunction): (...args: any[]) => Promise>; - static is: typeof Is; + of(fn: GeneratorFunction): (...args: any[]) => Promise>; + is: Is; } -export const gnc: typeof GNC; -import { Uninstantable } from "../util/index.js"; +export let gnc: GNC; +export function setGNC(instance?: GNC | undefined): void; import { GeneratorFunction } from "../util/index.js"; import { Is } from "./is.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/gnc/is.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/gnc/is.d.ts index eacd29580..146f217fa 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/gnc/is.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/gnc/is.d.ts @@ -1,18 +1,17 @@ -export class Is extends Uninstantable { +export class Is { /** * @param {*} item * @returns {boolean} */ - static coroutine(item: any): boolean; + coroutine(item: any): boolean; /** * @param {*} item * @returns {boolean} */ - static generatorFunc(item: any): boolean; + generatorFunc(item: any): boolean; /** * @param {*} item * @returns {boolean} */ - static generator(item: any): boolean; + generator(item: any): boolean; } -import { Uninstantable } from "../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/init/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/init/index.d.ts index 51456cf8c..eed360421 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/init/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/init/index.d.ts @@ -1,4 +1,4 @@ -export function canUseHttpProtocol(): boolean; +export function canUseHttpProtocol(): any; /** * 传递升级完成的信息 * @returns { string | void } 返回一个网址 diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/announce/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/announce/index.d.ts index 8e4af684b..34bc22c4b 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/announce/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/announce/index.d.ts @@ -1,53 +1,78 @@ -import { NonameAnnounceType } from "./interface.d.ts" - -export interface IAnnounceSubscriber { - subscribe(name: string): void; - unsubscribe(name: string): void; - - get isEmpty(): boolean -} - -export type AnnounceSubscriberType = new ( - content: (value: T, name: string) => void, - target: EventTarget -) => IAnnounceSubscriber; - +/** + * @template T + * @typedef {import("./index").AnnounceSubscriberType} AnnounceSubscriberType + */ +/** + * @typedef {import("./index").IAnnounceSubscriber} IAnnounceSubscriber + */ +/** + * + */ export class Announce { - constructor(eventTarget: EventTarget, records: WeakMap<((arg0: any) => void), IAnnounceSubscriber>, SubscriberType: AnnounceSubscriberType = AnnounceSubscriber) - - /** - * 推送任意数据给所有监听了指定事件的订阅者,并返回给定的数据 - * - * 若不存在订阅指定事件的订阅者,则推送的数据将无意义 - * - * @param name - 要推送事件的名称 - * @param values - 要推送的数据 - */ - publish(name: Name, values: Parameters[0]): Parameters[0] - - /** - * 订阅给定名字的事件,并返回给定的函数 - * - * 在事件触发时执行给定的函数 - * - * 给定的函数将被存储至当前实例中,用于取消订阅时获取 - * - * @param name - 要订阅事件的名称 - * @param method - 事件触发时执行的函数 - */ - subscribe(name: Name, method: Type[Name]): Type[Name] - - /** - * 取消指定事件某一个函数的订阅,并返回该函数 - * - * 给定的函数将不再于事件触发时执行,其余同事件需触发的函数不受限制 - * - * @param name - 要取消订阅事件的名称 - * @param method - 订阅指定事件的函数 - */ - unsubscribe(name: Name, method: Type[Name]): Type[Name] + /** + * + * @param {EventTarget} eventTarget + * @param {WeakMap} records + * @param {AnnounceSubscriberType} [SubscriberType] + */ + constructor(eventTarget: EventTarget, records: WeakMap<(arg0: any) => void, IAnnounceSubscriber>, SubscriberType?: AnnounceSubscriberType | undefined); + /** + * 推送任意数据给所有监听了指定事件的订阅者,并返回给定的数据 + * + * 若不存在订阅指定事件的订阅者,则推送的数据将无意义 + * + * @template T + * @param {string} name - 要推送事件的名称 + * @param {T} values - 要推送的数据 + * @returns {T} + */ + publish(name: string, values: T): T; + /** + * 订阅给定名字的事件,并返回给定的函数 + * + * 在事件触发时执行给定的函数 + * + * 给定的函数将被存储至当前实例中,用于取消订阅时获取 + * + * @template T + * @param {string} name - 要订阅事件的名称 + * @param {(values: T) => void} method - 事件触发时执行的函数 + * @returns {(values: T) => void} + */ + subscribe(name: string, method: (values: T_1) => void): (values: T_1) => void; + /** + * 取消指定事件某一个函数的订阅,并返回该函数 + * + * 给定的函数将不再于事件触发时执行,其余同事件需触发的函数不受限制 + * + * @template T + * @param {string} name - 要取消订阅事件的名称 + * @param {(values: T) => void} method - 订阅指定事件的函数 + * @returns {(values: T) => void} + */ + unsubscribe(name: string, method: (values: T_2) => void): (values: T_2) => void; + #private; } - -export class AnnounceSubscriber implements IAnnounceSubscriber { - constructor(content: (value: T, name: string) => void, target: EventTarget) +/** + * @template T + */ +export class AnnounceSubscriber { + /** + * + * @param {function(T, string): void} content + * @param {EventTarget} target + */ + constructor(content: (arg0: T, arg1: string) => void, target: EventTarget); + get isEmpty(): boolean; + /** + * @param {string} name + */ + subscribe(name: string): void; + /** + * @param {string} name + */ + unsubscribe(name: string): void; + #private; } +export type AnnounceSubscriberType = import("./index").AnnounceSubscriberType; +export type IAnnounceSubscriber = import("./index").IAnnounceSubscriber; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/announce/interface.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/announce/interface.d.ts deleted file mode 100644 index 329a6be84..000000000 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/announce/interface.d.ts +++ /dev/null @@ -1,54 +0,0 @@ - -export interface NonameAnnounceType { - // Apperaence 外观区域 - // 用于关于无名杀外观方面的通知 - - // Apperaence.Theme 无名杀主题区域 - /** - * 主题正在被切换时通知 - * - * @param values - 主题名称 - */ - "Noname.Apperaence.Theme.onChanging": AnnounceFunction - - /** - * 主题被切换时通知 - * - * @param values - 主题名称 - */ - "Noname.Apperaence.Theme.onChanged": AnnounceFunction - - /** - * 主题被切换时,已经显示完毕后通知 - * - * @param values - 主题名称 - */ - "Noname.Apperaence.Theme.onChangeFinished": AnnounceFunction - - // Game 游戏区域 - // 包含游戏对局下的通知 - - // Game.Event 事件区域 - /** - * 当游戏对局开始时进行通知 - * - * @param values - 空对象 - */ - "Noname.Game.Event.GameStart": AnnounceFunction<{}> - - - // Init 初始化区域 - // 用于关于初始化方面的通知 - - // Init.Extension 扩展初始化区域 - /** - * 当扩展初始化完成时通知 - * - * @param values - 扩展名称 - */ - "Noname.Init.Extension.onLoad": AnnounceFunction - - -} - -export type AnnounceFunction = (values: T) => void diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/cache/cacheContext.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/cache/cacheContext.d.ts index 14c9cd09a..1e90c9af0 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/cache/cacheContext.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/cache/cacheContext.d.ts @@ -33,14 +33,14 @@ export class CacheContext { * @param {Array} methods * @returns */ - static inject(source: any, methods: Array): any; + static inject(source: any, methods: Array): null | undefined; static _getCacheValueFromObject(storage: any, key: any, params: any, source: any, func: any): any; static _ensureMember(obj: any, key: any): any; static _wrapParametersToCacheKey(params: any): string; static _wrapParameterToCacheKey(param: any): any; - lib: typeof Library; - game: typeof Game; - get: typeof Get; + lib: import("../index.js").Library; + game: import("../../game/index.js").Game; + get: import("../../get/index.js").Get; sourceMap: Map; storageMap: Map; /** @@ -59,6 +59,3 @@ export class CacheContext { */ _createCacheProxy(delegateObject: T): T; } -import { Library } from "../index.js"; -import { Game } from "../../game/index.js"; -import { Get } from "../../get/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/channel/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/channel/index.d.ts index a929b8a42..2631e4630 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/channel/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/channel/index.d.ts @@ -9,7 +9,7 @@ export class Channel { /** * @type {PromiseResolve | [T, PromiseResolve] | null} */ - _buffer: ((value?: T | PromiseLike) => void) | [T, (value?: void | PromiseLike) => void]; + _buffer: ((value?: T | PromiseLike | undefined) => void) | [T, (value?: void | PromiseLike | undefined) => void] | null; /** * 向该频道发送消息,在消息未被接受前将等待 * diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts index 7e360e942..58f5afd4d 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts @@ -6,8 +6,12 @@ export class Button extends HTMLDivElement { * @param {true} [noClick] * @param { Button } [button] */ - constructor(item: {}, type: "character" | "tdnodes" | "blank" | "card" | "vcard" | "characterx" | "player" | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button), position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button); + constructor(item: {}, type: "character" | "tdnodes" | "blank" | "card" | "vcard" | "characterx" | "player" | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button), position?: HTMLDivElement | DocumentFragment | undefined, noClick?: true | undefined, button?: Button | undefined); + /** + * @type { string | undefined } + */ + buttonid: string | undefined; exclude(): void; get updateTransform(): (bool: any, delay: any) => void; } -import { UI as ui } from '../../ui/index.js'; +import { ui } from '../../ui/index.js'; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts index 649da9a72..cce666e53 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts @@ -2,12 +2,12 @@ export class Card extends HTMLDivElement { /** * @param {HTMLDivElement|DocumentFragment} [position] */ - constructor(position?: HTMLDivElement | DocumentFragment); + constructor(position?: HTMLDivElement | DocumentFragment | undefined); /** * @param {'noclick'} [info] * @param {true} [noclick] */ - build(info?: 'noclick', noclick?: true): this; + build(info?: "noclick" | undefined, noclick?: true | undefined): this; buildEventListener(info: any): void; buildProperty(): void; /** @@ -38,8 +38,8 @@ export class Card extends HTMLDivElement { willBeDestroyed(targetPosition: any, player: any, event: any): any; hasNature(nature: any, player: any): boolean; addNature(nature: any): string; - nature: string; - removeNature(nature: any): string; + nature: string | undefined; + removeNature(nature: any): string | undefined; addGaintag(gaintag: any): void; removeGaintag(tag: any): void; hasGaintag(tag: any): boolean; @@ -57,10 +57,10 @@ export class Card extends HTMLDivElement { name: string; nature: string; }): this; - suit: string; - number: number; + suit: string | undefined; + number: number | undefined; destroyed: any; - cardid: string; + cardid: string | undefined; /** * @param {[string, number, string, string]} card */ @@ -68,17 +68,17 @@ export class Card extends HTMLDivElement { updateTransform(bool: any, delay: any): void; aiexclude(): void; addKnower(player: any): void; - _knowers: any[]; + _knowers: any[] | undefined; removeKnower(player: any): void; clearKnowers(): void; isKnownBy(player: any): boolean; getSource(name: any): any; moveDelete(player: any): void; - fixed: boolean; + fixed: boolean | undefined; _onEndMoveDelete: any; moveTo(player: any): this; copy(...args: any[]): Card; - clone: Card; + clone: Card | undefined; uncheck(skill: any): void; recheck(skill: any): void; /** diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts index 64d9acd0f..3d3de19f4 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts @@ -1,4 +1,4 @@ /** * @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise)[]> } */ -export const Contents: SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise)[]>; +export const Contents: SMap<((event: any, trigger: any, player: any) => Promise)[]>; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts index 9f47f32f2..388b39ecc 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts @@ -22,16 +22,16 @@ export class Dialog extends HTMLDivElement { * @param {*} [noclick] * @param { boolean } [zoom] */ - add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean): string | HTMLDivElement | import("./player.js").Player[] | import("./card.js").Card[]; - forcebutton: boolean; + add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean | undefined): string | any[] | HTMLDivElement; + forcebutton: boolean | undefined; /** * @param { string } str * @param { boolean } [center] */ - addText(str: string, center?: boolean): this; - addSmall(item: any, noclick: any): string | HTMLDivElement | import("./player.js").Player[] | import("./card.js").Card[]; + addText(str: string, center?: boolean | undefined): this; + addSmall(item: any, noclick: any): string | any[] | HTMLDivElement; addAuto(content: any): void; - open(): this; + open(): this | undefined; _dragtransform: any; close(): this; /** diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts index f075e95cc..7e08ad170 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts @@ -1,10 +1,10 @@ export class GameEvent { - static initialGameEvent(): import("../index.js").GameEventPromise; + static initialGameEvent(): any; /** * @param {string | GameEvent} [name] * @param {false} [trigger] */ - constructor(name?: string | GameEvent, trigger?: false); + constructor(name?: string | GameEvent | undefined, trigger?: false | undefined); /** * @type { string } */ @@ -37,21 +37,21 @@ export class GameEvent { /** * @type {null|(event: GameEvent)=>any} 这个异步事件对应Promise的resolve函数 **/ - resolve: (event: GameEvent) => any; - _triggered: number; + resolve: ((event: GameEvent) => any) | null; + _triggered: number | undefined; __args: any; /** * @type { Player } */ - source: Player; + source: any; /** * @type { Player } */ - player: Player; + player: any; /** * @type { Player } */ - target: Player; + target: any; /** * @type { Player[] } */ @@ -59,7 +59,7 @@ export class GameEvent { /** * @type { Card } */ - card: Card; + card: any; /** * @type { Card[] } */ @@ -87,7 +87,7 @@ export class GameEvent { /** * @type { Player } */ - customSource: Player; + customSource: any; /** * @type { number } */ @@ -129,23 +129,23 @@ export class GameEvent { * @param {number} [value] * @param {number} [baseValue] */ - addNumber(key: keyof this, value?: number, baseValue?: number): this; + addNumber(key: keyof this, value?: number | undefined, baseValue?: number | undefined): this; /** * @param {keyof this} key * @param {number} [baseValue] */ - decrease(key: keyof this, baseValue?: number): this; + decrease(key: keyof this, baseValue?: number | undefined): this; /** * @param {keyof this} key * @param {number} [baseValue] */ - increase(key: keyof this, baseValue?: number): this; + increase(key: keyof this, baseValue?: number | undefined): this; /** * @param {keyof this} key * @param {number} [value] * @param {number} [baseValue] */ - subtractNumber(key: keyof this, value?: number, baseValue?: number): this; + subtractNumber(key: keyof this, value?: number | undefined, baseValue?: number | undefined): this; /** * @param {Parameters[0]} type * @param {GameEvent} event @@ -157,7 +157,7 @@ export class GameEvent { callHandler(type: Parameters[0], event: GameEvent, option: { state?: 'begin' | 'end'; }): this; - getDefaultHandlerType(): string; + getDefaultHandlerType(): string | undefined; /** * @param {Parameters[0]} [type] * @returns {((event: GameEvent, option: { @@ -170,7 +170,7 @@ export class GameEvent { /** * @param {`on${Capitalize}`} [type] */ - hasHandler(type?: `on${Capitalize}`): any; + hasHandler(type?: `on${Capitalize}` | undefined): any; /** * @overload * @param {...((event: GameEvent, option: { @@ -180,7 +180,7 @@ export class GameEvent { */ pushHandler(...handlers: ((event: GameEvent, option: { state?: 'begin' | 'end'; - }) => void)[]): number; + }) => void)[] | undefined): number; /** * @overload * @param {Parameters[0]} type @@ -191,24 +191,24 @@ export class GameEvent { */ pushHandler(type: Parameters[0], ...handlers: ((event: GameEvent, option: { state?: 'begin' | 'end'; - }) => void)[]): number; + }) => void)[] | undefined): number; changeToZero(): this; - numFixed: boolean; + numFixed: boolean | undefined; finish(): this; putStepCache(key: any, value: any): this; - _stepCache: {}; + _stepCache: {} | undefined; getStepCache(key: any): any; clearStepCache(key: any): this; callFuncUseStepCache(prefix: any, func: any, params: any): any; putTempCache(key1: any, key2: any, value: any): any; - _tempCache: {}; + _tempCache: {} | undefined; getTempCache(key1: any, key2: any): any; - cancel(arg1: any, arg2: any, notrigger: any): import("../index.js").GameEventPromise; + cancel(arg1: any, arg2: any, notrigger: any): any; neutralize(event: any): this; - _neutralized: boolean; + _neutralized: boolean | undefined; _neutralize_event: any; unneutralize(): this; - directHit: boolean; + directHit: boolean | undefined; goto(step: any): this; redo(): this; setHiddenSkill(skill: any): this; @@ -224,7 +224,7 @@ export class GameEvent { * @returns {GameEvent} */ setContents(contents: Function | keyof typeof lib.element.contents): GameEvent; - contents: (string | number | Function) & any[]; + contents: ((string | number | Function) & any[]) | undefined; getLogv(): any; send(): this; resume(): this; @@ -237,20 +237,20 @@ export class GameEvent { * @param {boolean} [includeSelf] 若level不是数字,指定搜索时是否包含事件本身 * @returns {GameEvent|{}|null} */ - getParent(level?: string | number | ((evt: gameEvent) => boolean), forced?: boolean, includeSelf?: boolean): GameEvent | {} | null; + getParent(level?: string | number | ((evt: gameEvent) => boolean) | undefined, forced?: boolean | undefined, includeSelf?: boolean | undefined): GameEvent | {} | null; getTrigger(): any; getRand(name: any): any; - _rand_map: {}; - _rand: number; - insert(content: any, map: any): import("../index.js").GameEventPromise; - insertAfter(content: any, map: any): import("../index.js").GameEventPromise; + _rand_map: {} | undefined; + _rand: number | undefined; + insert(content: any, map: any): any; + insertAfter(content: any, map: any): any; backup(skill: any): this; _backup: any; filterButton: any; selectButton: any; filterTarget: any; selectTarget: any; - ignoreMod: boolean; + ignoreMod: boolean | undefined; filterCard2: any; filterCard: any; filterOk: any; @@ -267,20 +267,20 @@ export class GameEvent { _cardChoice: any; _targetChoice: any; _skillChoice: any; - isMine(): boolean; - isOnline(): boolean; + isMine(): any; + isOnline(): any; notLink(): boolean; isPhaseUsing(player: any): boolean; addTrigger(skills: any, player: any): this; removeTrigger(skills: any, player: any): this; - trigger(name: any): import("../index.js").GameEventPromise; - untrigger(all: boolean, player: any): this; + trigger(name: any): any; + untrigger(all: boolean | undefined, player: any): this; /** * 事件转为Promise化 * * @returns { GameEventPromise } */ - toPromise(): GameEventPromise; + toPromise(): any; #private; } -import { Library as lib } from "../index.js"; +import { lib } from "../index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts index e2d98f1f2..1283b9270 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts @@ -21,13 +21,13 @@ * game.log('等待', player, '摸牌完成执行log'); * ``` */ -export class GameEventPromise extends Promise { +export class GameEventPromise extends Promise { /** * @param { GameEvent | GameEventPromise } arg */ constructor(arg: GameEvent | GameEventPromise); /** 获取原事件对象 */ - toEvent(): import("./gameEvent.js").GameEvent; + toEvent(): any; /** * 在某个异步事件中调试变量信息 * diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/nodeWS.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/nodeWS.d.ts index 1e7572241..3a7c6e9ff 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/nodeWS.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/nodeWS.d.ts @@ -3,7 +3,7 @@ export class NodeWS { * @param {string | NodeWS} id */ constructor(id: string | NodeWS); - wsid: string; + wsid: string | undefined; send(message: any): void; on(type: any, func: any): void; close(): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts index 71495b209..3564435b7 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts @@ -2,7 +2,7 @@ export class Player extends HTMLDivElement { /** * @param {HTMLDivElement|DocumentFragment} [position] */ - constructor(position?: HTMLDivElement | DocumentFragment); + constructor(position?: HTMLDivElement | DocumentFragment | undefined); build(noclick: any): this; buildNode(): void; /** @type { SMap } */ @@ -143,7 +143,7 @@ export class Player extends HTMLDivElement { */ outCount: number; buildEventListener(noclick: any): void; - noclick: boolean; + noclick: boolean | undefined; /** * @type { number } */ @@ -213,7 +213,7 @@ export class Player extends HTMLDivElement { * @param { number } amount * @param { boolean } [limit] */ - changeFury(amount: number, limit?: boolean): void; + changeFury(amount: number, limit?: boolean | undefined): void; /** * version 1.7 * @@ -290,35 +290,35 @@ export class Player extends HTMLDivElement { /** * 让一名角色明置一些手牌 */ - addShownCards(...args: any[]): import("../index.js").GameEventPromise; - hideShownCards(...args: any[]): import("../index.js").GameEventPromise; + addShownCards(...args: any[]): any; + hideShownCards(...args: any[]): any; /** * 获取角色所有的明置手牌 */ - getShownCards(): import("./card.js").Card[]; + getShownCards(): any[]; /** * 获取该角色被other所知的牌 * @param { Player } [other] * @param { (card: Card) => boolean } [filter] */ - getKnownCards(other?: Player, filter?: (card: Card) => boolean): import("./card.js").Card[]; + getKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): any[]; /** * 判断此角色的手牌是否已经被看光了 * @param { Player } [other] */ - isAllCardsKnown(other?: Player): boolean; + isAllCardsKnown(other?: Player | undefined): boolean; /** * 判断此角色是否有被知的牌。 * @param { Player } [other] * @param { (card: Card) => boolean } [filter] */ - hasKnownCards(other?: Player, filter?: (card: Card) => boolean): boolean; + hasKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): boolean; /** * 数此角色被知道的牌 * @param { Player } [other] * @param { (card: Card) => boolean } [filter] */ - countKnownCards(other?: Player, filter?: (card: Card) => boolean): number; + countKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): number; /** * Execute the delay card effect * @@ -329,14 +329,14 @@ export class Player extends HTMLDivElement { * @param {*} judge2 * @returns */ - executeDelayCardEffect(card: Card | string, target: Player, judge: any, judge2: any, ...args: any[]): import("../index.js").GameEventPromise; + executeDelayCardEffect(card: Card | string, target: Player, judge: any, judge2: any, ...args: any[]): any; /** * Check if the card does not count toward hand limit * * 检测此牌是否不计入手牌上限 * @param { Card } card */ - canIgnoreHandcard(card: Card): boolean; + canIgnoreHandcard(card: any): boolean; /** * Gift * @@ -344,7 +344,7 @@ export class Player extends HTMLDivElement { * @param { Card | Card[] } cards * @param { Player } target */ - gift(cards: Card | Card[], target: Player, ...args: any[]): import("../index.js").GameEventPromise; + gift(cards: Card | Card[], target: Player, ...args: any[]): any; /** * Check if the player can gift the card * @@ -353,7 +353,7 @@ export class Player extends HTMLDivElement { * @param { Player } target * @param { boolean } [strict] */ - canGift(card: Card, target: Player, strict?: boolean): boolean; + canGift(card: any, target: Player, strict?: boolean | undefined): boolean; /** * Check if the player refuses gifts * @@ -361,7 +361,7 @@ export class Player extends HTMLDivElement { * @param { Card } card * @param { Player } player */ - refuseGifts(card: Card, player: Player): boolean; + refuseGifts(card: any, player: Player): boolean; /** * Gift AI related * @@ -369,19 +369,19 @@ export class Player extends HTMLDivElement { * @param { Card } card * @param { Player } target */ - getGiftAIResultTarget(card: Card, target: Player): number; + getGiftAIResultTarget(card: any, target: Player): number; /** * @param { Card } card * @param { Player } target */ - getGiftEffect(card: Card, target: Player): number; + getGiftEffect(card: any, target: Player): number; /** * 重铸 * @param { Card | Card[] } cards * @param { (player: Player, cards: Card[]) => any } [recastingLose] * @param { (player: Player, cards: Card[]) => any } [recastingGain] */ - recast(cards: Card | Card[], recastingLose?: (player: Player, cards: Card[]) => any, recastingGain?: (player: Player, cards: Card[]) => any, ...args: any[]): import("../index.js").GameEventPromise; + recast(cards: Card | Card[], recastingLose?: ((player: Player, cards: Card[]) => any) | undefined, recastingGain?: ((player: Player, cards: Card[]) => any) | undefined, ...args: any[]): any; /** * Check if the player can recast the card * @@ -390,7 +390,7 @@ export class Player extends HTMLDivElement { * @param { Player } [source] * @param { boolean } [strict] */ - canRecast(card: Card, source?: Player, strict?: boolean): boolean; + canRecast(card: any, source?: Player | undefined, strict?: boolean | undefined): boolean; /** * 判断一名角色的某个区域是否被废除 * @@ -398,39 +398,39 @@ export class Player extends HTMLDivElement { * @param { string | number } [type] * @returns { boolean } */ - hasDisabledSlot(type?: string | number): boolean; + hasDisabledSlot(type?: string | number | undefined): boolean; /** * 判断一名角色的某个区域被废除的数量 * * 用法同 {@link hasDisabledSlot} * @param { string | number } [type] */ - countDisabledSlot(type?: string | number): number; + countDisabledSlot(type?: string | number | undefined): number; /** * 判断一名角色是否有某个装备栏空着 * @param { string | number } [type] * @returns { boolean } */ - hasEmptySlot(type?: string | number): boolean; + hasEmptySlot(type?: string | number | undefined): boolean; /** * 判断一名角色的某个装备栏空位的数量 * @param { string | number } [type] */ - countEmptySlot(type?: string | number): number; + countEmptySlot(type?: string | number | undefined): number; /** * 判断一名角色是否有可以用于装备新装备牌的区域(排除金箍棒和六龙等“不可被替换装备”) * * 用法同 {@link hasEnabledSlot} * @param { string | number } [type] */ - hasEquipableSlot(type?: string | number): boolean; + hasEquipableSlot(type?: string | number | undefined): boolean; /** * 统计一名角色有多少个可以用于装备新的装备牌的区域 * * 用法同 {@link hasEnabledSlot} * @param { string | number } [type] */ - countEquipableSlot(type?: string | number): number; + countEquipableSlot(type?: string | number | undefined): number; /** * 判断一名角色是否拥有未被废除的某个区域 * @@ -438,14 +438,14 @@ export class Player extends HTMLDivElement { * @param { string | number } [type] * @returns { boolean } */ - hasEnabledSlot(type?: string | number): boolean; + hasEnabledSlot(type?: string | number | undefined): boolean; /** * 判断一名角色的某个区域未被废除的数量 * * 用法同 {@link hasEnabledSlot} * @param { string | number } [type] */ - countEnabledSlot(type?: string | number): number; + countEnabledSlot(type?: string | number | undefined): number; /** * 获取一名角色装备区内某种类型的装备牌 * @@ -459,19 +459,19 @@ export class Player extends HTMLDivElement { * * 参数:废除来源角色(不写默认当前事件角色),废除区域(数字/区域字符串/数组,可以写多个,重复废除) */ - disableEquip(...args: any[]): import("../index.js").GameEventPromise; + disableEquip(...args: any[]): any; /** * 新的恢复装备区 * * 参数:恢复来源角色(不写默认当前事件角色),恢复区域(数字/区域字符串/数组,可以写多个,重复恢复) */ - enableEquip(...args: any[]): import("../index.js").GameEventPromise; + enableEquip(...args: any[]): any; /** * 新的扩展装备区 * * 参数:扩展来源角色(不写默认当前事件角色),扩展区域(数字/区域字符串/数组,可以写多个,重复扩展) */ - expandEquip(...args: any[]): import("../index.js").GameEventPromise; + expandEquip(...args: any[]): any; /** * 判断判定区是否被废除 */ @@ -480,18 +480,18 @@ export class Player extends HTMLDivElement { * 同步显示扩展装备区状态 * @param { SMap } [map] */ - $syncExpand(map?: SMap): void; + $syncExpand(map?: SMap | undefined): void; /** * 同步装备区废除牌显示状态 * @param { SMap } [map] */ - $syncDisable(map?: SMap): void; + $syncDisable(map?: SMap | undefined): void; /** * @param { string | Card | VCard | CardBaseUIData } name * @param { boolean } [replace] * @returns */ - canEquip(name: string | Card | VCard | CardBaseUIData, replace?: boolean): boolean; + canEquip(name: string | Card | VCard | CardBaseUIData, replace?: boolean | undefined): boolean; /** * @deprecated */ @@ -512,7 +512,7 @@ export class Player extends HTMLDivElement { * @deprecated */ $enableEquip(): void; - chooseToDebate(...args: any[]): import("../index.js").GameEventPromise; + chooseToDebate(...args: any[]): any; /** * 向target发起协力 * @param { Player } target @@ -520,7 +520,7 @@ export class Player extends HTMLDivElement { * @param {*} reason */ cooperationWith(target: Player, type: any, reason: any): void; - chooseCooperationFor(...args: any[]): import("../index.js").GameEventPromise; + chooseCooperationFor(...args: any[]): any; checkCooperationStatus(target: any, reason: any): boolean; removeCooperation(info: any): void; /** @@ -564,7 +564,7 @@ export class Player extends HTMLDivElement { * @param { string } skill */ removeSkillBlocker(skill: string): void; - loseToSpecial(cards: any, tag: any, target: any): import("../index.js").GameEventPromise; + loseToSpecial(cards: any, tag: any, target: any): any; /** * @param { Card | Card[] } cards * @param { string } tag @@ -574,7 +574,7 @@ export class Player extends HTMLDivElement { * @param { string } tag * @param { Card[] } [cards] */ - removeGaintag(tag: string, cards?: Card[]): void; + removeGaintag(tag: string, cards?: any[] | undefined): void; /** * @param { Player } target */ @@ -583,31 +583,31 @@ export class Player extends HTMLDivElement { * @param { Card } card * @param { Player } target */ - canSaveCard(card: Card, target: Player): any; + canSaveCard(card: any, target: Player): any; /** * @param { String } from * @param { String } to * @returns { GameEventPromise } */ - reinitCharacter(from: string, to: string, log?: boolean): GameEventPromise; + reinitCharacter(from: string, to: string, log?: boolean): any; /** * @param { String[] } newPairs * @returns { GameEventPromise } */ - changeCharacter(newPairs: string[], log?: boolean): GameEventPromise; + changeCharacter(newPairs: string[], log?: boolean): any; /** * @param { 0 | 1 | 2 } num * @param { false } [log] */ - showCharacter(num: 0 | 1 | 2, log?: false, ...args: any[]): import("../index.js").GameEventPromise; + showCharacter(num: 0 | 1 | 2, log?: false | undefined, ...args: any[]): any; /** * @param { 0 | 1 | 2 } num * @param { false } [log] */ - $showCharacter(num: 0 | 1 | 2, log?: false): void; - chooseToPlayBeatmap(beatmap: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseToMove(...args: any[]): import("../index.js").GameEventPromise; - chooseToGuanxing(num: any): import("../index.js").GameEventPromise; + $showCharacter(num: 0 | 1 | 2, log?: false | undefined): void; + chooseToPlayBeatmap(beatmap: any, ...args: any[]): any; + chooseToMove(...args: any[]): any; + chooseToGuanxing(num: any): any; /** * @param { Player } target * @param { string } name @@ -630,12 +630,12 @@ export class Player extends HTMLDivElement { * @param { string } [nature] * @param { string } [popname] */ - tryCardAnimate(card: Card, name: string, nature?: string, popname?: string, ...args: any[]): void; + tryCardAnimate(card: any, name: string, nature?: string | undefined, popname?: string | undefined, ...args: any[]): void; /** * @param { string } name * @param { string } type */ - hasUsableCard(name: string, type: string): boolean; + hasUsableCard(name: string, type: string): true | undefined; /** * @param { Player } to * @returns { boolean } @@ -652,7 +652,7 @@ export class Player extends HTMLDivElement { * * @param { boolean } [raw] */ - getHp(raw?: boolean): number; + getHp(raw?: boolean | undefined): number; /** * Set “raw” to true to get the player's raw damaged HP instead. * @@ -660,45 +660,45 @@ export class Player extends HTMLDivElement { * * @param { boolean } [raw] */ - getDamagedHp(raw?: boolean): number; + getDamagedHp(raw?: boolean | undefined): number; /** * @param { string } group */ - changeGroup(group: string, log: any, broadcast: any, ...args: any[]): import("../index.js").GameEventPromise; + changeGroup(group: string, log: any, broadcast: any, ...args: any[]): any; /** * @param { Player } target */ - chooseToDuiben(target: Player): import("../index.js").GameEventPromise; + chooseToDuiben(target: Player): any; /** * @param { Player } target */ - chooseToPSS(target: Player): import("../index.js").GameEventPromise; - chooseToEnable(...args: any[]): import("../index.js").GameEventPromise; - chooseToDisable(...args: any[]): import("../index.js").GameEventPromise; + chooseToPSS(target: Player): any; + chooseToEnable(...args: any[]): any; + chooseToDisable(...args: any[]): any; /** * @param { boolean } [notmeisok] */ - isPhaseUsing(notmeisok?: boolean): boolean; + isPhaseUsing(notmeisok?: boolean | undefined): boolean; /** * @param { Player } target */ - swapEquip(target: Player): import("../index.js").GameEventPromise; + swapEquip(target: Player): any; /** * @param { Player } target * @param { boolean } [goon] * @param { boolean} [bool] */ - canCompare(target: Player, goon?: boolean, bool?: boolean): boolean; + canCompare(target: Player, goon?: boolean | undefined, bool?: boolean | undefined): boolean; $disableJudge(): void; $enableJudge(): void; - disableJudge(): import("../index.js").GameEventPromise; - enableJudge(): import("../index.js").GameEventPromise; - init(character: any, character2: any, skill: any, update: any): this; + disableJudge(): any; + enableJudge(): any; + init(character: any, character2: any, skill: any, update: any): this | undefined; skin: { name: any; name2: any; - }; - singleHp: boolean; + } | undefined; + singleHp: boolean | undefined; $init(character: any, character2: any): this; /** * 换肤换音:想要支持某个武将更换皮肤,必须在lib.character.characterSubstitute中存在该武将的id(以下以name代指武将id,character代指换肤图片名) @@ -717,17 +717,17 @@ export class Player extends HTMLDivElement { avatar: any; uninitOL(): void; initRoom(info: any, info2: any): this; - serving: boolean; - roomempty: boolean; - roomfull: boolean; - roomgaming: boolean; + serving: boolean | undefined; + roomempty: boolean | undefined; + roomfull: boolean | undefined; + roomgaming: boolean | undefined; version: any; key: any; config: any; reinit2(newPairs: any): void; $reinit12(newPairs: any): void; $reinit21(newPairs: any): void; - reinit(from: any, to: any, maxHp: any, online: any): this; + reinit(from: any, to: any, maxHp: any, online: any): this | undefined; $reinit(from: any, to: any, maxHp: any, online: any): void; uninit(): this; $uninit(): void; @@ -737,13 +737,13 @@ export class Player extends HTMLDivElement { changeSeat(position: any, video: any): void; send(...args: any[]): this; getId(): this; - playerid: string; + playerid: string | undefined; throwEmotion(target: any, emotion: any, rotate: any): void; emotion(pack: any, id: any): void; chat(str: any): void; say(str: any): void; showGiveup(): void; - _giveUp: boolean; + _giveUp: boolean | undefined; applySkills(skills: any): void; getState(): { hp: number; @@ -754,22 +754,22 @@ export class Player extends HTMLDivElement { name: string; name1: string; name2: string; - handcards: import("./card.js").Card[]; - gaintag: any[]; - equips: import("./card.js").Card[]; - judges: import("./card.js").Card[]; - specials: import("./card.js").Card[]; - expansions: import("./card.js").Card[]; - expansion_gaintag: any[]; + handcards: any[]; + gaintag: never[]; + equips: any[]; + judges: any[]; + specials: any[]; + expansions: any[]; + expansion_gaintag: never[]; disableJudge: boolean; disabledSlots: SMap; expandedSlots: SMap; - views: any[]; + views: never[]; position: number; hujia: number; side: any; identityShown: any; - identityNode: string[]; + identityNode: (string | undefined)[]; identity: any; dead: boolean; linked: boolean; @@ -801,8 +801,8 @@ export class Player extends HTMLDivElement { num(arg1: any, arg2: any, arg3: any): any; line(target: any, config: any): void; line2(targets: any, config: any): void; - getNext(): this; - getPrevious(): this; + getNext(): this | null; + getPrevious(): this | null; countUsed(card: any, type: any): number; getCacheKey(): string; countSkill(skill: any): any; @@ -812,13 +812,13 @@ export class Player extends HTMLDivElement { * @param { string | Record | ((card: Card) => boolean) } [arg2] * @returns { Iterable } */ - iterableGetCards(arg1?: string, arg2?: string | Record | ((card: Card) => boolean)): Iterable; + iterableGetCards(arg1?: string | undefined, arg2?: string | Record | ((card: any) => boolean) | undefined): Iterable; /** * @param { string } [arg1='h'] * @param { string | Record | ((card: Card) => boolean) } [arg2] * @returns { Card[] } */ - getCards(arg1?: string, arg2?: string | Record | ((card: Card) => boolean)): Card[]; + getCards(arg1?: string | undefined, arg2?: string | Record | ((card: any) => boolean) | undefined): Card[]; iterableGetDiscardableCards(player: any, arg1: any, arg2: any): Generator; getDiscardableCards(player: any, arg1: any, arg2: any): any[]; iterableGetGainableCards(player: any, arg1: any, arg2: any): Generator; @@ -831,100 +831,100 @@ export class Player extends HTMLDivElement { getOriginalSkills(): any[]; getModableSkills(): any[]; getSkills(arg2: any, arg3: any, arg4: any): any[]; - get(arg1: any, arg2: any, arg3: any, arg4: any, ...args: any[]): any[] | ChildNode; + get(arg1: any, arg2: any, arg3: any, arg4: any, ...args: any[]): any[] | ChildNode | undefined; syncStorage(skill: any): void; syncSkills(): void; playerfocus(time: any): this; setIdentity(identity: any, nature: any): this; - insertPhase(skill: any, insert: any): import("../index.js").GameEventPromise; - insertEvent(name: any, content: any, arg: any): import("../index.js").GameEventPromise; - phase(skill: any): import("../index.js").GameEventPromise; - phaseZhunbei(): import("../index.js").GameEventPromise; - phaseJudge(): import("../index.js").GameEventPromise; - phaseDraw(): import("../index.js").GameEventPromise; - phaseUse(): import("../index.js").GameEventPromise; - phaseDiscard(): import("../index.js").GameEventPromise; - phaseJieshu(): import("../index.js").GameEventPromise; - chooseToUse(use: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseToRespond(...args: any[]): import("../index.js").GameEventPromise; - chooseToGive(...args: any[]): import("../index.js").GameEventPromise; - chooseToDiscard(...args: any[]): import("../index.js").GameEventPromise; - chooseToCompare(target: any, check: any, ...args: any[]): import("../index.js").GameEventPromise; + insertPhase(skill: any, insert: any): any; + insertEvent(name: any, content: any, arg: any): any; + phase(skill: any): any; + phaseZhunbei(): any; + phaseJudge(): any; + phaseDraw(): any; + phaseUse(): any; + phaseDiscard(): any; + phaseJieshu(): any; + chooseToUse(use: any, ...args: any[]): any; + chooseToRespond(...args: any[]): any; + chooseToGive(...args: any[]): any; + chooseToDiscard(...args: any[]): any; + chooseToCompare(target: any, check: any, ...args: any[]): any; chooseSkill(target: any, ...args: any[]): void; - discoverCard(list: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseCardButton(...args: any[]): import("../index.js").GameEventPromise; - chooseVCardButton(...args: any[]): import("../index.js").GameEventPromise; - chooseButton(...args: any[]): import("../index.js").GameEventPromise; - chooseButtonOL(list: any, callback: any, ai: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseCardOL(...args: any[]): import("../index.js").GameEventPromise; - chooseCard(choose: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseUseTarget(...args: any[]): import("../index.js").GameEventPromise; - chooseTarget(...args: any[]): import("../index.js").GameEventPromise; - chooseCardTarget(choose: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseControlList(...args: any[]): import("../index.js").GameEventPromise; - chooseControl(...args: any[]): import("../index.js").GameEventPromise; - chooseBool(...args: any[]): import("../index.js").GameEventPromise; - chooseDrawRecover(...args: any[]): import("../index.js").GameEventPromise; - choosePlayerCard(...args: any[]): import("../index.js").GameEventPromise; - discardPlayerCard(...args: any[]): import("../index.js").GameEventPromise; - gainPlayerCard(...args: any[]): import("../index.js").GameEventPromise; - showHandcards(str: any, ...args: any[]): import("../index.js").GameEventPromise; - showCards(cards: any, str: any, ...args: any[]): import("../index.js").GameEventPromise; - viewCards(str: any, cards: any, ...args: any[]): import("../index.js").GameEventPromise; - viewHandcards(target: any): false | import("../index.js").GameEventPromise; + discoverCard(list: any, ...args: any[]): any; + chooseCardButton(...args: any[]): any; + chooseVCardButton(...args: any[]): any; + chooseButton(...args: any[]): any; + chooseButtonOL(list: any, callback: any, ai: any, ...args: any[]): any; + chooseCardOL(...args: any[]): any; + chooseCard(choose: any, ...args: any[]): any; + chooseUseTarget(...args: any[]): any; + chooseTarget(...args: any[]): any; + chooseCardTarget(choose: any, ...args: any[]): any; + chooseControlList(...args: any[]): any; + chooseControl(...args: any[]): any; + chooseBool(...args: any[]): any; + chooseDrawRecover(...args: any[]): any; + choosePlayerCard(...args: any[]): any; + discardPlayerCard(...args: any[]): any; + gainPlayerCard(...args: any[]): any; + showHandcards(str: any, ...args: any[]): any; + showCards(cards: any, str: any, ...args: any[]): any; + viewCards(str: any, cards: any, ...args: any[]): any; + viewHandcards(target: any): any; canMoveCard(withatt: any, nojudge: any, ...args: any[]): boolean; - moveCard(...args: any[]): import("../index.js").GameEventPromise; - useResult(result: any, event: any): import("../index.js").GameEventPromise; - useCard(...args: any[]): import("../index.js").GameEventPromise; - useSkill(...args: any[]): import("../index.js").GameEventPromise; - drawTo(num: any, args: any): import("../index.js").GameEventPromise; - draw(...args: any[]): import("../index.js").GameEventPromise; - randomDiscard(...args: any[]): import("./card.js").Card[]; + moveCard(...args: any[]): any; + useResult(result: any, event: any): any; + useCard(...args: any[]): any; + useSkill(...args: any[]): any; + drawTo(num: any, args: any): any; + draw(...args: any[]): any; + randomDiscard(...args: any[]): any[]; randomGain(...args: any[]): any; - discard(...args: any[]): import("../index.js").GameEventPromise; - loseToDiscardpile(...args: any[]): import("../index.js").GameEventPromise; - respond(...args: any[]): import("../index.js").GameEventPromise; - swapHandcards(target: any, cards1: any, cards2: any): import("../index.js").GameEventPromise; + discard(...args: any[]): any; + loseToDiscardpile(...args: any[]): any; + respond(...args: any[]): any; + swapHandcards(target: any, cards1: any, cards2: any): any; directequip(cards: any): void; $addToExpansion(cards: any, broadcast: any, gaintag: any): this; directgain(cards: any, broadcast: any, gaintag: any): this; directgains(cards: any, broadcast: any, gaintag: any): this; - gainMultiple(targets: any, position: any): import("../index.js").GameEventPromise; - gain(...args: any[]): import("../index.js").GameEventPromise; - addToExpansion(...args: any[]): import("../index.js").GameEventPromise; + gainMultiple(targets: any, position: any): any; + gain(...args: any[]): any; + addToExpansion(...args: any[]): any; give(cards: any, target: any, visible: any): any; - lose(...args: any[]): import("../index.js").GameEventPromise; - damage(...args: any[]): import("../index.js").GameEventPromise; - recover(...args: any[]): import("../index.js").GameEventPromise; - doubleDraw(): import("../index.js").GameEventPromise; - loseHp(num: any): import("../index.js").GameEventPromise; - loseMaxHp(...args: any[]): import("../index.js").GameEventPromise; - gainMaxHp(...args: any[]): import("../index.js").GameEventPromise; - changeHp(num: any, popup: any): import("../index.js").GameEventPromise; - changeHujia(num: any, type: any, limit: any): import("../index.js").GameEventPromise; + lose(...args: any[]): any; + damage(...args: any[]): any; + recover(...args: any[]): any; + doubleDraw(): any; + loseHp(num: any): any; + loseMaxHp(...args: any[]): any; + gainMaxHp(...args: any[]): any; + changeHp(num: any, popup: any): any; + changeHujia(num: any, type: any, limit: any): any; getBuff(...args: any[]): this; getDebuff(...args: any[]): this; - dying(reason: any): import("../index.js").GameEventPromise; - die(reason: any): import("../index.js").GameEventPromise; + dying(reason: any): any; + die(reason: any): any; revive(hp: any, log: any): void; isMad(): boolean; goMad(end: any): void; unMad(): void; tempHide(): void; addExpose(num: any): this; - equip(card: any, draw: any): import("../index.js").GameEventPromise; - addJudge(card: any, cards: any): import("../index.js").GameEventPromise; + equip(card: any, draw: any): any; + addJudge(card: any, cards: any): any; /** * @returns { boolean } */ canAddJudge(card: any): boolean; addJudgeNext(card: any, unlimited: any): void; - judge(...args: any[]): import("../index.js").GameEventPromise; - turnOver(bool: any): import("../index.js").GameEventPromise; + judge(...args: any[]): any; + turnOver(bool: any): any; out(skill: any): void; - outSkills: any[]; + outSkills: any[] | undefined; in(skill: any): void; - link(bool: any): import("../index.js").GameEventPromise; + link(bool: any): any; skip(name: any): void; wait(callback: any): void; unwait(result: any): void; @@ -940,7 +940,7 @@ export class Player extends HTMLDivElement { hideTimer(): void; markAuto(name: any, info: any): void; unmarkAuto(name: any, info: any): void; - getExpansions(tag: any): import("./card.js").Card[]; + getExpansions(tag: any): any[]; countExpansions(tag: any): number; hasExpansions(tag: any): boolean; setStorage(name: any, value: any, mark: any): any; @@ -955,7 +955,7 @@ export class Player extends HTMLDivElement { markSkill(name: any, info: any, card: any, nobroadcast: any): this; unmarkSkill(name: any, nobroadcast: any): this; markSkillCharacter(id: any, target: any, name: any, content: any, nobroadcast: any): this; - markCharacter(name: any, info: any, learn: any, learn2: any): HTMLDivElement; + markCharacter(name: any, info: any, learn: any, learn2: any): HTMLDivElement | undefined; mark(name: any, info: any, skill: any): any; unmark(name: any, info: any): void; addLink(): void; @@ -966,26 +966,26 @@ export class Player extends HTMLDivElement { getUseValue(card: any, distance: any, includecard: any): number; addSubPlayer(cfg: any): string; removeSubPlayer(name: any): void; - callSubPlayer(...args: any[]): import("../index.js").GameEventPromise; - toggleSubPlayer(...args: any[]): import("../index.js").GameEventPromise; - exitSubPlayer(remove: any): import("../index.js").GameEventPromise; + callSubPlayer(...args: any[]): any; + toggleSubPlayer(...args: any[]): any; + exitSubPlayer(remove: any): any; getSubPlayers(tag: any): any[]; addSkillTrigger(skills: any, hidden: any, triggeronly: any): this; - _hookTrigger: any[]; - addSkillLog(skill: any): this; - removeSkillLog(skill: any, popup: any): this; + _hookTrigger: any[] | undefined; + addSkillLog(skill: any): this | undefined; + removeSkillLog(skill: any, popup: any): this | undefined; addInvisibleSkill(skill: any): void; removeInvisibleSkill(skill: any, ...args: any[]): any; - addSkills(skill: any): import("../index.js").GameEventPromise; - removeSkills(skill: any): import("../index.js").GameEventPromise; - changeSkills(addSkill?: any[], removeSkill?: any[]): import("../index.js").GameEventPromise; + addSkills(skill: any): any; + removeSkills(skill: any): any; + changeSkills(addSkill?: any[], removeSkill?: any[]): any; addSkill(skill: any, checkConflict: any, nobroadcast: any, addToSkills: any): any; - addAdditionalSkills(skill: any, skillsToAdd: any, keep: any): import("../index.js").GameEventPromise; + addAdditionalSkills(skill: any, skillsToAdd: any, keep: any): any; addAdditionalSkill(skill: any, skillsToAdd: any, keep: any): this; $removeAdditionalSkills(skill: any, target: any): void; getRemovableAdditionalSkills(skill: any, target: any): string[]; removeAdditionalSkill(skill: any, target: any): this; - removeAdditionalSkills(skill: any, target: any): import("../index.js").GameEventPromise; + removeAdditionalSkills(skill: any, target: any): any; awakenSkill(skill: any, nounmark: any): this; restoreSkill(skill: any, nomark: any): this; disableSkill(skill: any, skills: any): this; @@ -995,13 +995,29 @@ export class Player extends HTMLDivElement { removeEquipTrigger(card: any): this; removeSkillTrigger(skills: any, triggeronly: any): this; removeSkill(skill: any, ...args: any[]): any; - addTempSkills(skillsToAdd: any, expire: any): import("../index.js").GameEventPromise; + addTempSkills(skillsToAdd: any, expire: any): any; addTempSkill(skill: any, expire: any, checkConflict: any): any; tempBanSkill(skill: any, expire: any, log: any): any; isTempBanned(skill: any): boolean; attitudeTo(target: any): any; clearSkills(all: any, ...args: any[]): string[]; checkConflict(skill: any): void; + /** + * 快速获取一名角色当前轮次/前X轮次的历史 + * + * 第一个参数填写获取的动作 + * + * 第二个参数填写获取历史的筛选条件 + * + * 第三个参数填写数字(不填默认为0),获取上X轮的历史(X为0则为本轮历史),第四个参数若为true,则获取从上X轮开始至现在 + * + * 第四个参数若为true,则获取从上X轮开始至现在所有符合条件的历史 + * + * 第五个参数填写event,获取此event之前所有符合条件的历史 + * + * @param { string | function | number | boolean | object } map + */ + getRoundHistory(key: any, filter: any, num: any, keep: any, last: any): any[]; getHistory(key: any, filter: any, last: any): any; checkHistory(key: any, filter: any, last: any): void; hasHistory(key: any, filter: any, last: any): any; @@ -1013,14 +1029,14 @@ export class Player extends HTMLDivElement { getStat(key: any): any; getLastStat(key: any): any; queue(time: any): void; - queueTimeout: NodeJS.Timeout; + queueTimeout: NodeJS.Timeout | undefined; getCardUsable(card: any, pure: any): number; getAttackRange(raw: any): number; getEquipRange(cards: any): number; getGlobalFrom(): number; getGlobalTo(): number; getHandcardLimit(): number; - getEnemies(func: any): Player[]; + getEnemies(func: any): any[] | undefined; getFriends(func: any): any[]; isEnemyOf(...args: any[]): boolean; isFriendOf(player: any): boolean; @@ -1065,13 +1081,13 @@ export class Player extends HTMLDivElement { hasUnknown(num: any): boolean; isUnknown(player: any): boolean; hasWuxie(info: any): boolean; - hasSha(respond: any, noauto: any): boolean; - hasShan(respond: any): boolean; + hasSha(respond: any, noauto: any): true | undefined; + hasShan(respond: any): true | undefined; mayHaveSha(viewer: any, type: any, ignore: any, rvt: any): number | boolean; mayHaveShan(viewer: any, type: any, ignore: any, rvt: any): number | boolean; hasCard(name: any, position: any): boolean; - getEquip(name: any): import("./card.js").Card; - getJudge(name: any): ChildNode; + getEquip(name: any): any; + getJudge(name: any): ChildNode | null; $drawAuto(cards: any, target: any): void; $draw(num: any, init: any, config: any): void; $compareMultiple(card1: any, targets: any, cards: any): void; @@ -1083,12 +1099,12 @@ export class Player extends HTMLDivElement { $throwxy(card: any, left: any, top: any): any; $throwxy2(card: any, left: any, top: any, trans: any, flipx: any, flipy: any, ...args: any[]): any; throwDice(num: any): void; - $giveAuto(card: any, player: any, ...args: any[]): any; + $giveAuto(card: any, player: any, ...args: any[]): void; $give(card: any, player: any, log: any, init: any): void; $handleEquipChange(): void; $equip(card: any): this; $gain(card: any, log: any, init: any): void; - $gain2(cards: any, log: any): boolean; + $gain2(cards: any, log: any): true | undefined; $skill(name: any, type: any, color: any, avatar: any): void; $fire(): void; $thunder(): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts index fb220de8c..d4dd547d9 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts @@ -5,7 +5,7 @@ export class VCard { * @param { string } [name] * @param { string } [nature] */ - constructor(suitOrCard?: any, numberOrCards?: number | Card[], name?: string, nature?: string); + constructor(suitOrCard?: any, numberOrCards?: number | any[] | undefined, name?: string | undefined, nature?: string | undefined); /** * @type {string} */ @@ -22,7 +22,7 @@ export class VCard { * @type {string} */ nature: string; - color: string; + color: string | undefined; /** * @type { boolean } */ @@ -43,7 +43,7 @@ export class VCard { /** * @param { Player } player */ - hasNature(nature: any, player: Player): boolean; + hasNature(nature: any, player: any): boolean; getCacheKey(): string; hasGaintag(tag: any): any; } diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts index 225927a56..c78f21927 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts @@ -1,51 +1,51 @@ /// -export class Library extends Uninstantable { - static configprefix: string; - static versionOL: number; - static updateURLS: { +export class Library { + configprefix: string; + versionOL: number; + updateURLS: { coding: string; github: string; }; - static updateURL: string; - static mirrorURL: string; - static hallURL: string; - static assetURL: string; - static userAgent: string; - static characterDefaultPicturePath: string; - static compatibleEdition: boolean; - static changeLog: any[]; - static updates: any[]; - static canvasUpdates: any[]; + updateURL: string; + mirrorURL: string; + hallURL: string; + assetURL: string; + userAgent: string; + characterDefaultPicturePath: string; + compatibleEdition: boolean; + changeLog: any[]; + updates: any[]; + canvasUpdates: any[]; /** * @type { Video[] } */ - static video: Video[]; - static skilllist: any[]; - static connectBanned: any[]; - static characterIntro: {}; - static characterTitle: {}; - static characterPack: {}; - static characterFilter: {}; - static characterSort: {}; - static characterReplace: {}; - static characterSubstitute: {}; - static characterInitFilter: {}; - static characterGuozhanFilter: string[]; - static dynamicTranslate: {}; - static cardPack: {}; - static cardPackInfo: {}; + video: Video[]; + skilllist: any[]; + connectBanned: any[]; + characterIntro: {}; + characterTitle: {}; + characterPack: {}; + characterFilter: {}; + characterSort: {}; + characterReplace: {}; + characterSubstitute: {}; + characterInitFilter: {}; + characterGuozhanFilter: string[]; + dynamicTranslate: {}; + cardPack: {}; + cardPackInfo: {}; /** * @type { SMap } */ - static skin: SMap; - static onresize: any[]; - static onphase: any[]; - static onwash: any[]; - static onover: any[]; - static ondb: any[]; - static ondb2: any[]; - static chatHistory: any[]; - static emotionList: { + skin: SMap; + onresize: any[]; + onphase: any[]; + onwash: any[]; + onover: any[]; + ondb: any[]; + ondb2: any[]; + chatHistory: any[]; + emotionList: { xiaowu_emotion: number; xiaokuo_emotion: number; shibing_emotion: number; @@ -55,37 +55,77 @@ export class Library extends Uninstantable { xiaotao_emotion: number; xiaojiu_emotion: number; }; - static animate: { + animate: { skill: {}; card: {}; }; - static onload: any[]; - static onload2: any[]; - static onprepare: any[]; - static arenaReady: any[]; - static onfree: any[]; - static inpile: any[]; - static inpile_nature: any[]; - static extensions: any[]; - static extensionPack: {}; - static cardType: {}; - static hook: { + onload: any[]; + onload2: any[]; + onprepare: any[]; + arenaReady: any[]; + onfree: any[]; + inpile: any[]; + inpile_nature: any[]; + extensions: any[]; + extensionPack: {}; + cardType: {}; + hook: { globalskill: {}; }; /** * @type { Player | undefined } */ - static tempSortSeat: Player | undefined; + tempSortSeat: Player | undefined; /** - * @returns { never } - */ - static typeAnnotation(): never; + * @type { 'android' | 'ios' | undefined } + */ + device: 'android' | 'ios' | undefined; + /** + * @type { string } + */ + version: string; + /** + * @type { Videos[] } + */ + videos: Videos[]; + /** + * @type { { + * fs: typeof import("fs"), + * path: typeof import("path"), + * debug: () => void, + * clients: Element.Client[], + * banned:[], + * observing:[], + * torespond:{}, + * torespondtimeout:{}, + * } } + */ + node: { + fs: typeof import("fs"); + path: typeof import("path"); + debug: () => void; + clients: Element.Client[]; + banned: []; + observing: []; + torespond: {}; + torespondtimeout: {}; + }; + /** + * @type { { [key: string]: string } } + */ + playerOL: { + [key: string]: string; + }; + /** + * @type { IDBRequest } + */ + db: IDBRequest; /** * 你可以往这里加入{钩子名:函数数组},并在数组里增加你的自定义函数 * 这样当某个地方调用game.callHook(钩子名,[...函数参数])时,就会按顺序将对应数组中的每个函数运行一遍(传参为callHook的第二个参数)。 * 你可以将hook机制类比为event.trigger(),但是这里只能放同步代码 */ - static hooks: Readonly<{ + hooks: Readonly<{ checkBegin: import("./assembly/index.js").NonameAssembly; checkCard: import("./assembly/index.js").NonameAssembly; checkTarget: import("./assembly/index.js").NonameAssembly; @@ -120,7 +160,7 @@ export class Library extends Uninstantable { * // 从某个角落向channel发消息,若无消息接收则等待 * await channel.send(item); */ - static channel: typeof Channel; + channel: typeof Channel; /** * **无名杀消息推送库** * @@ -146,12 +186,12 @@ export class Library extends Uninstantable { * // 若此时乙扩展不想继续订阅`skinChange`事件,可以通过`unsubscribe`解除订阅 * lib.announce.unsubscribe("skinChange", method); */ - static announce: Announce; - static objectURL: Map; - static hookmap: {}; - static imported: {}; - static layoutfixed: string[]; - static pinyins: { + announce: Announce; + objectURL: Map; + hookmap: {}; + imported: {}; + layoutfixed: string[]; + pinyins: { _metadata: { shengmu: string[]; special_shengmu: string[]; @@ -184,10 +224,10 @@ export class Library extends Uninstantable { * * 应变 */ - static yingbian: { + yingbian: { condition: { color: Map; - complex: Map GameEventPromise>; + complex: Map any>; simple: Map any>; }; effect: Map void>; @@ -198,7 +238,7 @@ export class Library extends Uninstantable { * * 谋攻强化 */ - static stratagemBuff: { + stratagemBuff: { cost: Map; effect: Map void>; prompt: Map string>; @@ -208,13 +248,13 @@ export class Library extends Uninstantable { * * 实际的卡牌名称 */ - static actualCardName: Map; - static characterDialogGroup: { + actualCardName: Map; + characterDialogGroup: { 收藏: (name: any, capt: any) => any; 最近: (name: any, capt: any) => any; }; - static listenEnd(node: any): void; - static configMenu: { + listenEnd(node: any): void; + configMenu: { general: { name: string; config: { @@ -303,7 +343,7 @@ export class Library extends Uninstantable { restart: boolean; unfrequent: boolean; intro: string; - onclick(bool: any): boolean; + onclick(bool: any): false | undefined; }; swipe: { name: string; @@ -324,7 +364,7 @@ export class Library extends Uninstantable { chat: string; off: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; swipe_up: { name: string; @@ -339,7 +379,7 @@ export class Library extends Uninstantable { chat: string; off: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; swipe_left: { name: string; @@ -354,7 +394,7 @@ export class Library extends Uninstantable { chat: string; off: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; swipe_right: { name: string; @@ -369,7 +409,7 @@ export class Library extends Uninstantable { chat: string; off: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; round_menu_func: { name: string; @@ -382,7 +422,7 @@ export class Library extends Uninstantable { pause: string; auto: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; show_splash: { name: string; @@ -428,7 +468,7 @@ export class Library extends Uninstantable { config: string; auto: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; longpress_info: { name: string; @@ -667,7 +707,7 @@ export class Library extends Uninstantable { phonelayout: { name: string; init: boolean; - onclick(bool: any): boolean; + onclick(bool: any): false | undefined; }; change_skin: { name: string; @@ -1295,7 +1335,7 @@ export class Library extends Uninstantable { name: string; init: boolean; unfrequent: boolean; - onclick(bool: any): boolean; + onclick(bool: any): false | undefined; }; remember_round_button: { name: string; @@ -1666,7 +1706,7 @@ export class Library extends Uninstantable { }; }; }; - static extensionMenu: { + extensionMenu: { cardpile: { enable: { name: string; @@ -1874,7 +1914,7 @@ export class Library extends Uninstantable { }; }; }; - static mode: { + mode: { identity: { name: string; connect: { @@ -3259,7 +3299,7 @@ export class Library extends Uninstantable { }; }; }; - static status: { + status: { running: boolean; canvas: boolean; time: number; @@ -3269,7 +3309,7 @@ export class Library extends Uninstantable { videoId: number; globalId: number; }; - static help: { + help: { 关于游戏: string; 游戏操作: string; 游戏命令: string; @@ -3278,23 +3318,23 @@ export class Library extends Uninstantable { /** * @type {import('path')} */ - static path: import("path").PlatformPath; - static getErrorTip(msg: any): any; - static codeMirrorReady(node: any, editor: any): void; - static setIntro(node: any, func: any, left: any): void; - static setPopped(node: any, func: any, width: any, height: any, forceclick: any, paused2: any): void; - static placePoppedDialog(dialog: any, e: any): void; - static setHover(node: any, func: any, hoveration: any, width: any): any; - static setScroll(node: any): any; - static setMousewheel(node: any): void; - static setLongPress(node: any, func: any): any; - static updateCanvas(time: any): boolean; - static run(time: any): void; - static getUTC(date: any): any; - static saveVideo(): void; - static genAsync(fn: any): (...args: any[]) => Promise>; - static genAwait(item: any): Promise; - static gnc: { + path: import("path").PlatformPath; + getErrorTip(msg: any): any; + codeMirrorReady(node: any, editor: any): void; + setIntro(node: any, func: any, left: any): void; + setPopped(node: any, func: any, width: any, height: any, forceclick: any, paused2: any): void; + placePoppedDialog(dialog: any, e: any): void; + setHover(node: any, func: any, hoveration: any, width: any): any; + setScroll(node: any): any; + setMousewheel(node: any): void; + setLongPress(node: any, func: any): any; + updateCanvas(time: any): false | undefined; + run(time: any): void; + getUTC(date: any): any; + saveVideo(): void; + genAsync(fn: any): (...args: any[]) => Promise>; + genAwait(item: any): Promise; + gnc: { of: (fn: any) => (...args: any[]) => Promise>; is: { coroutine: (item: any) => boolean; @@ -3302,20 +3342,20 @@ export class Library extends Uninstantable { generator: (item: any) => boolean; }; }; - static comparator: { + comparator: { equals: (...args: any[]) => boolean; equalAny: (...args: any[]) => boolean; notEquals: (...args: any[]) => boolean; notEqualAny: (...args: any[]) => boolean; typeEquals: (...args: any[]) => boolean; }; - static creation: { - readonly array: any[]; + creation: { + readonly array: never[]; readonly object: {}; readonly nullObject: any; readonly string: string; }; - static linq: { + linq: { cselector: { hasAttr: (name: any) => string; isAttr: (name: any, item: any) => string; @@ -3348,8 +3388,8 @@ export class Library extends Uninstantable { div(...args: any[]): any; }; }; - static init: typeof LibInit; - static cheat: { + init: LibInit; + cheat: { /** * 将游戏内部的对象暴露到全局中 * @@ -3395,7 +3435,7 @@ export class Library extends Uninstantable { * @param { number | true } [i] 指定game.players的第几个元素,不填指定为自己的下家。为true时切换玩家布局 * @param { string } [skin] 皮肤id */ - p(name: string, i?: number | true, skin?: string): void; + p(name: string, i?: number | true | undefined, skin?: string | undefined): void; /** * @overload * @description 不传参数默认装备麒麟弓,八卦阵,的卢,赤兔,木牛 @@ -3452,24 +3492,24 @@ export class Library extends Uninstantable { * 炉石模式可用,使用'spell_yexinglanghun'卡牌 * @param { boolean } [me] 决定是自己还是对手使用'spell_yexinglanghun'卡牌 */ - uy(me?: boolean): void; + uy(me?: boolean | undefined): void; /** * 炉石模式可用,使用`spell_${name}`卡牌 * @param { string } [name] * @param { boolean } [act] */ - gs(name?: string, act?: boolean): void; + gs(name?: string | undefined, act?: boolean | undefined): void; /** * 炉石模式可用,获得`stone_${name}_stonecharacter`卡牌 * @param { string } [name] * @param { boolean } [act] */ - gc(name?: string, act?: boolean): void; + gc(name?: string | undefined, act?: boolean | undefined): void; /** * 进入/关闭快速自动测试模式(游戏速度最快),只有游戏记录界面 * @param { boolean | string } [bool] */ - a(bool?: boolean | string): void; + a(bool?: string | boolean | undefined): void; /** * 临时去掉“自动测试模式”带来的css效果, * @@ -3498,7 +3538,7 @@ export class Library extends Uninstantable { * 输出每个强度的武将数量、每个武将包的每个强度的武将数量、每个武将对应的id和翻译 * @param { boolean } [bool] 为false不输出无名杀自带的武将id和翻译 */ - r(bool?: boolean): void; + r(bool?: boolean | undefined): void; /** * 打印目标玩家的手牌 * @param { Player } player @@ -3565,7 +3605,7 @@ export class Library extends Uninstantable { * 指定的玩家或自己立即获得诸葛连弩,青龙刀,八卦阵,的卢,赤兔,木牛 * @param { Player } [target] */ - ge(target?: Player): void; + ge(target?: Element.Player | undefined): void; /** * 自己立即获得闪电,火山,洪水,乐不思蜀,鬼幽结 */ @@ -3579,7 +3619,7 @@ export class Library extends Uninstantable { * @param { number } [num] * @param { Player } [target] */ - d(num?: number, target?: Player): void; + d(num?: number | undefined, target?: Element.Player | undefined): void; /** * 给自己立刻添加一个或多个技能 * @param {...string} args 技能名 @@ -3592,7 +3632,7 @@ export class Library extends Uninstantable { * * @param { number | Player } [num] */ - t(num?: number | Player): void; + t(num?: number | Element.Player | undefined): void; /** * 自己以外的其他玩家弃置所有牌 */ @@ -3612,7 +3652,7 @@ export class Library extends Uninstantable { */ z(name: string): void; }; - static translate: { + translate: { flower: string; egg: string; wine: string; @@ -3832,8 +3872,8 @@ export class Library extends Uninstantable { phaseDiscard: string; phaseJieshu: string; }; - static experimental: typeof Experimental; - static element: { + experimental: typeof Experimental; + element: { content: { emptyEvent: () => void; changeCharacter(event: any, trigger: any, player: any): Promise; @@ -3952,7 +3992,7 @@ export class Library extends Uninstantable { link: () => void; chooseToGuanxing: () => void; }; - contents: SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Element.Player) => Promise)[]>; + contents: SMap<((event: any, trigger: any, player: any) => Promise)[]>; Player: typeof Element.Player; Card: typeof Element.Card; VCard: typeof Element.VCard; @@ -4002,8 +4042,8 @@ export class Library extends Uninstantable { */ readonly nodews: Element.NodeWS; }; - static card: { - list: any[]; + card: { + list: never[]; cooperation_damage: { fullskin: boolean; }; @@ -4118,7 +4158,7 @@ export class Library extends Uninstantable { fullimage: boolean; }; }; - static filter: { + filter: { all: () => boolean; none: () => boolean; /** @@ -4139,7 +4179,7 @@ export class Library extends Uninstantable { * @param { Player } target * @param { boolean } [strict] */ - cardGiftable: (card: Card, player: Player, target: Player, strict?: boolean) => boolean; + cardGiftable: (card: Card, player: Player, target: Player, strict?: boolean | undefined) => boolean; /** * Check if the card is recastable * @@ -4149,7 +4189,7 @@ export class Library extends Uninstantable { * @param { Player } [source] * @param { boolean } [strict] */ - cardRecastable: (card: Card, player?: Player, source?: Player, strict?: boolean) => boolean; + cardRecastable: (card: Card, player?: Player, source?: Element.Player | undefined, strict?: boolean | undefined) => boolean; /** * @param { Card } card * @param { Player } player @@ -4176,7 +4216,7 @@ export class Library extends Uninstantable { * @returns {boolean} */ filterEnable: (event: GameEvent, player: Player, skill: string) => boolean; - characterDisabled: (i: any, libCharacter: any) => boolean; + characterDisabled: (i: any, libCharacter: any) => true | undefined; characterDisabled2: (i: any) => boolean; skillDisabled: (skill: any) => boolean; cardEnabled: (card: any, player: any, event: any) => any; @@ -4200,13 +4240,13 @@ export class Library extends Uninstantable { attackFrom: (card: any, player: any, target: any) => boolean; globalFrom: (card: any, player: any, target: any) => boolean; selectCard: () => number[]; - selectTarget: (card: any, player: any) => number | number[] | (() => number | Select); + selectTarget: (card: any, player: any) => any; judge: (card: any, player: any, target: any) => any; autoRespondSha: () => boolean; autoRespondShan: () => boolean; - wuxieSwap: (event: any) => boolean; + wuxieSwap: (event: any) => true | undefined; }; - static sort: { + sort: { nature: (a: any, b: any) => number; group: (a: any, b: any) => number; character: (a: any, b: any) => number; @@ -4233,7 +4273,7 @@ export class Library extends Uninstantable { * [key: string]: Skill; * }} */ - static skill: { + skill: { [key: string]: Skill; global: string[]; globalmap: SMap; @@ -4244,10 +4284,10 @@ export class Library extends Uninstantable { zhuSkill: SMap; land_used: SMap; }; - static character: {}; - static perfectPair: {}; - static cardPile: {}; - static message: { + character: {}; + perfectPair: {}; + cardPile: {}; + message: { server: { /** @this { any } */ init(this: any, version: any, config: any, banned_info: any): void; @@ -4295,16 +4335,16 @@ export class Library extends Uninstantable { updateWaiting: (map: any) => void; }; }; - static suit: string[]; - static suits: string[]; - static color: { + suit: string[]; + suits: string[]; + color: { black: string[]; red: string[]; none: string[]; }; - static group: string[]; - static nature: Map; - static natureAudio: { + group: string[]; + nature: Map; + natureAudio: { damage: { fire: string; thunder: string; @@ -4325,10 +4365,10 @@ export class Library extends Uninstantable { kami: string; }; }; - static linked: string[]; - static natureBg: Map; - static natureSeparator: string; - static namePrefix: Map; + natureSeparator: string; + namePrefix: Map; - static groupnature: { + groupnature: { shen: string; wei: string; shu: string; @@ -4377,36 +4417,21 @@ export class Library extends Uninstantable { jin: string; ye: string; }; - static lineColor: Map; - static phaseName: string[]; - static quickVoice: string[]; - static other: { - ignore: () => any; + lineColor: Map; + phaseName: string[]; + quickVoice: string[]; + other: { + ignore: () => undefined; }; - static InitFilter: { + InitFilter: { noZhuHp: string; noZhuSkill: string; }; + config: any; + configOL: any; } -export namespace Library { - let videos: Videos[]; - let node: { - fs: typeof import("fs"); - path: typeof import("path"); - debug: () => void; - clients: Element.Client[]; - banned: []; - observing: []; - torespond: {}; - torespondtimeout: {}; - }; - let playerOL: { - [key: string]: string; - }; - let config: any; - let configOL: any; -} -export const lib: typeof Library; +export let lib: Library; +export function setLibrary(instance?: Library | undefined): void; export type Player = InstanceType; export type Card = InstanceType; export type VCard = InstanceType; @@ -4416,9 +4441,8 @@ export type GameEvent = InstanceType; export type GameEventPromise = InstanceType & InstanceType; export type NodeWS = InstanceType; export type Control = InstanceType; -import { Uninstantable } from "../util/index.js"; +import * as Element from "./element/index.js"; import { Channel } from "./channel/index.js"; import { Announce } from "./announce/index.js"; import { LibInit } from "./init/index.js"; import { Experimental } from "./experimental/index.js"; -import * as Element from "./element/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts index 50b48f53b..8b04c7075 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts @@ -1,53 +1,52 @@ -export class LibInit extends Uninstantable { +export class LibInit { /** * 部分函数的Promise版本 */ - static promises: typeof LibInitPromises; - static init(): void; - static reset(): void; - static onload(): Promise; - static startOnline(): void; - static onfree(): void; - static connection(ws: any): void; - static sheet(...args: any[]): HTMLStyleElement; - static css(path: any, file: any, before: any): HTMLLinkElement; - static jsForExtension(path: any, file: any, onLoad: any, onError: any): void; - static js(path: any, file: any, onLoad: any, onError: any): HTMLScriptElement; + promises: LibInitPromises; + init(): void; + reset(): void; + onload(): Promise; + startOnline(): void; + onfree(): void; + connection(ws: any): void; + sheet(...args: any[]): HTMLStyleElement; + css(path: any, file: any, before: any): HTMLLinkElement; + jsForExtension(path: any, file: any, onLoad: any, onError: any): void; + js(path: any, file: any, onLoad: any, onError: any): HTMLScriptElement | undefined; /** * 同步lib.init.js * @returns { void } */ - static jsSync(path: any, file: any, onLoad: any, onError: any): void; - static req(str: any, onload: any, onerror: any, master: any): void; + jsSync(path: any, file: any, onLoad: any, onError: any): void; + req(str: any, onload: any, onerror: any, master: any): void; /** * 同步lib.init.req */ - static reqSync(str: any, onload: any, onerror: any, master: any): string; - static json(url: any, onload: any, onerror: any): void; + reqSync(str: any, onload: any, onerror: any, master: any): string | undefined; + json(url: any, onload: any, onerror: any): void; /** * 同步lib.init.json */ - static jsonSync(url: any, onload: any, onerror: any): void; - static cssstyles(): void; - static layout(layout: any, nosave: any): void; - static background(): void; + jsonSync(url: any, onload: any, onerror: any): void; + cssstyles(): void; + layout(layout: any, nosave: any): void; + background(): void; /** * * @param {*} item * @param {Function} [scope] 作用域 * @returns */ - static parsex(item: any, scope?: Function): any; - static eval(func: any): any; - static encode(strUni: any): string; - static decode(str: any): string; - static stringify(obj: any): string; - static stringifySkill(obj: any): string; + parsex(item: any, scope?: Function | undefined): any; + eval(func: any): any; + encode(strUni: any): string; + decode(str: any): string; + stringify(obj: any): string; + stringifySkill(obj: any): string; /** * 在返回当前加载的esm模块相对位置。 * @param {*} url 传入import.meta.url */ - static getCurrentFileLocation(url: any): string; + getCurrentFileLocation(url: any): string; } -import { Uninstantable } from "../../util/index.js"; import { LibInitPromises } from "./promises.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts index 67f155fdd..385fdfb28 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts @@ -1,4 +1,4 @@ -export class LibInitPromises extends Uninstantable { +export class LibInitPromises { /** * Promise版的`lib.init.js` * @@ -6,7 +6,7 @@ export class LibInitPromises extends Uninstantable { * @param {string | string[]} [file] - 文件名或文件名组,忽略则直接读取`path`的内容 * @returns {Promise} */ - static js(path: string, file?: string | string[]): Promise; + js(path: string, file?: string | string[] | undefined): Promise; /** * Promise版的`lib.init.css` * @@ -16,7 +16,7 @@ export class LibInitPromises extends Uninstantable { * @param {boolean} [noerror = false] - 是否忽略报错 * @returns {Promise} */ - static css(path: string, file?: string | string[], before?: Element, noerror?: boolean): Promise; + css(path: string, file?: string | string[] | undefined, before?: Element | undefined, noerror?: boolean | undefined): Promise; /** * Promise版的`lib.init.req` * @@ -24,19 +24,18 @@ export class LibInitPromises extends Uninstantable { * @param {string} [master] * @returns {Promise} */ - static req(str: string, master?: string): Promise; + req(str: string, master?: string | undefined): Promise; /** * Promise版的`lib.init.json` * * @param {string} url - 要读取的地址 * @returns {Promise} */ - static json(url: string): Promise; + json(url: string): Promise; /** * Promise版的`lib.init.sheet` * * @returns {Promise} */ - static sheet(): Promise; + sheet(): Promise; } -import { Uninstantable } from "../../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts index b39ff334c..f52662f1a 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts @@ -1,3 +1,4 @@ +export function gainAuthorization(): Promise; /** * 字节转换 * @param { number } limit @@ -30,9 +31,9 @@ export function checkVersion(ver1: string, ver2: string): -1 | 0 | 1; * ``` */ export function getRepoTags(options?: { - username?: string; - repository?: string; - accessToken?: string; + username?: string | undefined; + repository?: string | undefined; + accessToken?: string | undefined; }): Promise<{ commit: { sha: string; @@ -58,9 +59,9 @@ export function getRepoTags(options?: { * ``` */ export function getRepoTagDescription(tagName: string, options?: { - username?: string; - repository?: string; - accessToken?: string; + username?: string | undefined; + repository?: string | undefined; + accessToken?: string | undefined; }): Promise<{ /** @type { { browser_download_url: string, content_type: string, name: string, size: number }[] } tag额外上传的素材包 */ assets: { @@ -97,7 +98,7 @@ export function getRepoTagDescription(tagName: string, options?: { * @param { string } [options.username = 'libccy'] 仓库拥有者 * @param { string } [options.repository = 'noname'] 仓库名称 * @param { string } [options.accessToken] 身份令牌 - * @returns { Promise<{ download_url: string, name: string, path: string, sha: string, size: number, type: 'file' } | { download_url: null, name: string, path: string, sha: string, size: 0, type: 'dir' }> } + * @returns { Promise<({ download_url: string, name: string, path: string, sha: string, size: number, type: 'file' } | { download_url: null, name: string, path: string, sha: string, size: 0, type: 'dir' })[]> } * @example * ```js * getRepoFilesList() @@ -105,11 +106,11 @@ export function getRepoTagDescription(tagName: string, options?: { * .catch(error => console.error('Failed to fetch files:', error)); * ``` */ -export function getRepoFilesList(path?: string, branch?: string, options?: { - username?: string; - repository?: string; - accessToken?: string; -}): Promise<{ +export function getRepoFilesList(path?: string | undefined, branch?: string | undefined, options?: { + username?: string | undefined; + repository?: string | undefined; + accessToken?: string | undefined; +}): Promise<({ download_url: string; name: string; path: string; @@ -123,17 +124,47 @@ export function getRepoFilesList(path?: string, branch?: string, options?: { sha: string; size: 0; type: 'dir'; -}>; +})[]>; +/** + * + * 获取仓库指定分支和指定目录内的所有文件(包含子目录的文件) + * @param { string } [path = ''] 路径名称(可放参数) + * @param { string } [branch = ''] 仓库分支名称 + * @param { Object } options + * @param { string } [options.username = 'libccy'] 仓库拥有者 + * @param { string } [options.repository = 'noname'] 仓库名称 + * @param { string } [options.accessToken] 身份令牌 + * @returns { Promise<{ download_url: string, name: string, path: string, sha: string, size: number, type: 'file' }[]> } + * @example + * ```js + * flattenRepositoryFiles() + * .then(files => console.log(files)) + * .catch(error => console.error('Failed to fetch files:', error)); + * ``` + */ +export function flattenRepositoryFiles(path?: string | undefined, branch?: string | undefined, options?: { + username?: string | undefined; + repository?: string | undefined; + accessToken?: string | undefined; +}): Promise<{ + download_url: string; + name: string; + path: string; + sha: string; + size: number; + type: 'file'; +}[]>; /** * 请求一个文件而不是直接储存为文件 * @param { string } url * @param { (receivedBytes: number, total?:number, filename?: string) => void } [onProgress] + * @param { RequestInit } [options={}] * @example * ```js * await getRepoTagDescription('v1.10.10').then(({ zipball_url }) => request(zipball_url)); * ``` */ -export function request(url: string, onProgress?: (receivedBytes: number, total?: number, filename?: string) => void): Promise; +export function request(url: string, onProgress?: ((receivedBytes: number, total?: number, filename?: string) => void) | undefined, options?: RequestInit | undefined): Promise; /** * * @param { string } [title] @@ -142,4 +173,4 @@ export function request(url: string, onProgress?: (receivedBytes: number, total? * @param { string | number } [value] * @returns { progress } */ -export function createProgress(title?: string, max?: string | number, fileName?: string, value?: string | number): progress; +export function createProgress(title?: string | undefined, max?: string | number | undefined, fileName?: string | undefined, value?: string | number | undefined): progress; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts index 59d72745e..37bbedeb7 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts @@ -1,30 +1,50 @@ -export namespace status { - let paused: boolean; - let paused2: boolean; - let paused3: boolean; - let over: boolean; - let clicked: boolean; - let auto: boolean; - let event: GameEventPromise; - let ai: {}; - let lastdragchange: any[]; - let skillaudio: any[]; - let dieClose: any[]; - let dragline: any[]; - let dying: any[]; - let globalHistory: GameHistory[]; - namespace cardtag { - let yingbian_zhuzhan: any[]; - let yingbian_kongchao: any[]; - let yingbian_fujia: any[]; - let yingbian_canqu: any[]; - let yingbian_force: any[]; - } - let renku: any[]; - let prehidden_skills: any[]; - let postReconnect: {}; - let extension: string | void; - let dragged: boolean | void; - let touchconfirmed: boolean | void; +export class status { + paused: boolean; + paused2: boolean; + paused3: boolean; + over: boolean; + clicked: boolean; + auto: boolean; + /** + * @type { GameEventPromise } + */ + event: any; + ai: {}; + lastdragchange: any[]; + skillaudio: any[]; + dieClose: any[]; + dragline: any[]; + dying: any[]; + /** + * @type { GameHistory[] } + */ + globalHistory: GameHistory[]; + cardtag: { + yingbian_zhuzhan: never[]; + yingbian_kongchao: never[]; + yingbian_fujia: never[]; + yingbian_canqu: never[]; + yingbian_force: never[]; + }; + renku: any[]; + prehidden_skills: any[]; + postReconnect: {}; + /** + * @type { string | void } + */ + extension: string | void; + /** + * @type { boolean | void } + */ + dragged: boolean | void; + /** + * @type { boolean | void } + */ + touchconfirmed: boolean | void; + /** + * @type { boolean | void } + */ + connectMode: boolean | void; } -export namespace _status { } +export let _status: status; +export function setStatus(instance?: status | undefined): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts index 5f767cc2f..35b3b467c 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts @@ -1,93 +1,122 @@ -export class Click extends Uninstantable { - static identitycircle(): void; - static connectEvents(): void; - static connectClients(): void; - static autoskin(): void; - static skin(avatar: any, name: any, callback: any): void; - static touchpop(forced: any): void; - static exit(): void; - static shortcut(show: any): void; - static favouriteCharacter(e: any): void; - static buttonnameenter(): void; - static buttonnameleave(): void; - static dragtouchdialog(e: any): void; - static identity(e: any): void; - static identity2(): void; - static roundmenu(): void; - static pausehistory(): import("../../library/element/dialog.js").Dialog; - static pauseconfig(): import("../../library/element/dialog.js").Dialog; - static cardPileButton(): import("../../library/element/dialog.js").Dialog; - static chat(): import("../../library/element/dialog.js").Dialog; - static volumn(): import("../../library/element/dialog.js").Dialog; - static volumn_background(e: any): void; - static volumn_audio(e: any): void; - static hoverpopped(): void; - static hoverpopped_leave(): void; - static leavehoverpopped(): void; - static dierevive(): void; - static dieswap(): void; - static dieswap2(): void; - static touchconfirm(): void; - static windowtouchstart(e: any): void; - static windowtouchmove(e: any): void; - static windowtouchend(e: any): void; - static checkroundtranslate(translate: any): void; - static checkdialogtranslate(translate: any, dialog: any): void; - static windowmousewheel(e: any): void; - static windowmousemove(e: any): void; - static windowmousedown(e: any): void; - static cardtouchstart(e: any): void; - static cardtouchmove(e: any): void; - static windowmouseup(e: any): void; - static mousemove(): void; - static mouseenter(): void; - static mouseleave(): void; - static mousedown(): void; - static mouseentercancel(): void; - static hoverplayer(e: any): import("../../library/element/dialog.js").Dialog; - static longpressdown(e: any): void; - static longpresscallback(): void; - static longpresscancel(): void; - static window(): void; - static toggle(): void; - static editor(): void; - static switcher(): void; - static choice(): void; - static button(): void; - static touchintro(): void; - static card(...args: any[]): void; - static avatar(): void; - static avatar2(): void; - static connectroom(e: any): void; - static player(...args: any[]): any; - static target(e: any): void; - static control2(): void; - static control(): void; - static dialogcontrol(): void; - static skill(skill: any): void; - static ok(node: any): void; - static cancel(node: any): void; - static logv(e: any): void; - static logvleave(): void; - static charactercard(name: any, sourcenode: any, noedit: any, resume: any, avatar: any): void; - static intro(e: any): import("../../library/element/dialog.js").Dialog; - static intro2(): void; - static auto(...args: any[]): void; - static wuxie(): void; - static tempnowuxie(): void; - static pause(): void; - static resume(e: any): boolean; - static config(): void; - static swap(): void; - static mousewheel(evt: any): void; - static touchStart(e: any): void; - static dialogtouchStart(e: any): void; - static touchScroll(e: any): void; - static autoskill(bool: any, node: any): void; - static skillbutton(): void; - static autoskill2(e: any): void; - static hiddenskill(e: any): void; - static rightplayer(e: any): boolean; - static right(e: any): boolean; +export class Click { + /** + * @type {() => void} + */ + consoleMenu: () => void; + /** + * @type {(arg0: string) => void} + */ + menuTab: (arg0: string) => void; + identitycircle(): void; + connectEvents(): void; + connectClients(): void; + autoskin(): void; + skin(avatar: any, name: any, callback: any): void; + touchpop(forced: any): void; + exit(): void; + shortcut(show: any): void; + favouriteCharacter(e: any): void; + innerHTML: string | undefined; + buttonnameenter(): void; + buttonnameleave(): void; + dragtouchdialog(e: any): void; + _dragorigin: { + clientX: any; + clientY: any; + } | undefined; + _dragtransform: number[] | undefined; + _dragorigintransform: number[] | undefined; + identity(e: any): void; + _customintro: ((uiintro: any) => void) | undefined; + identity2(): void; + roundmenu(): void; + pausehistory(): import("../../library/element/dialog.js").Dialog | undefined; + pauseconfig(): import("../../library/element/dialog.js").Dialog | undefined; + cardPileButton(): import("../../library/element/dialog.js").Dialog; + chat(): import("../../library/element/dialog.js").Dialog; + volumn(): import("../../library/element/dialog.js").Dialog; + volumn_background(e: any): void; + volumn_audio(e: any): void; + hoverpopped(): void; + _uiintro: any; + hoverpopped_leave(): void; + _poppedalready: boolean | undefined; + leavehoverpopped(): void; + dierevive(): void; + dieswap(): void; + dieswap2(): void; + touchconfirm(): void; + windowtouchstart(e: any): void; + windowtouchmove(e: any): void; + windowtouchend(e: any): void; + checkroundtranslate(translate: any): void; + checkdialogtranslate(translate: any, dialog: any): void; + windowmousewheel(e: any): void; + windowmousemove(e: any): void; + windowmousedown(e: any): void; + cardtouchstart(e: any): void; + _waitingfordrag: { + clientX: any; + clientY: any; + } | undefined; + cardtouchmove(e: any): void; + windowmouseup(e: any): void; + mousemove(): void; + mouseenter(): void; + mouseleave(): void; + _mouseentercreated: boolean | undefined; + mousedown(): void; + mouseentercancel(): void; + hoverplayer(e: any): import("../../library/element/dialog.js").Dialog | undefined; + longpressdown(e: any): void; + _longpresstimeout: NodeJS.Timeout | undefined; + _longpressevent: any; + longpresscallback(): void; + longpresscancel(): void; + window(): void; + toggle(): void; + link: boolean | undefined; + editor(): void; + switcher(): void; + choice(): void; + button(): void; + touchintro(): void; + card(...args: any[]): void; + avatar(): void; + _doubleClicking: boolean | undefined; + avatar2(): void; + connectroom(e: any): void; + player(...args: any[]): void; + target(e: any): void; + control2(): void; + control(): void; + dialogcontrol(): void; + skill(skill: any): void; + ok(node: any): void; + cancel(node: any): void; + logv(e: any): void; + logvtimeout: any; + logvleave(): void; + charactercard(name: any, sourcenode: any, noedit: any, resume: any, avatar: any): void; + intro(e: any): import("../../library/element/dialog.js").Dialog | undefined; + intro2(): void; + auto(...args: any[]): void; + wuxie(): void; + tempnowuxie(): void; + pause(): void; + resume(e: any): false | undefined; + config(): void; + swap(): void; + mousewheel(evt: any): void; + touchStart(e: any): void; + startX: number | undefined; + startY: number | undefined; + dialogtouchStart(e: any): void; + touchScroll(e: any): void; + autoskill(bool: any, node: any): void; + skillbutton(): void; + autoskill2(e: any): void; + hiddenskill(e: any): void; + rightplayer(e: any): boolean; + right(e: any): false | undefined; } -import { Uninstantable } from "../../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts index a4ee18e8d..ad87669c0 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts @@ -1,71 +1,75 @@ -export class Create extends Uninstantable { +export class Create { + /** + * @type {(video: Videos, before: boolean) => void} + */ + videoNode: (video: any, before: boolean) => void; /** * 创建身份牌实例 */ - static identityCard(identity: any, position: any, noclick: any): import("../../library/element/card.js").Card; + identityCard(identity: any, position: any, noclick: any): import("../../library/element/card.js").Card; /** * 让卡牌旋转 */ - static cardSpinning(card: any): void; + cardSpinning(card: any): void; /** * 旋转的身份牌! */ - static spinningIdentityCard(identity: any, dialog: any): void; + spinningIdentityCard(identity: any, dialog: any): void; /** * 创建codemirror编辑器 * @param {HTMLDivElement} container * @param {Function} saveInput */ - static editor(container: HTMLDivElement, saveInput: Function): HTMLDivElement; - static cardTempName(card: any, applyNode: any): any; - static connectRooms(list: any): void; - static rarity(button: any): void; - static div(...args: any[]): HTMLDivElement; - static filediv(...args: any[]): any; - static node(...args: any[]): any; - static iframe(src: any): void; - static identitycircle(list: any, target: any): void; - static chat(): void; - static exit(): void; - static connecting(bool: any): void; - static roomInfo(): void; - static templayer(time: any): void; - static selectlist(list: any, init: any, position: any, onchange: any): HTMLSelectElement; + editor(container: HTMLDivElement, saveInput: Function): HTMLDivElement; + cardTempName(card: any, applyNode: any): any; + connectRooms(list: any): void; + rarity(button: any): void; + div(...args: any[]): HTMLDivElement; + filediv(...args: any[]): HTMLDivElement; + node(...args: any[]): any; + iframe(src: any): void; + identitycircle(list: any, target: any): void; + chat(): void; + exit(): void; + connecting(bool: any): void; + roomInfo(): void; + templayer(time: any): void; + selectlist(list: any, init: any, position: any, onchange: any): HTMLSelectElement; /** 创建菜单 */ - static menu: typeof menu; + menu: typeof menu; /** 创建“开始”菜单 */ - static startMenu: (connectMenu: any) => HTMLDivElement; + startMenu: (connectMenu: any) => HTMLDivElement; /** 创建“选项”菜单 */ - static optionsMenu: (connectMenu: any) => void; + optionsMenu: (connectMenu: any) => void; /** 创建“武将”菜单 */ - static characterPackMenu: (connectMenu: any) => (packName: string) => void; + characterPackMenu: (connectMenu: any) => (packName: string) => void; /** 创建“卡牌”菜单 */ - static cardPackMenu: (connectMenu: any) => (packName: string) => void; + cardPackMenu: (connectMenu: any) => (packName: string) => void; /** 创建“扩展”菜单 */ - static extensionMenu: (connectMenu: any) => void; + extensionMenu: (connectMenu: any) => void; /** 创建“其他”菜单 */ - static otherMenu: (connectMenu: any) => void; - static statictable(...args: any[]): HTMLTableElement; - static giveup(): void; - static groupControl(dialog: any): import("../../library/element/control.js").Control; - static cardDialog(...args: any[]): any; - static characterDialog2(filter: any): import("../../library/element/dialog.js").Dialog; - static characterDialog(...args: any[]): import("../../library/element/dialog.js").Dialog; - static dialog(...args: any[]): import("../../library/element/dialog.js").Dialog; - static line2(...args: any[]): any; - static line(...args: any[]): HTMLDivElement; - static switcher(name: any, current: any, current2: any, ...args: any[]): HTMLDivElement; - static caption(str: any, position: any): HTMLDivElement; - static control(...args: any[]): import("../../library/element/control.js").Control; - static confirm(str: any, func: any): void; - static skills(skills: any): import("../../library/element/control.js").Control; - static skills2(skills: any): import("../../library/element/control.js").Control; - static skills3(skills: any): import("../../library/element/control.js").Control; - static arena(): void; - static system(str: any, func: any, right: any, before: any): HTMLDivElement; - static pause(): HTMLDivElement; - static prebutton(item: any, type: any, position: any, noclick: any): HTMLDivElement; - static buttonPresets: { + otherMenu: (connectMenu: boolean | undefined) => void; + statictable(...args: any[]): HTMLTableElement; + giveup(): void; + groupControl(dialog: any): import("../../library/element/control.js").Control; + cardDialog(...args: any[]): import("../../library/element/dialog.js").Dialog; + characterDialog2(filter: any): import("../../library/element/dialog.js").Dialog; + characterDialog(...args: any[]): import("../../library/element/dialog.js").Dialog; + dialog(...args: any[]): import("../../library/element/dialog.js").Dialog; + line2(...args: any[]): HTMLDivElement; + line(...args: any[]): HTMLDivElement; + switcher(name: any, current: any, current2: any, ...args: any[]): HTMLDivElement; + caption(str: any, position: any): HTMLDivElement; + control(...args: any[]): import("../../library/element/control.js").Control; + confirm(str: any, func: any): void; + skills(skills: any): any; + skills2(skills: any): any; + skills3(skills: any): any; + arena(): void; + system(str: any, func: any, right: any, before: any): HTMLDivElement; + pause(): HTMLDivElement | undefined; + prebutton(item: any, type: any, position: any, noclick: any): HTMLDivElement; + buttonPresets: { /** * @returns { import("../library/index.js").Button } */ @@ -95,16 +99,15 @@ export class Create extends Uninstantable { */ player: (item: any, type: any, position: any, noclick: any, node: any) => any; }; - static button(item: any, type: any, position: any, noClick: any, button: any): import("../../library/element/button.js").Button; - static buttons(list: any, type: any, position: any, noclick: any, zoom: any): HTMLDivElement[]; - static textbuttons(list: any, dialog: any, noclick: any): void; - static player(position: any, noclick: any): import("../../library/element/player.js").Player; - static connectPlayers(ip: any): void; - static players(numberOfPlayers: any): import("../../library/element/player.js").Player[]; - static me(hasme: any): void; - static card(position: any, info: any, noclick: any): import("../../library/element/card.js").Card; - static cardsAsync(...args: any[]): void; - static cards(ordered: any): void; + button(item: any, type: any, position: any, noClick: any, button: any): import("../../library/element/button.js").Button; + buttons(list: any, type: any, position: any, noclick: any, zoom: any): HTMLDivElement[]; + textbuttons(list: any, dialog: any, noclick: any): void; + player(position: any, noclick: any): import("../../library/element/player.js").Player; + connectPlayers(ip: any): void; + players(numberOfPlayers: any): any[] | undefined; + me(hasme: any): void; + card(position: any, info: any, noclick: any): import("../../library/element/card.js").Card; + cardsAsync(...args: any[]): void; + cards(ordered: any): void; } -import { Uninstantable } from "../../util/index.js"; import { menu } from "./menu/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/index.d.ts index 685a8393e..a4ca5efb3 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/index.d.ts @@ -22,7 +22,7 @@ export function setUpdateActiveCard(fun: Function): void; /** * @param { boolean } [connectMenu] */ -export function menu(connectMenu?: boolean): void; +export function menu(connectMenu?: boolean | undefined): void; /** * @type { HTMLDivElement } * diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/otherMenu.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/otherMenu.d.ts index 2b80a6971..4e260cd23 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/otherMenu.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/otherMenu.d.ts @@ -1 +1 @@ -export function otherMenu(connectMenu: any): void; +export function otherMenu(connectMenu: boolean | undefined): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts index 8d57192bc..b99c9fecf 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts @@ -1,15 +1,15 @@ -export class UI extends Uninstantable { - static updates: any[]; - static thrown: any[]; - static touchlines: any[]; - static todiscard: {}; +export class UI { + updates: any[]; + thrown: any[]; + touchlines: any[]; + todiscard: {}; /** * @type { HTMLStyleElement[] } */ - static playerPositions: HTMLStyleElement[]; - static create: typeof Create; - static click: typeof Click; - static selected: { + playerPositions: HTMLStyleElement[]; + create: Create; + click: Click; + selected: { /** * @type { Button[] } */ @@ -26,111 +26,139 @@ export class UI extends Uninstantable { /** * @type { Dialog[] } */ - static dialogs: Dialog[]; + dialogs: Dialog[]; /** * @type { Dialog } */ - static dialog: Dialog; + dialog: any; /** * @type { HTMLDivElement } */ - static arena: HTMLDivElement; + arena: HTMLDivElement; /** * @type { Control[] } */ - static controls: Control[]; + controls: Control[]; /** * @type { Control } */ - static control: Control; + control: any; /** * @type { Control | undefined } */ - static confirm: Control | undefined; + confirm: Control | undefined; /** * @type { Control | undefined } */ - static skills: Control | undefined; + skills: Control | undefined; /** * @type { Control | undefined } */ - static skills1: Control | undefined; + skills1: Control | undefined; /** * @type { Control | undefined } */ - static skills2: Control | undefined; + skills2: Control | undefined; /** * @type { Control | undefined } */ - static skills3: Control | undefined; + skills3: Control | undefined; /** * @type { HTMLDivElement } */ - static window: HTMLDivElement; + window: HTMLDivElement; /** * @type { HTMLDivElement } */ - static pause: HTMLDivElement; + pause: HTMLDivElement; /** * @type { HTMLAudioElement } */ - static backgroundMusic: HTMLAudioElement; + backgroundMusic: HTMLAudioElement; /** * @type { HTMLDivElement } */ - static special: HTMLDivElement; + special: HTMLDivElement; /** * @type { HTMLDivElement } */ - static fakeme: HTMLDivElement; + fakeme: HTMLDivElement; /** * @type { HTMLDivElement } */ - static chess: HTMLDivElement; + chess: HTMLDivElement; /** * 手动在菜单栏中添加一个武将包的ui * @type { ((packName: string) => void)[] } */ - static updateCharacterPackMenu: ((packName: string) => void)[]; + updateCharacterPackMenu: ((packName: string) => void)[]; /** * 手动在菜单栏中添加一个卡牌包的ui * @type { ((packName: string) => void)[] } */ - static updateCardPackMenu: ((packName: string) => void)[]; + updateCardPackMenu: ((packName: string) => void)[]; /** * @type { HTMLDivElement } 挑战模式下正在操作的角色 */ - static mebg: HTMLDivElement; - static refresh(node: any): void; - static clear(): void; - static updatec(): void; - static updatex(...args: any[]): void; - static updatexr(): void; - static updatejm(player: any, nodes: any, start: any, inv: any): void; - static updatem(player: any): void; - static updatej(player: any): void; - static updatehl(): void; - static updateh(compute: any): void; - static updatehx(node: any): void; - static updated(): void; - static updatez(): void; - static update(): void; - static recycle(node: any, key: any): any; + mebg: HTMLDivElement; + /** + * @type { Function | undefined } + */ + updateUpdate: Function | undefined; + /** + * @type {HTMLDivElement} + */ + commandnode: HTMLDivElement; + /** + * @type {() => void} + */ + updateVideoMenu: () => void; + /** + * @type {HTMLDivElement} + */ + menuContainer: HTMLDivElement; + /** + * @type {HTMLDivElement} + */ + auto: HTMLDivElement; + /** + * @type {HTMLDivElement} + */ + wuxie: HTMLDivElement; + /** + * @type {HTMLDivElement} + */ + tempnowuxie: HTMLDivElement; + refresh(node: any): void; + clear(): void; + updatec(): void; + updatex(...args: any[]): void; + updatexr(): void; + updatejm(player: any, nodes: any, start: any, inv: any): void; + updatem(player: any): void; + updatej(player: any): void; + updatehl(): void; + updateh(compute: any): void; + updatehx(node: any): void; + updated(): void; + updatez(): void; + update(): void; + recycle(node: any, key: any): any; /** * @author curpond * @author Tipx-L * @param {number} [numberOfPlayers] */ - static updateConnectPlayerPositions(numberOfPlayers?: number): void; + updateConnectPlayerPositions(numberOfPlayers?: number | undefined): void; /** * @author curpond * @author Tipx-L * @param {number} [numberOfPlayers] */ - static updatePlayerPositions(numberOfPlayers?: number): void; - static updateRoundNumber(roundNumber: any, cardPileNumber: any): void; + updatePlayerPositions(numberOfPlayers?: number | undefined): void; + updateRoundNumber(roundNumber: any, cardPileNumber: any): void; } -export const ui: typeof UI; -import { Uninstantable } from "../util/index.js"; +export let ui: UI; +export function setUI(instance?: UI | undefined): void; import { Create } from "./create/index.js"; import { Click } from "./click/index.js"; diff --git a/node_modules/@types/noname-typings/package.json b/node_modules/@types/noname-typings/package.json index 80981fd24..5c9f66ff6 100644 --- a/node_modules/@types/noname-typings/package.json +++ b/node_modules/@types/noname-typings/package.json @@ -1,6 +1,6 @@ { "name": "noname-typings", - "version": "2024.04.06", + "version": "2024.04.11", "description": "Noname typings, mainly for showing type hints when creating extensions of the Sanguosha-like game Noname.", "repository": { "type": "git", diff --git a/noname.js b/noname.js index 45db36bc4..24d68dcae 100644 --- a/noname.js +++ b/noname.js @@ -1,8 +1,8 @@ -export { GNC as gnc } from './noname/gnc/index.js'; -export { AI as ai } from './noname/ai/index.js'; -export { Game as game } from './noname/game/index.js'; -export { Get as get } from './noname/get/index.js'; -export { Library as lib } from './noname/library/index.js'; -export { status as _status } from './noname/status/index.js'; -export { UI as ui } from './noname/ui/index.js'; +export { GNC, gnc, setGNC } from './noname/gnc/index.js'; +export { AI, ai, setAI } from './noname/ai/index.js'; +export { Game, game, setGame } from './noname/game/index.js'; +export { Get, get, setGet } from './noname/get/index.js'; +export { Library, lib, setLibrary } from './noname/library/index.js'; +export { status, _status, setStatus } from './noname/status/index.js'; +export { UI, ui, setUI } from './noname/ui/index.js'; export { boot } from './noname/init/index.js'; diff --git a/noname/ai/basic.js b/noname/ai/basic.js index 0d03bb8c1..a9cef5c28 100644 --- a/noname/ai/basic.js +++ b/noname/ai/basic.js @@ -1,20 +1,16 @@ -import { Get as get } from '../get/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { Library as lib } from '../library/index.js'; -import { GNC as gnc } from '../gnc/index.js'; -import { Uninstantable } from "../util/index.js"; +import { get } from '../get/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; import { CacheContext } from '../library/cache/cacheContext.js'; - -export class Basic extends Uninstantable { +export class Basic { /** * @param { ( * button: Button, * buttons?: Button[] * ) => number } check */ - static chooseButton(check) { + chooseButton(check) { const event = _status.event; let i, j, range, buttons, buttons2; let ok = false, forced = event.forced; @@ -81,7 +77,7 @@ export class Basic extends Uninstantable { * ) => number } check * @returns { boolean | undefined } */ - static chooseCard(check) { + chooseCard(check) { const event = _status.event; if (event.filterCard == undefined) return (check() > 0); let i, j, range, cards, cards2, skills, effect; @@ -144,7 +140,7 @@ export class Basic extends Uninstantable { var info = get.info(event.skill); if (info.filterCard) { check = info.check || get.unuseful2; - return (Basic.chooseCard(check)); + return (this.chooseCard(check)); } else { return true; @@ -169,7 +165,7 @@ export class Basic extends Uninstantable { * targets?: Player[] * ) => number } check */ - static chooseTarget(check) { + chooseTarget(check) { const event = _status.event; if (event.filterTarget == undefined) return (check() > 0); let i, j, range, targets, targets2, effect; diff --git a/noname/ai/index.js b/noname/ai/index.js index 6452195ef..922a59433 100644 --- a/noname/ai/index.js +++ b/noname/ai/index.js @@ -1,19 +1,23 @@ -import { Get as get } from '../get/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { Library as lib } from '../library/index.js'; -import { GNC as gnc } from '../gnc/index.js'; -import { Uninstantable } from "../util/index.js"; - +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; import { Basic } from './basic.js'; -export class AI extends Uninstantable { - static basic = Basic; - static get = get; +export class AI { + basic = new Basic(); + get = get; }; -export const ai = AI; +export let ai = new AI(); + +/** + * @param { InstanceType } [instance] + */ +export let setAI = (instance) => { + ai = instance || new AI(); + if (lib.config.dev) { + window.ai = ai; + } +}; export { Basic diff --git a/noname/game/check.js b/noname/game/check.js new file mode 100644 index 000000000..d5476c12a --- /dev/null +++ b/noname/game/check.js @@ -0,0 +1,139 @@ +import { get } from '../get/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; +import { lib } from '../library/index.js'; + +export class Check { + processSelection({ type, items, event, useCache, isSelectable }) { + let ok = true, auto; + let selectableItems = false; + const uppercaseType = (type) => type[0].toUpperCase() + type.slice(1); + const uiSelected = ui.selected[`${type}s`]; + const range = get.select(event[`select${uppercaseType(type)}`]); + + if (event.forceAuto && uiSelected.length === range[1]) auto = true; + else if (range[0] !== range[1] || range[0] > 1) auto = false; + + let cache; + let firstCheck = false; + + if (useCache) { + if (!event[`_${type}Choice`]) event[`_${type}Choice`] = {}; + let cacheId = 0; + for (let Type of ['button', 'card', 'target']) { + if (type === Type) break; + if (Type === "target") Type = "player"; + ui.selected[`${Type}s`].forEach(i => cacheId ^= i[`${Type}id`]); + } + if (!event[`_${type}Choice`][cacheId]) { + event[`_${type}Choice`][cacheId] = []; + firstCheck = true; + } + cache = event[`_${type}Choice`][cacheId]; + } + + items.forEach(item => { + let selectable; + if (!lib.filter.cardAiIncluded(item)) selectable = false; + else if (useCache && !firstCheck) selectable = cache.includes(item); + else selectable = isSelectable(item, event); + + if (range[1] <= -1) { + if (selectable) { + item.classList.add('selected'); + uiSelected.add(item); + } else { + item.classList.remove('selected'); + uiSelected.remove(item); + } + if (item.updateTransform) item.updateTransform(selectable); + } else { + if (selectable && uiSelected.length < range[1]) { + item.classList.add('selectable'); + if (firstCheck) cache.push(item); + } + else item.classList.remove('selectable'); + } + + if (item.classList.contains('selectable')) selectableItems = true; + else if (item.classList.contains('selected')) item.classList.add('selectable'); + + game.callHook(`check${uppercaseType(type)}`, [item, event]); + }); + + if (event[`${type}Required`] && uiSelected.length === 0) ok = false; + else if (uiSelected.length < range[0] && (!event.forced || selectableItems || event.complexSelect)) ok = false; + + if (event.custom && event.custom.add[type]) event.custom.add[type](); + + return { ok, auto }; + } + button(event, useCache) { + const player = event.player; + const buttons = event.dialog.buttons; + const isSelectable = (button, event) => { + if (!lib.filter.buttonIncluded(button)) return false; + if (button.classList.contains('unselectable')) return false; + return event.filterButton(button, player); + } + return game.Check.processSelection({ type: 'button', items: buttons, event, useCache, isSelectable }); + } + card(event, useCache) { + const player = event.player; + const cards = player.getCards(event.position); + const isSelectable = (card, event) => { + if (card.classList.contains('uncheck')) return false; + if (player.isOut()) return false; + if (!lib.filter.cardRespondable(card, player)) return false; + return event.filterCard(card, player); + } + return game.Check.processSelection({ type: 'card', items: cards, event, useCache, isSelectable }); + } + target(event, useCache) { + const player = event.player; + const card = get.card(); + const targets = game.players.slice(); + if (event.deadTarget) targets.addArray(game.dead); + const isSelectable = (target, event) => { + if (game.chess && !event.chessForceAll && player && get.distance(player, target, 'pure') > 7) return false; + if (target.isOut()) return false; + return event.filterTarget(card, player, target); + } + return game.Check.processSelection({ type: 'target', items: targets, event, useCache, isSelectable }); + } + skill(event) { + if (ui.skills) ui.skills.close(); + if (ui.skills2) ui.skills2.close(); + if (ui.skills3) ui.skills3.close(); + if (event.skill || !get.noSelected() || _status.noconfirm) return; + + const player = event.player; + if (!event._skillChoice) event._skillChoice = game.expandSkills(player.getSkills('invisible').concat(lib.skill.global)).filter(skill => lib.filter.filterEnable(event, player, skill)); + + const skills = event._skillChoice.filter(i => event.isMine() || !event._aiexclude.includes(i)); + const globallist = game.expandSkills(lib.skill.global.slice()); + const ownedlist = game.expandSkills(player.getSkills('invisible', false)); + + const ownedSkills = [], globalSkills = [], equipSkills = []; + skills.forEach(skill => { + if (globallist.includes(skill)) globalSkills.push(skill); + else if (!ownedlist.includes(skill)) equipSkills.push(skill); + else ownedSkills.push(skill); + }); + + if (ownedSkills.length) ui.create.skills(ownedSkills); + if (globalSkills.length) ui.create.skills2(globalSkills); + if (equipSkills.length) ui.create.skills3(equipSkills); + } + confirm(event, confirm) { + ui.arena.classList.add('selecting'); + if (event.filterTarget && (!event.filterCard || !event.position || (typeof event.position == 'string' && !event.position.includes('e')))) { + ui.arena.classList.add('tempnoe'); + } + game.countChoose(); + if (!_status.noconfirm && !_status.event.noconfirm && (_status.mouseleft || !_status.mousedown)) { + ui.create.confirm(confirm); + } + } +} \ No newline at end of file diff --git a/noname/game/index.js b/noname/game/index.js index e971b0536..e0b77255c 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -10,51 +10,55 @@ * @typedef { { mode: string, name: string[], name1: string, name2?: string, time: number, video: Video, win: boolean } } Videos */ -import { AI as ai } from '../ai/index.js'; -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { GNC as gnc } from '../gnc/index.js'; +import { ai } from '../ai/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; +import { gnc } from '../gnc/index.js'; import { userAgent, Uninstantable, GeneratorFunction, AsyncFunction, delay, nonameInitialized } from "../util/index.js"; import { DynamicStyle } from "./dynamic-style/index.js"; import { GamePromises } from "./promises.js"; +import { Check } from "./check.js"; -export class Game extends Uninstantable { - static online = false; - static onlineID = null; - static onlineKey = null; +export class Game { + online = false; + onlineID = null; + onlineKey = null; /** * @type {Player[]} */ - static players = []; + players = []; /** * @type {Player[]} */ - static dead = []; - static imported = []; + dead = []; + imported = []; /** * @type { { [key: string]: Player } } */ - static playerMap = {}; - static phaseNumber = 0; - static roundNumber = 0; - static shuffleNumber = 0; - static promises = GamePromises; + playerMap = {}; + phaseNumber = 0; + roundNumber = 0; + shuffleNumber = 0; + promises = new GamePromises(); /** * @type { string } */ - static layout; + // @ts-ignore + layout; /** * @type { Player } */ - static me; + // @ts-ignore + me; /** * @type { boolean } */ - static chess; - static globalEventHandlers = new class { + // @ts-ignore + chess; + globalEventHandlers = new class { constructor() { this._handlers = {}; } @@ -116,13 +120,13 @@ export class Game extends Uninstantable { } //Stratagem //谋攻 - static setStratagemBuffCost(cardName, cost) { return game.broadcastAll((clientCardName, clientCost) => lib.stratagemBuff.cost.set(clientCardName, clientCost), cardName, cost) } - static setStratagemBuffEffect(cardName, effect) { return game.broadcastAll((clientCardName, clientEffect) => lib.stratagemBuff.cost.set(clientCardName, clientEffect), cardName, effect) } - static setStratagemBuffPrompt(cardName, prompt) { return game.broadcastAll((clientCardName, clientPrompt) => lib.stratagemBuff.cost.set(clientCardName, clientPrompt), cardName, prompt) } + setStratagemBuffCost(cardName, cost) { return game.broadcastAll((clientCardName, clientCost) => lib.stratagemBuff.cost.set(clientCardName, clientCost), cardName, cost) } + setStratagemBuffEffect(cardName, effect) { return game.broadcastAll((clientCardName, clientEffect) => lib.stratagemBuff.cost.set(clientCardName, clientEffect), cardName, effect) } + setStratagemBuffPrompt(cardName, prompt) { return game.broadcastAll((clientCardName, clientPrompt) => lib.stratagemBuff.cost.set(clientCardName, clientPrompt), cardName, prompt) } /** * 添加新的属性杀 */ - static addNature(nature, translation, config) { + addNature(nature, translation, config) { if (!nature) throw new TypeError(); if (translation && translation.length) lib.translate['nature_' + nature] = translation; game.callHook("addNature", [nature, translation, config]); @@ -131,7 +135,7 @@ export class Game extends Uninstantable { /** * 判断卡牌信息/事件是否有某个属性 */ - static hasNature(item, nature, player) { + hasNature(item, nature, player) { var natures = get.natureList(item, player); if (!nature) return natures.length > 0; if (nature == 'linked') return natures.some(n => lib.linked.includes(n)); @@ -140,7 +144,7 @@ export class Game extends Uninstantable { /** * 设置卡牌信息/事件的属性 */ - static setNature(item, nature, addNature) { + setNature(item, nature, addNature) { if (!nature) nature = []; if (!addNature) { item.nature = get.nature(nature); @@ -157,7 +161,7 @@ export class Game extends Uninstantable { /** * 洗牌 */ - static washCard() { + washCard() { if (!ui.cardPile.hasChildNodes() && !ui.discardPile.hasChildNodes()) return false; if (_status.maxShuffle != undefined) { if (_status.maxShuffle == 0) { @@ -192,7 +196,7 @@ export class Game extends Uninstantable { /** * 基于钩子的添加势力方法 */ - static addGroup(id, short, name, config) { + addGroup(id, short, name, config) { if (!id) throw new TypeError(); if (lib.comparator.typeEquals(short, "object")) { config = short; @@ -222,7 +226,7 @@ export class Game extends Uninstantable { * @param {Name} name * @param {Parameters} args */ - static callHook(name, args) { + callHook(name, args) { const callHook = () => { for (const hook of lib.hooks[name]) { if (hook != null && typeof hook == "function") { @@ -235,7 +239,7 @@ export class Game extends Uninstantable { } //Yingbian //应变 - static yingbianEffect(event, content) { + yingbianEffect(event, content) { const yingbianEffect = game.createEvent('yingbianEffect'); yingbianEffect.player = event.player; yingbianEffect.card = event.card; @@ -244,11 +248,11 @@ export class Game extends Uninstantable { yingbianEffect._args = Array.from(arguments); return yingbianEffect; } - static setYingbianConditionColor(yingbianCondition, color) { return game.broadcastAll((yingbianCondition, color) => lib.yingbian.condition.color.set(yingbianCondition, color), yingbianCondition, color) } - static setComplexYingbianCondition(yingbianCondition, condition) { return game.broadcastAll((yingbianCondition, condition) => lib.yingbian.condition.complex.set(yingbianCondition, condition), yingbianCondition, condition) } - static setSimpleYingbianCondition(yingbianCondition, condition) { return game.broadcastAll((yingbianCondition, condition) => lib.yingbian.condition.simple.set(yingbianCondition, condition), yingbianCondition, condition) } - static setYingbianEffect(yingbianEffect, effect) { return game.broadcastAll((yingbianEffect, effect) => lib.yingbian.effect.set(yingbianEffect, effect), yingbianEffect, effect) } - static setYingbianPrompt(yingbian, prompt) { return game.broadcastAll((yingbian, prompt) => lib.yingbian.prompt.set(yingbian, prompt), yingbian, prompt) } + setYingbianConditionColor(yingbianCondition, color) { return game.broadcastAll((yingbianCondition, color) => lib.yingbian.condition.color.set(yingbianCondition, color), yingbianCondition, color) } + setComplexYingbianCondition(yingbianCondition, condition) { return game.broadcastAll((yingbianCondition, condition) => lib.yingbian.condition.complex.set(yingbianCondition, condition), yingbianCondition, condition) } + setSimpleYingbianCondition(yingbianCondition, condition) { return game.broadcastAll((yingbianCondition, condition) => lib.yingbian.condition.simple.set(yingbianCondition, condition), yingbianCondition, condition) } + setYingbianEffect(yingbianEffect, effect) { return game.broadcastAll((yingbianEffect, effect) => lib.yingbian.effect.set(yingbianEffect, effect), yingbianEffect, effect) } + setYingbianPrompt(yingbian, prompt) { return game.broadcastAll((yingbian, prompt) => lib.yingbian.prompt.set(yingbian, prompt), yingbian, prompt) } /** * Dynamic Style Manager * 动态CSS管理对象 @@ -293,13 +297,13 @@ export class Game extends Uninstantable { * textAlign: "center" * }); */ - static dynamicStyle = new DynamicStyle() + dynamicStyle = new DynamicStyle() /** * Add a background music to the config option * * 在设置选项中添加一首背景音乐 */ - static addBackgroundMusic(link, musicName, aozhan) { + addBackgroundMusic(link, musicName, aozhan) { const backgroundMusicSetting = ui[aozhan ? 'aozhan_bgm' : 'background_music_setting'], menu = backgroundMusicSetting._link.menu, config = backgroundMusicSetting._link.config; if (typeof musicName != 'string') musicName = link; if (aozhan) lib.mode.guozhan.config.aozhan_bgm.item[link] = musicName; @@ -321,7 +325,7 @@ export class Game extends Uninstantable { * * 从设置选项中移除一首背景音乐 */ - static removeBackgroundMusic(link, aozhan) { + removeBackgroundMusic(link, aozhan) { if (aozhan) { if (['disabled', 'random'].includes(link)) return; delete lib.mode.guozhan.config.aozhan_bgm.item[link]; @@ -335,7 +339,7 @@ export class Game extends Uninstantable { const backgroundMusicSetting = ui[aozhan ? 'aozhan_bgm' : 'background_music_setting'], config = backgroundMusicSetting._link.config; config.updatex.call(backgroundMusicSetting, []); } - static updateBackground() { + updateBackground() { const background = _status.tempBackground || lib.config.image_background; ui.background.delete(); const uiBackground = ui.background = ui.create.div('.background'), style = uiBackground.style; @@ -369,8 +373,8 @@ export class Game extends Uninstantable { * * 用给定的BPM、节拍和偏移生成谱面 */ - static generateBeatmapTimeleap(bpm, beats, offset) { return beats.map(value => Math.round(value * 60000 / bpm + (offset || 0))) } - static updateRenku() { + generateBeatmapTimeleap(bpm, beats, offset) { return beats.map(value => Math.round(value * 60000 / bpm + (offset || 0))) } + updateRenku() { game.broadcast(function (renku) { _status.renku = renku; }, _status.renku); @@ -383,7 +387,7 @@ export class Game extends Uninstantable { * @param { Card[] | Card } cards * @param { Player[] } players */ - static addCardKnower(cards, players) { + addCardKnower(cards, players) { if (get.itemtype(cards) == 'card') { // @ts-ignore cards = [cards]; @@ -395,7 +399,7 @@ export class Game extends Uninstantable { * 移除牌的所有知情者。 * @param { Card[] | Card } cards */ - static clearCardKnowers(cards) { + clearCardKnowers(cards) { // @ts-ignore if (get.itemtype(cards) == 'card') { // @ts-ignore @@ -407,7 +411,7 @@ export class Game extends Uninstantable { /** * @param { { [key: string]: any } } [arg] */ - static loseAsync(arg) { + loseAsync(arg) { var next = game.createEvent('loseAsync'); next.forceDie = true; next.getd = function (player, key, position) { @@ -466,7 +470,7 @@ export class Game extends Uninstantable { } return next; } - static callFuncUseStepCache(prefix, func, params) { + callFuncUseStepCache(prefix, func, params) { if (typeof func != 'function') return; if (_status.closeStepCache || !_status.event) return func.apply(null, params); var cacheKey = "[" + prefix + "]" + get.paramToCacheKey.apply(null, params); @@ -480,7 +484,7 @@ export class Game extends Uninstantable { /** * @param {string} name */ - static getRarity(name) { + getRarity(name) { var rank = lib.rank.rarity; if (rank.legend.includes(name)) return 'legend'; if (rank.epic.includes(name)) return 'epic'; @@ -495,7 +499,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { boolean } */ - static hasGlobalHistory(key, filter, last) { + hasGlobalHistory(key, filter, last) { // md谁写的和getGlobalHistory一样?害人! if (!key || !filter) return false; else { @@ -519,7 +523,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { void } */ - static checkGlobalHistory(key, filter, last) { + checkGlobalHistory(key, filter, last) { // md谁写的和getGlobalHistory一样?害人! if (!key || !filter) return; else { @@ -548,7 +552,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ - static getGlobalHistory(key, filter, last) { + getGlobalHistory(key, filter, last) { if (!key) return _status.globalHistory[_status.globalHistory.length - 1]; if (!filter) return _status.globalHistory[_status.globalHistory.length - 1][key]; else { @@ -570,7 +574,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { boolean } */ - static hasAllGlobalHistory(key, filter, last) { + hasAllGlobalHistory(key, filter, last) { if (!key || !filter) return false; return _status.globalHistory.some(value => { if (value[key]) { @@ -594,7 +598,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { void } */ - static checkAllGlobalHistory(key, filter, last) { + checkAllGlobalHistory(key, filter, last) { if (!key || !filter) return; let stopped = false; _status.globalHistory.forEach(value => { @@ -625,7 +629,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ - static getAllGlobalHistory(key, filter, last) { + getAllGlobalHistory(key, filter, last) { const history = []; _status.globalHistory.forEach(value => { if (!key || !value[key]) { @@ -661,7 +665,7 @@ export class Game extends Uninstantable { * @param {Card[]} cards * @returns { GameEventPromise } */ - static cardsDiscard(cards) { + cardsDiscard(cards) { /** @type { 'cards' | 'card' | void } */ // @ts-ignore var type = get.itemtype(cards); @@ -689,7 +693,7 @@ export class Game extends Uninstantable { * @param {Card[]} cards * @returns { GameEventPromise } */ - static cardsGotoOrdering(cards) { + cardsGotoOrdering(cards) { /** @type { 'cards' | 'card' | void } */ // @ts-ignore var type = get.itemtype(cards); @@ -715,7 +719,7 @@ export class Game extends Uninstantable { * @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库 * @returns { GameEventPromise } */ - static cardsGotoSpecial(cards, bool) { + cardsGotoSpecial(cards, bool) { /** @type { 'cards' | 'card' | void } */ // @ts-ignore var type = get.itemtype(cards); @@ -738,7 +742,7 @@ export class Game extends Uninstantable { * )} args * @returns */ - static cardsGotoPile(...args) { + cardsGotoPile(...args) { /** * @type { Card[] } */ @@ -778,7 +782,7 @@ export class Game extends Uninstantable { /** * @param { GameEventPromise } event */ - static $cardsGotoPile(event) { + $cardsGotoPile(event) { const cards = event.cards; const pile = ui.cardPile; for (let i = 0; i < cards.length; i++) { @@ -804,7 +808,7 @@ export class Game extends Uninstantable { /** * @param { false } [pause] */ - static showHistory(pause) { + showHistory(pause) { if (lib.config.show_history == 'left') { ui.window.classList.add('leftbar'); } @@ -819,7 +823,7 @@ export class Game extends Uninstantable { * @param { string } src * @param { true } [blur] */ - static createBackground(src, blur) { + createBackground(src, blur) { const current = document.body.querySelector('.background.upper'); if (current) current.delete(); const node = ui.create.div('.background.blurbg', document.body); @@ -833,7 +837,7 @@ export class Game extends Uninstantable { * @param { string } url * @param { Player } [player] */ - static changeLand(url, player) { + changeLand(url, player) { game.addVideo('changeLand', player, url); const parsedPath = lib.path.parse(url); // @ts-ignore @@ -885,7 +889,7 @@ export class Game extends Uninstantable { * @param { string[] } updates * @param { Function } proceed */ - static checkFileList(updates, proceed) { + checkFileList(updates, proceed) { let n = updates.length; if (!n) { proceed(n); @@ -937,7 +941,7 @@ export class Game extends Uninstantable { /** * @param {...(Player[] | Player)} args */ - static replaceHandcards(...args) { + replaceHandcards(...args) { var next = game.createEvent('replaceHandcards'); if (Array.isArray(args[0])) { next.players = args[0]; @@ -961,7 +965,7 @@ export class Game extends Uninstantable { /** * @param { string } name */ - static removeCard(name) { + removeCard(name) { for (var i = 0; i < lib.card.list.length; i++) { if (lib.card.list[i][2] == name) { lib.card.list.splice(i--, 1); @@ -980,7 +984,7 @@ export class Game extends Uninstantable { /** * @param { 'hidden' } [type] */ - static randomMapOL(type) { + randomMapOL(type) { if (type == 'hidden') { ui.arena.classList.add('playerhidden'); } @@ -1041,17 +1045,17 @@ export class Game extends Uninstantable { _status.mode = lib.configOL[lib.configOL.mode + '_mode']; game.chooseCharacterOL(); } - static closeMenu() { + closeMenu() { if (ui.menuContainer && !ui.menuContainer.classList.contains('hidden')) { ui.click.configMenu(); } } - static closeConnectMenu() { + closeConnectMenu() { if (ui.connectMenuContainer && !ui.connectMenuContainer.classList.contains('hidden')) { ui.click.connectMenu(); } } - static closePopped() { + closePopped() { if (ui.currentpopped) { if (ui.currentpopped._uiintro) { ui.currentpopped._uiintro.delete(); @@ -1074,7 +1078,7 @@ export class Game extends Uninstantable { * @param { ...T } args * @returns { void } */ - static broadcast(func, ...args) { + broadcast(func, ...args) { if (!lib.node || !lib.node.clients || game.online) return; for (var i = 0; i < lib.node.clients.length; i++) { if (lib.node.clients[i].inited) { @@ -1096,7 +1100,7 @@ export class Game extends Uninstantable { * @param { ...T } args * @returns { void } */ - static broadcastAll(func, ...args) { + broadcastAll(func, ...args) { if (game.online) return; game.broadcast.apply(this, arguments); if (typeof func == 'string') { @@ -1106,7 +1110,7 @@ export class Game extends Uninstantable { func.apply(this, args); } } - static syncState() { + syncState() { let state = null; if (game.getState) { state = game.getState(); @@ -1117,7 +1121,7 @@ export class Game extends Uninstantable { game.phaseNumber = number; }, state, _status.currentPhase, game.phaseNumber); } - static updateWaiting() { + updateWaiting() { const map = []; for (let i = 0; i < game.connectPlayers.length; i++) { const player = game.connectPlayers[i]; @@ -1145,7 +1149,7 @@ export class Game extends Uninstantable { /** * @param { Function } func */ - static waitForPlayer(func) { + waitForPlayer(func) { var next = game.createEvent('waitForPlayer', false); next.func = func; next.setContent('waitForPlayer'); @@ -1154,7 +1158,7 @@ export class Game extends Uninstantable { * @param { number } time * @param { Function } [onEnd] */ - static countDown(time, onEnd) { + countDown(time, onEnd) { // @ts-ignore time = parseInt(time); if (!time) return; @@ -1173,7 +1177,7 @@ export class Game extends Uninstantable { } }, 1000); } - static countChoose(clear) { + countChoose(clear) { if (_status.imchoosing) return; _status.imchoosing = true; if (_status.connectMode && !_status.countDown) { @@ -1260,7 +1264,7 @@ export class Game extends Uninstantable { } } } - static stopCountChoose() { + stopCountChoose() { if (_status.countDown) { clearInterval(_status.countDown); delete _status.countDown; @@ -1282,7 +1286,7 @@ export class Game extends Uninstantable { * @param { string } ip * @param { (result: boolean) => any } callback */ - static connect(ip, callback) { + connect(ip, callback) { if (game.online) return; let withport = false; let index = ip.lastIndexOf(':'); @@ -1316,7 +1320,7 @@ export class Game extends Uninstantable { game.ws.onclose = lib.element.ws.onclose; _status.ip = ip; } - static send() { + send() { if (game.observe && arguments[0] != 'reinited') return; if (game.ws) { const args = Array.from(arguments); @@ -1330,10 +1334,10 @@ export class Game extends Uninstantable { * @param { string } id * @param {*} message */ - static sendTo(id, message) { + sendTo(id, message) { return new lib.element.Client(new lib.element.NodeWS(id)).send(message); } - static createServer() { + createServer() { lib.node.clients = []; lib.node.banned = []; lib.node.observing = []; @@ -1357,7 +1361,7 @@ export class Game extends Uninstantable { /** * @returns { HTMLAudioElement } */ - static playAudio() { + playAudio() { let path = '', emptyPath = true, notCheckDBPath = true, onError = null; if (_status.video) { // 为了能更美观的写代码,默认返回audio而不额外加一个void类型 @@ -1447,7 +1451,7 @@ export class Game extends Uninstantable { * //如果key中包含发动技能的角色名player,则直接改用info.audioname2[player]来播放语音 * ``` */ - static parseSkillAudio(skill, player, skillInfo) { + parseSkillAudio(skill, player, skillInfo) { if (typeof player === 'string') player = { name: player }; else if (typeof player !== 'object' || player === null) player = {}; @@ -1553,7 +1557,7 @@ export class Game extends Uninstantable { * @param { ['lib']['skill'] } [skillInfo] * @returns */ - static trySkillAudio(skill, player, directaudio, nobroadcast, skillInfo) { + trySkillAudio(skill, player, directaudio, nobroadcast, skillInfo) { if (!nobroadcast) game.broadcast(game.trySkillAudio, skill, player, directaudio, nobroadcast, skillInfo); const info = skillInfo || lib.skill[skill]; if (!info) return; @@ -1573,7 +1577,7 @@ export class Game extends Uninstantable { * @param { number } [index] * @returns */ - static playSkillAudio(name, index) { + playSkillAudio(name, index) { if (_status.video && arguments[1] != 'video') return; if (!lib.config.repeat_audio && _status.skillaudio.includes(name)) return; game.addVideo('playSkillAudio', null, name); @@ -1628,7 +1632,7 @@ export class Game extends Uninstantable { * @param { string | Card } card * @param { Player | Sex } sex */ - static playCardAudio(card, sex) { + playCardAudio(card, sex) { if (typeof card === 'string') { // @ts-ignore card = { name: card }; @@ -1661,7 +1665,7 @@ export class Game extends Uninstantable { } else game.playAudio('card', sex, card.name); } - static playBackgroundMusic() { + playBackgroundMusic() { if (lib.config.background_music == 'music_off') { ui.backgroundMusic.src = ''; return; @@ -1758,7 +1762,7 @@ export class Game extends Uninstantable { * ) => importExtensionConfig } content * @param {*} [url] */ - static import(type, content, url) { + import(type, content, url) { if (type == 'extension') { const promise = game.loadExtension(content).then((name) => { if (typeof _status.extensionLoaded == "undefined") _status.extensionLoaded = []; @@ -1783,7 +1787,7 @@ export class Game extends Uninstantable { return promise; } } - static async loadExtension(object) { + async loadExtension(object) { let noEval = false; if (typeof object == 'function') { object = await (gnc.is.generatorFunc(object) ? gnc.of(object) : object)(lib, game, ui, get, ai, _status); @@ -1910,58 +1914,58 @@ export class Game extends Uninstantable { } /** * 下载文件 - * @type { undefined | ((url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void) => void, dev?: 'nodev', onprogress?: Function) => void) } + * @type { undefined | ((url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void, dev?: 'nodev', onprogress?: Function) => void) } */ - static download; + download; /** * 读取文件为arraybuffer * @type { undefined | ((filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void) } */ - static readFile; + readFile; /** * 读取文件为文本 * @type { undefined | ((filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void) } */ - static readFileAsText; + readFileAsText; /** * 将数据写入文件 * @type { undefined | ((data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void) } */ - static writeFile; + writeFile; /** * 移除文件 * @type { undefined | ((filename: string, callback?: (e: Error) => void) => void) } */ - static removeFile; + removeFile; /** * 获取文件列表 * @type { undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure: (e: Error) => void) => void) } */ - static getFileList; + getFileList; /** * 按路径依次创建文件夹 * @type { undefined | ((list: string | string[], callback: Function, file?: boolean) => void) } */ - static ensureDirectory; + ensureDirectory; /** * 创建文件夹 * @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) } */ - static createDir; + createDir; /** * 删除文件夹 * @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) } */ - static removeDir; + removeDir; /** * @type { (forcecheck?: boolean | null, dev?: boolean) => Promise } */ - static checkForUpdate; + checkForUpdate; /** * @type { () => Promise } */ - static checkForAssetUpdate; - static async importExtension(data, finishLoad, exportExtension, extensionPackage) { + checkForAssetUpdate; + async importExtension(data, finishLoad, exportExtension, extensionPackage) { //by 来瓶可乐加冰、Rintim、Tipx-L、诗笺 const zip = await get.promises.zip(); if (get.objtype(data) == 'object') { @@ -2114,7 +2118,7 @@ export class Game extends Uninstantable { * @param { string } textToWrite * @param { string } [name] */ - static export(textToWrite, name) { + export(textToWrite, name) { let textFileAsBlob = new Blob([textToWrite], { type: 'text/plain' }); let fileNameToSaveAs = name || 'noname'; fileNameToSaveAs = fileNameToSaveAs.replace(/\\|\/|:|\?|"|\*|<|>|\|/g, '.'); @@ -2154,7 +2158,7 @@ export class Game extends Uninstantable { * @param { Function } [process] * @param {*} [dev] */ - static multiDownload2(list, onsuccess, onerror, onfinish, process, dev) { + multiDownload2(list, onsuccess, onerror, onfinish, process, dev) { list = list.slice(0); let download = function () { if (list.length) { @@ -2197,7 +2201,7 @@ export class Game extends Uninstantable { * @param { Function } [process] * @param {*} [dev] */ - static multiDownload(list, onsuccess, onerror, onfinish, process, dev) { + multiDownload(list, onsuccess, onerror, onfinish, process, dev) { if (lib.config.dev) game.print(get.url()); const args = Array.from(arguments); if (list.length <= 3) { @@ -2229,7 +2233,7 @@ export class Game extends Uninstantable { * @param { Function } [onerror] * @param { Function } [onprogress] */ - static fetch(url, onload, onerror, onprogress) { + fetch(url, onload, onerror, onprogress) { var tmpName = '~tmp' + get.id(); game.download(encodeURI(url), tmpName, function () { game.readFile(tmpName, function (data) { @@ -2242,7 +2246,7 @@ export class Game extends Uninstantable { * @param { string } time * @param { string } mode */ - static playVideo(time, mode) { + playVideo(time, mode) { if (!_status.replayvideo) { localStorage.setItem(lib.configprefix + 'playbackmode', lib.config.mode); } @@ -2253,7 +2257,7 @@ export class Game extends Uninstantable { /** * @param { Videos } video */ - static playVideoContent(video) { + playVideoContent(video) { const next = game.createEvent('video', false); next.video = video; ui.system.style.display = 'none'; @@ -2277,7 +2281,7 @@ export class Game extends Uninstantable { next.setContent('playVideoContent'); game.loop(); } - static videoContent = { + videoContent = { arrangeLib: function (content) { for (var i in content) { for (var j in content[i]) { @@ -3631,7 +3635,7 @@ export class Game extends Uninstantable { } } } - static reload() { + reload() { if (_status) { if (_status.reloading) return; _status.reloading = true; @@ -3647,7 +3651,7 @@ export class Game extends Uninstantable { window.location.reload(); } } - static reload2() { + reload2() { lib.status.reload--; if (lib.status.reload == 0 && lib.ondb2.length) { const command = lib.ondb2.shift(); @@ -3661,7 +3665,7 @@ export class Game extends Uninstantable { window.location.reload(); delete _status.waitingToReload; } - static exit() { + exit() { var ua = userAgent; var ios = ua.includes('iphone') || ua.includes('ipad') || ua.includes('macintosh'); //electron @@ -3705,7 +3709,7 @@ export class Game extends Uninstantable { /** * @param { string } url */ - static open(url) { + open(url) { if (lib.device) { if (cordova.InAppBrowser) { cordova.InAppBrowser.open(url, '_system'); @@ -3718,7 +3722,7 @@ export class Game extends Uninstantable { window.open(url); } } - static reloadCurrent() { + reloadCurrent() { game.saveConfig('continue_name', [game.me.name1 || game.me.name, game.me.name2]); game.saveConfig('mode', lib.config.mode); localStorage.setItem(lib.configprefix + 'directstart', true); @@ -3727,7 +3731,7 @@ export class Game extends Uninstantable { /** * @param { Function } func */ - static update(func) { + update(func) { lib.updates.push(func); if (lib.updates.length === 1) { game.run(); @@ -3737,13 +3741,13 @@ export class Game extends Uninstantable { /** * @param { Function } func */ - static unupdate(func) { + unupdate(func) { lib.updates.remove(func); } - static stop() { + stop() { cancelAnimationFrame(lib.status.frameId); } - static run() { + run() { if (lib.updates.length) { cancelAnimationFrame(lib.status.frameId); lib.status.frameId = requestAnimationFrame(function (time) { @@ -3760,7 +3764,7 @@ export class Game extends Uninstantable { * @param { any } [content] * @returns */ - static addVideo(type, player, content) { + addVideo(type, player, content) { if (_status.video || game.online) return; if (!_status.videoInited) { if (type == 'arrangeLib') { @@ -3796,7 +3800,7 @@ export class Game extends Uninstantable { /** * @param { Function } func */ - static draw(func) { + draw(func) { lib.canvasUpdates.push(func); if (!lib.status.canvas) { lib.status.canvas = true; @@ -3806,12 +3810,12 @@ export class Game extends Uninstantable { /** * @param { number } [time] */ - static vibrate(time) { + vibrate(time) { if ('vibrate' in navigator) { navigator.vibrate(time || 500); } } - static prompt() { + prompt() { let str, forced, callback, noinput = false, str2 = ''; for (let i = 0; i < arguments.length; i++) { if (arguments[i] == 'alert') { @@ -3910,16 +3914,16 @@ export class Game extends Uninstantable { } //} } - static alert(str) { + alert(str) { game.prompt(str, 'alert'); } - static print() { + print() { if (!_status.toprint) { _status.toprint = []; } _status.toprint.push(Array.from(arguments)); } - static animate = { + animate = { window: function (num) { switch (num) { case 1: { @@ -4180,7 +4184,7 @@ export class Game extends Uninstantable { /** * @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path */ - static linexy(path) { + linexy(path) { const from = [path[0], path[1]], to = [path[2], path[3]]; let total = typeof arguments[1] === 'number' ? arguments[1] : lib.config.duration * 2, opacity = 1, @@ -4253,7 +4257,7 @@ export class Game extends Uninstantable { /** * @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path */ - static _linexy(path) { + _linexy(path) { let from = [path[0], path[1]]; let to = [path[2], path[3]]; let total = typeof arguments[1] === 'number' ? arguments[1] : lib.config.duration * 2; @@ -4327,7 +4331,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } event * @returns { GameEventPromise } */ - static createTrigger(name, skill, player, event, indexedData) { + createTrigger(name, skill, player, event, indexedData) { let info = get.info(skill); if (!info) return false; if ((player.isOut() || player.removed) && !info.forceOut) return; @@ -4350,7 +4354,7 @@ export class Game extends Uninstantable { * @param { false } [trigger] * @param { GameEventPromise } [triggerEvent] */ - static createEvent(name, trigger, triggerEvent) { + createEvent(name, trigger, triggerEvent) { const next = (new lib.element.GameEvent(name, trigger)).toPromise(); (triggerEvent || _status.event).next.push(next); return next; @@ -4359,7 +4363,7 @@ export class Game extends Uninstantable { * @param { string } name * @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information */ - static addCharacter(name, information) { + addCharacter(name, information) { const extensionName = _status.extension || information.extension, character = [ information.sex, information.group, @@ -4382,7 +4386,7 @@ export class Game extends Uninstantable { * @param { { mode?: string, forbid?: any, character: { [key: string]: Character }, skill: { [key: string]: object }, [key: string]: any } } pack * @param { string } [packagename] */ - static addCharacterPack(pack, packagename) { + addCharacterPack(pack, packagename) { let extname = _status.extension || '扩展'; let gzFlag = false; packagename = packagename || extname; @@ -4447,7 +4451,7 @@ export class Game extends Uninstantable { * @param { Card } info * @param { { extension: string, translate: string, description: string, number?: number, color?: string } } info2 */ - static addCard(name, info, info2) { + addCard(name, info, info2) { var extname = (_status.extension || info2.extension); if (info.audio == true) { info.audio = 'ext:' + extname; @@ -4494,7 +4498,7 @@ export class Game extends Uninstantable { * @param { { extension: string, mode?: string[], forbid?: string[], list: any[], card: {[key: string]: Card}, skill: { [key: string]: object } } } pack * @param { string } [packagename] */ - static addCardPack(pack, packagename) { + addCardPack(pack, packagename) { let extname = _status.extension || '扩展'; packagename = packagename || extname; let packname = 'mode_extension_' + packagename; @@ -4562,7 +4566,7 @@ export class Game extends Uninstantable { * @param { string } [appendInfo] * @param { string } [abInfo] */ - static addSkill(name, info, translate, description, appendInfo, abInfo) { + addSkill(name, info, translate, description, appendInfo, abInfo) { if (lib.skill[name]) { return false; } @@ -4581,7 +4585,7 @@ export class Game extends Uninstantable { * @param {*} info * @param { { translate: string, config: { [key: string]: object } } } info2 */ - static addMode(name, info, info2) { + addMode(name, info, info2) { lib.config.all.mode.push(name); lib.translate[name] = info2.translate; let imgsrc; @@ -4619,7 +4623,7 @@ export class Game extends Uninstantable { * @param { string } skill * @param { Player } [player] */ - static addGlobalSkill(skill, player) { + addGlobalSkill(skill, player) { let info = lib.skill[skill]; if (!info) return false; lib.skill.global.add(skill); @@ -4653,15 +4657,21 @@ export class Game extends Uninstantable { } /** * @param { string } skill + * @param { lib.element.Player } player */ - static removeGlobalSkill(skill) { + removeGlobalSkill(skill, player) { + const players = lib.skill.globalmap[skill]; + if(player && Array.isArray(players)) { + lib.skill.globalmap[skill].remove(player); + if(players.length) return; + } lib.skill.global.remove(skill); delete lib.skill.globalmap[skill]; for (let i in lib.hook.globalskill) { lib.hook.globalskill[i].remove(skill); } } - static resetSkills() { + resetSkills() { for (let i = 0; i < game.players.length; i++) { for (let j in game.players[i].tempSkills) { game.players[i].removeSkill(j); @@ -4679,7 +4689,7 @@ export class Game extends Uninstantable { /** * @param { string } extensionName */ - static hasExtension(extensionName) { + hasExtension(extensionName) { if (typeof lib.config[`extension_${extensionName}_enable`] != 'boolean') { game.saveExtensionConfig(extensionName, 'enable', true); } @@ -4688,20 +4698,20 @@ export class Game extends Uninstantable { /** * @param { string } extensionName */ - static hasExtensionInstalled(extensionName) { + hasExtensionInstalled(extensionName) { return lib.config.extensions.includes(extensionName); } /** * @param { string } extensionName */ - static hasExtensionLoaded(extensionName) { + hasExtensionLoaded(extensionName) { return extensionName !== void 0 && _status.extensionLoaded.includes(extensionName); } /** * @param { string } extensionName * @param { Function } runnable */ - static runAfterExtensionLoaded(extensionName, runnable) { + runAfterExtensionLoaded(extensionName, runnable) { if (game.hasExtensionLoaded(extensionName)) { runnable(); } else { @@ -4717,7 +4727,7 @@ export class Game extends Uninstantable { * @param { string } extensionName * @param { boolean } [keepFile] */ - static removeExtension(extensionName, keepFile) { + removeExtension(extensionName, keepFile) { const prefix = `extension_${extensionName}`; Object.keys(lib.config).forEach(key => { if (key.startsWith(prefix)) game.saveConfig(key); @@ -4736,7 +4746,7 @@ export class Game extends Uninstantable { if (!game.download || keepFile) return; game.promises.removeDir(`${nonameInitialized}extension/${extensionName}`).catch(console.error); } - static addRecentCharacter() { + addRecentCharacter() { let list = get.config('recentCharacter') || []; for (let i = 0; i < arguments.length; i++) { if (lib.character[arguments[i]]) { @@ -4761,7 +4771,7 @@ export class Game extends Uninstantable { * @param { number | string } [number] * @param { string } [nature] */ - static createCard(name, suit, number, nature) { + createCard(name, suit, number, nature) { if (typeof name == 'object') { nature = name.nature; number = name.number; @@ -4815,7 +4825,7 @@ export class Game extends Uninstantable { * @param { number } number * @param { string } nature */ - static createCard2() { + createCard2() { let card = game.createCard.apply(this, arguments); delete card.storage.vanish; return card; @@ -4824,7 +4834,7 @@ export class Game extends Uninstantable { * @param { boolean } bool * @param { Function } callback */ - static forceOver(bool, callback) { + forceOver(bool, callback) { _status.event.next.length = 0; let next = game.createEvent('finish_game'); next.bool = bool; @@ -4840,7 +4850,7 @@ export class Game extends Uninstantable { * @param { boolean } [bool] * @returns */ - static over(result, bool) { + over(result, bool) { if (_status.over) return; if (game.me._trueMe) game.swapPlayer(game.me._trueMe); let i, j, k, num, table, tr, td, dialog; @@ -5483,15 +5493,15 @@ export class Game extends Uninstantable { * * 但是需要事件结果的除外 */ - static executingAsyncEventMap = new Map(); + executingAsyncEventMap = new Map(); /** * @type { GameEventPromise[] } */ - static belongAsyncEventList = []; + belongAsyncEventList = []; /** * @param { GameEventPromise } [belongAsyncEvent] */ - static async loop(belongAsyncEvent) { + async loop(belongAsyncEvent) { if (belongAsyncEvent) { game.belongAsyncEventList.push(belongAsyncEvent); } else if (game.belongAsyncEventList.length) { @@ -5657,7 +5667,7 @@ export class Game extends Uninstantable { /** * @param { GameEventPromise } [belongAsyncEvent] */ - static runContent(belongAsyncEvent) { + runContent(belongAsyncEvent) { return new Promise(resolve => { let event = (belongAsyncEvent && belongAsyncEvent.parent == _status.event) ? belongAsyncEvent : _status.event; let { step, source, player, target, targets, card, cards, skill, forced, num, _trigger: trigger, _result: result, _storeEvent } = event; @@ -5779,15 +5789,15 @@ export class Game extends Uninstantable { } }); } - static pause() { + pause() { clearTimeout(_status.timeout); _status.paused = true; } - static pause2() { + pause2() { if (_status.connectMode) return; _status.paused2 = true; } - static resume() { + resume() { if (_status.paused) { if (!_status.noclearcountdown) { game.stopCountChoose(); @@ -5797,20 +5807,20 @@ export class Game extends Uninstantable { game.loop(); } } - static resume2() { + resume2() { if (_status.connectMode) return; if (_status.paused2) { _status.paused2 = false; game.loop(); } } - static delaye() { + delaye() { let next = game.createEvent('delay', false); next.setContent('delay'); next._args = Array.from(arguments); return next; } - static delayex() { + delayex() { let next = game.createEvent('delayx', false); next.setContent('delay'); next._args = Array.from(arguments); @@ -5820,7 +5830,7 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static delay(time, time2) { + delay(time, time2) { if (_status.paused) return; game.pause(); if (typeof time != 'number') time = 1; @@ -5833,7 +5843,7 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static delayx(time, time2) { + delayx(time, time2) { if (typeof time != 'number') time = 1; switch (lib.config.game_speed) { case 'vslow': time *= 2.5; break; @@ -5852,7 +5862,7 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static asyncDelay(time, time2) { + asyncDelay(time, time2) { // if(_status.paused) return; // game.pause(); if (typeof time != 'number') time = 1; @@ -5870,7 +5880,7 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static asyncDelayx(time, time2) { + asyncDelayx(time, time2) { if (typeof time != 'number') time = 1; switch (lib.config.game_speed) { case 'vslow': time *= 2.5; break; @@ -5884,7 +5894,7 @@ export class Game extends Uninstantable { /** * @param { GameEventPromise } [event] */ - static check(event = _status.event) { + check(event = _status.event) { game.callHook("checkBegin", [event]); event._checked = true; @@ -5969,140 +5979,8 @@ export class Game extends Uninstantable { // } return ok; } - static Check = class extends Uninstantable { - static processSelection({ type, items, event, useCache, isSelectable }) { - let ok = true, auto; - let selectableItems = false; - const uppercaseType = (type) => type[0].toUpperCase() + type.slice(1); - const uiSelected = ui.selected[`${type}s`]; - const range = get.select(event[`select${uppercaseType(type)}`]); - - if (event.forceAuto && uiSelected.length === range[1]) auto = true; - else if (range[0] !== range[1] || range[0] > 1) auto = false; - - let cache; - let firstCheck = false; - - if (useCache) { - if (!event[`_${type}Choice`]) event[`_${type}Choice`] = {}; - let cacheId = 0; - for (let Type of ['button', 'card', 'target']) { - if (type === Type) break; - if (Type === "target") Type = "player"; - ui.selected[`${Type}s`].forEach(i => cacheId ^= i[`${Type}id`]); - } - if (!event[`_${type}Choice`][cacheId]) { - event[`_${type}Choice`][cacheId] = []; - firstCheck = true; - } - cache = event[`_${type}Choice`][cacheId]; - } - - items.forEach(item => { - let selectable; - if (!lib.filter.cardAiIncluded(item)) selectable = false; - else if (useCache && !firstCheck) selectable = cache.includes(item); - else selectable = isSelectable(item, event); - - if (range[1] <= -1) { - if (selectable) { - item.classList.add('selected'); - uiSelected.add(item); - } else { - item.classList.remove('selected'); - uiSelected.remove(item); - } - if (item.updateTransform) item.updateTransform(selectable); - } else { - if (selectable && uiSelected.length < range[1]) { - item.classList.add('selectable'); - if (firstCheck) cache.push(item); - } - else item.classList.remove('selectable'); - } - - if (item.classList.contains('selectable')) selectableItems = true; - else if (item.classList.contains('selected')) item.classList.add('selectable'); - - game.callHook(`check${uppercaseType(type)}`, [item, event]); - }); - - if (event[`${type}Required`] && uiSelected.length === 0) ok = false; - else if (uiSelected.length < range[0] && (!event.forced || selectableItems || event.complexSelect)) ok = false; - - if (event.custom && event.custom.add[type]) event.custom.add[type](); - - return { ok, auto }; - } - static button(event, useCache) { - const player = event.player; - const buttons = event.dialog.buttons; - const isSelectable = (button, event) => { - if (!lib.filter.buttonIncluded(button)) return false; - if (button.classList.contains('unselectable')) return false; - return event.filterButton(button, player); - } - return game.Check.processSelection({ type: 'button', items: buttons, event, useCache, isSelectable }); - } - static card(event, useCache) { - const player = event.player; - const cards = player.getCards(event.position); - const isSelectable = (card, event) => { - if (card.classList.contains('uncheck')) return false; - if (player.isOut()) return false; - if (!lib.filter.cardRespondable(card, player)) return false; - return event.filterCard(card, player); - } - return game.Check.processSelection({ type: 'card', items: cards, event, useCache, isSelectable }); - } - static target(event, useCache) { - const player = event.player; - const card = get.card(); - const targets = game.players.slice(); - if (event.deadTarget) targets.addArray(game.dead); - const isSelectable = (target, event) => { - if (game.chess && !event.chessForceAll && player && get.distance(player, target, 'pure') > 7) return false; - if (target.isOut()) return false; - return event.filterTarget(card, player, target); - } - return game.Check.processSelection({ type: 'target', items: targets, event, useCache, isSelectable }); - } - static skill(event) { - if (ui.skills) ui.skills.close(); - if (ui.skills2) ui.skills2.close(); - if (ui.skills3) ui.skills3.close(); - if (event.skill || !get.noSelected() || _status.noconfirm) return; - - const player = event.player; - if (!event._skillChoice) event._skillChoice = game.expandSkills(player.getSkills('invisible').concat(lib.skill.global)).filter(skill => lib.filter.filterEnable(event, player, skill)); - - const skills = event._skillChoice.filter(i => event.isMine() || !event._aiexclude.includes(i)); - const globallist = game.expandSkills(lib.skill.global.slice()); - const ownedlist = game.expandSkills(player.getSkills('invisible', false)); - - const ownedSkills = [], globalSkills = [], equipSkills = []; - skills.forEach(skill => { - if (globallist.includes(skill)) globalSkills.push(skill); - else if (!ownedlist.includes(skill)) equipSkills.push(skill); - else ownedSkills.push(skill); - }); - - if (ownedSkills.length) ui.create.skills(ownedSkills); - if (globalSkills.length) ui.create.skills2(globalSkills); - if (equipSkills.length) ui.create.skills3(equipSkills); - } - static confirm(event, confirm) { - ui.arena.classList.add('selecting'); - if (event.filterTarget && (!event.filterCard || !event.position || (typeof event.position == 'string' && !event.position.includes('e')))) { - ui.arena.classList.add('tempnoe'); - } - game.countChoose(); - if (!_status.noconfirm && !_status.event.noconfirm && (_status.mouseleft || !_status.mousedown)) { - ui.create.confirm(confirm); - } - } - } - static uncheck(...args) { + Check = new Check() + uncheck(...args) { if (args.length === 0) args = ['button', 'card', 'target']; const event = _status.event; const players = game.players.slice(); @@ -6169,7 +6047,7 @@ export class Game extends Uninstantable { * @param { boolean } [behind] * @param { boolean } [noanimate] */ - static swapSeat(player1, player2, prompt, behind, noanimate) { + swapSeat(player1, player2, prompt, behind, noanimate) { if (noanimate) { player1.style.transition = 'all 0s'; player2.style.transition = 'all 0s'; @@ -6231,7 +6109,7 @@ export class Game extends Uninstantable { * @param { Player } player1 * @param { Player } [player2] */ - static swapPlayer(player, player2) { + swapPlayer(player, player2) { let players = game.players.concat(game.dead) if (player2) { if (player == game.me) game.swapPlayer(player2); @@ -6300,7 +6178,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static swapControl(player) { + swapControl(player) { if (player == game.me) return; game.me.node.handcards1.remove(); @@ -6335,7 +6213,7 @@ export class Game extends Uninstantable { } } } - static swapPlayerAuto(player) { + swapPlayerAuto(player) { if (game.modeSwapPlayer) { game.modeSwapPlayer(player); } @@ -6346,7 +6224,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static findNext(player) { + findNext(player) { let players = get.players(lib.sort.position); let position = parseInt(player.dataset.position); for (let i = 0; i < players.length; i++) { @@ -6360,7 +6238,7 @@ export class Game extends Uninstantable { * @param { string } name * @param { Function } callback */ - static loadModeAsync(name, callback) { + loadModeAsync(name, callback) { window.game = game; let script = lib.init.js(lib.assetURL + 'mode', name, async () => { await Promise.allSettled(_status.importing.mode); @@ -6378,7 +6256,7 @@ export class Game extends Uninstantable { * @param { string } name * @param {*} configx */ - static switchMode(name, configx) { + switchMode(name, configx) { if (!lib.layoutfixed.includes(name)) { if (lib.config.layout != game.layout) { lib.init.layout(lib.config.layout); @@ -6567,7 +6445,7 @@ export class Game extends Uninstantable { /** * @param { string } mode */ - static loadMode(mode) { + loadMode(mode) { let next = game.createEvent('loadMode', false); next.mode = mode; next.setContent('loadMode'); @@ -6575,7 +6453,7 @@ export class Game extends Uninstantable { /** * @param {...string} args */ - static loadPackage(...args) { + loadPackage(...args) { let next = game.createEvent('loadPackage'); next.packages = []; for (let i = 0; i < arguments.length; i++) { @@ -6588,7 +6466,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static phaseLoop(player) { + phaseLoop(player) { let next = game.createEvent('phaseLoop'); next.player = player; next._isStandardLoop = true; @@ -6597,14 +6475,14 @@ export class Game extends Uninstantable { /** * @param { Player } [player] */ - static gameDraw(player, num = 4) { + gameDraw(player, num = 4) { let next = game.createEvent('gameDraw'); next.player = player || game.me; next.num = num; next.setContent('gameDraw'); return next; } - static chooseCharacterDouble() { + chooseCharacterDouble() { let next = game.createEvent('chooseCharacter'); let config, width, num, ratio, func, update, list, first; for (let i = 0; i < arguments.length; i++) { @@ -7123,7 +7001,7 @@ export class Game extends Uninstantable { } }); } - static updateRoundNumber() { + updateRoundNumber() { game.broadcastAll((roundNumber, pileTop, pileNumber) => { if (game.roundNumber != roundNumber) game.roundNumber = roundNumber; if (_status.pileTop != pileTop) _status.pileTop = pileTop; @@ -7136,7 +7014,7 @@ export class Game extends Uninstantable { * @param { { drawDeck: boolean } } [drawDeck] * @param { boolean } [bottom] */ - static asyncDraw(players, num, drawDeck, bottom) { + asyncDraw(players, num, drawDeck, bottom) { return players.forEach((value, index) => { let num2 = 1; if (typeof num == 'number') num2 = num; @@ -7152,7 +7030,7 @@ export class Game extends Uninstantable { * @param { number | number[] | (player: Player) => number } num * @param { { drawDeck: boolean } } [drawDeck] */ - static asyncDrawAuto(players, num, drawDeck) { + asyncDrawAuto(players, num, drawDeck) { if (players.length > 1) { game.asyncDraw.apply(this, arguments); return; @@ -7164,7 +7042,7 @@ export class Game extends Uninstantable { if (drawDeck && drawDeck.drawDeck) players[0].draw(num2, drawDeck); else players[0].draw(num2); } - static finishSkill(i, sub) { + finishSkill(i, sub) { const mode = get.mode(), info = lib.skill[i], iInfo = `${i}_info`; if (info.alter) { lib.translate[`${iInfo}_origin`] = lib.translate[iInfo]; @@ -7286,7 +7164,7 @@ export class Game extends Uninstantable { } if (i[0] == '_') game.addGlobalSkill(i); } - static finishCards() { + finishCards() { _status.cardsFinished = true; const mode = get.mode(), filterTarget = (card, player, target) => player == target && target.canEquip(card, true), aiBasicOrder = (card, player) => { const equipValue = get.equipValue(card, player) / 20; @@ -7358,7 +7236,7 @@ export class Game extends Uninstantable { /** * 这玩意至少19种重载了吧 */ - static checkMod() { + checkMod() { const argumentArray = Array.from(arguments), name = argumentArray[argumentArray.length - 2]; let skills = argumentArray[argumentArray.length - 1]; if (typeof skills.getModableSkills == 'function') { @@ -7384,7 +7262,7 @@ export class Game extends Uninstantable { /** * @param { number } num */ - static prepareArena(num) { + prepareArena(num) { _status.prepareArena = true; game.showHistory(false); ui.create.players(num); @@ -7392,7 +7270,7 @@ export class Game extends Uninstantable { ui.create.cardsAsync(); game.finishCards(); } - static clearArena() { + clearArena() { ui.control.innerHTML = ''; ui.arenalog.innerHTML = ''; Array.from(ui.arena.childNodes).forEach(value => { @@ -7414,7 +7292,7 @@ export class Game extends Uninstantable { game.dead.length = 0; game.me = null; } - static clearConnect() { + clearConnect() { if (ui.ipnode) { ui.ipnode.remove(); delete ui.ipnode; @@ -7459,7 +7337,7 @@ export class Game extends Uninstantable { delete ui.connectClientsCount; delete ui.createRoomButton; } - static log() { + log() { let str = '', str2 = '', logvid = null; const color = new Map([ ['r', 'fire'], @@ -7539,7 +7417,7 @@ export class Game extends Uninstantable { * @param { boolean } [forced] * @param { string } [logvid] */ - static logv(player, card, targets, event, forced, logvid) { + logv(player, card, targets, event, forced, logvid) { if (!player) { player = _status.event.getParent().logvid; if (!player) return; @@ -7686,7 +7564,7 @@ export class Game extends Uninstantable { * @param { Function } [onSuccess] * @param { Function } [onError] */ - static putDB(storeName, idbValidKey, value, onSuccess, onError) { + putDB(storeName, idbValidKey, value, onSuccess, onError) { if (!lib.db) return Promise.resolve(value); if (lib.status.reload) return new Promise((resolve, reject) => lib[_status.dburgent ? 'ondb2' : 'ondb'].push(['putDB', [storeName, idbValidKey, value, event => { if (typeof onSuccess == 'function') onSuccess(event); @@ -7730,7 +7608,7 @@ export class Game extends Uninstantable { * @param { Function } [onSuccess] * @param { Function } [onError] */ - static getDB(storeName, query, onSuccess, onError) { + getDB(storeName, query, onSuccess, onError) { if (!lib.db) return new Promise(resolve => { if (typeof onSuccess == 'function') onSuccess(null); resolve(null); @@ -7806,7 +7684,7 @@ export class Game extends Uninstantable { * @param { Function } [onSuccess] * @param { Function } [onError] */ - static deleteDB(storeName, query, onSuccess, onError) { + deleteDB(storeName, query, onSuccess, onError) { if (!lib.db) return new Promise(resolve => { if (typeof onSuccess == 'function') onSuccess(false); resolve(false); @@ -7862,7 +7740,7 @@ export class Game extends Uninstantable { * @param { * } [value] * @param { string } [mode] */ - static save(key, value, mode) { + save(key, value, mode) { if (_status.reloading) return; mode = mode || lib.config.mode; if (lib.db) { @@ -7908,7 +7786,7 @@ export class Game extends Uninstantable { config.version = lib.version; localStorage.setItem(`${lib.configprefix}${mode}`, JSON.stringify(config)); } - static showChangeLog() { + showChangeLog() { if (lib.version == lib.config.version && !_status.extensionChangeLog) return; const ul = document.createElement('ul'); ul.style.textAlign = 'left'; @@ -7973,7 +7851,7 @@ export class Game extends Uninstantable { * @param { string } str * @param { string } [extname] */ - static showExtensionChangeLog(str, extname) { + showExtensionChangeLog(str, extname) { extname = extname || _status.extension; const cfg = `extension_${extname}_changelog`; if (!lib.extensionPack[extname] || lib.extensionPack[extname].version == lib.config[cfg]) return; @@ -7988,7 +7866,7 @@ export class Game extends Uninstantable { * @param { string | boolean } [local] * @param { Function } [callback] */ - static saveConfig(key, value, local, callback) { + saveConfig(key, value, local, callback) { if (_status.reloading) return; if (local) { const localmode = typeof local == 'string' ? local : lib.config.mode; @@ -8020,27 +7898,27 @@ export class Game extends Uninstantable { /** * @param { string } key */ - static saveConfigValue(key) { return game.saveConfig(key, lib.config[key]) } + saveConfigValue(key) { return game.saveConfig(key, lib.config[key]) } /** * @param { string } extension * @param { string } key * @param { * } [value] */ - static saveExtensionConfig(extension, key, value) { return game.saveConfig(`extension_${extension}_${key}`, value) } + saveExtensionConfig(extension, key, value) { return game.saveConfig(`extension_${extension}_${key}`, value) } /** * @param { string } extension * @param { string } key */ - static saveExtensionConfigValue(extension, key) { return game.saveExtensionConfig(extension, key, game.getExtensionConfig(extension, key)) } + saveExtensionConfigValue(extension, key) { return game.saveExtensionConfig(extension, key, game.getExtensionConfig(extension, key)) } /** * @param { string } extension * @param { string } key */ - static getExtensionConfig(extension, key) { return lib.config[`extension_${extension}_${key}`] } + getExtensionConfig(extension, key) { return lib.config[`extension_${extension}_${key}`] } /** * @param { string } mode */ - static clearModeConfig(mode) { + clearModeConfig(mode) { if (_status.reloading) return; if (lib.db) { game.getDB('config', null, config => Object.keys(config).forEach(value => { @@ -8067,7 +7945,7 @@ export class Game extends Uninstantable { * @param { string } [character] * @param { string } [character2] */ - static addPlayer(position, character, character2) { + addPlayer(position, character, character2) { if (position < 0 || position > game.players.length + game.dead.length || position == undefined) position = Math.ceil(Math.random() * (game.players.length + game.dead.length)); const players = game.players.concat(game.dead); ui.arena.setNumber(players.length + 1); @@ -8086,7 +7964,7 @@ export class Game extends Uninstantable { * @param { string } [character] * @param { string } [animation] */ - static addFellow(position, character, animation) { + addFellow(position, character, animation) { game.addVideo('addFellow', null, [position, character, animation]); const player = ui.create.player(ui.arena).addTempClass(animation || 'start'); player.dataset.position = position || game.players.length + game.dead.length; @@ -8099,7 +7977,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static triggerEnter(player) { + triggerEnter(player) { const next = game.createEvent('enterGame', false); next.player = player; next.setContent(() => { @@ -8110,7 +7988,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static restorePlayer(player) { + restorePlayer(player) { if (game.players.includes(player) || game.dead.includes(player)) return; let position = parseInt(player.dataset.position); if (position < 0 || position > game.players.length + game.dead.length || position == undefined) position = Math.ceil(Math.random() * (game.players.length + game.dead.length)); @@ -8130,7 +8008,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static removePlayer(player) { + removePlayer(player) { if (_status.roundStart == player) _status.roundStart = player.next || player.getNext() || game.players[0]; const players = game.players.concat(game.dead); player.style.left = `${player.getLeft()}px`; @@ -8164,7 +8042,7 @@ export class Game extends Uninstantable { * @param { string } [character] * @param { string } [character2] */ - static replacePlayer(player, character, character2) { + replacePlayer(player, character, character2) { player.removed = true; const position = parseInt(player.dataset.position); game.players.remove(player); @@ -8193,7 +8071,7 @@ export class Game extends Uninstantable { if (_status.roundStart == player) _status.roundStart = player2; return player2; } - static arrangePlayers() { + arrangePlayers() { if (game.chess && game.me) { let friendCount = 0, enemyCount = 0; const rand = Math.random() < 0.5, sortCount = new Map(); @@ -8233,7 +8111,7 @@ export class Game extends Uninstantable { * @param { Player } player * @param { string[] } exclude */ - static filterSkills(skills, player, exclude) { + filterSkills(skills, player, exclude) { const out = skills.slice().removeArray(Object.keys(player.disabledSkills)); if (!player.storage.skill_blocker || !player.storage.skill_blocker.length) return out; return out.filter(value => exclude && exclude.includes(value) || !get.is.blocked(value, player)); @@ -8241,7 +8119,7 @@ export class Game extends Uninstantable { /** * @param { string[] } skills */ - static expandSkills(skills) { + expandSkills(skills) { return skills.addArray(skills.reduce((previousValue, currentValue) => { const info = get.info(currentValue); if (info) { @@ -8257,7 +8135,7 @@ export class Game extends Uninstantable { /** * @param { { [key:string]: any } } style */ - static css(style) { + css(style) { return Object.keys(style).forEach(value => { let uiStyle = ui.style[value]; if (!uiStyle) { @@ -8271,17 +8149,17 @@ export class Game extends Uninstantable { * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static hasPlayer(func, includeOut) { return game.players.some(value => (includeOut || !value.isOut()) && func(value)) } + hasPlayer(func, includeOut) { return game.players.some(value => (includeOut || !value.isOut()) && func(value)) } /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static hasPlayer2(func, includeOut) { return game.players.concat(game.dead).some(value => (includeOut || !value.isOut()) && func(value)) } + hasPlayer2(func, includeOut) { return game.players.concat(game.dead).some(value => (includeOut || !value.isOut()) && func(value)) } /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static countPlayer(func, includeOut) { + countPlayer(func, includeOut) { if (typeof func != 'function') func = lib.filter.all; return game.players.reduce((previousValue, currentValue) => { if (!includeOut && currentValue.isOut()) return previousValue; @@ -8295,7 +8173,7 @@ export class Game extends Uninstantable { * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static countPlayer2(func, includeOut) { + countPlayer2(func, includeOut) { if (typeof func != 'function') func = lib.filter.all; return game.players.concat(game.dead).reduce((previousValue, currentValue) => { if (!includeOut && currentValue.isOut()) return previousValue; @@ -8316,7 +8194,7 @@ export class Game extends Uninstantable { * @param { boolean } [includeOut] * @returns { Player[] } */ - static filterPlayer(func, list, includeOut) { + filterPlayer(func, list, includeOut) { if (!Array.isArray(list)) list = []; if (typeof func != 'function') func = lib.filter.all; return list.addArray(game.players.filter(value => (includeOut || !value.isOut()) && func(value))); @@ -8332,7 +8210,7 @@ export class Game extends Uninstantable { * @param { boolean } [includeOut] * @returns { Player[] } */ - static filterPlayer2(func, list, includeOut) { + filterPlayer2(func, list, includeOut) { if (!Array.isArray(list)) list = []; if (typeof func != 'function') func = lib.filter.all; return list.addArray(game.players.concat(game.dead).filter(value => (includeOut || !value.isOut()) && func(value))); @@ -8341,17 +8219,17 @@ export class Game extends Uninstantable { * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static findPlayer(func, includeOut) { return game.players.find(value => (includeOut || !value.isOut()) && func(value)) || null } + findPlayer(func, includeOut) { return game.players.find(value => (includeOut || !value.isOut()) && func(value)) || null } /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static findPlayer2(func, includeOut) { return game.players.concat(game.dead).find(value => (includeOut || !value.isOut()) && func(value)) || null } + findPlayer2(func, includeOut) { return game.players.concat(game.dead).find(value => (includeOut || !value.isOut()) && func(value)) || null } /** * @param { (player: Player) => boolean } func * @param { boolean } [all] */ - static findCards(func, all) { + findCards(func, all) { return Object.keys(lib.card).filter(value => { if (!lib.translate[`${value}_info`]) return false; if (lib.card[value].mode && lib.card[value].mode.includes(lib.config.mode) == false) return false; @@ -8359,7 +8237,7 @@ export class Game extends Uninstantable { return func(value, lib.card[value]); }) } - static countGroup() { + countGroup() { const list = lib.group.slice(0); return game.countPlayer(current => { if (!list.includes(current.group)) return false; @@ -8372,7 +8250,7 @@ export class Game extends Uninstantable { * @param {function} 测试的函数 * @returns {number} 消耗的时间 */ - static testRunCost(func){ + testRunCost(func){ let time = Date.now(); func(); let past = Date.now() - time; @@ -8386,7 +8264,7 @@ export class Game extends Uninstantable { * @param { (player: Player, i: number) => Promise } asyncFunc 需要执行的async方法 * @param { (a: Player, b: Player) => number } sort 排序器,默认为lib.sort.seat */ - static async doAsyncInOrder(targets,asyncFunc,sort){ + async doAsyncInOrder(targets,asyncFunc,sort){ if(!sort) sort = lib.sort.seat; let sortedTargets = targets.sort(sort); for(let i=0;i } [instance] + */ +export let setGame = (instance) => { + game = instance || new Game(); + if (lib.config.dev) { + window.game = game; + } +}; diff --git a/noname/game/promises.js b/noname/game/promises.js index 0fe76dd33..ecbfadc37 100644 --- a/noname/game/promises.js +++ b/noname/game/promises.js @@ -1,7 +1,6 @@ -import { Uninstantable } from "../util/index.js"; -import { game, Game } from "./index.js"; +import { game } from "../../noname.js"; -export class GamePromises extends Uninstantable { +export class GamePromises { /** * 模仿h5的prompt,用于显示可提示用户进行输入的对话框 * @@ -32,7 +31,7 @@ export class GamePromises extends Uninstantable { * */ // @ts-ignore - static prompt(alertOption, title, forced) { + prompt(alertOption, title, forced) { return new Promise((resolve, reject) => { if (alertOption !== 'alert') { // @ts-ignore @@ -54,29 +53,33 @@ export class GamePromises extends Uninstantable { * ``` * @returns { Promise } */ - static alert(title) { + alert(title) { return new Promise((resolve, reject) => { game.prompt(title, 'alert', resolve); }); } // 读写函数promises化(不用考虑其对应函数是否存在) - static download(url, folder, dev, onprogress) { + download(url, folder, dev, onprogress) { return new Promise((resolve, reject) => { + // @ts-ignore game.download(url, folder, resolve, reject, dev, onprogress); }); } - static readFile(filename) { + readFile(filename) { return new Promise((resolve, reject) => { + // @ts-ignore game.readFile(filename, resolve, reject); }); } - static readFileAsText(filename) { + readFileAsText(filename) { return new Promise((resolve, reject) => { + // @ts-ignore game.readFileAsText(filename, resolve, reject); }); } - static writeFile(data, path, name) { + writeFile(data, path, name) { return (new Promise((resolve, reject) => { + // @ts-ignore game.writeFile(data, path, name, resolve); })).then(result => { return new Promise((resolve, reject) => { @@ -88,26 +91,30 @@ export class GamePromises extends Uninstantable { }); }); } - static ensureDirectory(list, callback, file) { + ensureDirectory(list, callback, file) { return new Promise((resolve, reject) => { - game.ensureDirectory(list, callback, file).then(resolve).catch(reject); + // @ts-ignore + game.ensureDirectory(list, resolve, file); }); } - static createDir(directory) { + createDir(directory) { return new Promise((resolve, reject) => { + // @ts-ignore game.createDir(directory, resolve, reject); }); } - static removeFile(filename) { + removeFile(filename) { return /** @type {Promise} */(new Promise((resolve, reject) => { + // @ts-ignore game.removeFile(filename, err => { if (err) reject(err); else resolve(); }); })); } - static removeDir(directory) { + removeDir(directory) { return /** @type {Promise} */(new Promise((resolve, reject) => { + // @ts-ignore game.removeDir(directory, resolve, reject); })); } diff --git a/noname/get/index.js b/noname/get/index.js index cbb0946c6..e9ad4de4a 100644 --- a/noname/get/index.js +++ b/noname/get/index.js @@ -1,17 +1,15 @@ -import { userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../util/index.js"; -import { AI as ai } from '../ai/index.js'; -import { Game as game } from '../game/index.js'; -import { Library as lib } from '../library/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { GNC as gnc } from '../gnc/index.js'; +import { userAgent, GeneratorFunction, AsyncFunction } from "../util/index.js"; +import { game } from '../game/index.js'; +import { lib } from '../library/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; import { CacheContext } from "../library/cache/cacheContext.js"; import { Is } from "./is.js"; import { Promises } from "./promises.js"; -export class Get extends Uninstantable { - static is = Is; - static promises = Promises; +export class Get { + is = new Is() + promises = new Promises() /** * 获取当前内核版本信息 * @@ -21,7 +19,7 @@ export class Get extends Uninstantable { * * @returns {["firefox" | "chrome" | "safari" | "other", number, number, number]} */ - static coreInfo() { + coreInfo() { const regex = /(firefox|chrome|safari)\/(\d+(?:\.\d+)+)/ let result if (!(result = userAgent.match(regex))) return ["other", NaN, NaN, NaN] @@ -38,7 +36,7 @@ export class Get extends Uninstantable { * @param {Function} filter * @returns {string[][]} */ - static inpileVCardList(filter) { + inpileVCardList(filter) { let list = []; for (const name of lib.inpile) { const type = get.type(name); @@ -57,7 +55,7 @@ export class Get extends Uninstantable { * 根据(Player的)座次数n(从1开始)获取对应的“n号位”翻译 * @param {number | Player} seat */ - static seatTranslation(seat) { + seatTranslation(seat) { if (get.itemtype(seat) === 'player') seat = seat.getSeatNum() - 1; return `${get.cnNumber(seat + 1, true)}号位`; } @@ -65,7 +63,7 @@ export class Get extends Uninstantable { * @param {number} numberOfPlayers * @returns {string[]} */ - static identityList(numberOfPlayers) { + identityList(numberOfPlayers) { const modeConfig = lib.config.mode_config; if (modeConfig) { const identityConfig = modeConfig.identity; @@ -91,7 +89,7 @@ export class Get extends Uninstantable { * * 从Base64编码的八位字节流生成对象URL */ - static objectURL(octetStream) { + objectURL(octetStream) { const objectURLMap = lib.objectURL; if (objectURLMap.has(octetStream)) return objectURLMap.get(octetStream); const objectURL = URL.createObjectURL(new Blob([Uint8Array.from(atob(octetStream.replace(/^data:[\s\S]*\/[\s\S]*;base64,/, '')), character => character.charCodeAt())])); @@ -103,7 +101,7 @@ export class Get extends Uninstantable { * * 获取此牌的字数 */ - static cardNameLength(card, player) { + cardNameLength(card, player) { const actualCardName = lib.actualCardName, name = get.translation(typeof card == 'string' ? card : get.name(card, player)); return (actualCardName.has(name) ? actualCardName.get(name) : name).length; } @@ -114,12 +112,12 @@ export class Get extends Uninstantable { * * 获取(此牌的)应变条件 */ - static yingbianConditions(card) { return get.complexYingbianConditions(card).concat(get.simpleYingbianConditions(card)); } - static complexYingbianConditions(card) { + yingbianConditions(card) { return get.complexYingbianConditions(card).concat(get.simpleYingbianConditions(card)); } + complexYingbianConditions(card) { const complexYingbianConditions = Array.from(lib.yingbian.condition.complex.keys()); return card ? complexYingbianConditions.filter(value => get.cardtag(card, `yingbian_${value}`)) : complexYingbianConditions; } - static simpleYingbianConditions(card) { + simpleYingbianConditions(card) { const simpleYingbianConditions = Array.from(lib.yingbian.condition.simple.keys()); return card ? simpleYingbianConditions.filter(value => get.cardtag(card, `yingbian_${value}`)) : simpleYingbianConditions; } @@ -128,7 +126,7 @@ export class Get extends Uninstantable { * * 获取(此牌的)应变效果 */ - static yingbianEffects(card) { + yingbianEffects(card) { const yingbianEffects = Array.from(lib.yingbian.effect.keys()); return card ? yingbianEffects.filter(value => get.cardtag(card, `yingbian_${value}`)) : yingbianEffects; } @@ -137,14 +135,14 @@ export class Get extends Uninstantable { * * 获取此牌的默认应变效果 */ - static defaultYingbianEffect(card) { + defaultYingbianEffect(card) { const info = get.info(card); return info && info.defaultYingbianEffect || null; } /** * 优先度判断 */ - static priority(skill) { + priority(skill) { const info = get.info(skill); if (!info) return 0; if ('_priority' in info) return info._priority; @@ -172,7 +170,7 @@ export class Get extends Uninstantable { * @param { false | Player } [player] * @returns { string[] } */ - static subtypes(obj, player) { + subtypes(obj, player) { if (typeof obj == 'string') obj = { name: obj }; if (typeof obj != 'object') return; var name = get.name(obj, player); @@ -191,7 +189,7 @@ export class Get extends Uninstantable { /** * @returns { string[] } */ - static pinyin(chinese, withTone) { + pinyin(chinese, withTone) { const pinyinUtilx = window.pinyinUtilx; if (!pinyinUtilx) return []; const pinyins = lib.pinyins; @@ -201,7 +199,7 @@ export class Get extends Uninstantable { } return pinyinUtilx.getPinyin(chinese, null, withTone, true); } - static yunmu(str) { + yunmu(str) { //部分整体认读音节特化处理 const util = window.pinyinUtilx; if (util && lib.pinyins._metadata.zhengtirendu.includes(util.removeTone(str))) { @@ -233,7 +231,7 @@ export class Get extends Uninstantable { /** * 用于将参数转换为字符串,作为缓存的key。 */ - static paramToCacheKey() { + paramToCacheKey() { var str = ""; for (var arg of arguments) { if (arg === null || arg === undefined) { @@ -253,7 +251,7 @@ export class Get extends Uninstantable { } return str; } - static yunjiao(str) { + yunjiao(str) { const util = window.pinyinUtilx; if (util) str = util.removeTone(str); if (lib.pinyins._metadata.zhengtirendu.includes(str)) { @@ -278,7 +276,7 @@ export class Get extends Uninstantable { * @param { Player } player * @returns { string[] } */ - static skillCategoriesOf(skill, player) { + skillCategoriesOf(skill, player) { const list = [], info = get.info(skill); if (!info) return list; if (get.is.locked(skill, player)) list.add('锁定技'); @@ -301,9 +299,9 @@ export class Get extends Uninstantable { if (info.categories) list.addArray(info.categories(skill, player)); return list; } - static numOf(obj, item) { return obj.filter(element => element == item).length; } - static connectNickname() { return typeof lib.config.connect_nickname == 'string' ? (lib.config.connect_nickname.slice(0, 12)) : "无名玩家"; } - static zhinangs(filter) { + numOf(obj, item) { return obj.filter(element => element == item).length; } + connectNickname() { return typeof lib.config.connect_nickname == 'string' ? (lib.config.connect_nickname.slice(0, 12)) : "无名玩家"; } + zhinangs(filter) { var list = (_status.connectMode ? lib.configOL : lib.config).zhinang_tricks; if (!list || !list.filter || !list.length) return get.inpile('trick', 'trick').randomGets(3); if (filter === false) return list.slice(0); @@ -311,7 +309,7 @@ export class Get extends Uninstantable { if (list.length) return list; return get.inpile('trick', 'trick').randomGets(3); } - static sourceCharacter(str) { + sourceCharacter(str) { if (str) { for (var i in lib.characterReplace) { if (lib.characterReplace[i].includes(str)) return i; @@ -319,12 +317,12 @@ export class Get extends Uninstantable { } return str; } - static isLuckyStar(player) { + isLuckyStar(player) { if (player && player.hasSkillTag('luckyStar')) return true; if (_status.connectMode) return false; return (!player || player == game.me || player.isUnderControl()) && lib.config.lucky_star == true; } - static infoHp(hp) { + infoHp(hp) { if (typeof hp == 'number') return hp; else if (typeof hp == 'string') { if (hp.includes('/')) { @@ -340,7 +338,7 @@ export class Get extends Uninstantable { } return 0; } - static infoMaxHp(hp) { + infoMaxHp(hp) { if (typeof hp == 'number') return hp; else if (typeof hp == 'string') { if (hp.includes('/')) { @@ -356,7 +354,7 @@ export class Get extends Uninstantable { } return 0; } - static infoHujia(hp) { + infoHujia(hp) { if (typeof hp == 'string' && hp.includes('/')) { const num = hp.split('/')[2]; if (num) { @@ -369,7 +367,7 @@ export class Get extends Uninstantable { } return 0; } - static bottomCards(num, putBack) { + bottomCards(num, putBack) { if (_status.waitingForCards) { ui.create.cards.apply(ui.create, _status.waitingForCards); delete _status.waitingForCards; @@ -400,13 +398,13 @@ export class Get extends Uninstantable { if (card) return list[0]; return list; } - static discarded() { return _status.discarded.filter(item => item.parentNode == ui.discardPile); } - static cardOffset() { + discarded() { return _status.discarded.filter(item => item.parentNode == ui.discardPile); } + cardOffset() { var x = ui.arena.getBoundingClientRect(); var y = ui.window.getBoundingClientRect(); return -y.width / 2 + (x.left + x.width / 2); } - static colorspan(str) { + colorspan(str) { if (str[0] == '#') { var color; switch (str[1]) { @@ -420,7 +418,7 @@ export class Get extends Uninstantable { } return str; } - static evtprompt(next, str) { + evtprompt(next, str) { if (next.prompt) { next.set('prompt2', str); } @@ -435,11 +433,11 @@ export class Get extends Uninstantable { } } } - static autoViewAs(card, cards) { return new lib.element.VCard(card, cards); } + autoViewAs(card, cards) { return new lib.element.VCard(card, cards); } /** * @deprecated */ - static _autoViewAs(card, cards) { + _autoViewAs(card, cards) { var info = get.info(card); if (info.autoViewAs) { if (cards === false) { @@ -492,7 +490,7 @@ export class Get extends Uninstantable { return card; } } - static max(list, func, type) { + max(list, func, type) { list = list.slice(0); if (typeof func == 'string') { var key = func; @@ -519,7 +517,7 @@ export class Get extends Uninstantable { return func(list[0]); } } - static min(list, func, type) { + min(list, func, type) { list = list.slice(0); if (typeof func == 'string') { var key = func; @@ -558,7 +556,7 @@ export class Get extends Uninstantable { * @param { T } num * @returns { Character[T] } */ - static character(name, num) { + character(name, num) { let info = lib.character[name]; if (!info) { const pack = Object.keys(lib.characterPack).find(pack => name in lib.characterPack[pack]); @@ -572,14 +570,14 @@ export class Get extends Uninstantable { } return info; } - static characterInitFilter(name) { + characterInitFilter(name) { const info = get.character(name); if (!info || !info[4]) return []; const filter = info[4].find(tag => tag.startsWith('InitFilter')); if (!filter) return []; return filter.split(':').slice(1); } - static characterIntro(name) { + characterIntro(name) { if (lib.characterIntro[name]) return lib.characterIntro[name]; var tags = get.character(name, 4); if (tags) { @@ -595,7 +593,7 @@ export class Get extends Uninstantable { if (lib.characterIntro[name]) return lib.characterIntro[name]; return '暂无武将介绍'; } - static bordergroup(info, raw) { + bordergroup(info, raw) { if (!Array.isArray(info)) { info = lib.character[info]; if (!info) return ''; @@ -605,7 +603,7 @@ export class Get extends Uninstantable { } return raw ? '' : info[1] || ''; } - static groupnature(group, method) { + groupnature(group, method) { var nature = lib.groupnature[group]; if (!nature) return ''; if (method == 'raw') { @@ -613,12 +611,12 @@ export class Get extends Uninstantable { } return nature + 'mm'; } - static sgn(num) { + sgn(num) { if (num > 0) return 1; if (num < 0) return -1; return 0; } - static rand(num, num2) { + rand(num, num2) { if (typeof num2 == 'number') { return num + Math.floor(Math.random() * (num2 - num + 1)); } @@ -626,12 +624,12 @@ export class Get extends Uninstantable { return Math.floor(Math.random() * num); } } - static sort(arr, method, arg) { return method == "seat" ? arr.sortBySeat(arg) : void 0; } - static sortSeat(arr, target) { return arr.sortBySeat(target); } + sort(arr, method, arg) { return method == "seat" ? arr.sortBySeat(arg) : void 0; } + sortSeat(arr, target) { return arr.sortBySeat(target); } /** * @param { (zip: JSZip) => any } callback */ - static zip(callback) { + zip(callback) { if (!window.JSZip) { lib.init.js(lib.assetURL + 'game', 'jszip', function () { callback(new JSZip()); @@ -641,7 +639,7 @@ export class Get extends Uninstantable { callback(new JSZip()); } } - static delayx(num, max) { + delayx(num, max) { if (typeof num != 'number') num = 1; if (typeof max != 'number') max = Infinity; switch (lib.config.game_speed) { @@ -653,7 +651,7 @@ export class Get extends Uninstantable { default: return Math.min(max, num); } } - static prompt(skill, target, player) { + prompt(skill, target, player) { player = player || _status.event.player; if (target) { var str = get.translation(target); @@ -666,12 +664,12 @@ export class Get extends Uninstantable { return '是否发动【' + get.skillTranslation(skill, player) + '】?'; } } - static prompt2(skill, target, player) { + prompt2(skill, target, player) { var str = get.prompt.apply(this, arguments); if (!lib.translate[skill + '_info']) return str; return '###' + str + '###' + lib.translate[skill + '_info']; } - static url(master) { + url(master) { var url = lib.config.updateURL || lib.updateURL; if (url[url.length - 1] != '/') { url += '/'; @@ -683,11 +681,11 @@ export class Get extends Uninstantable { return url + 'v' + lib.version + '/'; } } - static round(num, f) { + round(num, f) { var round = Math.pow(10, f); return Math.round(num * round) / round; } - static playerNumber() { + playerNumber() { var num; if (_status.brawl && _status.brawl.playerNumber) { num = _status.brawl.playerNumber; @@ -697,7 +695,7 @@ export class Get extends Uninstantable { } return parseInt(num) || 2; } - static benchmark(func1, func2, iteration, arg) { + benchmark(func1, func2, iteration, arg) { var tic, toc; var key1, key2; if (!arg) arg = []; @@ -742,7 +740,7 @@ export class Get extends Uninstantable { /** * @param {any} obj */ - static stringify(obj, level = 0) { + stringify(obj, level = 0) { level = level || 0; let indent = ''; let str; @@ -862,7 +860,7 @@ export class Get extends Uninstantable { * @param {WeakMap} [map] - 拷贝用的临时存储,用于处理循环引用(请勿自行赋值) * @returns {T} - 深拷贝后的对象,若传入值不是对象则为传入值 */ - static copy(obj, copyKeyDeep = false, map = new WeakMap()) { + copy(obj, copyKeyDeep = false, map = new WeakMap()) { // 参考[这里](https://juejin.cn/post/7315612852890026021)实现深拷贝 // 不再判断是否能structuredClone是因为structuredClone会把Symbol给毙了 const getType = (obj) => Object.prototype.toString.call(obj); @@ -941,7 +939,7 @@ export class Get extends Uninstantable { return target; } - static inpilefull(type) { + inpilefull(type) { var list = []; for (var i in lib.cardPile) { for (var j = 0; j < lib.cardPile[i].length; j++) { @@ -958,7 +956,7 @@ export class Get extends Uninstantable { } return list; } - static inpile(type, filter) { + inpile(type, filter) { var list = []; if (filter == 'trick') { for (var i = 0; i < lib.inpile.length; i++) { @@ -985,8 +983,8 @@ export class Get extends Uninstantable { } return list; } - static inpile2(type) { return get.inpile(type, 'trick'); } - static typeCard(type, filter) { + inpile2(type) { return get.inpile(type, 'trick'); } + typeCard(type, filter) { var list = []; for (var i in lib.card) { if (lib.card[i].mode && lib.card[i].mode.includes(get.mode()) == false) continue; @@ -1006,7 +1004,7 @@ export class Get extends Uninstantable { } return list; } - static libCard(filter) { + libCard(filter) { var list = []; for (var i in lib.card) { if (lib.card[i].mode && lib.card[i].mode.includes(get.mode()) == false) continue; @@ -1020,7 +1018,7 @@ export class Get extends Uninstantable { } return list; } - static ip() { + ip() { if (!require) return ''; var interfaces = require('os').networkInterfaces(); for (var devName in interfaces) { @@ -1033,7 +1031,7 @@ export class Get extends Uninstantable { } } } - static modetrans(config, server) { + modetrans(config, server) { if (config.mode == 'doudizhu') { switch (config.doudizhu_mode) { case 'kaihei': return '开黑斗地主'; @@ -1082,7 +1080,7 @@ export class Get extends Uninstantable { return get.cnNumber(parseInt(config.number)) + '人' + get.translation(config.mode); } } - static charactersOL(func) { + charactersOL(func) { var list = []; var libCharacter = {}; for (var i = 0; i < lib.configOL.characterPack.length; i++) { @@ -1099,16 +1097,16 @@ export class Get extends Uninstantable { } return list; } - static trimip(str) { + trimip(str) { var len = str.length - 5; if (str.lastIndexOf(':8080') == len) { str = str.slice(0, len); } return str; } - static mode() { return lib[_status.connectMode ? 'configOL' : 'config'].mode; } - static idDialog(id) { return ui.dialogs.find(dialog => dialog.videoId == id) || null; } - static arenaState() { + mode() { return lib[_status.connectMode ? 'configOL' : 'config'].mode; } + idDialog(id) { return ui.dialogs.find(dialog => dialog.videoId == id) || null; } + arenaState() { var state = { number: ui.arena.dataset.number, players: {}, @@ -1126,7 +1124,7 @@ export class Get extends Uninstantable { } return state; } - static skillState(player) { + skillState(player) { var skills = { global: lib.skill.global }; @@ -1153,8 +1151,8 @@ export class Get extends Uninstantable { } return skills; } - static id() { return (Math.floor(1000000 + 9000000 * Math.random())).toString() + (10 + lib.status.globalId++); } - static zhu(player, skill, group) { + id() { return (Math.floor(1000000 + 9000000 * Math.random())).toString() + (10 + lib.status.globalId++); } + zhu(player, skill, group) { if (typeof player == 'string') { skill = player; player = null; @@ -1199,12 +1197,12 @@ export class Get extends Uninstantable { } return null; } - static config(item, mode) { + config(item, mode) { mode = mode || lib.config.mode; if (!lib.config.mode_config[mode]) return; return lib.config.mode_config[mode][item]; } - static coinCoeff(list) { + coinCoeff(list) { var num = 0; for (var i = 0; i < list.length; i++) { var rank = get.rank(list[i]); @@ -1223,7 +1221,7 @@ export class Get extends Uninstantable { } return num / list.length; } - static rank(name, num) { + rank(name, num) { if (typeof name == 'object' && name.name) { name = name.name; } @@ -1269,7 +1267,7 @@ export class Get extends Uninstantable { } return num ? Math.round(9 * (num - 1) / 8 + 1) : 'x'; } - static skillRank(skill, type, grouped) { + skillRank(skill, type, grouped) { var info = lib.skill[skill]; var player = _status.event.skillRankPlayer || _status.event.player; if (!info) return 0; @@ -1363,26 +1361,26 @@ export class Get extends Uninstantable { } return num; } - static targetsInfo(targets) { + targetsInfo(targets) { var info = []; for (var i = 0; i < targets.length; i++) { info.push(targets[i].dataset.position); } return info; } - static infoTargets(infos) { return Array.from(infos || []).map(info => game.playerMap[info]); } - static cardInfo(card) { return [card.suit, card.number, card.name, card.nature]; } - static cardsInfo(cards = []) { return Array.from(cards).map(get.cardInfo); } - static infoCard(info) { + infoTargets(infos) { return Array.from(infos || []).map(info => game.playerMap[info]); } + cardInfo(card) { return [card.suit, card.number, card.name, card.nature]; } + cardsInfo(cards = []) { return Array.from(cards).map(get.cardInfo); } + infoCard(info) { var card = ui.create.card(); if (info[0]) { card.init(info); } return card; } - static infoCards(infos) { return Array.from(infos || []).map(get.infoCard); } - static cardInfoOL(card) { return '_noname_card:' + JSON.stringify([card.cardid, card.suit, card.number, card.name, card.nature]); } - static infoCardOL(info) { + infoCards(infos) { return Array.from(infos || []).map(get.infoCard); } + cardInfoOL(card) { return '_noname_card:' + JSON.stringify([card.cardid, card.suit, card.number, card.name, card.nature]); } + infoCardOL(info) { if (!lib.cardOL) return info; var card; try { @@ -1410,13 +1408,13 @@ export class Get extends Uninstantable { } return card || info; } - static cardsInfoOL(cards) { return Array.from(cards || []).map(get.cardInfoOL); } - static infoCardsOL(infos) { return Array.from(infos || []).map(get.infoCardOL); } - static playerInfoOL(player) { return '_noname_player:' + player.playerid; } - static infoPlayerOL(info) { return lib.playerOL ? (lib.playerOL[info.slice(15)] || info) : info; } - static playersInfoOL(players) { return Array.from(players || []).map(get.playerInfoOL); } - static infoPlayersOL(infos) { return Array.from(infos || []).map(get.infoPlayerOL); } - static funcInfoOL(func) { + cardsInfoOL(cards) { return Array.from(cards || []).map(get.cardInfoOL); } + infoCardsOL(infos) { return Array.from(infos || []).map(get.infoCardOL); } + playerInfoOL(player) { return '_noname_player:' + player.playerid; } + infoPlayerOL(info) { return lib.playerOL ? (lib.playerOL[info.slice(15)] || info) : info; } + playersInfoOL(players) { return Array.from(players || []).map(get.playerInfoOL); } + infoPlayersOL(infos) { return Array.from(infos || []).map(get.infoPlayerOL); } + funcInfoOL(func) { if (typeof func == 'function') { if (func._filter_args) { return '_noname_func:' + JSON.stringify(get.stringifiedResult(func._filter_args, 3)); @@ -1428,7 +1426,7 @@ export class Get extends Uninstantable { } return ''; } - static infoFuncOL(info) { + infoFuncOL(info) { let func; const str = info.slice(13).trim(); try { @@ -1453,7 +1451,7 @@ export class Get extends Uninstantable { } return func; } - static eventInfoOL(item, level, noMore) { + eventInfoOL(item, level, noMore) { return get.itemtype(item) == 'event' ? `_noname_event:${JSON.stringify(Object.entries(item).reduce((stringifying, entry) => { const key = entry[0]; if (key == '_trigger') { @@ -1466,7 +1464,7 @@ export class Get extends Uninstantable { /** * @param {string} item */ - static infoEventOL(item) { + infoEventOL(item) { const evt = new lib.element.GameEvent(); try { Object.entries(JSON.parse(item.slice(14))).forEach(entry => { @@ -1479,7 +1477,7 @@ export class Get extends Uninstantable { } return evt || item; } - static stringifiedResult(item, level, nomore) { + stringifiedResult(item, level, nomore) { if (!item) return item; if (typeof item == 'function') { return get.funcInfoOL(item); @@ -1529,7 +1527,7 @@ export class Get extends Uninstantable { return item; } } - static parsedResult(item) { + parsedResult(item) { if (!item) return item; if (typeof item == 'string') { if (item.startsWith('_noname_func:')) { @@ -1569,11 +1567,11 @@ export class Get extends Uninstantable { return item; } } - static verticalStr(str, sp) { + verticalStr(str, sp) { if (typeof str != 'string') return ''; return Array.from(str).filter(value => value != '`').join(''); } - static numStr(num, method) { + numStr(num, method) { if (num == Infinity) { if (method == 'card') return get.selectableCards().length + ui.selected.cards.length; if (method == 'target') return get.selectableTargets().length + ui.selected.targets.length; @@ -1581,7 +1579,7 @@ export class Get extends Uninstantable { } return num.toString(); } - static rawName(str) { + rawName(str) { let str2 = lib.translate[str]; if (lib.translate[str + '_ab']) str2 = lib.translate[str + '_ab']; if (!str2) return ''; @@ -1593,7 +1591,7 @@ export class Get extends Uninstantable { /** * 作用修改:只读前缀 不读_ab */ - static rawName2(str) { + rawName2(str) { let str2 = lib.translate[str]; if (!str2) return ''; if (lib.translate[str + '_prefix'] && str2.startsWith(lib.translate[str + '_prefix'])) { @@ -1601,7 +1599,7 @@ export class Get extends Uninstantable { } return str2; } - static slimNameHorizontal(str) { + slimNameHorizontal(str) { const slimName = lib.translate[`${str}_ab`] || lib.translate[str]; if (!slimName) return ''; const prefix = lib.translate[`${str}_prefix`]; @@ -1617,7 +1615,7 @@ export class Get extends Uninstantable { * @param {string} name * @returns {string} */ - static prefixSpan(prefix, name) { + prefixSpan(prefix, name) { const config = lib.config.buttoncharacter_prefix; if (config == 'off') return ''; if (config == 'simple') { @@ -1637,8 +1635,8 @@ export class Get extends Uninstantable { span.innerHTML = prefix; return span.outerHTML; } - static slimName(str) { return get.verticalStr(get.slimNameHorizontal(str), true); } - static time() { + slimName(str) { return get.verticalStr(get.slimNameHorizontal(str), true); } + time() { if (lib.status.dateDelaying) { return lib.getUTC(lib.status.dateDelaying) - lib.getUTC(lib.status.date) - lib.status.dateDelayed; } @@ -1646,13 +1644,13 @@ export class Get extends Uninstantable { return lib.getUTC(new Date()) - lib.getUTC(lib.status.date) - lib.status.dateDelayed; } } - static utc() { return (new Date()).getTime(); } - static evtDistance(e1, e2) { + utc() { return (new Date()).getTime(); } + evtDistance(e1, e2) { var dx = (e1.clientX - e2.clientX) / game.documentZoom; var dy = (e1.clientY - e2.clientY) / game.documentZoom; return Math.sqrt(dx * dx + dy * dy); } - static xyDistance(from, to) { return Math.sqrt((from[0] - to[0]) * (from[0] - to[0]) + (from[1] - to[1]) * (from[1] - to[1])); } + xyDistance(from, to) { return Math.sqrt((from[0] - to[0]) * (from[0] - to[0]) + (from[1] - to[1]) * (from[1] - to[1])); } /** * @overload * @returns { void } @@ -1707,7 +1705,7 @@ export class Get extends Uninstantable { * @param { GameEvent | GameEventPromise } obj * @returns { 'event' } */ - static itemtype(obj) { + itemtype(obj) { if (typeof obj == 'string') { if (obj.length <= 5) { let bool = true; @@ -1747,13 +1745,13 @@ export class Get extends Uninstantable { if (lib.experimental.symbol.itemType in obj) return obj[lib.experimental.symbol.itemType]; } - static equipNum(card) { + equipNum(card) { if (get.type(card) == 'equip') { return parseInt(get.subtype(card)[5]); } return 0; } - static objtype(obj) { + objtype(obj) { if (Object.prototype.toString.call(obj) === '[object Array]') return 'array'; if (Object.prototype.toString.call(obj) === '[object Object]') return 'object'; if (Object.prototype.toString.call(obj) === '[object HTMLDivElement]') return 'div'; @@ -1763,7 +1761,7 @@ export class Get extends Uninstantable { if (Object.prototype.toString.call(obj) === '[object HTMLBodyElement]') return 'td'; if (Object.prototype.toString.call(obj) === '[object DocumentFragment]') return 'fragment'; } - static type(obj, method, player) { + type(obj, method, player) { if (typeof obj == 'string') obj = { name: obj }; if (typeof obj != 'object') return; var name = get.name(obj, player); @@ -1774,14 +1772,14 @@ export class Get extends Uninstantable { if (method == 'trick' && lib.card[name].type == 'delay') return 'trick'; return lib.card[name].type; } - static type2(card, player) { return get.type(card, 'trick', player); } + type2(card, player) { return get.type(card, 'trick', player); } /** * * @param { string | Card | VCard | CardBaseUIData } obj * @param { false | Player } [player] * @returns { string } */ - static subtype(obj, player) { + subtype(obj, player) { if (typeof obj == 'string') obj = { name: obj }; if (typeof obj != 'object') return; const name = get.name(obj, player); @@ -1789,7 +1787,7 @@ export class Get extends Uninstantable { let subtype = lib.card[name].subtype; return subtype; } - static equiptype(card, player) { + equiptype(card, player) { var subtype = get.subtype(card, player); if (subtype.startsWith('equip')) return parseInt(subtype[5]); return 0; @@ -1800,7 +1798,7 @@ export class Get extends Uninstantable { * @param { false | Player } [player] * @returns { string } */ - static name(card, player) { + name(card, player) { if (get.itemtype(player) == 'player' || (player !== false && get.position(card) == 'h')) { var owner = player || get.owner(card); if (owner) { @@ -1814,7 +1812,7 @@ export class Get extends Uninstantable { * @param {false | Player} [player] * @returns {string} */ - static suit(card, player) { + suit(card, player) { if (typeof card !== 'object') return; if (Array.isArray(card)) { if (card.length == 1) return get.suit(card[0], player); @@ -1839,7 +1837,7 @@ export class Get extends Uninstantable { * @param {false | Player} [player] * @returns {string} */ - static color(card, player) { + color(card, player) { if (typeof card !== 'object') return; if (Array.isArray(card)) { if (!card.length) return 'none'; @@ -1868,7 +1866,7 @@ export class Get extends Uninstantable { * @param {false | Player} [player] * @returns {number} */ - static number(card, player) { + number(card, player) { if (typeof card !== 'object') return; //狗卡你是真敢出啊 var number = null; @@ -1894,7 +1892,7 @@ export class Get extends Uninstantable { * @param {false | Player} [player] * @returns {string} */ - static nature(card, player) { + nature(card, player) { if (typeof card == 'string') return card.split(lib.natureSeparator).sort(lib.sort.nature).join(lib.natureSeparator); if (Array.isArray(card)) return card.sort(lib.sort.nature).join(lib.natureSeparator); var nature = card.nature; @@ -1912,7 +1910,7 @@ export class Get extends Uninstantable { * @param {false | Player} [player] * @returns {string[]} */ - static natureList(card, player) { + natureList(card, player) { if (!card) return []; if (get.itemtype(card) == 'natures') return card.split(lib.natureSeparator); if (get.itemtype(card) == 'nature') return [card]; @@ -1920,7 +1918,7 @@ export class Get extends Uninstantable { if (typeof natures != 'string') return []; return natures.split(lib.natureSeparator); } - static cards(num, putBack) { + cards(num, putBack) { if (_status.waitingForCards) { ui.create.cards.apply(ui.create, _status.waitingForCards); delete _status.waitingForCards; @@ -1951,12 +1949,12 @@ export class Get extends Uninstantable { if (card) return list[0]; return list; } - static judge(card) { + judge(card) { const cardInfo = (card.viewAs ? lib.card[card.viewAs] : get.info(card)); return (cardInfo && cardInfo.judge) ? cardInfo.judge : ()=>0; } - static judge2(card) { return card.viewAs ? lib.card[card.viewAs].judge2 : get.info(card).judge2; } - static distance(from, to, method) { + judge2(card) { return card.viewAs ? lib.card[card.viewAs].judge2 : get.info(card).judge2; } + distance(from, to, method) { if (from == to) return 0; if (!game.players.includes(from) && !game.dead.includes(from)) return Infinity; if (!game.players.includes(to) && !game.dead.includes(to)) return Infinity; @@ -2012,8 +2010,8 @@ export class Get extends Uninstantable { if (info.globalTo) { n += info.globalTo; } - if (info.attaclTo) { - m += info.attaclTo; + if (info.attackTo) { + m += info.attackTo; } } if (method == 'attack') { @@ -2026,8 +2024,8 @@ export class Get extends Uninstantable { // for(let i=0;iSelect) } [select] * @returns { Select } */ - static select(select) { + select(select) { if (typeof select == 'function') return get.select(select()); else if (typeof select == 'number') return [select, select]; else if (select && get.itemtype(select) == 'select') return select; return [1, 1]; } - static card(original) { + card(original) { if (_status.event.skill) { var card = get.info(_status.event.skill).viewAs; if (typeof card == 'function') card = card(ui.selected.cards, _status.event.player); @@ -2094,9 +2092,9 @@ export class Get extends Uninstantable { * @param {T} key * @returns {GameEvent[T]} */ - static event(key) { return key ? _status.event[key] : _status.event; } - static player() { return _status.event.player; } - static players(sort, dead, out) { + event(key) { return key ? _status.event[key] : _status.event; } + player() { return _status.event.player; } + players(sort, dead, out) { var players = game.players.slice(0); if (sort != false) { if (typeof sort == 'function') players.sort(sort); @@ -2106,7 +2104,7 @@ export class Get extends Uninstantable { if (!out) players = players.filter(current => !current.isOut()); return players; } - static position(card, ordering) { + position(card, ordering) { if (get.itemtype(card) == 'player') return parseInt(card.dataset.position); if (card.timeout && card.destiny && card.destiny.classList) { if (card.destiny.classList.contains('equips')) return 'e'; @@ -2130,7 +2128,7 @@ export class Get extends Uninstantable { if (card.parentNode.id == 'ordering') return ordering ? 'o' : 'd'; return null; } - static skillTranslation(str, player) { + skillTranslation(str, player) { var str2; if (str.startsWith('re')) { str2 = str.slice(2); @@ -2154,7 +2152,7 @@ export class Get extends Uninstantable { } return get.translation(str); } - static skillInfoTranslation(name, player) { + skillInfoTranslation(name, player) { if (player && lib.dynamicTranslate[name]) return lib.dynamicTranslate[name](player, name); var str = lib.translate[name + '_info']; if (!str) return ''; @@ -2170,7 +2168,7 @@ export class Get extends Uninstantable { /** * @returns {string} */ - static translation(str, arg) { + translation(str, arg) { if (str && typeof str == 'object' && (str.name || str._tempTranslate)) { if (str._tempTranslate) return str._tempTranslate; var str2; @@ -2266,13 +2264,13 @@ export class Get extends Uninstantable { } return ''; } - static menuZoom(){ + menuZoom(){ if(game.menuZoom === undefined || game.menuZoom === null){ return game.documentZoom; } return game.menuZoom; } - static strNumber(num) { + strNumber(num) { switch (num) { case 1: return 'A'; case 11: return 'J'; @@ -2281,7 +2279,7 @@ export class Get extends Uninstantable { default: return num.toString(); } } - static cnNumber(num, ordinal) { + cnNumber(num, ordinal) { if (isNaN(num)) return ''; let numStr = num.toString(); if (numStr === 'Infinity') return '∞'; @@ -2340,7 +2338,7 @@ export class Get extends Uninstantable { * @param {HTMLElement} node * @returns {Iterable} 迭代器 */ - static *iterableChildNodes(node){ + *iterableChildNodes(node){ for(let i=0;i number)} [sort] 排序函数 * @returns { Button[] } */ - static selectableButtons(sort) { + selectableButtons(sort) { if (!_status.event.player) return []; var buttons = _status.event.dialog.buttons; var selectable = []; @@ -2371,7 +2369,7 @@ export class Get extends Uninstantable { * @param {((a: Card, b: Card) => number)} [sort] 排序函数 * @returns { Card[] } */ - static selectableCards(sort) { + selectableCards(sort) { if (!_status.event.player) return []; var cards = _status.event.player.getCards('hes'); var selectable = []; @@ -2389,7 +2387,7 @@ export class Get extends Uninstantable { /** * @returns { string[] } 技能名数组 */ - static skills() { + skills() { var skills = []; if (ui.skills) { skills = skills.concat(ui.skills.skills); @@ -2402,7 +2400,7 @@ export class Get extends Uninstantable { } return skills; } - static gainableSkills(func, player) { + gainableSkills(func, player) { var list = []; for (var i in lib.character) { if (lib.filter.characterDisabled(i)) continue; @@ -2424,7 +2422,7 @@ export class Get extends Uninstantable { } return list; } - static gainableSkillsName(name, func) { + gainableSkillsName(name, func) { var list = []; if (name && lib.character[name]) { if (lib.character[name][4]) { @@ -2443,7 +2441,7 @@ export class Get extends Uninstantable { } return list; } - static gainableCharacters(func) { + gainableCharacters(func) { var list = []; for (var i in lib.character) { var info = lib.character[i]; @@ -2467,7 +2465,7 @@ export class Get extends Uninstantable { * @param {((a: Player, b: Player) => number)} [sort] 排序函数 * @returns { Player[] } */ - static selectableTargets(sort) { + selectableTargets(sort) { var selectable = []; var players = game.players.slice(0); if (_status.event.deadTarget) players.addArray(game.dead); @@ -2483,7 +2481,7 @@ export class Get extends Uninstantable { } return selectable; } - static filter(filter, i) { + filter(filter, i) { if (typeof filter == 'function') return filter; if (i == undefined) i = 0; var result = function () { @@ -2556,7 +2554,7 @@ export class Get extends Uninstantable { result._filter_args = [filter, i]; return result; } - static cardCount(card, player) { + cardCount(card, player) { var num; if (player == undefined) player = _status.event.player; if (card == true) { @@ -2574,13 +2572,13 @@ export class Get extends Uninstantable { if (num == undefined) return 0; return num; } - static skillCount(skill, player) { + skillCount(skill, player) { if (player == undefined) player = _status.event.player; var num = player.getStat('skill')[skill]; if (num == undefined) return 0; return num; } - static owner(card, method) { + owner(card, method) { return game.players.concat(game.dead).find(current=>{ if(current.judging[0] == card && method != "judge")return true; let parent = card.parentNode; @@ -2598,13 +2596,13 @@ export class Get extends Uninstantable { //return game.players.concat(game.dead).find(current => // current.getCards("hejsx").includes(card) || (current.judging[0] == card && method != "judge")); } - static noSelected() { return ui.selected.buttons.length + ui.selected.cards.length + ui.selected.targets.length == 0; } - static population(identity) { + noSelected() { return ui.selected.buttons.length + ui.selected.cards.length + ui.selected.targets.length == 0; } + population(identity) { return identity == undefined ? game.players.length + game.dead.length : game.players.filter(current => current.identity == identity).length; } - static totalPopulation(identity) { + totalPopulation(identity) { return identity == undefined ? game.players.length + game.dead.length : game.players.concat(game.dead).filter(current => current.identity == identity).length; @@ -2612,11 +2610,11 @@ export class Get extends Uninstantable { /** * @param { Card | VCard } item */ - static cardtag(item, tag) { + cardtag(item, tag) { return (item.cardid && (get.itemtype(item) == 'card' || !item.cards || !item.cards.length || item.name == item.cards[0].name) && _status.cardtag && _status.cardtag[tag] && _status.cardtag[tag].includes(item.cardid)) || (item.cardtags && item.cardtags.includes(tag)); } - static tag(item, tag, item2, bool) { + tag(item, tag, item2, bool) { var result; if (get.info(item, bool) && get.info(item, bool).ai && get.info(item, bool).ai.tag) { result = get.info(item, bool).ai.tag[tag]; @@ -2624,7 +2622,7 @@ export class Get extends Uninstantable { if (typeof result == 'function') return result(item, item2); return result; } - static sortCard(sort) { + sortCard(sort) { var func; if (sort == 'type_sort') { func = function (card) { @@ -2661,7 +2659,7 @@ export class Get extends Uninstantable { } return func; } - static difficulty() { + difficulty() { switch (get.config('difficulty')) { case 'easy': return 1; case 'normal': return 2; @@ -2669,7 +2667,7 @@ export class Get extends Uninstantable { default: return 1; } } - static cardPile(name, create) { + cardPile(name, create) { var filter = function (card) { if (typeof name == 'string') { if (card.name == name) { @@ -2720,9 +2718,9 @@ export class Get extends Uninstantable { } return null; } - static cardPile2(name) { return get.cardPile(name, 'cardPile'); } - static discardPile(name) { return get.cardPile(name, 'discardPile'); } - static aiStrategy() { + cardPile2(name) { return get.cardPile(name, 'cardPile'); } + discardPile(name) { return get.cardPile(name, 'discardPile'); } + aiStrategy() { switch (get.config('ai_strategy')) { case 'ai_strategy_1': return 1; case 'ai_strategy_2': return 2; @@ -2733,7 +2731,7 @@ export class Get extends Uninstantable { default: return 1; } } - static skillintro(name, learn, learn2) { + skillintro(name, learn, learn2) { var str = ''; var infoitem = lib.character[name]; if (!infoitem) { @@ -2761,7 +2759,7 @@ export class Get extends Uninstantable { } return str; } - static intro(name) { + intro(name) { var info = lib.character[name]; var str = '性别:' + get.translation(info[0]) + '
        '; str += '势力:' + get.translation(info[1]) + '
        '; @@ -2775,7 +2773,7 @@ export class Get extends Uninstantable { } return str; } - static storageintro(type, content, player, dialog, skill) { + storageintro(type, content, player, dialog, skill) { switch (type) { case 'mark': { if (content > 0) { @@ -2883,7 +2881,7 @@ export class Get extends Uninstantable { } } } - static nodeintro(node, simple, evt) { + nodeintro(node, simple, evt) { var uiintro = ui.create.dialog('hidden', 'notouchscroll'); if (node.classList.contains('player') && !node.name) { return uiintro; @@ -3998,7 +3996,7 @@ export class Get extends Uninstantable { } return uiintro; } - static linkintro(dialog, content, player) { + linkintro(dialog, content, player) { dialog.content.firstChild.remove(); dialog.add('
        已横置
        '); var list = []; @@ -4011,8 +4009,8 @@ export class Get extends Uninstantable { dialog.add(list, true, true); } } - static groups() { return ['wei', 'shu', 'wu', 'qun', 'jin', 'western', 'key']; } - static types() { + groups() { return ['wei', 'shu', 'wu', 'qun', 'jin', 'western', 'key']; } + types() { var types = []; for (var i in lib.card) { if (lib.card[i].mode && lib.card[i].mode.includes(lib.config.mode) == false) continue; @@ -4024,14 +4022,14 @@ export class Get extends Uninstantable { } return types; } - static links(buttons) { + links(buttons) { var links = []; for (var i = 0; i < buttons.length; i++) { if (buttons[i].link != undefined) links.push(buttons[i].link); } return links; } - static threaten(target, player, hp) { + threaten(target, player, hp) { var threaten = 1; var skills = target.getSkills(); if (!player && player !== false) { @@ -4063,7 +4061,7 @@ export class Get extends Uninstantable { } return threaten; } - static condition(player) { + condition(player) { var num = player.hp; if (num > 4) { num = 4 + Math.sqrt(num - 4); @@ -4088,7 +4086,7 @@ export class Get extends Uninstantable { } return num; } - static attitude(from, to) { + attitude(from, to) { if (!from || !to) return 0; from = from._trueMe || from; arguments[0] = from; @@ -4114,10 +4112,10 @@ export class Get extends Uninstantable { } return att; } - static sgnAttitude() { + sgnAttitude() { return get.sgn(get.attitude.apply(this, arguments)); } - static useful_raw(card, player) { + useful_raw(card, player) { if (get.position(card) == 'j') return -1; if (get.position(card) == 'e') return get.equipValue(card); if (card._modUseful) { @@ -4152,19 +4150,19 @@ export class Get extends Uninstantable { result = game.checkMod(player, card, result, 'aiUseful', player); return result; } - static useful(card, player) { + useful(card, player) { if (_status.event.useCache) { return game.callFuncUseStepCache("get.useful_raw", get.useful_raw, [card, player]); } return get.useful_raw(card, player); } - static unuseful(card) { return -get.useful(card); } - static unuseful2(card) { return 10 - get.useful(card); } - static unuseful3(card) { + unuseful(card) { return -get.useful(card); } + unuseful2(card) { return 10 - get.useful(card); } + unuseful3(card) { if (card.name == 'du') return 20; return 10 - get.useful(card); } - static value(card, player, method) { + value(card, player, method) { var result = 0; var value; if (Array.isArray(card)) { @@ -4198,7 +4196,7 @@ export class Get extends Uninstantable { result = game.checkMod(player, card, result, 'aiValue', player); return result; } - static equipResult(player, target, name) { + equipResult(player, target, name) { var card = get.card(); if (!card || card.name != name) { card = { name: name }; @@ -4217,7 +4215,7 @@ export class Get extends Uninstantable { } return Math.max(0, value1 - value2) / 5; } - static equipValue(card, player) { + equipValue(card, player) { if (player == undefined || get.itemtype(player) != 'player') player = get.owner(card); if (player == undefined || get.itemtype(player) != 'player') player = _status.event.player; var info = get.info(card); @@ -4233,7 +4231,7 @@ export class Get extends Uninstantable { if (typeof value == 'function') return value(card, player, null, 'raw2'); return 0; } - static equipValueNumber(card) { + equipValueNumber(card) { var info = get.info(card); if (info.ai) { if (typeof info.ai.equipValue == 'number') return info.ai.equipValue; @@ -4241,9 +4239,9 @@ export class Get extends Uninstantable { } return 0; } - static disvalue(card, player) { return -get.value(card, player); } - static disvalue2(card, player) { return -get.value(card, player, 'raw'); } - static skillthreaten(skill, player, target) { + disvalue(card, player) { return -get.value(card, player); } + disvalue2(card, player) { return -get.value(card, player, 'raw'); } + skillthreaten(skill, player, target) { if (!lib.skill[skill]) return 1; if (!lib.skill[skill].ai) return 1; var threaten = lib.skill[skill].ai.threaten; @@ -4255,14 +4253,14 @@ export class Get extends Uninstantable { } return 1; } - static cacheOrder(item){ + cacheOrder(item){ let cache = CacheContext.requireCacheContext(); return cache.get.order(item); } /** * @returns { number } */ - static order(item, player = get.player() || game.me) { + order(item, player = get.player() || game.me) { let cache = CacheContext.requireCacheContext(); var info = get.info(item); if (!info) return -1; @@ -4280,7 +4278,7 @@ export class Get extends Uninstantable { } return num; } - static result(item, skill) { + result(item, skill) { var result; var info = get.info(item); if (info.ai) result = get.copy(info.ai.result); @@ -4297,11 +4295,11 @@ export class Get extends Uninstantable { } return result; } - static cacheEffectUse(target, card, player, player2, isLink){ + cacheEffectUse(target, card, player, player2, isLink){ let cache = CacheContext.requireCacheContext(); return cache.get.effect_use(target,card,player,player2,isLink); } - static effect_use(target, card, player, player2, isLink) { + effect_use(target, card, player, player2, isLink) { let cache = CacheContext.requireCacheContext(); var event = _status.event; var eventskill = null; @@ -4493,11 +4491,11 @@ export class Get extends Uninstantable { } return final; } - static cacheEffect(target, card, player, player2, isLink){ + cacheEffect(target, card, player, player2, isLink){ let cache = CacheContext.requireCacheContext(); return cache.get.effect(target,card,player,player2,isLink); } - static effect(target, card, player, player2, isLink) { + effect(target, card, player, player2, isLink) { let cache = CacheContext.requireCacheContext(); var event = _status.event; var eventskill = null; @@ -4673,7 +4671,7 @@ export class Get extends Uninstantable { } return final; } - static damageEffect(target, player, viewer, nature) { + damageEffect(target, player, viewer, nature) { if (get.itemtype(nature) == 'natures') { var natures = get.natureList(nature); return natures.map(n => get.damageEffect(target, player, viewer, n)).reduce((p, c) => p + c, 0) / (natures.length || 1); @@ -4703,13 +4701,13 @@ export class Get extends Uninstantable { * @param {any} source 如果参数是function,执行此函数并返回结果,传参为此方法剩余的参数。如果参数不是function,直接返回结果。 * @returns 返回的结果 */ - static dynamicVariable(source){ + dynamicVariable(source){ if(typeof source == 'function'){ return source.call(null,...(Array.from(arguments).slice(1))); } return source; } - static recoverEffect(target, player, viewer) { + recoverEffect(target, player, viewer) { if (target.hp == target.maxHp) return 0; if (!player) { player = target; @@ -4719,7 +4717,7 @@ export class Get extends Uninstantable { } return get.effect(target, { name: 'recover' }, player, viewer); } - static buttonValue(button) { + buttonValue(button) { var card = button.link; var player = get.owner(card); if (!player) player = _status.event.player; @@ -4753,10 +4751,19 @@ export class Get extends Uninstantable { default: return 0.4; } } - static attitude2(to) { return get.attitude(_status.event.player, to); } + attitude2(to) { return get.attitude(_status.event.player, to); } } -export const get = Get; +export let get = new Get(); +/** + * @param { InstanceType } [instance] + */ +export let setGet = (instance) => { + get = instance || new Get(); + if (lib.config.dev) { + window.get = get; + } +}; export { Is, diff --git a/noname/get/is.js b/noname/get/is.js index f94ba5539..dfe584a6e 100644 --- a/noname/get/is.js +++ b/noname/get/is.js @@ -1,20 +1,18 @@ -import { userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../util/index.js"; -import { AI as ai } from '../ai/index.js'; -import { Game as game } from '../game/index.js'; -import { Library as lib } from '../library/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { GNC as gnc } from '../gnc/index.js'; -import { Get as get } from "./index.js"; +import { userAgent } from "../util/index.js"; +import { game } from '../game/index.js'; +import { lib } from '../library/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; +import { get } from "./index.js"; -export class Is extends Uninstantable { +export class Is { /** * 判断是否为进攻坐骑 * @param { Card | VCard } card * @param { false | Player } [player] * @returns { boolean } */ - static attackingMount(card, player) { + attackingMount(card, player) { const subtype = get.subtype(card, player); if (subtype == 'equip4') return true; else if (subtype == 'equip6') { @@ -30,7 +28,7 @@ export class Is extends Uninstantable { * @param { false | Player } [player] * @returns { boolean } */ - static defendingMount(card, player) { + defendingMount(card, player) { const subtype = get.subtype(card, player); if (subtype == 'equip3') return true; else if (subtype == 'equip6') { @@ -44,7 +42,7 @@ export class Is extends Uninstantable { * 判断坐骑栏是否被合并 * @returns { boolean } */ - static mountCombined() { + mountCombined() { if (lib.configOL.mount_combine) { return lib.configOL.mount_combine; } @@ -58,7 +56,7 @@ export class Is extends Uninstantable { * @param {...} infos 要判断的属性列表 * @param {boolean} every 是否判断每一个传入的属性是否完全相同而不是存在部分相同 */ - static sameNature() { + sameNature() { let processedArguments = [], every = false; Array.from(arguments).forEach(argument => { if (typeof argument == 'boolean') every = argument; @@ -90,7 +88,7 @@ export class Is extends Uninstantable { * @param ...infos 要判断的属性列表 * @param every {boolean} 是否判断每一个传入的属性是否完全不同而不是存在部分不同 */ - static differentNature() { + differentNature() { let processedArguments = [], every = false; Array.from(arguments).forEach(argument => { if (typeof argument == 'boolean') every = argument; @@ -121,7 +119,7 @@ export class Is extends Uninstantable { * 判断一张牌是否为明置手牌 * @param { Card } card */ - static shownCard(card) { + shownCard(card) { if (!card) return false; const gaintag = card.gaintag; return Array.isArray(gaintag) && gaintag.some(tag => tag.startsWith('visible_')); @@ -131,7 +129,7 @@ export class Is extends Uninstantable { * @param { Card | VCard } card */ // @ts-ignore - static virtualCard(card) { + virtualCard(card) { return (!("cards" in card) || !Array.isArray(card.cards) || card.cards.length === 0); } /** @@ -139,7 +137,7 @@ export class Is extends Uninstantable { * @param { Card | VCard } card */ // @ts-ignore - static convertedCard(card) { + convertedCard(card) { return !card.isCard && ("cards" in card) && Array.isArray(card.cards) && card.cards.length > 0; } /** @@ -147,7 +145,7 @@ export class Is extends Uninstantable { * @param { Card | VCard } card */ // @ts-ignore - static ordinaryCard(card) { + ordinaryCard(card) { return card.isCard && ("cards" in card) && Array.isArray(card.cards) && card.cards.length === 1 } /** @@ -155,7 +153,7 @@ export class Is extends Uninstantable { * @param { string } str1 * @param { string } str2 */ - static yayun(str1, str2) { + yayun(str1, str2) { if (str1 == str2) return true; let pinyin1 = get.pinyin(str1, false), pinyin2 = get.pinyin(str2, false); if (!pinyin1.length || !pinyin2.length) return false; @@ -168,7 +166,7 @@ export class Is extends Uninstantable { * @param { Player } player 玩家 * @returns */ - static blocked(skill, player) { + blocked(skill, player) { if (!player.storage.skill_blocker || !player.storage.skill_blocker.length) return false; for (let i of player.storage.skill_blocker) { if (lib.skill[i] && lib.skill[i].skillBlocker && lib.skill[i].skillBlocker(skill, player)) return true; @@ -181,7 +179,7 @@ export class Is extends Uninstantable { * @param { string[] } array * @returns { boolean | string[] } */ - static double(name, array) { + double(name, array) { const extraInformations = get.character(name, 4); if (!extraInformations) return false; for (const extraInformation of extraInformations) { @@ -196,11 +194,11 @@ export class Is extends Uninstantable { * 检测此牌是否具有应变条件 * @param { Card | VCard } card */ - static yingbianConditional(card) { return get.is.complexlyYingbianConditional(card) || get.is.simplyYingbianConditional(card) } + yingbianConditional(card) { return get.is.complexlyYingbianConditional(card) || get.is.simplyYingbianConditional(card) } /** * @param { Card | VCard } card */ - static complexlyYingbianConditional(card) { + complexlyYingbianConditional(card) { for (const key of lib.yingbian.condition.complex.keys()) { if (get.cardtag(card, `yingbian_${key}`)) return true; } @@ -209,7 +207,7 @@ export class Is extends Uninstantable { /** * @param { Card | VCard } card */ - static simplyYingbianConditional(card) { + simplyYingbianConditional(card) { for (const key of lib.yingbian.condition.simple.keys()) { if (get.cardtag(card, `yingbian_${key}`)) return true; } @@ -222,7 +220,7 @@ export class Is extends Uninstantable { * * @param { Card | VCard } card */ - static yingbianEffective(card) { + yingbianEffective(card) { for (const key of lib.yingbian.effect.keys()) { if (get.cardtag(card, `yingbian_${key}`)) return true; } @@ -231,11 +229,11 @@ export class Is extends Uninstantable { /** * @param { Card | VCard } card */ - static yingbian(card) { return get.is.yingbianConditional(card) || get.is.yingbianEffective(card) } + yingbian(card) { return get.is.yingbianConditional(card) || get.is.yingbianEffective(card) } /** * @param { string } [substring] */ - static emoji(substring) { + emoji(substring) { if (substring) { const reg = new RegExp("[~#^$@%&!?%*]", 'g'); if (substring.match(reg)) { @@ -284,23 +282,23 @@ export class Is extends Uninstantable { /** * @param { string } str */ - static banWords(str) { return get.is.emoji(str) || window.bannedKeyWords.some(item => str.includes(item)) } + banWords(str) { return get.is.emoji(str) || window.bannedKeyWords.some(item => str.includes(item)) } /** * @param { GameEventPromise } event */ // @ts-ignore - static converted(event) { return !(event.card && event.card.isCard) } - static safari() { return userAgent.indexOf('safari') != -1 && userAgent.indexOf('chrome') == -1 } + converted(event) { return !(event.card && event.card.isCard) } + safari() { return userAgent.indexOf('safari') != -1 && userAgent.indexOf('chrome') == -1 } /** * @param { (Card | VCard)[]} cards */ // @ts-ignore - static freePosition(cards) { return !cards.some(card => !card.hasPosition || card.hasPosition()) } + freePosition(cards) { return !cards.some(card => !card.hasPosition || card.hasPosition()) } /** * @param { string } name * @param { boolean } item */ - static nomenu(name, item) { + nomenu(name, item) { const menus = ['system', 'menu']; const configs = { show_round_menu: lib.config.show_round_menu, @@ -334,7 +332,7 @@ export class Is extends Uninstantable { } return true; } - static altered(skillName) { return false; } + altered(skillName) { return false; } /* skill=>{ return false; @@ -346,25 +344,25 @@ export class Is extends Uninstantable { * @param { any } obj * @returns { boolean } */ - static node(obj) { + node(obj) { return Object.prototype.toString.call(obj).startsWith('[object HTML'); } /** * @param { any } obj */ - static div(obj) { return Object.prototype.toString.call(obj) === '[object HTMLDivElement]' } + div(obj) { return Object.prototype.toString.call(obj) === '[object HTMLDivElement]' } /** * @param { any } obj */ - static map(obj) { return Object.prototype.toString.call(obj) === '[object Map]' } + map(obj) { return Object.prototype.toString.call(obj) === '[object Map]' } /** * @param { any } obj */ - static set(obj) { return Object.prototype.toString.call(obj) === '[object Set]' } + set(obj) { return Object.prototype.toString.call(obj) === '[object Set]' } /** * @param { any } obj */ - static object(obj) { return Object.prototype.toString.call(obj) === '[object Object]' } + object(obj) { return Object.prototype.toString.call(obj) === '[object Object]' } /** * @overload * @param { Function } func @@ -375,7 +373,7 @@ export class Is extends Uninstantable { * @param { number | [number, number] } func * @returns { boolean } */ - static singleSelect(func) { + singleSelect(func) { if (typeof func == 'function') return false; const select = get.select(func); return select[0] == 1 && select[1] == 1; @@ -383,7 +381,7 @@ export class Is extends Uninstantable { /** * @param { string | Player } name */ - static jun(name) { + jun(name) { if (get.mode() == 'guozhan') { if (name instanceof lib.element.Player) { if (name.isUnseen && name.isUnseen(0)) return false; @@ -395,23 +393,23 @@ export class Is extends Uninstantable { } return false; } - static versus() { return !_status.connectMode && get.mode() == 'versus' && _status.mode == 'three' } - static changban() { return get.mode() == 'single' && _status.mode == 'changban' } - static single() { return get.mode() == 'single' && _status.mode == 'normal' } + versus() { return !_status.connectMode && get.mode() == 'versus' && _status.mode == 'three' } + changban() { return get.mode() == 'single' && _status.mode == 'changban' } + single() { return get.mode() == 'single' && _status.mode == 'normal' } /** * @param { Player } [player] */ - static mobileMe(player) { return (game.layout == 'mobile' || game.layout == 'long') && !game.chess && player && player.dataset.position == '0' } - static newLayout() { return game.layout != 'default' } - static phoneLayout() { + mobileMe(player) { return (game.layout == 'mobile' || game.layout == 'long') && !game.chess && player && player.dataset.position == '0' } + newLayout() { return game.layout != 'default' } + phoneLayout() { if (!lib.config.phonelayout) return false; return (game.layout == 'mobile' || game.layout == 'long' || game.layout == 'long2' || game.layout == 'nova'); } - static singleHandcard() { return game.singleHandcard || game.layout == 'mobile' || game.layout == 'long' || game.layout == 'long2' || game.layout == 'nova' } + singleHandcard() { return game.singleHandcard || game.layout == 'mobile' || game.layout == 'long' || game.layout == 'long2' || game.layout == 'nova' } /** * @param { Player } player */ - static linked2(player) { + linked2(player) { if (game.chess) return true; if (lib.config.link_style2 != 'rotate') return true; // if(game.chess) return false; @@ -424,17 +422,17 @@ export class Is extends Uninstantable { /** * @param { {} } obj */ - static empty(obj) { return Object.keys(obj).length == 0 } + empty(obj) { return Object.keys(obj).length == 0 } /** * @param { string } str */ - static pos(str) { return str == 'h' || str == 'e' || str == 'j' || str == 'he' || str == 'hj' || str == 'ej' || str == 'hej' } + pos(str) { return str == 'h' || str == 'e' || str == 'j' || str == 'he' || str == 'hj' || str == 'ej' || str == 'hej' } /** * @param { string } skill * @param { Player } player * @returns */ - static locked(skill, player) { + locked(skill, player) { const info = lib.skill[skill]; if (typeof info.locked == 'function') return info.locked(skill, player); if (info.locked == false) return false; @@ -448,7 +446,7 @@ export class Is extends Uninstantable { * @param { Player } player * @returns */ - static zhuanhuanji(skill, player) { + zhuanhuanji(skill, player) { const info = lib.skill[skill], { zhuanhuanji } = info; if ('zhuanhuanji2' in info) { const { zhuanhuanji2 } = info; diff --git a/noname/get/promises.js b/noname/get/promises.js index 5c417f95b..daa544485 100644 --- a/noname/get/promises.js +++ b/noname/get/promises.js @@ -1,11 +1,10 @@ import { get } from "./index.js"; -import { Uninstantable } from "../util/index.js"; -export class Promises extends Uninstantable { +export class Promises { /** * @returns { Promise } */ - static zip() { + zip() { return new Promise(resolve => get.zip(resolve)); } } \ No newline at end of file diff --git a/noname/gnc/index.js b/noname/gnc/index.js index df5a6d83b..c569456d4 100644 --- a/noname/gnc/index.js +++ b/noname/gnc/index.js @@ -1,14 +1,14 @@ -import { GeneratorFunction, Uninstantable } from "../util/index.js"; +import { GeneratorFunction } from "../util/index.js"; import { Is } from "./is.js"; // gnc: GeNCoroutine -export class GNC extends Uninstantable { +export class GNC { /** * @param {GeneratorFunction} fn * @returns */ - static of(fn) { - return Is.generatorFunc(fn) ? + of(fn) { + return this.is.generatorFunc(fn) ? /** * @param {Parameters} args * @returns {Promise>} @@ -45,7 +45,14 @@ export class GNC extends Uninstantable { return new Promise(callback); } : (() => { throw new TypeError("gnc.of needs a GeneratorFunction."); })(); } - static is = Is; + is = new Is(); }; -export const gnc = GNC; +export let gnc = new GNC(); + +/** + * @param { InstanceType } [instance] + */ +export let setGNC = (instance) => { + gnc = instance || new GNC(); +}; diff --git a/noname/gnc/is.js b/noname/gnc/is.js index 7089fa988..31d9c84be 100644 --- a/noname/gnc/is.js +++ b/noname/gnc/is.js @@ -1,11 +1,11 @@ -import { GeneratorFunction, Uninstantable } from "../util/index.js"; +import { GeneratorFunction } from "../util/index.js"; -export class Is extends Uninstantable { +export class Is { /** * @param {*} item * @returns {boolean} */ - static coroutine(item) { + coroutine(item) { return typeof item == "function" && item.name == "genCoroutine"; } @@ -13,7 +13,7 @@ export class Is extends Uninstantable { * @param {*} item * @returns {boolean} */ - static generatorFunc(item) { + generatorFunc(item) { return item instanceof GeneratorFunction; } @@ -21,7 +21,7 @@ export class Is extends Uninstantable { * @param {*} item * @returns {boolean} */ - static generator(item) { + generator(item) { return (typeof item == "object") && ("constructor" in item) && item.constructor && ("constructor" in item.constructor) && item.constructor.constructor === GeneratorFunction; } }; diff --git a/noname/init/cordova.js b/noname/init/cordova.js index a1d00eb59..2253a6abd 100644 --- a/noname/init/cordova.js +++ b/noname/init/cordova.js @@ -1,9 +1,9 @@ // @ts-nocheck -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; import { nonameInitialized } from '../util/index.js'; export async function cordovaReady() { diff --git a/noname/init/import.js b/noname/init/import.js index 2b7f302b5..f7a1b1e97 100644 --- a/noname/init/import.js +++ b/noname/init/import.js @@ -1,4 +1,4 @@ -import { Game as game } from '../game/index.js'; +import { game } from '../game/index.js'; import { lib } from '../library/index.js'; /** diff --git a/noname/init/index.js b/noname/init/index.js index 5ea3777a0..baf9b23f5 100644 --- a/noname/init/index.js +++ b/noname/init/index.js @@ -1,16 +1,14 @@ -import { AI as ai } from '../ai/index.js'; -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; - +import { ai } from '../ai/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; +import { gnc } from '../gnc/index.js'; import { userAgent, nonameInitialized } from '../util/index.js'; import * as config from '../util/config.js'; import { promiseErrorHandlerMap } from '../util/browser.js'; -import { gnc } from '../gnc/index.js'; - import { importCardPack, importCharacterPack, importExtension, importMode } from './import.js'; import { onload } from './onload.js'; @@ -441,20 +439,18 @@ export async function boot() { //lib.init.onload=backup_onload; _status.evaluatingExtension = false; } - else if (config.get('mode') != 'connect' || (!localStorage.getItem(lib.configprefix + 'directstart') && show_splash)) { + else { extensionlist.push(config.get('extensions')[name]); } } } else { - if (config.get('mode') != 'connect' || (!localStorage.getItem(lib.configprefix + 'directstart') && show_splash)) { - for (var name = 0; name < config.get('extensions').length; name++) { - if (Reflect.get(window, 'bannedExtensions').includes(config.get('extensions')[name])) { - continue; - } - // @ts-ignore - game.import('extension', { name: config.get('extensions')[name] }); + for (var name = 0; name < config.get('extensions').length; name++) { + if (Reflect.get(window, 'bannedExtensions').includes(config.get('extensions')[name])) { + continue; } + // @ts-ignore + game.import('extension', { name: config.get('extensions')[name] }); } } @@ -576,7 +572,7 @@ export async function boot() { Reflect.get(ui, 'css')[stylesName[i]] = stylesLoaded[i]; } - if (extensionlist.length && (config.get('mode') != 'connect' || show_splash)) { + if (extensionlist.length) { _status.extensionLoading = []; _status.extensionLoaded = []; diff --git a/noname/init/node.js b/noname/init/node.js index f4be1c7d0..90d63c3ce 100644 --- a/noname/init/node.js +++ b/noname/init/node.js @@ -1,9 +1,9 @@ // @ts-nocheck -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; import { checkVersion } from '../library/update.js'; export function nodeReady() { diff --git a/noname/init/onload.js b/noname/init/onload.js index 51c615a03..fa674cc22 100644 --- a/noname/init/onload.js +++ b/noname/init/onload.js @@ -1,13 +1,10 @@ // @ts-nocheck -import { AI as ai } from '../ai/index.js'; -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; - -import { userAgent } from '../util/index.js'; -import * as config from '../util/config.js'; +import { ai } from '../ai/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; import { gnc } from '../gnc/index.js'; import { Mutex } from '../util/index.js'; @@ -675,33 +672,27 @@ export async function onload(resetGameTimeout) { clickedNode = true; lib.config.mode = this.link; game.saveConfig('mode', this.link); - if (this.link === 'connect') { - localStorage.setItem(lib.configprefix + 'directstart', true); - game.reload(); + if (game.layout != 'mobile' && lib.layoutfixed.indexOf(lib.config.mode) !== -1) { + game.layout = 'mobile'; + ui.css.layout.href = lib.assetURL + 'layout/' + game.layout + '/layout.css'; } - else { - if (game.layout != 'mobile' && lib.layoutfixed.indexOf(lib.config.mode) !== -1) { - game.layout = 'mobile'; + else if (game.layout == 'mobile' && lib.config.layout != 'mobile' && lib.layoutfixed.indexOf(lib.config.mode) === -1) { + game.layout = lib.config.layout; + if (game.layout == 'default') { + ui.css.layout.href = ''; + } + else { ui.css.layout.href = lib.assetURL + 'layout/' + game.layout + '/layout.css'; } - else if (game.layout == 'mobile' && lib.config.layout != 'mobile' && lib.layoutfixed.indexOf(lib.config.mode) === -1) { - game.layout = lib.config.layout; - if (game.layout == 'default') { - ui.css.layout.href = ''; - } - else { - ui.css.layout.href = lib.assetURL + 'layout/' + game.layout + '/layout.css'; - } - } - splash.delete(1000); - delete window.inSplash; - // 这不好删/m/,顺带lib.init.reset也不好删 - window.resetGameTimeout = setTimeout(lib.init.reset, 10000); - - this.listenTransition(function () { - lib.init.js(lib.assetURL + 'mode', lib.config.mode, proceed); - }, 500); } + splash.delete(1000); + delete window.inSplash; + // 这不好删/m/,顺带lib.init.reset也不好删 + window.resetGameTimeout = setTimeout(lib.init.reset, 10000); + + this.listenTransition(function () { + lib.init.js(lib.assetURL + 'mode', lib.config.mode, proceed); + }, 500); } var downNode = function () { this.classList.add('glow'); diff --git a/noname/init/polyfill.js b/noname/init/polyfill.js index e3547ebc1..c12b86986 100644 --- a/noname/init/polyfill.js +++ b/noname/init/polyfill.js @@ -1,8 +1,8 @@ -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; // 废弃覆盖原型的HTMLDivElement.prototype.animate // 改为HTMLDivElement.prototype.addTempClass @@ -196,11 +196,10 @@ Reflect.defineProperty(HTMLDivElement.prototype, 'setBackground', { this.style.backgroundSize = 'cover'; if (type === 'character') { const nameinfo = get.character(name); - const sex = nameinfo ? nameinfo[0] : 'male'; + const sex = nameinfo && ['male', 'female', 'double'].includes(nameinfo[0]) ? nameinfo[0] : 'male'; this.setBackgroundImage([ src, - `${lib.characterDefaultPicturePath}${sex}${ext}`, - `${lib.characterDefaultPicturePath}male${ext}` + `${lib.characterDefaultPicturePath}${sex}${ext}` ]); } else { this.setBackgroundImage(src); diff --git a/noname/library/cache/cacheContext.js b/noname/library/cache/cacheContext.js index 18d6b3e81..3c4b00b65 100644 --- a/noname/library/cache/cacheContext.js +++ b/noname/library/cache/cacheContext.js @@ -1,17 +1,17 @@ -import { Library } from "../index.js"; -import { Game } from "../../game/index.js"; -import { Get } from "../../get/index.js"; -import { status as _status } from "../../status/index.js"; +import { lib } from "../index.js"; +import { game } from "../../game/index.js"; +import { get } from "../../get/index.js"; +import { _status } from "../../status/index.js"; import { hex_md5 } from "../crypt/md5.js"; /** * 缓存上下文,用于在各种方法中暂时缓存值,以第一次获取的缓存值为准。 */ -export class CacheContext{ +export class CacheContext { constructor(){ - this.lib = this._createCacheProxy(Library); - this.game = this._createCacheProxy(Game); - this.get = this._createCacheProxy(Get); + this.lib = this._createCacheProxy(lib); + this.game = this._createCacheProxy(game); + this.get = this._createCacheProxy(get); this.sourceMap = new Map(); this.storageMap = new Map(); } diff --git a/noname/library/element/button.js b/noname/library/element/button.js index 4785b1648..0c1a428a1 100644 --- a/noname/library/element/button.js +++ b/noname/library/element/button.js @@ -1,11 +1,12 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; - +import { get } from '../../get/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; export class Button extends HTMLDivElement { + /** + * @type { string | undefined } + */ + buttonid; /** * @param {{}} item * @param {keyof typeof ui.create.buttonPresets | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button)} type @@ -37,7 +38,7 @@ export class Button extends HTMLDivElement { } else { console.error([item, type, position, noClick, button]); throw 'button不合法'; - } + }; } exclude() { if (_status.event.excludeButton == undefined) { diff --git a/noname/library/element/card.js b/noname/library/element/card.js index a53f089d1..e164efa8a 100644 --- a/noname/library/element/card.js +++ b/noname/library/element/card.js @@ -1,9 +1,8 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; export class Card extends HTMLDivElement { /** diff --git a/noname/library/element/client.js b/noname/library/element/client.js index fba45ff6c..607378b0d 100644 --- a/noname/library/element/client.js +++ b/noname/library/element/client.js @@ -1,10 +1,8 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; -import { GNC as gnc } from '../../gnc/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; export class Client { /** diff --git a/noname/library/element/content.js b/noname/library/element/content.js index 1e2297cb1..27e0387f6 100644 --- a/noname/library/element/content.js +++ b/noname/library/element/content.js @@ -1,10 +1,10 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; -import { GNC as gnc } from '../../gnc/index.js'; +import { ai } from '../../ai/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; +import { gnc } from '../../gnc/index.js'; // 未来再改 export const Content = { diff --git a/noname/library/element/contents.js b/noname/library/element/contents.js index 163a9869b..bb199ed10 100644 --- a/noname/library/element/contents.js +++ b/noname/library/element/contents.js @@ -1,10 +1,8 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; -import { GNC as gnc } from '../../gnc/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; /** * @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise)[]> } diff --git a/noname/library/element/control.js b/noname/library/element/control.js index 0b9545620..78d0d3522 100644 --- a/noname/library/element/control.js +++ b/noname/library/element/control.js @@ -1,10 +1,8 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; -import { GNC as gnc } from '../../gnc/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; export class Control extends HTMLDivElement { // @ts-ignore diff --git a/noname/library/element/dialog.js b/noname/library/element/dialog.js index 5d8bcc999..44c207638 100644 --- a/noname/library/element/dialog.js +++ b/noname/library/element/dialog.js @@ -1,9 +1,7 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; +import { get } from '../../get/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; export class Dialog extends HTMLDivElement { /** @type { HTMLDivElement } */ diff --git a/noname/library/element/gameEvent.js b/noname/library/element/gameEvent.js index 9fbd5bfa6..c0100ca19 100644 --- a/noname/library/element/gameEvent.js +++ b/noname/library/element/gameEvent.js @@ -1,9 +1,8 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; import { AsyncFunction } from '../../util/index.js'; export class GameEvent { diff --git a/noname/library/element/gameEventPromise.js b/noname/library/element/gameEventPromise.js index 7aeecc31d..4b9523fa8 100644 --- a/noname/library/element/gameEventPromise.js +++ b/noname/library/element/gameEventPromise.js @@ -1,7 +1,7 @@ -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; import { AsyncFunction } from '../../util/index.js'; /** diff --git a/noname/library/element/nodeWS.js b/noname/library/element/nodeWS.js index 91e9da267..acbf67d77 100644 --- a/noname/library/element/nodeWS.js +++ b/noname/library/element/nodeWS.js @@ -1,10 +1,5 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; -import { GNC as gnc } from '../../gnc/index.js'; +import { game } from '../../game/index.js'; +import { _status } from '../../status/index.js'; export class NodeWS { /** diff --git a/noname/library/element/player.js b/noname/library/element/player.js index c401366a6..4ec6f8526 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -1,9 +1,9 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; +import { ai } from '../../ai/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; import { CacheContext } from '../cache/cacheContext.js'; import { ChildNodesWatcher } from '../cache/childNodesWatcher.js'; @@ -1970,8 +1970,8 @@ export class Player extends HTMLDivElement { m += info.globalTo; n += info.globalTo; } - if (info.attaclTo) { - m += info.attaclTo; + if (info.attackTo) { + m += info.attackTo; } } return m <= range; @@ -5939,6 +5939,19 @@ export class Player extends HTMLDivElement { next.setContent('recover'); return next; } + recoverTo() { + const newArguments = []; + let num = 1; + for (let i = 0; i < arguments.length; i++) { + if (typeof arguments[i] === 'number') { + num = arguments[i] - this.getHp(true); + newArguments.push(num); + } else { + newArguments.push(arguments[i]); + } + } + return this.recover(...newArguments); + } doubleDraw() { var next = game.createEvent('doubleDraw'); if (get.is.changban()) { @@ -8116,6 +8129,44 @@ export class Player extends HTMLDivElement { } } } + /** + * 快速获取一名角色当前轮次/前X轮次的历史 + * + * 第一个参数填写获取的动作 + * + * 第二个参数填写获取历史的筛选条件 + * + * 第三个参数填写数字(不填默认为0),获取上X轮的历史(X为0则为本轮历史),第四个参数若为true,则获取从上X轮开始至现在 + * + * 第四个参数若为true,则获取从上X轮开始至现在所有符合条件的历史 + * + * 第五个参数填写event,获取此event之前所有符合条件的历史 + * + * @param { string | function | number | boolean | object } map + */ + getRoundHistory(key, filter, num, keep, last) { + if (!num) num = 0; + const player = this; + let evts = [], history = player.actionHistory; + for (let i = history.length - 1; i >= 0; i--) { + if (keep === true || num == 0) { + let currentHistory = history[i]; + if (key) currentHistory = currentHistory[key]; + if (filter) currentHistory = currentHistory.filter(filter); + evts.addArray(currentHistory.reverse()); + } + if (history[i].isRound) { + if (num > 0) num--; + else break; + } + } + evts.reverse(); + if (last && evts.includes(last)) { + const lastIndex = evts.indexOf(last); + return evts.filter(evt => evts.indexOf(evt) <= lastIndex); + } + return evts; + } getHistory(key, filter, last) { if (!key) return this.actionHistory[this.actionHistory.length - 1]; if (!filter) return this.actionHistory[this.actionHistory.length - 1][key]; @@ -10623,4 +10674,4 @@ export class Player extends HTMLDivElement { } CacheContext.inject(Player.prototype, - ['hasCard','hasValueTarget','getModableSkills','getCardIndex','countCards','getSkills','getUseValue','canUse']); \ No newline at end of file + ['hasCard','hasValueTarget','getModableSkills','getCardIndex','countCards','getSkills','getUseValue','canUse']); diff --git a/noname/library/element/vcard.js b/noname/library/element/vcard.js index 4cd565e83..af8651b9f 100644 --- a/noname/library/element/vcard.js +++ b/noname/library/element/vcard.js @@ -1,9 +1,6 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; +import { get } from '../../get/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; export class VCard { /** diff --git a/noname/library/index.js b/noname/library/index.js index f5aac07b3..7a69c7830 100644 --- a/noname/library/index.js +++ b/noname/library/index.js @@ -9,14 +9,13 @@ * @typedef { InstanceType } NodeWS * @typedef { InstanceType } Control */ -import { nonameInitialized, assetURL, userAgent, Uninstantable, GeneratorFunction, AsyncFunction, characterDefaultPicturePath } from "../util/index.js"; -import { AI as ai } from '../ai/index.js'; -import { Get as get } from '../get/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { GNC as gnc } from '../gnc/index.js'; - +import { nonameInitialized, assetURL, userAgent, GeneratorFunction, AsyncFunction, characterDefaultPicturePath } from "../util/index.js"; +import { ai } from '../ai/index.js'; +import { get } from '../get/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; +import { gnc } from '../gnc/index.js'; import { LibInit } from "./init/index.js"; import { Announce } from "./announce/index.js"; import { Channel } from "./channel/index.js"; @@ -27,29 +26,29 @@ import { defaultHooks } from "./hooks/index.js" import { freezeButExtensible } from "../util/index.js" -export class Library extends Uninstantable { - static configprefix = 'noname_0.9_'; - static versionOL = 27; - static updateURLS = updateURLs; - static updateURL = updateURLs.github; - static mirrorURL = updateURLs.coding; - static hallURL = '47.99.105.222'; - static assetURL = assetURL; - static userAgent = userAgent; - static characterDefaultPicturePath = characterDefaultPicturePath; - static compatibleEdition = Boolean(typeof nonameInitialized == 'string' && nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//)); - static changeLog = []; - static updates = []; - static canvasUpdates = []; +export class Library { + configprefix = 'noname_0.9_'; + versionOL = 27; + updateURLS = updateURLs; + updateURL = updateURLs.github; + mirrorURL = updateURLs.coding; + hallURL = '47.99.105.222'; + assetURL = assetURL; + userAgent = userAgent; + characterDefaultPicturePath = characterDefaultPicturePath; + compatibleEdition = Boolean(typeof nonameInitialized == 'string' && nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//)); + changeLog = []; + updates = []; + canvasUpdates = []; /** * @type { Video[] } */ - static video = []; - static skilllist = []; - static connectBanned = []; - static characterIntro = {}; - static characterTitle = {}; - static characterPack = new Proxy({}, { + video = []; + skilllist = []; + connectBanned = []; + characterIntro = {}; + characterTitle = {}; + characterPack = new Proxy({}, { set(target, prop, newValue) { if (typeof prop == 'string') { // 新增武将包,且不是“收藏”和“禁用” @@ -62,14 +61,14 @@ export class Library extends Uninstantable { return Reflect.set(target, prop, newValue); } }); - static characterFilter = {}; - static characterSort = {}; - static characterReplace = {}; - static characterSubstitute = {}; - static characterInitFilter = {}; - static characterGuozhanFilter = ["mode_guozhan"]; - static dynamicTranslate = {}; - static cardPack = new Proxy({}, { + characterFilter = {}; + characterSort = {}; + characterReplace = {}; + characterSubstitute = {}; + characterInitFilter = {}; + characterGuozhanFilter = ["mode_guozhan"]; + dynamicTranslate = {}; + cardPack = new Proxy({}, { set(target, prop, newValue) { if (typeof prop == 'string') { if (!Reflect.has(target, prop)) { @@ -81,19 +80,19 @@ export class Library extends Uninstantable { return Reflect.set(target, prop, newValue); } }); - static cardPackInfo = {}; + cardPackInfo = {}; /** * @type { SMap } */ - static skin = {}; - static onresize = []; - static onphase = []; - static onwash = []; - static onover = []; - static ondb = []; - static ondb2 = []; - static chatHistory = []; - static emotionList = { + skin = {}; + onresize = []; + onphase = []; + onwash = []; + onover = []; + ondb = []; + ondb2 = []; + chatHistory = []; + emotionList = { xiaowu_emotion: 14, xiaokuo_emotion: 8, shibing_emotion: 15, @@ -103,37 +102,37 @@ export class Library extends Uninstantable { xiaotao_emotion: 20, xiaojiu_emotion: 20, }; - static animate = { + animate = { skill: {}, card: {}, }; - static onload = []; - static onload2 = []; - static onprepare = []; - static arenaReady = []; - static onfree = []; - static inpile = []; - static inpile_nature = []; - static extensions = []; - static extensionPack = {}; - static cardType = {}; - static hook = { globalskill: {} }; + onload = []; + onload2 = []; + onprepare = []; + arenaReady = []; + onfree = []; + inpile = []; + inpile_nature = []; + extensions = []; + extensionPack = {}; + cardType = {}; + hook = { globalskill: {} }; /** * @type { Player | undefined } */ - static tempSortSeat; + tempSortSeat; /** * @type { 'android' | 'ios' | undefined } */ - static device; + device; /** * @type { string } */ - static version; + version; /** * @type { Videos[] } */ - static videos; + videos; /** * @type { { * fs: typeof import("fs"), @@ -146,22 +145,22 @@ export class Library extends Uninstantable { * torespondtimeout:{}, * } } */ - static node; + node; /** * @type { { [key: string]: string } } */ - static playerOL; + playerOL; /** * @type { IDBRequest } */ - static db; + db; //函数钩子 /** * 你可以往这里加入{钩子名:函数数组},并在数组里增加你的自定义函数 * 这样当某个地方调用game.callHook(钩子名,[...函数参数])时,就会按顺序将对应数组中的每个函数运行一遍(传参为callHook的第二个参数)。 * 你可以将hook机制类比为event.trigger(),但是这里只能放同步代码 */ - static hooks = freezeButExtensible({ ...defaultHooks }); + hooks = freezeButExtensible({ ...defaultHooks }); /** * **无名杀频道推送机制** @@ -184,7 +183,7 @@ export class Library extends Uninstantable { * // 从某个角落向channel发消息,若无消息接收则等待 * await channel.send(item); */ - static channel = Channel; + channel = Channel; /** * **无名杀消息推送库** @@ -211,13 +210,13 @@ export class Library extends Uninstantable { * // 若此时乙扩展不想继续订阅`skinChange`事件,可以通过`unsubscribe`解除订阅 * lib.announce.unsubscribe("skinChange", method); */ - static announce = new Announce(new EventTarget(), new WeakMap()); + announce = new Announce(new EventTarget(), new WeakMap()); - static objectURL = new Map(); - static hookmap = {}; - static imported = {}; - static layoutfixed = ['chess', 'tafang', 'stone']; - static pinyins = { + objectURL = new Map(); + hookmap = {}; + imported = {}; + layoutfixed = ['chess', 'tafang', 'stone']; + pinyins = { _metadata: { shengmu: ['zh', 'ch', 'sh', 'b', 'p', 'm', 'f', 'd', 't', 'l', 'n', 'g', 'k', 'h', 'j', 'q', 'x', 'r', 'z', 'c', 's', 'y', 'w'], special_shengmu: ['j', 'q', 'x', 'y'], @@ -250,7 +249,7 @@ export class Library extends Uninstantable { * * 应变 */ - static yingbian = { + yingbian = { condition: { color: new Map([ ['zhuzhan', 'wood'], @@ -426,7 +425,7 @@ export class Library extends Uninstantable { * * 谋攻强化 */ - static stratagemBuff = { + stratagemBuff = { cost: new Map([ ['sha', 1], ['shan', 1], @@ -516,11 +515,11 @@ export class Library extends Uninstantable { * * 实际的卡牌名称 */ - static actualCardName = new Map([ + actualCardName = new Map([ ['挟令', '挟天子以令诸侯'], ['霹雳投石车', '霹雳车'] ]); - static characterDialogGroup = { + characterDialogGroup = { '收藏': function (name, capt) { return lib.config.favouriteCharacter.includes(name) ? capt : null; }, @@ -529,7 +528,7 @@ export class Library extends Uninstantable { return list.includes(name) ? capt : null; } }; - static listenEnd(node) { + listenEnd(node) { if (!node._listeningEnd) { node._listeningEnd = true; node.listenTransition(function () { @@ -544,7 +543,7 @@ export class Library extends Uninstantable { }); } } - static configMenu = { + configMenu = { general: { name: '通用', config: { @@ -4480,7 +4479,7 @@ export class Library extends Uninstantable { } } }; - static extensionMenu = { + extensionMenu = { cardpile: { enable: { name: '开启', @@ -4794,7 +4793,7 @@ export class Library extends Uninstantable { }, }, }; - static mode = { + mode = { identity: { name: '身份', connect: { @@ -7482,7 +7481,7 @@ export class Library extends Uninstantable { } }, }; - static status = { + status = { running: false, canvas: false, time: 0, @@ -7492,7 +7491,7 @@ export class Library extends Uninstantable { videoId: 0, globalId: 0, }; - static help = { + help = { '关于游戏': '
        关于无名杀
        • 无名杀官方发布地址仅有GitHub仓库!
          点击前往Github仓库
        • 无名杀基于GPLv3开源协议。
          点击查看GPLv3协议
        • 其他所有的所谓“无名杀”社群(包括但不限于绝大多数“官方”QQ群、QQ频道等)均为玩家自发组织,与无名杀官方无关!', '游戏操作': '
          • 长按/鼠标悬停/右键单击显示信息。
          • 触屏模式中,双指点击切换暂停;下划显示菜单,上划切换托管。
          • 键盘快捷键
            ' + '
            A切换托管
            W切换不询问无懈
            空格暂停
          • 编辑牌堆
            在卡牌包中修改牌堆后,将自动创建一个临时牌堆,在所有模式中共用,当保存当前牌堆后,临时牌堆被清除。每个模式可设置不同的已保存牌堆,设置的牌堆优先级大于临时牌堆。
          ', @@ -7529,8 +7528,8 @@ export class Library extends Uninstantable { * @type {import('path')} */ // @ts-ignore - static path = {}; - static getErrorTip(msg) { + path = {}; + getErrorTip(msg) { if (typeof msg != 'string') { try { msg = msg.toString(); @@ -7672,7 +7671,7 @@ export class Library extends Uninstantable { return newMessage; } } - static codeMirrorReady(node, editor) { + codeMirrorReady(node, editor) { ui.window.appendChild(node); node.style.fontSize = 20 / game.documentZoom + 'px'; const mirror = window.CodeMirror(editor, { @@ -7893,7 +7892,7 @@ export class Library extends Uninstantable { return found.sort((a, b) => (a + '').localeCompare(b + '')); } } - static setIntro(node, func, left) { + setIntro(node, func, left) { if (lib.config.touchscreen) { if (left) { node.listen(ui.click.touchintro); @@ -7920,7 +7919,7 @@ export class Library extends Uninstantable { node._customintro = func; } } - static setPopped(node, func, width, height, forceclick, paused2) { + setPopped(node, func, width, height, forceclick, paused2) { node._poppedfunc = func; node._poppedwidth = width; node._poppedheight = height; @@ -7938,7 +7937,7 @@ export class Library extends Uninstantable { node._paused2 = true; } } - static placePoppedDialog(dialog, e) { + placePoppedDialog(dialog, e) { if (dialog._place_text) { if (dialog._place_text.firstChild.offsetWidth >= 190 || dialog._place_text.firstChild.offsetHeight >= 30) { dialog._place_text.style.marginLeft = '14px'; @@ -7970,7 +7969,7 @@ export class Library extends Uninstantable { } dialog.style.top = idealtop + 'px'; } - static setHover(node, func, hoveration, width) { + setHover(node, func, hoveration, width) { node._hoverfunc = func; if (typeof hoveration == 'number') { node._hoveration = hoveration; @@ -7984,22 +7983,22 @@ export class Library extends Uninstantable { node.addEventListener('mousemove', ui.click.mousemove); return node; } - static setScroll(node) { + setScroll(node) { node.ontouchstart = ui.click.touchStart; node.ontouchmove = ui.click.touchScroll; node.style.webkitOverflowScrolling = 'touch'; return node; } - static setMousewheel(node) { + setMousewheel(node) { if (lib.config.mousewheel) node.onmousewheel = ui.click.mousewheel; } - static setLongPress(node, func) { + setLongPress(node, func) { node.addEventListener('touchstart', ui.click.longpressdown); node.addEventListener('touchend', ui.click.longpresscancel); node._longpresscallback = func; return node; } - static updateCanvas(time) { + updateCanvas(time) { if (lib.canvasUpdates.length === 0) { lib.status.canvas = false; return false; @@ -8025,7 +8024,7 @@ export class Library extends Uninstantable { } } } - static run(time) { + run(time) { lib.status.time = time; for (var i = 0; i < lib.updates.length; i++) { if (!('_time' in lib.updates[i])) { @@ -8043,18 +8042,18 @@ export class Library extends Uninstantable { lib.status.delayed = 0; } } - static getUTC(date) { + getUTC(date) { return date.getTime(); } - static saveVideo() { + saveVideo() { if (_status.videoToSave) { game.export(lib.init.encode(JSON.stringify(_status.videoToSave)), '无名杀 - 录像 - ' + _status.videoToSave.name[0] + ' - ' + _status.videoToSave.name[1]); } } - static genAsync(fn) { return gnc.of(fn); } - static genAwait(item) { return gnc.is.generator(item) ? gnc.of(function* () { for (const content of item) { yield content; } })() : Promise.resolve(item); } - static gnc = { + genAsync(fn) { return gnc.of(fn); } + genAwait(item) { return gnc.is.generator(item) ? gnc.of(function* () { for (const content of item) { yield content; } })() : Promise.resolve(item); } + gnc = { of: fn => gnc.of(fn), is: { coroutine: item => gnc.is.coroutine(item), @@ -8062,7 +8061,7 @@ export class Library extends Uninstantable { generator: item => gnc.is.generator(item) } }; - static comparator = { + comparator = { equals: function () { if (arguments.length == 0) return false; if (arguments.length == 1) return true; @@ -8095,7 +8094,7 @@ export class Library extends Uninstantable { return true; } }; - static creation = { + creation = { get array() { return []; }, @@ -8109,7 +8108,7 @@ export class Library extends Uninstantable { return ""; } }; - static linq = { + linq = { cselector: { hasAttr: name => `[${name}]`, isAttr: (name, item) => `[${name}=${item}]`, @@ -8214,8 +8213,8 @@ export class Library extends Uninstantable { } } }; - static init = LibInit; - static cheat = { + init = new LibInit(); + cheat = { /** * 将游戏内部的对象暴露到全局中 * @@ -9096,7 +9095,7 @@ export class Library extends Uninstantable { game.zhu.update(); }, }; - static translate = { + translate = { flower: '鲜花', egg: '鸡蛋', wine: '酒杯', @@ -9322,9 +9321,9 @@ export class Library extends Uninstantable { phaseJieshu: '结束阶段', }; - static experimental = Experimental + experimental = Experimental - static element = { + element = { content: Element.Content, contents: Element.Contents, Player: Element.Player, @@ -9448,7 +9447,7 @@ export class Library extends Uninstantable { return this.NodeWS.prototype; } }; - static card = { + card = { list: [], cooperation_damage: { fullskin: true, @@ -9553,7 +9552,7 @@ export class Library extends Uninstantable { fullimage: true, }, }; - static filter = { + filter = { all: () => true, none: () => false, /** @@ -10100,7 +10099,7 @@ export class Library extends Uninstantable { } } }; - static sort = { + sort = { nature: function (a, b) { return (lib.nature.get(b) || 0) - (lib.nature.get(a) || 0); }, @@ -10276,7 +10275,7 @@ export class Library extends Uninstantable { * [key: string]: Skill; * }} */ - static skill = { + skill = { stratagem_fury: { marktext: '🔥', intro: { @@ -11678,10 +11677,10 @@ export class Library extends Uninstantable { } } }; - static character = {}; - static perfectPair = {}; - static cardPile = {}; - static message = { + character = {}; + perfectPair = {}; + cardPile = {}; + message = { server: { /** @this { any } */ init(version, config, banned_info) { @@ -12776,16 +12775,16 @@ export class Library extends Uninstantable { } } }; - static suit = ['club', 'spade', 'diamond', 'heart']; - static suits = ['club', 'spade', 'diamond', 'heart', 'none']; - static color = { + suit = ['club', 'spade', 'diamond', 'heart']; + suits = ['club', 'spade', 'diamond', 'heart', 'none']; + color = { black: ['club', 'spade'], red: ['diamond', 'heart'], none: ['none'], }; - static group = ['wei', 'shu', 'wu', 'qun', 'jin', 'shen']; + group = ['wei', 'shu', 'wu', 'qun', 'jin', 'shen']; //数值代表各元素在名称中排列的先后顺序 - static nature = new Map([ + nature = new Map([ ['fire', 20], ['thunder', 30], ['kami', 60], @@ -12793,7 +12792,7 @@ export class Library extends Uninstantable { ['stab', 10], ['poison', 50] ]); - static natureAudio = { + natureAudio = { damage: { 'fire': 'default',//默认,即语音放置在audio/effect下,以damage_fire.mp3 damage_fire2.mp3命名。 'thunder': 'default', @@ -12832,12 +12831,12 @@ export class Library extends Uninstantable { */ } }; - static linked = ['fire', 'thunder', 'kami', 'ice']; - static natureBg = new Map([ + linked = ['fire', 'thunder', 'kami', 'ice']; + natureBg = new Map([ ['stab', 'image/card/cisha.png'] ]); - static natureSeparator = '|'; - static namePrefix = new Map([ + natureSeparator = '|'; + namePrefix = new Map([ ['界', { color: '#fdd559', nature: 'soilmm', @@ -13120,9 +13119,15 @@ export class Library extends Uninstantable { * @returns {string} */ getSpan: () => `${get.prefixSpan('旧')}${get.prefixSpan('谋')}` + }], + ['手杀神', { + /** + * @returns {string} + */ + getSpan: () => `${get.prefixSpan('手杀')}${get.prefixSpan('神')}` }] ]); - static groupnature = { + groupnature = { shen: 'shen', wei: 'water', shu: 'soil', @@ -13133,7 +13138,7 @@ export class Library extends Uninstantable { jin: 'thunder', ye: 'thunder', }; - static lineColor = new Map([ + lineColor = new Map([ ['fire', [255, 146, 68]], ['yellow', [255, 255, 122]], ['blue', [150, 202, 255]], @@ -13146,8 +13151,8 @@ export class Library extends Uninstantable { ['brown', [195, 161, 223]], ['legend', [233, 131, 255]] ]); - static phaseName = ['phaseZhunbei', 'phaseJudge', 'phaseDraw', 'phaseUse', 'phaseDiscard', 'phaseJieshu']; - static quickVoice = [ + phaseName = ['phaseZhunbei', 'phaseJudge', 'phaseDraw', 'phaseUse', 'phaseDiscard', 'phaseJieshu']; + quickVoice = [ '我从未见过如此厚颜无耻之人!', '这波不亏', '请收下我的膝盖', @@ -13172,19 +13177,29 @@ export class Library extends Uninstantable { '哥哥,交个朋友吧', '妹子,交个朋友吧', ]; - static other = { + other = { ignore: () => void 0 }; - static InitFilter = { + InitFilter = { 'noZhuHp': '不享受主公的额外体力上限', 'noZhuSkill': '不享受地主的额外技能', }; } -Library.config = undefined; -Library.configOL = undefined; +Library.prototype.config = undefined; +Library.prototype.configOL = undefined; -export const lib = Library; +export let lib = new Library(); + +/** + * @param { InstanceType } [instance] + */ +export let setLibrary = (instance) => { + lib = instance || new Library(); + if (lib.config.dev) { + window.lib = lib; + } +}; /** * @template T diff --git a/noname/library/init/index.js b/noname/library/init/index.js index fc597e389..43aaf6c8e 100644 --- a/noname/library/init/index.js +++ b/noname/library/init/index.js @@ -1,27 +1,26 @@ -import { nonameInitialized, assetURL, userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../../util/index.js"; -import { AI as ai } from '../../ai/index.js' -import { Get as get } from '../../get/index.js' -import { Game, Game as game } from '../../game/index.js' -import { Library as lib } from "../index.js" -import { status as _status } from '../../status/index.js' -import { UI as ui } from '../../ui/index.js' -import { GNC as gnc } from '../../gnc/index.js' +import { GeneratorFunction } from "../../util/index.js"; +import { get } from '../../get/index.js' +import { game } from '../../game/index.js' +import { lib } from "../index.js" +import { _status } from '../../status/index.js' +import { ui } from '../../ui/index.js' +import { gnc } from '../../gnc/index.js' import { LibInitPromises } from "./promises.js" import { GameEvent } from "../element/gameEvent.js" import { GameEventPromise } from "../element/gameEventPromise.js" -export class LibInit extends Uninstantable { +export class LibInit { /** * 部分函数的Promise版本 */ - static promises = LibInitPromises + promises = new LibInitPromises() - static init() { + init() { throw new Error('lib.init.init is moved to noname/init') } - static reset() { + reset() { if (window.inSplash) return; if (window.resetExtension) { if (confirm('游戏似乎未正常载入,有可能因为部分扩展未正常载入,或者因为部分扩展未载入完毕。\n是否禁用扩展并重新打开?')) { @@ -83,11 +82,11 @@ export class LibInit extends Uninstantable { } // 现在改lib.init.onload的都给我无报错被创 - static async onload() { + async onload() { throw new Error('lib.init.onload is moved to noname/init/onload') } - static startOnline() { + startOnline() { 'step 0' event._resultid = null; event._result = null; @@ -102,7 +101,7 @@ export class LibInit extends Uninstantable { event.goto(0); } - static onfree() { + onfree() { if (lib.onfree) { clearTimeout(window.resetGameTimeout); delete window.resetGameTimeout; @@ -131,7 +130,7 @@ export class LibInit extends Uninstantable { } } - static connection(ws) { + connection(ws) { const client = new lib.element.Client(ws); lib.node.clients.push(client); if (window.isNonameServer) { @@ -162,7 +161,7 @@ export class LibInit extends Uninstantable { client.send('opened'); } - static sheet() { + sheet() { var style = document.createElement('style'); document.head.appendChild(style); for (var i = 0; i < arguments.length; i++) { @@ -173,7 +172,7 @@ export class LibInit extends Uninstantable { return style; } - static css(path, file, before) { + css(path, file, before) { const style = document.createElement("link"); style.rel = "stylesheet"; if (path) { @@ -195,7 +194,7 @@ export class LibInit extends Uninstantable { //在扩展的precontent中调用,用于加载扩展必需的JS文件。 //If any of the parameters is an Array, corresponding files will be loaded in order //如果任意参数为数组,则按顺序加载加载相应的文件 - static jsForExtension(path, file, onLoad, onError) { + jsForExtension(path, file, onLoad, onError) { if (!_status.javaScriptExtensions) _status.javaScriptExtensions = []; _status.javaScriptExtensions.push({ path: path, @@ -205,7 +204,7 @@ export class LibInit extends Uninstantable { }); } - static js(path, file, onLoad, onError) { + js(path, file, onLoad, onError) { if (path[path.length - 1] == '/') path = path.slice(0, path.length - 1); if (path == `${lib.assetURL}mode` && lib.config.all.stockmode.indexOf(file) == -1) { lib.genAwait(lib.init[`setMode_${file}`]()).then(onLoad); @@ -243,7 +242,7 @@ export class LibInit extends Uninstantable { * 同步lib.init.js * @returns { void } */ - static jsSync(path, file, onLoad, onError) { + jsSync(path, file, onLoad, onError) { if (lib.assetURL.length == 0 && location.origin == 'file://' && typeof game.readFile == 'undefined') { const e = new Error('浏览器file协议下无法使用此api,请在http/https协议下使用此api'); if (typeof onError == 'function') onError(e); @@ -292,7 +291,7 @@ export class LibInit extends Uninstantable { xmlHttpRequest.send(); } - static req(str, onload, onerror, master) { + req(str, onload, onerror, master) { let sScriptURL; if (str.startsWith('http')) sScriptURL = str; else if (str.startsWith('local:')) { @@ -326,7 +325,7 @@ export class LibInit extends Uninstantable { /** * 同步lib.init.req */ - static reqSync(str, onload, onerror, master) { + reqSync(str, onload, onerror, master) { let sScriptURL; if (str.startsWith('http')) sScriptURL = str; else if (str.startsWith('local:')) { @@ -358,7 +357,7 @@ export class LibInit extends Uninstantable { if (typeof onload !== 'function') return oReq.responseText; } - static json(url, onload, onerror) { + json(url, onload, onerror) { const oReq = new XMLHttpRequest(); if (typeof onload == 'function') oReq.addEventListener("load", () => { if (![0, 200].includes(oReq.status)) { @@ -385,7 +384,7 @@ export class LibInit extends Uninstantable { /** * 同步lib.init.json */ - static jsonSync(url, onload, onerror) { + jsonSync(url, onload, onerror) { if (lib.assetURL.length == 0 && location.origin == 'file://' && typeof game.readFile == 'undefined') { const e = new Error('浏览器file协议下无法使用此api,请在http/https协议下使用此api'); if (typeof onerror == 'function') onerror(e); @@ -415,7 +414,7 @@ export class LibInit extends Uninstantable { oReq.send(); } - static cssstyles() { + cssstyles() { if (ui.css.styles) { ui.css.styles.remove(); } @@ -438,7 +437,7 @@ export class LibInit extends Uninstantable { } } - static layout(layout, nosave) { + layout(layout, nosave) { const loadingScreen = ui.create.div('.loading-screen', document.body), loadingScreenStyle = loadingScreen.style; loadingScreenStyle.animationDuration = '1s'; loadingScreenStyle.animationFillMode = 'forwards'; @@ -558,7 +557,7 @@ export class LibInit extends Uninstantable { }); } - static background() { + background() { if (lib.config.image_background_random) { var list = []; for (var i in lib.configMenu.appearence.config.image_background.item) { @@ -585,7 +584,7 @@ export class LibInit extends Uninstantable { * @param {Function} [scope] 作用域 * @returns */ - static parsex(item, scope) { + parsex(item, scope) { //by 诗笺、Tipx-L /** * @param {Function} func @@ -748,7 +747,7 @@ export class LibInit extends Uninstantable { } } - static eval(func) { + eval(func) { if (typeof func == 'function') { return eval('(' + func.toString() + ')'); } @@ -768,7 +767,7 @@ export class LibInit extends Uninstantable { return func; } - static encode(strUni) { + encode(strUni) { var strUtf = strUni.replace( /[\u0080-\u07ff]/g, function (c) { var cc = c.charCodeAt(0); @@ -782,7 +781,7 @@ export class LibInit extends Uninstantable { return btoa(strUtf); } - static decode(str) { + decode(str) { var strUtf = atob(str); var strUni = strUtf.replace( /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, function (c) { @@ -797,7 +796,7 @@ export class LibInit extends Uninstantable { return strUni; } - static stringify(obj) { + stringify(obj) { var str = '{' for (var i in obj) { str += '"' + i + '":' @@ -816,7 +815,7 @@ export class LibInit extends Uninstantable { return str; } - static stringifySkill(obj) { + stringifySkill(obj) { var str = ''; for (var i in obj) { str += i + ':' @@ -838,7 +837,7 @@ export class LibInit extends Uninstantable { * 在返回当前加载的esm模块相对位置。 * @param {*} url 传入import.meta.url */ - static getCurrentFileLocation(url){ + getCurrentFileLocation(url){ let head = window.location.href.slice(0,window.location.href.lastIndexOf('/')+1); let ret = url.replace(head,''); return decodeURIComponent(ret); diff --git a/noname/library/init/promises.js b/noname/library/init/promises.js index 170248d1b..b4c54f158 100644 --- a/noname/library/init/promises.js +++ b/noname/library/init/promises.js @@ -1,7 +1,6 @@ -import { Uninstantable } from "../../util/index.js"; -import { Library as lib } from "../index.js"; +import { lib } from '../../../noname.js'; -export class LibInitPromises extends Uninstantable { +export class LibInitPromises { /** * Promise版的`lib.init.js` * @@ -9,7 +8,7 @@ export class LibInitPromises extends Uninstantable { * @param {string | string[]} [file] - 文件名或文件名组,忽略则直接读取`path`的内容 * @returns {Promise} */ - static js(path, file) { + js(path, file) { return new Promise((resolve, reject) => lib.init.js(path, file, resolve, reject)) } @@ -22,7 +21,7 @@ export class LibInitPromises extends Uninstantable { * @param {boolean} [noerror = false] - 是否忽略报错 * @returns {Promise} */ - static css(path, file, before, noerror = false) { + css(path, file, before, noerror = false) { return new Promise((resolve, reject) => { const style = lib.init.css(path, file, before); const success = () => resolve(style); @@ -38,7 +37,7 @@ export class LibInitPromises extends Uninstantable { * @param {string} [master] * @returns {Promise} */ - static req(str, master) { + req(str, master) { return new Promise((resolve, reject) => lib.init.req(str, resolve, reject, master)) } @@ -48,7 +47,7 @@ export class LibInitPromises extends Uninstantable { * @param {string} url - 要读取的地址 * @returns {Promise} */ - static json(url) { + json(url) { return new Promise((resolve, reject) => lib.init.json(url, resolve, reject)) } @@ -57,7 +56,7 @@ export class LibInitPromises extends Uninstantable { * * @returns {Promise} */ - static sheet() { + sheet() { return new Promise((resolve, reject) => { const style = lib.init.sheet.apply(lib.init, arguments); style.addEventListener("load", () => resolve(style)); diff --git a/noname/status/index.js b/noname/status/index.js index eba68cd36..e874627a7 100644 --- a/noname/status/index.js +++ b/noname/status/index.js @@ -1,58 +1,69 @@ -export const status = { - paused: false, - paused2: false, - paused3: false, - over: false, - clicked: false, - auto: false, +import { lib } from "../library/index.js" + +export class status { + paused = false + paused2 = false + paused3 = false + over = false + clicked = false + auto = false /** * @type { GameEventPromise } */ // @ts-ignore - event: null, - ai: {}, - lastdragchange: [], - skillaudio: [], - dieClose: [], - dragline: [], - dying: [], + event = null + ai = {} + lastdragchange = [] + skillaudio = [] + dieClose = [] + dragline = [] + dying = [] /** * @type { GameHistory[] } */ - globalHistory: [{ - // @ts-ignore + globalHistory = [{ cardMove: [], custom: [], useCard: [], changeHp: [], everything: [], - }], - cardtag: { + }] + cardtag = { yingbian_zhuzhan: [], yingbian_kongchao: [], yingbian_fujia: [], yingbian_canqu: [], yingbian_force: [] - }, - renku: [], - prehidden_skills: [], - postReconnect: {}, + } + renku = [] + prehidden_skills = [] + postReconnect = {} /** * @type { string | void } */ - extension: undefined, + extension = undefined /** * @type { boolean | void } */ - dragged: undefined, + dragged = undefined /** * @type { boolean | void } */ - touchconfirmed: undefined, + touchconfirmed = undefined /** * @type { boolean | void } */ - connectMode: undefined, + connectMode = undefined }; -export const _status = status; \ No newline at end of file +export let _status = new status(); + +/** + * @param { InstanceType } [instance] + */ +export let setStatus = (instance) => { + _status = instance || new status(); + if (lib.config.dev) { + window._status = _status; + } +}; \ No newline at end of file diff --git a/noname/ui/click/index.js b/noname/ui/click/index.js index 6f69b66f6..e47441dd6 100644 --- a/noname/ui/click/index.js +++ b/noname/ui/click/index.js @@ -1,16 +1,19 @@ -import { ui, game, get, lib, _status } from "../../../noname.js"; -import { Uninstantable } from "../../util/index.js"; +import { ui } from '../index.js'; +import { lib } from '../../library/index.js'; +import { game } from "../../game/index.js"; +import { get } from "../../get/index.js"; +import { _status } from "../../status/index.js"; -export class Click extends Uninstantable { +export class Click { /** * @type {() => void} */ - static consoleMenu; + consoleMenu; /** * @type {(arg0: string) => void} */ - static menuTab; - static identitycircle() { + menuTab; + identitycircle() { var list = []; this.classList.toggle('transparent'); for (var i = 0; i < this.parentNode.childNodes.length; i++) { @@ -35,7 +38,7 @@ export class Click extends Uninstantable { } this._source._guozhanguess = list; } - static connectEvents() { + connectEvents() { if (this.info) { var button = this; var layer = ui.create.div('.poplayer', ui.window); @@ -317,7 +320,7 @@ export class Click extends Uninstantable { }; } } - static connectClients() { + connectClients() { if (this.info) { var button = this; var layer = ui.create.div('.poplayer', ui.window); @@ -432,7 +435,7 @@ export class Click extends Uninstantable { }; } } - static autoskin() { + autoskin() { if (!lib.config.change_skin) return; var players = game.filterPlayer(); var change = function (player, num, callback) { @@ -485,7 +488,7 @@ export class Click extends Uninstantable { }; autoskin(); } - static skin(avatar, name, callback) { + skin(avatar, name, callback) { var num = 1; if (name.startsWith('gz_')) { name = name.slice(3); @@ -530,7 +533,7 @@ export class Click extends Uninstantable { }; img.src = lib.assetURL + 'image/skin/' + name + '/' + num + '.jpg'; } - static touchpop(forced) { + touchpop(forced) { if (lib.config.touchscreen || forced) { _status.touchpopping = true; clearTimeout(_status.touchpoppingtimeout); @@ -539,7 +542,7 @@ export class Click extends Uninstantable { }, 600); } } - static exit() { + exit() { if (game.servermode && lib.config.reconnect_info && _status.over) { if (!_status.roomtimeout) { lib.config.reconnect_info[2] = game.roomId; @@ -566,7 +569,7 @@ export class Click extends Uninstantable { game.reload(); } } - static shortcut(show) { + shortcut(show) { if (show === false) { ui.shortcut.classList.add('hidden'); } @@ -600,7 +603,7 @@ export class Click extends Uninstantable { ui.window.classList.add('shortcutpaused'); } } - static favouriteCharacter(e) { + favouriteCharacter(e) { if (typeof this.link == 'string') { if (this.innerHTML == '添加收藏') { this.innerHTML = '移除收藏'; @@ -653,7 +656,7 @@ export class Click extends Uninstantable { } e.stopPropagation(); } - static buttonnameenter() { + buttonnameenter() { if (this.buttonscrollinterval) { clearInterval(this.buttonscrollinterval); } @@ -677,7 +680,7 @@ export class Click extends Uninstantable { }, 16); } } - static buttonnameleave() { + buttonnameleave() { if (this.buttonscrollinterval) { clearInterval(this.buttonscrollinterval); } @@ -695,7 +698,7 @@ export class Click extends Uninstantable { }, 16); } } - static dragtouchdialog(e) { + dragtouchdialog(e) { if (e.touches.length > 1 && !this.classList.contains('popped') && !this.classList.contains('fixed')) { @@ -712,7 +715,7 @@ export class Click extends Uninstantable { e.stopPropagation(); } } - static identity(e) { + identity(e) { if (_status.dragged) return; _status.clicked = true; if (!game.getIdentityList) return; @@ -835,7 +838,7 @@ export class Click extends Uninstantable { // } } } - static identity2() { + identity2() { if (_status.clickingidentity) { _status.clicked = true; var player = _status.clickingidentity[0]; @@ -849,7 +852,7 @@ export class Click extends Uninstantable { delete _status.clickingidentity; } } - static roundmenu() { + roundmenu() { game.closeConnectMenu(); switch (lib.config.round_menu_func) { case 'system': @@ -877,7 +880,7 @@ export class Click extends Uninstantable { } _status.clicked = true; } - static pausehistory() { + pausehistory() { if (!lib.config.auto_popped_history) return; if (!ui.sidebar.childNodes.length) return; var uiintro = ui.create.dialog('hidden'); @@ -885,7 +888,7 @@ export class Click extends Uninstantable { uiintro.add(ui.sidebar); return uiintro; } - static pauseconfig() { + pauseconfig() { if (!lib.config.auto_popped_config) return; if (get.is.phoneLayout()) return; var uiintro = ui.create.dialog('hidden'); @@ -919,7 +922,7 @@ export class Click extends Uninstantable { return uiintro; } - static cardPileButton() { + cardPileButton() { var uiintro = ui.create.dialog('hidden'); uiintro.listen(function (e) { e.stopPropagation(); @@ -948,7 +951,7 @@ export class Click extends Uninstantable { } return uiintro; } - static chat() { + chat() { ui.system1.classList.add('shown'); ui.system2.classList.add('shown'); @@ -1170,7 +1173,7 @@ export class Click extends Uninstantable { list3.scrollTop = list1.scrollHeight; return uiintro; } - static volumn() { + volumn() { var uiintro = ui.create.dialog('hidden'); uiintro.listen(function (e) { e.stopPropagation(); @@ -1209,7 +1212,7 @@ export class Click extends Uninstantable { uiintro.add(ui.create.div('.placeholder')); return uiintro; } - static volumn_background(e) { + volumn_background(e) { if (_status.dragged) return; var volume = this.link; if (volume === 1 && lib.config.volumn_background === 1) { @@ -1227,7 +1230,7 @@ export class Click extends Uninstantable { } e.stopPropagation(); } - static volumn_audio(e) { + volumn_audio(e) { if (_status.dragged) return; var volume = this.link; if (volume === 1 && lib.config.volumn_audio === 1) { @@ -1244,7 +1247,7 @@ export class Click extends Uninstantable { } e.stopPropagation(); } - static hoverpopped() { + hoverpopped() { if (this._uiintro) { return; } @@ -1322,10 +1325,10 @@ export class Click extends Uninstantable { uiintro.addEventListener('click', clicklayer); } } - static hoverpopped_leave() { + hoverpopped_leave() { this._poppedalready = false; } - static leavehoverpopped() { + leavehoverpopped() { if (_status.dragged) return; if (this.classList.contains('noleave')) return; this.delete(); @@ -1339,7 +1342,7 @@ export class Click extends Uninstantable { }, 500); } - static dierevive() { + dierevive() { if (game.me.isDead()) { game.me.revive(Math.max(1, game.me.maxHp)); game.me.draw(2); @@ -1351,7 +1354,7 @@ export class Click extends Uninstantable { } } } - static dieswap() { + dieswap() { if (game.me.isDead()) { _status.clicked = true; var i, translation, intro, str; @@ -1388,15 +1391,15 @@ export class Click extends Uninstantable { } } } - static dieswap2() { + dieswap2() { if (_status.dragged) return; game.swapPlayer(this.link); } - static touchconfirm() { + touchconfirm() { _status.touchconfirmed = true; document.removeEventListener('touchstart', ui.click.touchconfirm); } - static windowtouchstart(e) { + windowtouchstart(e) { if (window.inSplash) return; if (e.touches[0] && lib.config.swipe && e.touches.length < 2) { _status._swipeorigin = { @@ -1409,7 +1412,7 @@ export class Click extends Uninstantable { // _status.forcetouchinterval=setInterval(ui.click.forcetouch,30); // } } - static windowtouchmove(e) { + windowtouchmove(e) { e.preventDefault(); if (window.inSplash) return; if (_status.draggingroundmenu) { @@ -1618,7 +1621,7 @@ export class Click extends Uninstantable { _status.dragstatuschanged = null; } } - static windowtouchend(e) { + windowtouchend(e) { delete _status.force; // if(_status.forcetouchinterval){ // clearInterval(_status.forcetouchinterval); @@ -1770,7 +1773,7 @@ export class Click extends Uninstantable { _status.dragged = false; _status.clicked = false; } - static checkroundtranslate(translate) { + checkroundtranslate(translate) { var translate = translate || ui.roundmenu._dragtransform; if (translate[1] + ui.roundmenu._position[1] + 50 + ui.arena.offsetTop > ui.window.offsetHeight) { translate[1] = ui.window.offsetHeight - (ui.roundmenu._position[1] + 50) - ui.arena.offsetTop; @@ -1786,7 +1789,7 @@ export class Click extends Uninstantable { } ui.roundmenu.style.transform = 'translate(' + translate[0] + 'px,' + translate[1] + 'px)'; } - static checkdialogtranslate(translate, dialog) { + checkdialogtranslate(translate, dialog) { var translate = translate || dialog._dragtransform; if (Math.sqrt(translate[0] * translate[0] + translate[1] * translate[1]) < 10) { translate[0] = 0; @@ -1794,10 +1797,10 @@ export class Click extends Uninstantable { } dialog.style.transform = 'translate(' + translate[0] + 'px,' + translate[1] + 'px)'; } - static windowmousewheel(e) { + windowmousewheel(e) { _status.tempunpopup = e; } - static windowmousemove(e) { + windowmousemove(e) { if (window.inSplash) return; if (_status.tempunpopup) { if (get.evtDistance(_status.tempunpopup, e) > 5) { @@ -2030,7 +2033,7 @@ export class Click extends Uninstantable { } } } - static windowmousedown(e) { + windowmousedown(e) { if (window.inSplash) return; if (!ui.window) return; if (e.button == 2) return; @@ -2095,7 +2098,7 @@ export class Click extends Uninstantable { item = item.parentNode; } } - static cardtouchstart(e) { + cardtouchstart(e) { if (e.touches.length != 1) return; if (!lib.config.enable_drag) return; if (!this.parentNode) return; @@ -2111,7 +2114,7 @@ export class Click extends Uninstantable { }; } } - static cardtouchmove(e) { + cardtouchmove(e) { ui.click.longpresscancel.call(this); if (this._waitingfordrag) { var drag = this._waitingfordrag; @@ -2129,7 +2132,7 @@ export class Click extends Uninstantable { delete this._waitingfordrag; } } - static windowmouseup(e) { + windowmouseup(e) { delete _status.force; // if(_status.forcetouchinterval){ // clearInterval(_status.forcetouchinterval); @@ -2218,7 +2221,7 @@ export class Click extends Uninstantable { ui.arena.classList.remove('dragging'); } } - static mousemove() { + mousemove() { if (!lib.config.hover_handcard && this.parentNode && this.parentNode.parentNode == ui.me) { return; } @@ -2226,38 +2229,38 @@ export class Click extends Uninstantable { _status.currentmouseenter = this; } } - static mouseenter() { + mouseenter() { if (!lib.config.hover_handcard && this.parentNode && this.parentNode.parentNode == ui.me) { return; } _status.currentmouseenter = this; } - static mouseleave() { + mouseleave() { ui.click.mouseentercancel(); if (_status.currentmouseenter == this) { _status.currentmouseenter = null; } this._mouseentercreated = false; } - static mousedown() { + mousedown() { ui.click.mouseentercancel(); if (_status.currentmouseenter == this) { _status.currentmouseenter = null; } this._mouseentercreated = true; } - static mouseentercancel() { + mouseentercancel() { if (_status._mouseentertimeout) { clearTimeout(_status._mouseentertimeout); delete _status._mouseentertimeout; } } - static hoverplayer(e) { + hoverplayer(e) { var node = get.nodeintro(this, true); if (node) node.style.zIndex = 21; return node; } - static longpressdown(e) { + longpressdown(e) { if (_status.longpressed) return; if (this._longpresstimeout) { clearTimeout(this._longpresstimeout); @@ -2274,7 +2277,7 @@ export class Click extends Uninstantable { // } _status.longpressing = this; } - static longpresscallback() { + longpresscallback() { if (!_status.longpressing) return; var node = _status.longpressing; var func = node._longpresscallback; @@ -2304,7 +2307,7 @@ export class Click extends Uninstantable { ui.click.touchpop(); } } - static longpresscancel() { + longpresscancel() { if (this._longpresstimeout) { clearTimeout(this._longpresstimeout); delete this._longpresstimeout; @@ -2314,7 +2317,7 @@ export class Click extends Uninstantable { delete _status.longpressing; } } - static window() { + window() { var clicked = _status.clicked; var dialogtouched = false; if (_status.dialogtouched) { @@ -2403,7 +2406,7 @@ export class Click extends Uninstantable { _status.event.custom.add.window(clicked); } } - static toggle() { + toggle() { if (_status.dragged) return; if (this.parentNode.classList.contains('disabled')) return; _status.tempunpop = true; @@ -2418,7 +2421,7 @@ export class Click extends Uninstantable { if (this.additionalCommand) this.additionalCommand(true, this.parentNode); } } - static editor() { + editor() { if (_status.dragged) return; if (_status.editing) return; _status.clicked = true; @@ -2426,7 +2429,7 @@ export class Click extends Uninstantable { _status.editing = this; if (this.additionalCommand) this.additionalCommand(this); } - static switcher() { + switcher() { if (_status.dragged) return; if (this.parentNode.classList.contains('disabled')) return; if (_status.choosing) return; @@ -2449,7 +2452,7 @@ export class Click extends Uninstantable { }, 500); } } - static choice() { + choice() { if (_status.dragged) return; if (!_status.choosing) return; _status.choosing.link = this.link; @@ -2462,7 +2465,7 @@ export class Click extends Uninstantable { this.parentNode.parentNode.querySelector('.toggle').additionalCommand(this.link, this.parentNode.parentNode); } } - static button() { + button() { if (_status.dragged) return; if (_status.clicked) return; if (_status.tempNoButton) return; @@ -2494,7 +2497,7 @@ export class Click extends Uninstantable { } game.check(); } - static touchintro() { + touchintro() { var rect = this.getBoundingClientRect(); ui.click.touchpop(); ui.click.intro.call(this, { @@ -2503,7 +2506,7 @@ export class Click extends Uninstantable { }); _status.clicked = false; } - static card() { + card() { delete this._waitingfordrag; if (_status.dragged) return; if (_status.clicked) return; @@ -2570,7 +2573,7 @@ export class Click extends Uninstantable { }); } } - static avatar() { + avatar() { if (!lib.config.doubleclick_intro) return; if (this.parentNode.isUnseen(0)) return; if (!lib.character[this.parentNode.name]) return; @@ -2589,7 +2592,7 @@ export class Click extends Uninstantable { game.pause2(); ui.click.charactercard(player.name1 || player.name, null, null, true, this); } - static avatar2() { + avatar2() { if (!lib.config.doubleclick_intro) return; if (this.parentNode.classList.contains('unseen2')) return; if (!lib.character[this.parentNode.name2]) return; @@ -2608,7 +2611,7 @@ export class Click extends Uninstantable { game.pause2(); ui.click.charactercard(player.name2, null, null, true, this); } - static connectroom(e) { + connectroom(e) { if (_status.dragged) return; if (_status.clicked) return; if (ui.intro) return; @@ -2639,10 +2642,10 @@ export class Click extends Uninstantable { } } } - static player() { + player() { return ui.click.target.apply(this, arguments); } - static target(e) { + target(e) { if (_status.dragged) return; if (_status.clicked) return; if (ui.intro) return; @@ -2750,12 +2753,12 @@ export class Click extends Uninstantable { } game.check(); } - static control2() { + control2() { if (this.childNodes.length == 1 && !this._doubleclick) { ui.click.control.call(this.firstChild); } } - static control() { + control() { if (_status.dragged) return; if (ui.control.classList.contains('hidden')) return; var node = this.parentNode; @@ -2803,7 +2806,7 @@ export class Click extends Uninstantable { game.resume(); } } - static dialogcontrol() { + dialogcontrol() { _status.event.result = { buttons: ui.selected.buttons.slice(0), cards: ui.selected.cards.slice(0), @@ -2813,7 +2816,7 @@ export class Click extends Uninstantable { }; game.resume(); } - static skill(skill) { + skill(skill) { var info = get.info(skill); var event = _status.event; event.backup(skill); @@ -2860,7 +2863,7 @@ export class Click extends Uninstantable { } } } - static ok(node) { + ok(node) { const gameEvent = get.event(), custom = gameEvent.custom, replaceConfirm = custom.replace.confirm; if (replaceConfirm) { replaceConfirm(true); @@ -2911,7 +2914,7 @@ export class Click extends Uninstantable { if (addConfirm) addConfirm(true); game.resume(); } - static cancel(node) { + cancel(node) { var event = _status.event; if (event.custom.replace.confirm) { event.custom.replace.confirm(false); return; @@ -2952,7 +2955,7 @@ export class Click extends Uninstantable { } game.resume(); } - static logv(e) { + logv(e) { if (_status.currentlogv) { if (_status.currentlogv == this) return; if (_status.logvtimeout) { @@ -2972,7 +2975,7 @@ export class Click extends Uninstantable { ui.click.intro.call(this, e); } } - static logvleave() { + logvleave() { if (_status.currentlogv == this) { setTimeout(function () { delete _status.currentlogv; @@ -2986,7 +2989,7 @@ export class Click extends Uninstantable { delete this.logvtimeout; } } - static charactercard(name, sourcenode, noedit, resume, avatar) { + charactercard(name, sourcenode, noedit, resume, avatar) { if (_status.dragged) return; if (lib.config.theme != 'simple') { ui.window.classList.add('shortcutpaused'); @@ -3518,7 +3521,7 @@ export class Click extends Uninstantable { layer.addEventListener(lib.config.touchscreen ? 'touchend' : 'click', clicklayer); ui.window.appendChild(layer); } - static intro(e) { + intro(e) { if (_status.dragged) return; _status.clicked = true; if (this.classList.contains('player') && !this.name) { @@ -3616,7 +3619,7 @@ export class Click extends Uninstantable { game.pause2(); return uiintro; } - static intro2() { + intro2() { if (ui.intro) { ui.intro.close(); if (ui.intro.source == this) { @@ -3627,7 +3630,7 @@ export class Click extends Uninstantable { } } } - static auto() { + auto() { if (!ui || !ui.auto || ui.auto.classList.contains('hidden') && arguments[0] !== 'forced') return; if (_status.paused2) return; ui.click.shortcut(false); @@ -3679,7 +3682,7 @@ export class Click extends Uninstantable { } } } - static wuxie() { + wuxie() { if (this.classList.contains('hidden')) return; this.classList.toggle('glow'); if (this.classList.contains('glow') && _status.event.type == 'wuxie' && @@ -3687,7 +3690,7 @@ export class Click extends Uninstantable { ui.click.cancel(ui.confirm.lastChild); } } - static tempnowuxie() { + tempnowuxie() { if (this.classList.contains('hidden')) return; this.classList.toggle('glow'); if (this.classList.contains('glow') && _status.event.type == 'wuxie' && @@ -3701,7 +3704,7 @@ export class Click extends Uninstantable { ui.click.cancel(ui.confirm.lastChild); } } - static pause() { + pause() { if (_status.paused2 || _status.pausing || _status.nopause || !ui.pause) return; if (!_status.video) { if (ui.pause.classList.contains('hidden')) return; @@ -3730,7 +3733,7 @@ export class Click extends Uninstantable { game.onpause(); } } - static resume(e) { + resume(e) { if (_status.pausing) return; if (_status.dragged) return; if (_status.clicked) return; @@ -3747,7 +3750,7 @@ export class Click extends Uninstantable { } return false; } - static config() { + config() { if (!ui.click.configMenu) return; if (_status.paused2) _status.config2 = false; else _status.config2 = true; @@ -3758,7 +3761,7 @@ export class Click extends Uninstantable { ui.system1.classList.remove('shown'); ui.system2.classList.remove('shown'); } - static swap() { + swap() { if (_status.dragged) return; if (this.classList.contains('dead')) return; if (_status.over) return; @@ -3766,7 +3769,7 @@ export class Click extends Uninstantable { if (ui.wuxie) ui.wuxie.show(); game.swapPlayer(this); } - static mousewheel(evt) { + mousewheel(evt) { if (this.firstChild && this.firstChild.classList.contains('handcards') && !this.classList.contains('scrollh')) return; var node = this; @@ -3794,16 +3797,16 @@ export class Click extends Uninstantable { }, 16); } } - static touchStart(e) { + touchStart(e) { this.startX = e.touches[0].clientX / game.documentZoom; this.startY = e.touches[0].clientY / game.documentZoom; _status.dragged = false; } - static dialogtouchStart(e) { + dialogtouchStart(e) { ui.click.touchStart.call(this, e); _status.dialogtouched = true; } - static touchScroll(e) { + touchScroll(e) { if (_status.mousedragging) return; if (_status.draggingtouchdialog) return; if (!_status.dragged) { @@ -3823,7 +3826,7 @@ export class Click extends Uninstantable { e.stopPropagation(); } } - static autoskill(bool, node) { + autoskill(bool, node) { var list = lib.config.autoskilllist; if (bool) { list.remove(node.link); @@ -3833,10 +3836,10 @@ export class Click extends Uninstantable { } game.saveConfig('autoskilllist', list); } - static skillbutton() { + skillbutton() { this.func(this.link); } - static autoskill2(e) { + autoskill2(e) { this.classList.toggle('on'); var list = []; if (lib.skill[this.link].frequent) { @@ -3859,7 +3862,7 @@ export class Click extends Uninstantable { ui.click.touchpop(); e.stopPropagation(); } - static hiddenskill(e) { + hiddenskill(e) { this.classList.toggle('on'); var hidden = lib.skill[this.link].preHidden; if (Array.isArray(hidden)) { @@ -3879,7 +3882,7 @@ export class Click extends Uninstantable { ui.click.touchpop(); e.stopPropagation(); } - static rightplayer(e) { + rightplayer(e) { if (this._nopup) return false; if (_status.clickedplayer) { return false; @@ -3896,7 +3899,7 @@ export class Click extends Uninstantable { ui.click.longpresscancel.call(this); return false; } - static right(e) { + right(e) { if (window.inSplash) return false; if (lib.config.touchscreen) return; if (_status.noright) { diff --git a/noname/ui/create/index.js b/noname/ui/create/index.js index 61d228821..e2e5249d7 100644 --- a/noname/ui/create/index.js +++ b/noname/ui/create/index.js @@ -1,5 +1,8 @@ -import { ui, game, get, lib, _status } from "../../../noname.js"; -import { Uninstantable } from "../../util/index.js"; +import { ui } from '../index.js'; +import { lib } from '../../library/index.js'; +import { game } from "../../game/index.js"; +import { get } from "../../get/index.js"; +import { _status } from "../../status/index.js"; import { menu } from "./menu/index.js"; import { cardPackMenu } from "./menu/pages/cardPackMenu.js"; import { characterPackMenu } from "./menu/pages/characterPackMenu.js"; @@ -8,15 +11,15 @@ import { optionsMenu } from "./menu/pages/optionsMenu.js"; import { otherMenu } from "./menu/pages/otherMenu.js"; import { startMenu } from "./menu/pages/startMenu.js"; -export class Create extends Uninstantable { +export class Create { /** * @type {(video: Videos, before: boolean) => void} */ - static videoNode; + videoNode; /** * 创建身份牌实例 */ - static identityCard(identity, position, noclick) { + identityCard(identity, position, noclick) { const card = ui.create.card(position, 'noclick', noclick); card.removeEventListener(lib.config.touchscreen ? 'touchend' : 'click', ui.click.card); card.classList.add('button'); @@ -36,7 +39,7 @@ export class Create extends Uninstantable { /** * 让卡牌旋转 */ - static cardSpinning(card) { + cardSpinning(card) { if (lib.config.cardback_style != 'default') { card.style.transitionProperty = 'none'; ui.refresh(card); @@ -71,7 +74,7 @@ export class Create extends Uninstantable { /** * 旋转的身份牌! */ - static spinningIdentityCard(identity, dialog) { + spinningIdentityCard(identity, dialog) { const card = ui.create.identityCard(identity); const buttons = ui.create.div('.buttons', dialog.content); setTimeout(() => { @@ -85,7 +88,7 @@ export class Create extends Uninstantable { * @param {HTMLDivElement} container * @param {Function} saveInput */ - static editor(container, saveInput) { + editor(container, saveInput) { const createList = []; const containerDelete = container.delete; const editorpage = ui.create.div(container); @@ -269,7 +272,7 @@ export class Create extends Uninstantable { const editor = ui.create.div(editorpage); return editor; } - static cardTempName(card, applyNode) { + cardTempName(card, applyNode) { let getApplyNode = applyNode || card; let cardName = get.name(card); let cardNature = get.nature(card); @@ -408,7 +411,7 @@ export class Create extends Uninstantable { node.tempname = tempname; return node; } - static connectRooms(list) { + connectRooms(list) { ui.rooms = []; ui.roombase = ui.create.dialog(); ui.roombase.classList.add('fullwidth'); @@ -426,7 +429,7 @@ export class Create extends Uninstantable { ui.rooms.push(player); } } - static rarity(button) { + rarity(button) { var rarity = game.getRarity(button.link); if (rarity != 'common' && lib.config.show_rarity) { var intro = button.node.intro; @@ -451,7 +454,7 @@ export class Create extends Uninstantable { else button.node.group.style.backgroundColor=get.translation('weiColor'); }*/ } - static div() { + div() { var str, innerHTML, position, position2, style, divposition, listen; for (var i = 0; i < arguments.length; i++) { if (typeof arguments[i] == 'string') { @@ -501,7 +504,7 @@ export class Create extends Uninstantable { if (listen) node.listen(listen); return node; } - static filediv() { + filediv() { var args = Array.from(arguments); var func = null; for (var i = 0; i < args.length; i++) { @@ -521,7 +524,7 @@ export class Create extends Uninstantable { div.inputNode = input; return div; } - static node() { + node() { var tagName, str, innerHTML, position, position2, style, divposition, listen; for (var i = 0; i < arguments.length; i++) { if (typeof arguments[i] == 'string') { @@ -586,7 +589,7 @@ export class Create extends Uninstantable { if (listen) node.onclick = listen; return node; } - static iframe(src) { + iframe(src) { var layer = document.createElement('div'); layer.classList.add('poplayer'); layer.style.zIndex = '100'; @@ -618,7 +621,7 @@ export class Create extends Uninstantable { ui.window.appendChild(layer); } - static identitycircle(list, target) { + identitycircle(list, target) { var container = ui.create.div('.identitycircle.menubg', target); var circle = ui.create.div(container); container.dataset.num = list.length; @@ -639,17 +642,17 @@ export class Create extends Uninstantable { sec2.style.transform = 'rotate(' + (deg1 + deg2) + 'deg)'; } } - static chat() { + chat() { var chat = ui.create.system('聊天', null, true); ui.chatButton = chat; lib.setPopped(chat, ui.click.chat, 220); } - static exit() { + exit() { if (!ui.exit) { ui.exit = ui.create.control('退出房间', ui.click.exit); } } - static connecting(bool) { + connecting(bool) { if (bool) { ui.window.classList.remove('connecting'); if (ui.connecting) { @@ -674,7 +677,7 @@ export class Create extends Uninstantable { // },1000); } } - static roomInfo() { + roomInfo() { var chat = ui.create.system(game.online ? '房间信息' : '房间设置', function () { if (!game.online || game.onlinezhu) { ui.click.connectMenu(); @@ -689,7 +692,7 @@ export class Create extends Uninstantable { } }, 180); } - static templayer(time) { + templayer(time) { if (typeof time != 'number' || isNaN(time) || time == Infinity) { time = 500; } @@ -698,7 +701,7 @@ export class Create extends Uninstantable { templayer.remove(); }, time); } - static selectlist(list, init, position, onchange) { + selectlist(list, init, position, onchange) { var select = document.createElement('select'); for (var i = 0; i < list.length; i++) { var option = document.createElement('option'); @@ -724,20 +727,20 @@ export class Create extends Uninstantable { return select; } /** 创建菜单 */ - static menu = menu; + menu = menu; /** 创建“开始”菜单 */ - static startMenu = startMenu; + startMenu = startMenu; /** 创建“选项”菜单 */ - static optionsMenu = optionsMenu; + optionsMenu = optionsMenu; /** 创建“武将”菜单 */ - static characterPackMenu = characterPackMenu; + characterPackMenu = characterPackMenu; /** 创建“卡牌”菜单 */ - static cardPackMenu = cardPackMenu; + cardPackMenu = cardPackMenu; /** 创建“扩展”菜单 */ - static extensionMenu = extensionMenu; + extensionMenu = extensionMenu; /** 创建“其他”菜单 */ - static otherMenu = otherMenu; - static statictable() { + otherMenu = otherMenu; + statictable() { var str, row, col, position, position2, fixed, style, divposition; for (var i = 0; i < arguments.length; i++) { if (typeof arguments[i] == 'string') str = arguments[i]; @@ -792,7 +795,7 @@ export class Create extends Uninstantable { } return node; } - static giveup() { + giveup() { if (ui.giveup) return; if (!lib.config.show_giveup) return; ui.giveup = ui.create.system('投降', function () { @@ -814,7 +817,7 @@ export class Create extends Uninstantable { } }, true, true); } - static groupControl(dialog) { + groupControl(dialog) { return ui.create.control('wei', 'shu', 'wu', 'qun', 'jin', 'western', 'key', function (link, node) { if (link == '全部') { dialog.currentcapt = ''; @@ -857,14 +860,14 @@ export class Create extends Uninstantable { } }); } - static cardDialog() { + cardDialog() { var args = ['thisiscard']; for (var i = 0; i < arguments.length; i++) { args.push(arguments[i]); } return ui.create.characterDialog.apply(this, args); } - static characterDialog2(filter) { + characterDialog2(filter) { var list = []; for (var i in lib.character) { if (lib.character[i][4].includes('minskin')) continue; @@ -953,7 +956,7 @@ export class Create extends Uninstantable { var node = ui.create.div('.dialogbutton.menubutton.large', '筛选', packnode); return dialog; } - static characterDialog() { + characterDialog() { // if(lib.config.character_dialog_style=='newstyle'){ // for(var i=0;i ui.arena.appendChild(player)); return players; } - static me(hasme) { + me(hasme) { ui.mebg = ui.create.div('#mebg', ui.arena); ui.me = ui.create.div('#me', ui.arena).addTempClass('start'); ui.handcards1Container = ui.create.div('#handcards1', ui.me); @@ -3034,8 +3037,8 @@ export class Create extends Uninstantable { // ui.updatehl(); } } - static card(position, info, noclick) { return new lib.element.Card(position).build(info, noclick); } - static cardsAsync() { + card(position, info, noclick) { return new lib.element.Card(position).build(info, noclick); } + cardsAsync() { if (lib.onfree) { _status.waitingForCards = Array.from(arguments); lib.onfree.push(function () { @@ -3049,7 +3052,7 @@ export class Create extends Uninstantable { ui.create.cards.apply(ui.create, arguments); } } - static cards(ordered) { + cards(ordered) { if (_status.brawl) { if (_status.brawl.cardPile) { lib.card.list = _status.brawl.cardPile(lib.card.list); diff --git a/noname/ui/index.js b/noname/ui/index.js index 345da2432..265185b9c 100644 --- a/noname/ui/index.js +++ b/noname/ui/index.js @@ -1,25 +1,22 @@ -import { Uninstantable, nonameInitialized } from "../util/index.js"; -import { Library as lib } from '../library/index.js'; -import { Game as game } from "../game/index.js"; -import { Get as get } from "../get/index.js"; +import { lib } from '../library/index.js'; +import { game } from "../game/index.js"; +import { get } from "../get/index.js"; import { _status } from "../status/index.js"; -import { GNC as gnc } from '../gnc/index.js'; -import { AI as ai } from "../ai/index.js"; import { Click } from "./click/index.js"; import { Create } from "./create/index.js"; -export class UI extends Uninstantable { - static updates = []; - static thrown = []; - static touchlines = []; - static todiscard = {}; +export class UI { + updates = []; + thrown = []; + touchlines = []; + todiscard = {}; /** * @type { HTMLStyleElement[] } */ - static playerPositions = []; - static create = Create; - static click = Click; - static selected = { + playerPositions = []; + create = new Create(); + click = new Click(); + selected = { /** * @type { Button[] } */ @@ -36,113 +33,113 @@ export class UI extends Uninstantable { /** * @type { Dialog[] } */ - static dialogs; + dialogs; /** * @type { Dialog } */ - static dialog; + dialog; /** * @type { HTMLDivElement } */ - static arena; + arena; /** * @type { Control[] } */ - static controls; + controls; /** * @type { Control } */ - static control; + control; /** * @type { Control | undefined } */ - static confirm; + confirm; /** * @type { Control | undefined } */ - static skills; + skills; /** * @type { Control | undefined } */ - static skills1; + skills1; /** * @type { Control | undefined } */ - static skills2; + skills2; /** * @type { Control | undefined } */ - static skills3; + skills3; /** * @type { HTMLDivElement } */ - static window; + window; /** * @type { HTMLDivElement } */ - static pause; + pause; /** * @type { HTMLAudioElement } */ - static backgroundMusic; + backgroundMusic; /** * @type { HTMLDivElement } */ - static special; + special; /** * @type { HTMLDivElement } */ - static fakeme; + fakeme; /** * @type { HTMLDivElement } */ - static chess; + chess; /** * 手动在菜单栏中添加一个武将包的ui * @type { ((packName: string) => void)[] } */ - static updateCharacterPackMenu = []; + updateCharacterPackMenu = []; /** * 手动在菜单栏中添加一个卡牌包的ui * @type { ((packName: string) => void)[] } */ - static updateCardPackMenu = []; + updateCardPackMenu = []; /** * @type { HTMLDivElement } 挑战模式下正在操作的角色 */ - static mebg; + mebg; /** * @type { Function | undefined } */ - static updateUpdate; + updateUpdate; /** * @type {HTMLDivElement} */ - static commandnode; + commandnode; /** * @type {() => void} */ - static updateVideoMenu; + updateVideoMenu; /** * @type {HTMLDivElement} */ - static menuContainer; + menuContainer; /** * @type {HTMLDivElement} */ - static auto; + auto; /** * @type {HTMLDivElement} */ - static wuxie; + wuxie; /** * @type {HTMLDivElement} */ - static tempnowuxie; - static refresh(node) { + tempnowuxie; + refresh(node) { void window.getComputedStyle(node, null).getPropertyValue("opacity"); } - static clear() { + clear() { game.addVideo('uiClear'); var thrown = document.getElementsByClassName('thrown'); var nodes = []; @@ -154,7 +151,7 @@ export class UI extends Uninstantable { if (!nodes[i].fixed) nodes[i].delete(); } } - static updatec() { + updatec() { if (_status.noupdatec) return; var length = 0, minoffset = -Infinity; var controls = []; @@ -281,7 +278,7 @@ export class UI extends Uninstantable { } } } - static updatex() { + updatex() { ui.update.apply(this, arguments); ui.updatehl(); for (var i = 0; i < lib.onresize.length; i++) { @@ -293,13 +290,13 @@ export class UI extends Uninstantable { ui.updatez(); delete ui._updatexr; } - static updatexr() { + updatexr() { if (ui._updatexr) { clearTimeout(ui._updatexr); } ui._updatexr = setTimeout(ui.updatex, 500); } - static updatejm(player, nodes, start, inv) { + updatejm(player, nodes, start, inv) { if (typeof start != 'number') { start = 0; } @@ -330,7 +327,7 @@ export class UI extends Uninstantable { } } } - static updatem(player) { + updatem(player) { if (player) { var start = 0; if (!player.classList.contains('linked2') || !ui.arena.classList.contains('nolink')) { @@ -344,7 +341,7 @@ export class UI extends Uninstantable { } } } - static updatej(player) { + updatej(player) { if (player) { ui.updatejm(player, player.node.judges); } @@ -354,7 +351,7 @@ export class UI extends Uninstantable { } } } - static updatehl() { + updatehl() { if (!game.me) return; if (!ui.handcards1Container || !ui.handcards2Container) return; if (!ui.handcards1Container.childNodes.length) return; @@ -457,7 +454,7 @@ export class UI extends Uninstantable { } ui.handcards2Container.firstChild.style.width = (offset2 * (hs2.length - 1) + 118) + 'px'; } - static updateh(compute) { + updateh(compute) { if (!game.me) return; if (!ui.handcards1Container) return; if (lib.config.low_performance) { @@ -474,7 +471,7 @@ export class UI extends Uninstantable { ui.updatehx(game.me.node.handcards1); ui.updatehx(game.me.node.handcards2); } - static updatehx(node) { + updatehx(node) { var width = node.parentNode._handcardsWidth; var num = node.childElementCount - node.getElementsByClassName('removing').length; node.classList.remove('fold0'); @@ -498,7 +495,7 @@ export class UI extends Uninstantable { node.classList.add('fold0'); } } - static updated() { + updated() { if (document.documentElement.offsetWidth < 900 || document.documentElement.offsetHeight < 500) { game.deviceZoom = Math.min( Math.round(document.documentElement.offsetWidth / 98) / 10, @@ -509,7 +506,7 @@ export class UI extends Uninstantable { game.deviceZoom = 1; } } - static updatez() { + updatez() { var width = document.documentElement.offsetWidth; var height = document.documentElement.offsetHeight; var zoom = game.documentZoom; @@ -524,7 +521,7 @@ export class UI extends Uninstantable { document.body.style.transform = ''; } } - static update() { + update() { for (var i = 0; i < ui.updates.length; i++) { ui.updates[i](); } @@ -605,7 +602,7 @@ export class UI extends Uninstantable { } } } - static recycle(node, key) { + recycle(node, key) { if (!ui._recycle) ui._recycle = {}; if (typeof node == 'string') { return ui._recycle[node]; @@ -617,7 +614,7 @@ export class UI extends Uninstantable { * @author Tipx-L * @param {number} [numberOfPlayers] */ - static updateConnectPlayerPositions(numberOfPlayers) { + updateConnectPlayerPositions(numberOfPlayers) { if (typeof numberOfPlayers != 'number') { const configOL = lib.configOL; numberOfPlayers = parseInt(configOL.player_number) || configOL.number; @@ -667,7 +664,7 @@ export class UI extends Uninstantable { * @author Tipx-L * @param {number} [numberOfPlayers] */ - static updatePlayerPositions(numberOfPlayers) { + updatePlayerPositions(numberOfPlayers) { if (typeof numberOfPlayers != 'number') numberOfPlayers = ui.arena.dataset.number; //当人数不超过8人时,还是用以前的布局 if (!numberOfPlayers || numberOfPlayers <= 8) return; @@ -701,9 +698,19 @@ export class UI extends Uninstantable { playerPositions.push(selector); } } - static updateRoundNumber(roundNumber, cardPileNumber) { + updateRoundNumber(roundNumber, cardPileNumber) { if (ui.cardPileNumber) ui.cardPileNumber.innerHTML = `${roundNumber}轮 剩余牌: ${cardPileNumber}`; } } -export const ui = UI; +export let ui = new UI(); + +/** + * @param { InstanceType } [instance] + */ +export let setUI = (instance) => { + ui = instance || new UI(); + if (lib.config.dev) { + window.ui = ui; + } +}; \ No newline at end of file diff --git a/noname/util/config.js b/noname/util/config.js index 84e2ba7c1..2274c212f 100644 --- a/noname/util/config.js +++ b/noname/util/config.js @@ -1,4 +1,4 @@ -import { Library as lib } from "../library/index.js"; +import { lib } from "../library/index.js"; /** * @param {string} name diff --git a/tsconfig.json b/tsconfig.json index 649199216..297fdb201 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -77,7 +77,7 @@ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ /* Type Checking */ "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ + "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */