diff --git a/character/rank.js b/character/rank.js index 2f3466f24..19a80e0d4 100644 --- a/character/rank.js +++ b/character/rank.js @@ -598,6 +598,7 @@ window.noname_character_rank={ 'jsrg_sunce', 're_caorui', 'ol_zhouqun', + 'caoxi', ], bp:[ 'chess_diaochan', diff --git a/character/sp.js b/character/sp.js index 995dbed4b..d9103a8c0 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","ganfuren","ol_bianfuren","qinghegongzhu","tengfanglan","ruiji",'caoxiancaohua'], - sp_sibi:["yangxiu","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'], + sp_sibi:["yangxiu","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'], sp_tianzhu:['niujin','hejin','hansui',"wutugu","yanbaihu","shamoke","panfeng","zhugedan",'huangzu','gaogan',"tadun","fanjiangzhangda","ahuinan","dongtuna",'ol_wenqin'], sp_nvshi:["lingju","guanyinping","zhangxingcai","mayunlu","dongbai","zhaoxiang",'ol_zhangchangpu','ol_xinxianying',"daxiaoqiao","jin_guohuai"], sp_shaowei:["simahui","zhangbao","zhanglu","zhugeguo","xujing","zhangling",'huangchengyan','zhangzhi','lushi'], @@ -28,6 +28,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, character:{ ol_luyusheng:['female','wu',3,['olcangxin','skill_luyusheng_B']], + caoxi:['male','wei',3,['olgangshu','oljianxuan']], + ol_pengyang:['male','shu',3,['olqifan','oltuishi','nzry_cunmu']], ol_qianzhao:['male','wei',4,['olweifu','olkuansai']], niujin:['male','wei',4,['olcuorui','liewei']], hejin:['male','qun',4,['olmouzhu','olyanhuo']], @@ -195,6 +197,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ //kaisa:["male","western",4,["zhengfu"]], }, characterIntro:{ + caoxi:'曹羲(?-249年),字昭叔。曹真之子,曹爽之弟。为人有学识,明律法。司马懿曾组织朝议改革九品中正制废除九品而留中正,曹羲认为此举并无区别,最终都是决定于人的人治。曹爽掌权后,受封中领军,掌握禁兵,封安乡侯。曹爽及诸兄弟轻视司马懿,恣意妄为,经常外出狩猎,曹羲屡次劝谏,不被采纳。249年,司马懿发动高平陵政变,被夷三族。', duanjiong:'段颎(?-179年),字纪明,武威姑臧(今甘肃省武威市)人。东汉名将,西域都护段会宗从曾孙,与皇甫规(字威明)、张奂(字然明)并称“凉州三明”。段颎少时学习骑射,有文武智略,最初被举为孝廉,为宪陵园丞、阳陵令,有治理之才。汉桓帝时入军旅,先破鲜卑,后讨平东郭窦、公孙举起事,以功封列侯。延熹二年(159年)起戍边征战十余年,百战羌人,至永康元年(167年)平定西羌,建宁二年(169年)平定东羌,前后斩东西羌六万余级。累功封新丰县侯。建宁三年(170年),段颎被征入朝,历任侍中、执金吾、河南尹、司隶校尉等职,他党附宦官、捕杀太学生,因而得保富贵,两度出任太尉。光和二年(179年),权宦王甫罪行被揭发,段颎受牵连下狱,其后在狱中饮鸩而死。', haopu:'郝普,字子太,义阳(治所在今湖北枣阳东南)人。刘备入川后,郝普为零陵太守。建安二十年(215年),吴将吕蒙进攻荆州三郡,唯有郝普坚守待援。但援兵久久不至,其挚友邓玄之又被吕蒙所骗,郝普也因此上当,投降吴国。湘水划界后,郝普回归刘备。建安二十四年(219年),吕蒙再次袭击荆州,击败关羽,郝普再次投降,最终归顺吴国并官至廷尉。郝普与隐蕃亲善,隐蕃蓄谋叛变事情败露,他受到牵连,因此自杀。在刘备集团的5个荆州郡守中,郝普是唯一一个抵抗过东吴的荆州郡守。', ol_zhanghe:'字儁乂,河间鄚人。三国时期魏国名将。官渡之战时,本为袁绍部将的张郃投降了曹操,并在曹操帐下多立功勋,于曹魏建立后加封为征西车骑将军。诸葛亮六出祁山之间,张郃多次抵御蜀军的进攻,于公元231年在木门道被诸葛亮设伏射死。后谥曰壮侯。为曹魏“五子良将”之一。', @@ -833,6 +836,338 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, }, + //曹羲 + olgangshu:{ + audio:2, + trigger:{ + player:'useCardAfter', + }, + filter:function(event,player){ + return get.type2(event.card,false)!='basic'; + }, + getInfo:(player)=>{ + if(!player.storage.olgangshu_buff) player.storage.olgangshu_buff=[0,0,0]; + return player.storage.olgangshu_buff; + }, + direct:true, + group:'olgangshu_reset', + content:function(){ + 'step 0' + var info=lib.skill.olgangshu.getInfo(player); + player.chooseControl('攻击范围('+info[0]+')','摸牌数('+info[1]+')','使用【杀】的上限('+info[2]+')','cancel2').set('prompt',get.prompt('olgangshu')).set('prompt2','
令以下一个数值+1(每项至多+5):
1.攻击范围;
2.下个摸牌阶段的摸牌数;
3.使用【杀】的次数上限。
').set('ai',()=>{ + return _status.event.choice; + }).set('choice',function(){ + var info=lib.skill.olgangshu.getInfo(player); + if(info[1]==0) return 1; + if(info[2]<5&&player.hasCard(card=>{ + return get.name(card)=='sha'&&player.hasValueTarget(card); + },'hs')&&!player.getCardUsable('sha')) return 2; + if(info[0]<5&&!game.hasPlayer(current=>{ + return player.inRange(current)&&get.effect(current,{name:'sha'},player,player)>0; + })) return 0; + var rand=Math.random(); + var list=[0,1,2].filter(i=>info[i]<5); + if(!list.length) return 'cancel2'; + if(rand<0.2&&list.includes(0)) return 0; + if(rand<0.7&&list.includes(1)) return 1; + if(rand<1.0&&list.includes(2)) return 2; + return list.randomGet(); + }()); + 'step 1' + if(result.control!='cancel2'){ + player.logSkill('olgangshu'); + player.addSkill('olgangshu_buff'); + var info=lib.skill.olgangshu.getInfo(player); + info[result.index]=Math.min(5,info[result.index]+1); + game.log(player,'的',result.control.slice(0,result.control.indexOf('(')),'#y+1'); + player.markSkill('olgangshu_buff'); + } + }, + ai:{ + threaten:3.1, + }, + subSkill:{ + buff:{ + trigger:{player:'phaseDrawBegin2'}, + charlotte:true, + onremove:true, + forced:true, + filter:function(event,player){ + var info=lib.skill.olgangshu.getInfo(player); + if(!info[1]) return false; + return !event.numFixed; + }, + content:function(){ + var info=lib.skill.olgangshu.getInfo(player); + trigger.num+=info[1]; + info[1]=0; + player.markSkill('olgangshu_buff'); + }, + mod:{ + attackRange:function(player,range){ + var info=lib.skill.olgangshu.getInfo(player); + if(info) return range+info[0]; + }, + cardUsable:function(card,player,num){ + if(card.name!='sha') return; + var info=lib.skill.olgangshu.getInfo(player); + if(info) return num+info[2]; + }, + }, + mark:true, + intro:{ + markcount:()=>0, + content:function(storage,player){ + var info=lib.skill.olgangshu.getInfo(player); + var str=''; + if(info[0]>0) str+='
  • 攻击范围+'+info[0]; + if(info[1]>0) str+='
  • 下个摸牌阶段摸牌数+'+info[1]; + if(info[2]>0) str+='
  • 使用【杀】的次数上限+'+info[2]; + return str; + }, + }, + }, + reset:{ + audio:'olgangshu', + trigger:{ + global:['shaMiss','eventNeutralized'], + }, + filter:function(event,player){ + if(event.type!='card') return false; + var responder; + if(event.name=='sha'){ + responder=event.target; + } + else{ + responder=event._neutralize_event.player; + } + return player==responder; + player.removeSkill('olgangshu_buff'); + game.log(player,'重置了','#g【刚述】','的数值'); + } + } + } + }, + //OL彭羕 + olqifan:{ + audio:2, + enable:'chooseToUse', + hiddenCard:function(player,name){ + if(name!='wuxie'&&lib.inpile.contains(name)) return true; + }, + filter:function(event,player){ + if(event.responded||event.type=='wuxie'||event.olqifan) return false; + for(var i of lib.inpile){ + if(i!='wuxie'&&get.type(i)=='basic'&&event.filterCard({name:i},player,event)) return true; + } + return false; + }, + delay:false, + content:function(){ + 'step 0' + var evt=event.getParent(2); + evt.set('olqifan',true); + var cards=get.bottomCards(1+player.getStorage('olqifan').length,true); + var aozhan=player.hasSkill('aozhan'); + player.chooseButton(['器翻:选择要使用的牌',cards]).set('filterButton',function(button){ + return _status.event.cards.contains(button.link); + }).set('cards',cards.filter(function(card){ + if(aozhan&&card.name=='tao'){ + return evt.filterCard({ + name:'sha',isCard:true,cards:[card], + },evt.player,evt)||evt.filterCard({ + name:'shan',isCard:true,cards:[card], + },evt.player,evt); + } + return evt.filterCard(card,evt.player,evt); + })).set('ai',function(button){ + var evt=_status.event.getParent(3); + if(evt&&evt.ai){ + var tmp=_status.event; + _status.event=evt; + var result=(evt.ai||event.ai1)(button.link,_status.event.player,evt); + _status.event=tmp; + return result; + } + return 1; + }); + 'step 1' + var evt=event.getParent(2); + if(result.bool&&result.links&&result.links.length){ + var name=result.links[0].name,aozhan=(player.hasSkill('aozhan')&&name=='tao'); + if(aozhan){ + name=evt.filterCard({ + name:'sha',isCard:true,cards:[card], + },evt.player,evt)?'sha':'shan'; + } + game.broadcastAll(function(result,name){ + lib.skill.olqifan_backup.viewAs={name:name,cards:[result],isCard:true}; + lib.skill.olqifan_backup.prompt=('请选择'+get.translation(result)+'的目标'); + },result.links[0],name); + evt.set('_backupevent','olqifan_backup'); + evt.backup('olqifan_backup'); + } + evt.goto(0); + }, + ai:{ + effect:{ + target:function(card,player,target,effect){ + if(get.tag(card,'respondShan')) return 0.7; + if(get.tag(card,'respondSha')) return 0.7; + } + }, + order:11, + respondShan:true, + respondSha:true, + result:{ + player:function(player){ + if(_status.event.dying) return get.attitude(player,_status.event.dying); + return 1; + } + } + }, + onremove:true, + intro:{ + content:'已使用过$牌', + }, + subSkill:{ + discard:{ + trigger:{player:'chooseToUseAfter'}, + forced:true, + charlotte:true, + filter:function(event,player){ + if(!event.olqifan_discard) return false; + var num=player.getStorage('olqifan').length,pos=('jeh').slice(0,num); + return num>0&&player.countCards(pos)>0; + }, + content:function(){ + 'step 0' + event.num=Math.min(3,player.getStorage('olqifan').length); + 'step 1' + event.num--; + var pos=('jeh')[event.num],hs=player.countCards('h'); + if(hs>0) player.chooseToDiscard(hs,pos,true); + if(event.num>0) event.redo(); + }, + }, + }, + }, + oljianxuan:{ + audio:2, + trigger:{ + player:'damageEnd', + }, + direct:true, + content:function(){ + 'step 0' + var info=lib.skill.olgangshu.getInfo(player); + var list=[]; + list.add(player.getAttackRange()); + list.add(2+info[1]); + list.add(player.getCardUsable('sha',true)); + list.sort(); + var str=list.join('、').replace(/(.*)、/, '$1或'); + event.list=list; + player.chooseTarget(get.prompt('oljianxuan'),'令一名角色摸一张牌,然后若其手牌数为'+str+',其可以重复此流程。').set('ai',target=>{ + var list=_status.event.list; + var player=_status.event.player; + var att=get.attitude(player,target); + if(att<=0) return 0; + var num=target.countCards('h')+1; + var value=1; + while(true){ + if(list.includes(num)){ + value++; + num++; + } + else break; + } + return value+att/10; + }).set('list',list); + 'step 1' + if(result.bool){ + var target=result.targets[0]; + event.target=target; + player.logSkill('oljianxuan',target); + if(player!=target) player.addExpose(0.15); + } + else event.finish(); + 'step 2' + target.draw(); + 'step 3' + if(event.list.includes(target.countCards('h'))){ + target.chooseBool('谏旋:是否摸一张牌?').set('ai',()=>true); + } + else event.finish(); + 'step 4' + if(result.bool) event.goto(2); + }, + ai:{ + combo:'olguangshu', + maixie:true, + }, + }, + olqifan_backup:{ + sourceSkill:'olqifan', + precontent:function(){ + delete event.result.skill; + var name=event.result.card.name; + event.result.cards=event.result.card.cards.slice(0); + event.result.card=get.autoViewAs({name:name},event.result.cards); + player.markAuto('olqifan',[get.type2(event.result.card,false)]); + event.getParent().set('olqifan_discard',true); + player.addTempSkill('olqifan_discard'); + }, + filterCard:function(){return false}, + selectCard:-1, + }, + oltuishi:{ + audio:2, + mod:{ + wuxieJudgeEnabled:()=>false, + wuxieEnabled:()=>false, + cardEnabled:(card)=>{ + if(card.name=='wuxie') return false; + }, + targetInRange:(card)=>{ + if(card.storage&&card.storage.oltuishi) return true; + } + }, + trigger:{player:'useCardAfter'}, + forced:true, + filter:function(event){ + const num=get.number(event.card); + return [1,11,12,13].includes(num); + }, + content:function(){ + player.draw(2); + player.addSkill('oltuishi_unlimit'); + }, + subSkill:{ + unlimit:{ + charlotte:true, + mod:{ + cardUsable:()=>Infinity, + targetInRange:()=>true, + }, + trigger:{player:'useCard1'}, + forced:true, + popup:false, + silent:true, + firstDo:true, + content:function(){ + player.removeSkill('oltuishi_unlimit') + var card=trigger.card; + if(!card.storage) card.storage={}; + card.storage.oltuishi=true; + if(trigger.addCount!==false){ + trigger.addCount=false; + player.getStat('card')[card.name]--; + } + }, + }, + }, + }, //OL牵招 olweifu:{ audio:2, @@ -23617,6 +23952,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ wenqin:['wenqin','pe_wenqin'], zhouqun:['ol_zhouqun','zhouqun'], qianzhao:['ol_qianzhao','qianzhao'], + ol_pengyang:['ol_pengyang','sp_pengyang'], }, translate:{ "xinfu_lingren":"凌人", @@ -24744,6 +25080,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ olcangxin_info:'①当你受到伤害时,你可以观看牌堆底的三张牌并弃置其中任意张牌,若你以此法弃置了红桃牌,则防止此伤害。②摸牌阶段,你多摸X张牌(X为牌堆底前三张牌中红桃牌的数量)。', skill_luyusheng_B:'技能', skill_luyusheng_B_info:'其他角色的弃牌阶段开始时,若其已受伤且其手牌数不等于其体力上限,则你可以选择一项:①令其弃置一张牌,其本回合手牌上限+1;②令其摸一张牌,其本回合手牌上限-1。', + caoxi:'曹羲', + olgangshu:'刚述', + olgangshu_info:'①当你使用非基本牌结算结束后,你可以令以下一项数值+1(每项至多以此法+5):1.攻击范围;2.受〖刚述〗影响的下个摸牌阶段摸牌数;3.使用【杀】的次数上限。②当有牌被你抵消后,重置你〖刚述①〗增加的所有数值。', + oljianxuan:'谏旋', + oljianxuan_info:'当你受到伤害后,你可以令一名角色摸一张牌,然后若其手牌数等于你〖刚述①〗中的任意一项对应的数值,其可以重复此流程。', + ol_pengyang:'OL彭羕', + olqifan:'器翻', + olqifan_info:'当你需要使用不为【无懈可击】的牌时,你可以观看牌堆底的X+1张牌并使用其中的一张。此牌结算结束时,你依次弃置以下前X个区域中的所有牌:⒈判定区、⒉装备区、⒊手牌区(X为你因此技能使用过的牌中包含的类型数)。', + oltuishi:'侻失', + oltuishi_info:'锁定技。①你不能使用【无懈可击】。②当你使用点数为字母的牌后,你摸两张牌,且你使用的下一张牌无距离和次数限制。', sp_tianji:'天极·皇室宗亲', sp_sibi:'四弼·辅国文曲', diff --git a/character/sp2.js b/character/sp2.js index b8826db7e..623dd000a 100644 --- a/character/sp2.js +++ b/character/sp2.js @@ -2028,11 +2028,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ subSkill:{ random:{ audio:'dunxi', - trigger:{global:'useCardToPlayer'}, + trigger:{global:'useCard'}, forced:true, locked:false, filter:function(event,player){ - if(!event.player.hasMark('dunxi')||event.targets.length!=1||event.getParent()._dunxi) return false; + if(!event.player.hasMark('dunxi')||event.targets.length!=1||event._dunxi||_status.dying.length) return false; var type=get.type2(event.card,false); return (type=='basic'||type=='trick'); }, @@ -2040,12 +2040,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ line:'fire', content:function(){ 'step 0' - trigger.getParent()._dunxi=true; + trigger._dunxi=true; trigger.player.removeMark('dunxi',1); var target=trigger.target; event.target=target; trigger.targets.remove(target); - trigger.getParent().triggeredTargets1.remove(target); + trigger.triggeredTargets1.remove(target); trigger.untrigger(); game.delayx(); 'step 1' @@ -10431,7 +10431,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ dcbihuo_info:'①当你受到其他角色造成的伤害后,你可令一名角色下回合摸牌阶段的额定摸牌数+1。②当你对其他角色造成伤害后,你可令一名角色下回合摸牌阶段的额定摸牌数-1。', bianxi:'卞喜', dunxi:'钝袭', - dunxi_info:'①当你使用具有伤害标签的牌结算结束后,你可以令一名不为你的目标角色获得一枚“钝”。②有“钝”的角色使用基本牌或锦囊牌指定唯一目标时,你令其移去一枚“钝”。系统随机选择一名角色,并将此牌的目标改为该角色。若该角色和原目标相同,则其失去1点体力。若其正处于出牌阶段内,则结束此阶段。', + dunxi_info:'①当你使用具有伤害标签的牌结算结束后,你可以令一名不为你的目标角色获得一枚“钝”。②有“钝”的角色使用基本牌或锦囊牌时,若此牌目标数为1且此时没有角色处于濒死状态,你令其移去一枚“钝”。系统随机选择一名角色,并将此牌的目标改为该角色。若该角色和原目标相同,则其失去1点体力。若其正处于出牌阶段内,则结束此阶段。', niufu:'牛辅', dcxiaoxi:'宵袭', dcxiaoxi_info:'锁定技。出牌阶段开始时,你声明X并减X点体力上限(X∈[1,2])。然后你选择一名攻击范围内的其他角色并选择一项:⒈获得该角色的X张牌。⒉视为对其使用X张【杀】。', diff --git a/game/asset.js b/game/asset.js index 04f3309fb..d2b909d64 100644 --- a/game/asset.js +++ b/game/asset.js @@ -8359,6 +8359,14 @@ window.noname_asset_list=[ 'image/emotion/xiaojiu_emotion/18.gif', 'image/emotion/xiaojiu_emotion/19.gif', 'image/emotion/xiaojiu_emotion/20.gif', + 'image/emotion/xiaokuo_emotion/1.gif', + 'image/emotion/xiaokuo_emotion/2.gif', + 'image/emotion/xiaokuo_emotion/3.gif', + 'image/emotion/xiaokuo_emotion/4.gif', + 'image/emotion/xiaokuo_emotion/5.gif', + 'image/emotion/xiaokuo_emotion/6.gif', + 'image/emotion/xiaokuo_emotion/7.gif', + 'image/emotion/xiaokuo_emotion/8.gif', 'image/emotion/xiaosha_emotion/1.gif', 'image/emotion/xiaosha_emotion/2.gif', 'image/emotion/xiaosha_emotion/3.gif', diff --git a/game/game.js b/game/game.js index 1a068d507..ca0b6e5ae 100644 --- a/game/game.js +++ b/game/game.js @@ -32,22 +32,16 @@ const GeneratorFunction=(function*(){}).constructor; // gnc: GeNCoroutine const gnc={ - async:fn=>function genCoroutine(){ - let result=fn.apply(this,arguments); - result.name="genCoroutine"; - result.status="next"; - result.state=undefined; - return gnc.await(result); - }, - await:gen=>new Promise((resolve,reject)=>{ - let result=gen; - let nexts=resolve; - let throws=reject; - if(gnc.is.coroutine(gen)||(gnc.is.generator(gen)&&!gen.nocoroutine)) { - if(!gen.status)gen.status="next"; - if(!gen.state)gen.state=undefined; + of:fn=>gnc.is.generatorFunc(fn)?function genCoroutine(){ + let gen=fn.apply(this,arguments); + gen.status="next"; + gen.state=undefined; + const callback=(resolve,reject)=>{ + let result, + nexts=resolve, + throws=reject; try{ - result=gen[result.status](result.state); + result=gen[gen.status](gen.state); }catch(error){ reject(error); return; @@ -56,24 +50,21 @@ nexts=(item)=>{ gen.state=item; gen.status="next"; - gnc.await(gen).then(resolve,reject); + callback(resolve,reject); } throws=(err)=>{ gen.state=err; gen.status="throw"; - gnc.await(gen).then(resolve,reject); + callback(resolve,reject); } } result=result.value; + Promise.resolve(result).then(nexts,throws); } - Promise.resolve(result).then(nexts,throws); - }), - escape:gen=>{ - gen.nocoroutine=true; - return gen; - }, + return new Promise(callback); + }:(()=>{throw new TypeError("gnc.of needs a GeneratorFunction.")})(), is:{ - coroutine:item=>(typeof item=="function"||gnc.is.generator(item))&&item.name=="genCoroutine", + coroutine:item=>typeof item=="function"&&item.name=="genCoroutine", generatorFunc:item=>item instanceof GeneratorFunction, generator:item=>(typeof item=="object")&&("constructor" in item)&&item.constructor&&("constructor" in item.constructor)&&item.constructor.constructor===GeneratorFunction } @@ -150,6 +141,7 @@ chatHistory:[], emotionList:{ xiaowu_emotion:14, + xiaokuo_emotion:8, shibing_emotion:15, guojia_emotion:20, zhenji_emotion:20, @@ -3946,12 +3938,6 @@ init:true, unfrequent:true, }, - show_extensionimage:{ - name:'显示扩展武将图片', - intro:'关闭扩展武将包仍加载扩展武将图片', - init:true, - unfrequent:true, - }, show_skillnamepinyin:{ name:'显示技能名拼音', intro:'在武将资料卡显示技能名拼音', @@ -7278,12 +7264,10 @@ '无名杀 - 录像 - '+_status.videoToSave.name[0]+' - '+_status.videoToSave.name[1]); } }, - genAsync:fn=>gnc.async(fn), - genAwait:gen=>gnc.await(gen), + genAsync:fn=>gnc.of(fn), + genAwait:item=>gnc.is.generator(item)?gnc.of(function*(){for(const content of item){yield content;}})():Promise.resolve(item), gnc:{ - async:fn=>gnc.async(fn), - await:gen=>gnc.await(gen), - escape:gen=>gnc.escape(gen), + of:fn=>gnc.of(fn), is:{ coroutine:item=>gnc.is.coroutine(item), generatorFunc:item=>gnc.is.generatorFunc(item), @@ -7497,25 +7481,25 @@ let dbimage=null,extimage=null,modeimage=null,nameinfo,gzbool=false; const mode=get.mode(); if(type=='character'){ - if(lib.characterPack[`mode_${mode}`]&&lib.characterPack[`mode_${mode}`][name]) if(mode=='guozhan'){ - nameinfo=lib.character[name]; - if(name.indexOf('gz_shibing')==0) name=name.slice(3,11); - else{ - if(lib.config.mode_config.guozhan.guozhanSkin&&lib.character[name]&&lib.character[name][4].contains('gzskin')) gzbool=true; - name=name.slice(3); + if(lib.characterPack[`mode_${mode}`]&&lib.characterPack[`mode_${mode}`][name]){ + if(mode=='guozhan'){ + nameinfo=lib.character[name]; + if(name.indexOf('gz_shibing')==0) name=name.slice(3,11); + else{ + if(lib.config.mode_config.guozhan.guozhanSkin&&lib.character[name]&&lib.character[name][4].contains('gzskin')) gzbool=true; + name=name.slice(3); + } } - } - else modeimage=mode; - else if(lib.character[name]) nameinfo=lib.character[name]; - else if(lib.config.show_extensionimage){ - const pack=Object.keys(lib.characterPack).find(pack=>Object.keys(lib.characterPack[pack]).contains(name)); - if(pack) nameinfo=lib.characterPack[pack][name]; + else modeimage=mode; } else if(name.indexOf('::')!=-1){ name=name.split('::'); modeimage=name[0]; name=name[1]; } + else{ + nameinfo=get.character(name); + } } if(!modeimage&&nameinfo&&nameinfo[4]) for(const value of nameinfo[4]){ if(value.indexOf('ext:')==0){ @@ -8323,7 +8307,7 @@ if (Array.isArray(lib.onprepare)&&lib.onprepare.length){ _status.onprepare=Object.freeze(lib.onprepare.map(fn=>{ if(typeof fn!="function") return; - return gnc.await(fn()); + return (gnc.is.generatorFunc(fn)?gnc.of(fn):fn)(); })); } let toLoad=lib.config.all.cards.length+lib.config.all.characters.length+1; @@ -8335,7 +8319,7 @@ if(!arrayLengths.length) return previousValue+1; return previousValue+Math.min(...arrayLengths); },0); - const packLoaded=gnc.async(function*(){ + const packLoaded=gnc.of(function*(){ toLoad--; if(toLoad) return; if(_status.importing){ @@ -8448,13 +8432,13 @@ throw e; }); var styleToLoad=6; - var styleLoaded=gnc.async(function*(){ + var styleLoaded=gnc.of(function*(){ --styleToLoad; if(styleToLoad==0){ if(extensionlist.length&&(lib.config.mode!='connect'||show_splash)){ _status.extensionLoading=[]; let extToLoad=extensionlist.length; - const extLoaded=gnc.async(function*(){ + const extLoaded=gnc.of(function*(){ --extToLoad; if(extToLoad==0){ yield Promise.allSettled(_status.extensionLoading); @@ -8476,7 +8460,7 @@ continue; } lib.init.js(lib.assetURL+'extension/'+extensionlist[i],'extension',extLoaded,(function(i){ - return gnc.async(function*(){ + return gnc.of(function*(){ game.removeExtension(i); --extToLoad; if(extToLoad==0){ @@ -9124,13 +9108,13 @@ } }, //lib.onload支持传入GeneratorFunction以解决异步函数的问题 by诗笺 - onload:gnc.async(function*(){ + onload:gnc.of(function*(){ const libOnload=lib.onload; delete lib.onload; while(Array.isArray(libOnload)&&libOnload.length){ const fun=libOnload.shift(); if(typeof fun!="function") continue; - yield gnc.await(fun()); + yield (gnc.is.generatorFunc(fun)?gnc.of(fun):fun)(); } ui.updated(); game.documentZoom=game.deviceZoom; @@ -9325,7 +9309,7 @@ }); } - var proceed2=gnc.async(function*(){ + var proceed2=gnc.of(function*(){ var mode=lib.imported.mode; var card=lib.imported.card; var character=lib.imported.character; @@ -9739,7 +9723,8 @@ try{ _status.extension=lib.extensions[i][0]; _status.evaluatingExtension=lib.extensions[i][3]; - if (typeof lib.extensions[i][1]=="function") yield gnc.await(lib.extensions[i][1](lib.extensions[i][2],lib.extensions[i][4])); + if (typeof lib.extensions[i][1]=="function") + yield (gnc.is.coroutine(lib.extensions[i][1])?gnc.of(lib.extensions[i][1]):lib.extensions[i][1])(lib.extensions[i][2],lib.extensions[i][4]); if(lib.extensions[i][4]){ if(lib.extensions[i][4].character){ for(var j in lib.extensions[i][4].character.character){ @@ -9791,7 +9776,7 @@ } game.loop(); }) - var proceed=gnc.async(function*(){ + var proceed=gnc.of(function*(){ if(!lib.db){ try{ lib.storage=JSON.parse(localStorage.getItem(lib.configprefix+lib.config.mode)); @@ -9906,7 +9891,7 @@ while(Array.isArray(libOnload2)&&libOnload2.length){ const fun=libOnload2.shift(); if(typeof fun!="function") continue; - yield gnc.await(fun()); + yield (gnc.is.generatorFunc(fun)?gnc.of(fun):fun)(); } }), startOnline:function(){ @@ -11153,6 +11138,7 @@ xiaosha_emotion:'小杀表情', xiaotao_emotion:'小桃表情', xiaojiu_emotion:'小酒表情', + xiaokuo_emotion:'小扩表情', pause:'暂停', config:'选项', @@ -29917,17 +29903,29 @@ } }, sort:{ + group:function(a,b){ + const groupSort=function(group){ + let base=0; + if(group=='wei') return base; + if(group=='shu') return base+1; + if(group=='wu') return base+2; + if(group=='qun') return base+3; + if(group=='jin') return base+4; + if(group=='key') return base+5; + if(group=='western') return base+6; + if(group=='shen') return base+7; + if(group=='double') return base+7; + return base+9; + } + return groupSort(a)-groupSort(b); + }, character:function(a,b){ - /*var getGroup=function(name){ - var group=get.is.double(name,true); - if(group) return group[0]; - return lib.character[name][1]; - }*/ const groupSort=function(name){ - if(!lib.character[name]) return 7; + const info=get.character(name); + if(!info) return 7; let base=0; if(get.is.double(name,true)) base=9; - const group=lib.character[name][1]; + const group=info[1]; if(group=='shen') return base-1; if(group=='wei') return base; if(group=='shu') return base+1; @@ -33638,7 +33636,7 @@ if(!lib.imported[type])lib.imported[type]={}; if(typeof _status.importing=="undefined")_status.importing={}; if(!_status.importing[type])_status.importing[type]=[]; - const promise=gnc.await(content(lib,game,ui,get,ai,_status)).then(content2=>{ + const promise=Promise.resolve((gnc.is.generator(content)?gnc.of(content):content)(lib,game,ui,get,ai,_status)).then(content2=>{ if(content2.name){ lib.imported[type][content2.name]=content2; delete content2.name; @@ -33648,10 +33646,10 @@ return promise; } }, - loadExtension:gnc.async(function*(obj){ + loadExtension:gnc.of(function*(obj){ var noeval=false; if(typeof obj=='function'){ - obj=yield gnc.await(obj(lib,game,ui,get,ai,_status)); + obj=yield (gnc.is.generatorFunc(obj)?gnc.of(obj):obj)(lib,game,ui,get,ai,_status); noeval=true; } lib.extensionMenu['extension_'+obj.name]={ @@ -33769,7 +33767,7 @@ } if(obj.precontent){ _status.extension=obj.name; - yield gnc.await(obj.precontent(cfg)); + yield (gnc.is.generatorFunc(obj.precontent)?gnc.of(obj.precontent):obj.precontent)(cfg); delete _status.extension; } if(obj.content){ @@ -33823,7 +33821,7 @@ })(); } }, - importExtension:gnc.async(function*(data,finishLoad,exportext,pkg){ + importExtension:gnc.of(function*(data,finishLoad,exportext,pkg){ //by 来瓶可乐加冰 if(!window.JSZip) yield new Promise((resolve,reject)=>lib.init.js(`${lib.assetURL}game`,"jszip",resolve,reject)); @@ -42304,41 +42302,7 @@ } } alterableCharacters.sort(); - /*var getGroup=function(name){ - var group=get.is.double(name,true); - if(group) return group[0]; - return lib.character[name][1]; - };*/ - const groupSort=function(name){ - if(!lib.character[name]) return 7; - let base=0; - if(get.is.double(name,true)) base=9; - const group=lib.character[name][1]; - if(group=='shen') return base-1; - if(group=='wei') return base; - if(group=='shu') return base+1; - if(group=='wu') return base+2; - if(group=='qun') return base+3; - if(group=='jin') return base+4; - if(group=='key') return base+5; - if(group=='western') return base+6; - return base+7; - } - list.sort(function(a,b){ - var del=groupSort(a)-groupSort(b); - if(del!=0) return del; - var aa=a,bb=b; - if(a.indexOf('_')!=-1){ - a=a.slice(a.lastIndexOf('_')+1); - } - if(b.indexOf('_')!=-1){ - b=b.slice(b.lastIndexOf('_')+1); - } - if(a!=b){ - return a>b?1:-1; - } - return aa>bb?1:-1; - }); + list.sort(lib.sort.character); var list2=list.slice(0); var cfgnode=createConfig({ name:'开启', @@ -47575,6 +47539,7 @@ } } var list=[]; + const groups=[]; var dialog; var node=ui.create.div('.caption.pointerspan'); if(get.is.phoneLayout()){ @@ -47619,6 +47584,10 @@ if(lib.characterFilter[i]&&!lib.characterFilter[i](get.mode())) continue; if(filter&&filter(i)) continue; list.push(i); + if(get.is.double(i)){ + groups.add('double'); + } + else groups.add(lib.character[i][1]); if(namecapt.indexOf(getCapt(i))==-1){ namecapt.push(getCapt(i)); } @@ -47627,6 +47596,7 @@ namecapt.sort(function(a,b){ return a>b?1:-1; }); + groups.sort(lib.sort.group); if(!thisiscard){ namecapt.remove('自定义'); namecapt.push('newline'); @@ -47822,29 +47792,6 @@ } } if(!thisiscard){ - var groups=['wei','shu','wu','qun','jin']; - var bool1=false; - var bool2=false; - var bool3=(get.mode()=='guozhan'&&_status.forceKey!=true&&get.config('onlyguozhan')); - var bool4=false; - var bool5=false; - for(var i in lib.character){ - if(lib.character[i][1]=='shen'){ - bool1=true; - } - if(lib.character[i][1]=='ye'){ - bool5=true; - } - if(bool3||lib.character[i][1]=='key'){ - bool2=true; - } - if(!bool4&&get.is.double(i)) bool4=true; - if(bool1&&bool2&&bool4&&bool5) break; - } - if(bool1) groups.add('shen'); - if(bool2&&!bool3) groups.add('key'); - if(bool4) groups.add('double'); - if(bool5) groups.add('ye'); var natures=['water','soil','wood','metal']; var span=document.createElement('span'); newlined.appendChild(span); @@ -48054,45 +48001,26 @@ case 'zhenfa':return 5; default:return 6; } - }; + } + list.sort(function(a,b){ + var del=groupSort(a)-groupSort(b); + if(del!=0) return del; + var aa=a,bb=b; + if(a.indexOf('_')!=-1){ + a=a.slice(a.lastIndexOf('_')+1); + } + if(b.indexOf('_')!=-1){ + b=b.slice(b.lastIndexOf('_')+1); + } + if(a!=b){ + return a>b?1:-1; + } + return aa>bb?1:-1; + }); } else{ - /*var getGroup=function(name){ - var group=get.is.double(name,true); - if(group) return group[0]; - return lib.character[name][1]; - }*/ - groupSort=function(name){ - if(!lib.character[name]) return 7; - let base=0; - if(get.is.double(name,true)) base=9; - const group=lib.character[name][1]; - if(group=='shen') return base-1; - if(group=='wei') return base; - if(group=='shu') return base+1; - if(group=='wu') return base+2; - if(group=='qun') return base+3; - if(group=='jin') return base+4; - if(group=='key') return base+5; - if(group=='western') return base+6; - return base+7; - } + list.sort(lib.sort.character); } - list.sort(function(a,b){ - var del=groupSort(a)-groupSort(b); - if(del!=0) return del; - var aa=a,bb=b; - if(a.indexOf('_')!=-1){ - a=a.slice(a.lastIndexOf('_')+1); - } - if(b.indexOf('_')!=-1){ - b=b.slice(b.lastIndexOf('_')+1); - } - if(a!=b){ - return a>b?1:-1; - } - return aa>bb?1:-1; - }); dialog=ui.create.dialog('hidden'); dialog.classList.add('noupdate'); dialog.classList.add('scroll1'); @@ -53003,13 +52931,12 @@ if(lib.config.show_characternamepinyin){ var charactername=get.rawName(name); var characterpinyin=get.pinyin(charactername); - var nameinfo=lib.character[name]; - if(!nameinfo){ - const pack=Object.keys(lib.characterPack).find(pack=>Object.keys(lib.characterPack[pack]).contains(name)); - if(pack) nameinfo=lib.characterPack[pack][name]; - } + var nameinfo=get.character(name); var charactersex=get.translation(nameinfo[0]); - var charactergroup=get.translation(nameinfo[1]); + const charactergroups=get.is.double(name,true); + let charactergroup; + if(charactergroups) charactergroup=charactergroups.map(i=>get.translation(i)).join('/') + else charactergroup=get.translation(nameinfo[1]); var characterhp=nameinfo[2]; var characterintroinfo=get.characterIntro(name); intro.innerHTML=''+charactername+''+''+'['+characterpinyin+']'+''+' | '+charactersex+' | '+charactergroup+' | '+characterhp+'
    '+characterintroinfo; @@ -54351,9 +54278,10 @@ } return false; }, - double:function(name,array){ - if(!lib.character[name]||!lib.character[name][4]) return false; - for(var i of lib.character[name][4]){ + double:(name,array)=>{ + let info=get.character(name,4); + if(!info) return false; + for(let i of info){ if(i.indexOf('doublegroup:')==0){ if(!array) return true; return i.split(':').slice(1); @@ -54679,8 +54607,8 @@ _card.cards=cards.slice(0); if(!lib.suits.includes(_card.suit)) _card.suit=get.suit(_card); if(!Object.keys(lib.color).includes(_card.color)) _card.color=get.color(_card); - if(!_card.hasOwnProperty('number')) _card.number=get.number(card); - if(!_card.hasOwnProperty('nature')) _card.nature=get.nature(card); + if(!_card.hasOwnProperty('number')) _card.number=get.number(_card); + if(!_card.hasOwnProperty('nature')) _card.nature=(get.nature(_card)||false); } } } @@ -54799,14 +54727,10 @@ } }, character:function(name,num){ - var info=lib.character[name]; + let info=lib.character[name]; if(!info){ - for(var i in lib.characterPack){ - if(lib.characterPack[i][name]){ - info=lib.characterPack[i][name]; - break; - } - } + const pack=Object.keys(lib.characterPack).find(pack=>lib.characterPack[pack].hasOwnProperty(name)); + if(pack) info=lib.characterPack[pack][name]; } if(info){ if(typeof num=='number'){ @@ -56014,14 +55938,13 @@ }, number:function(card,player){ //狗卡你是真敢出啊 - var number; + var number=null; if(card.hasOwnProperty('number')){ number=card.number; - if(typeof number!='number') return null; + if(typeof number!='number') number=null; } else{ - if(card.cards&&card.cards.length==1) return get.number(card.cards[0]); - return null; + if(card.cards&&card.cards.length==1) number=get.number(card.cards[0],false); } if(player!==false){ var owner=player||get.owner(card); @@ -56956,8 +56879,8 @@ node=node.link; } var capt=get.translation(node.name); - if((lib.character[node.name]&&lib.character[node.name][1])||lib.group.contains(node.group)){ - capt+='  '+(lib.group.contains(node.group)?get.translation(node.group):lib.translate[lib.character[node.name][1]]); + if(lib.group.contains(node.group)||get.character(node.name,1)){ + capt+='  '+(lib.group.contains(node.group)?get.translation(node.group):get.translation(get.character(node.name,1))); } uiintro.add(capt); @@ -57663,8 +57586,8 @@ } } else if(node.classList.contains('character')){ - var character=node.link; - if(lib.character[node.link]&&lib.character[node.link][1]){ + var character=node.link,characterinfo=get.character(node.link); + if(characterinfo&&characterinfo[1]){ var group=get.is.double(node.link,true); if(group){ var str=get.translation(character)+'  '; @@ -57674,7 +57597,7 @@ } uiintro.add(str); } - else uiintro.add(get.translation(character)+'  '+lib.translate[lib.character[node.link][1]]); + else uiintro.add(get.translation(character)+'  '+lib.translate[characterinfo[1]]); } else{ uiintro.add(get.translation(character)); @@ -57780,14 +57703,7 @@ ui.create.div('.placeholder.slim',uiintro.content); } else{ - var infoitem=lib.character[character]; - if(!infoitem){ - for(var itemx in lib.characterPack){ - if(lib.characterPack[itemx][character]){ - infoitem=lib.characterPack[itemx][character];break; - } - } - } + var infoitem=get.character(character); var skills=infoitem[3]; for(i=0;i