From 94a3733d3e03ae5840b525d88e2cd8362837b9f1 Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Thu, 24 Aug 2023 22:56:06 +0800 Subject: [PATCH] Border color, History change --- character/jsrg.js | 2 +- character/old.js | 2 +- character/sp.js | 7 +- character/yijiang.js | 2 +- game/game.js | 160 +++++++++++++++++++++++++++---------------- 5 files changed, 107 insertions(+), 66 deletions(-) diff --git a/character/jsrg.js b/character/jsrg.js index 6f54d0c25..5988e5b4f 100644 --- a/character/jsrg.js +++ b/character/jsrg.js @@ -32,7 +32,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ jsrg_lvbu:['male','qun',5,['jsrgwuchang','jsrgqingjiao','jsrgchengxu'],['doublegroup:qun:shu']], jsrg_zhanghe:['male','wei',4,['jsrgqiongtu','jsrgxianzhu'],['doublegroup:qun:wei']], jsrg_zoushi:['female','qun',3,['jsrgguyin','jsrgzhangdeng']], - jsrg_guanyu:['male','shu',5,['jsrgguanjue','jsrgnianen']], + jsrg_guanyu:['male','shu',5,['jsrgguanjue','jsrgnianen'],['border:wei']], jsrg_chendeng:['male','qun',3,['jsrglunshi','jsrgguitu']], jsrg_zhenji:['female','qun',3,['jsrgjixiang','jsrgchengxian']], jsrg_zhangliao:['male','qun',4,['jsrgzhengbing','jsrgtuwei'],['doublegroup:qun:wei']], diff --git a/character/old.js b/character/old.js index 7b3ca06e8..4baccbd77 100755 --- a/character/old.js +++ b/character/old.js @@ -61,7 +61,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ jsp_caoren:['male','wei',4,['kuiwei','yanzheng']], old_caochun:['male','wei',4,['shanjia']], masu:['male','shu',3,['xinzhan','huilei']], - xushu:['male','shu',3,['xswuyan','jujian']], + xushu:['male','shu',3,['xswuyan','jujian'],['border:wei']], liru:['male','qun',3,['juece','mieji','fencheng']], xin_yujin:['male','wei',4,['jieyue']], //lusu:['male','wu',3,['haoshi','dimeng']], diff --git a/character/sp.js b/character/sp.js index c8e91f0bd..3528712c7 100755 --- a/character/sp.js +++ b/character/sp.js @@ -18118,9 +18118,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, filter:function(event,player){ if(event.targets.length!=1||!['sha','juedou'].contains(event.card.name)) return false; - return player.getHistory('useCard',function(evt){ - return evt.card.name==event.card.name; - }).indexOf(event.getParent())==0; + var evtx=event.getParent(); + return !player.hasHistory('useCard',function(evt){ + return evt!=evtx&&evt.card.name==event.card.name; + },evtx) }, direct:true, content:function(){ diff --git a/character/yijiang.js b/character/yijiang.js index fd8a98932..f8fce6623 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -34,7 +34,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ caozhi:['male','wei',3,['luoying','jiushi']], caochong:['male','wei',3,['chengxiang','renxin']], xunyou:['male','wei',3,['qice','zhiyu'],['clan:颍川荀氏']], - xin_xushu:['male','shu',3,['xinwuyan','xinjujian']], + xin_xushu:['male','shu',3,['xinwuyan','xinjujian'],['border:wei']], xin_masu:['male','shu',3,['olsanyao','rezhiman']], zhuran:['male','wu',4,['danshou']], xusheng:['male','wu',4,['xinpojun']], diff --git a/game/game.js b/game/game.js index e6d59835a..4e0db2c5a 100644 --- a/game/game.js +++ b/game/game.js @@ -24523,25 +24523,31 @@ if(!key) return this.actionHistory[this.actionHistory.length-1]; if(!filter) return this.actionHistory[this.actionHistory.length-1][key]; else{ - var history=this.getHistory(key).slice(0); - if(last) history=history.slice(0,history.indexOf(last)+1); - for(var i=0;ilastIndex) return false; + return filter(event); + }) } - return history; + return history.filter(filter); } }, hasHistory:function(key,filter,last){ - var history=this.getHistory(key).slice(0); - if(last) history=history.slice(0,history.indexOf(last)+1); - for(var i=0;ilastIndex) return false; + return filter(event); + }) } - return false; + return history.some(filter); }, getLastHistory:function(key,filter,last){ - var history=false; - for(var i=this.actionHistory.length-1;i>=0;i--){ + let history=false; + for(let i=this.actionHistory.length-1;i>=0;i--){ if(this.actionHistory[i].isMe){ history=this.actionHistory[i];break; } @@ -24550,42 +24556,52 @@ if(!key) return history; if(!filter) return history[key]; else{ - history=history.slice(0); - if(last) history=history.slice(0,history.indexOf(last)+1); - for(var i=0;ilastIndex) return false; + return filter(event); + }) } - return history; + return history.filter(filter); } }, getAllHistory:function(key,filter,last){ - var list=[]; - var all=this.actionHistory; - for(var j=0;jlastIndex) return false; + return filter(event); + }); + } + return history.filter(filter); + } + return history; }, hasAllHistory:function(key,filter,last){ - var list=[]; - var all=this.actionHistory; - for(var j=0;jlastIndex) return false; + return filter(event); + })) return true; + } + else{ + if(history.some(filter)) return true; } } return false; @@ -31337,35 +31353,43 @@ if(get.mode()!='chess'&&rank.junk.contains(name)) return 'junk'; return 'common'; }, - getGlobalHistory:function(key,filter){ + getGlobalHistory:function(key,filter,last){ if(!key) return _status.globalHistory[_status.globalHistory.length-1]; if(!filter) return _status.globalHistory[_status.globalHistory.length-1][key]; else{ - var history=game.getGlobalHistory(key).slice(0); - for(var i=0;ilastIndex) return false; + return filter(event); + }) } - return history; + return history.filter(filter); } }, - getAllGlobalHistory:function(key,filter){ - var list=[]; - var all=_status.globalHistory; + getAllGlobalHistory:function(key,filter,last){ + const history=[]; + const all=_status.globalHistory; for(var j=0;jlastIndex) return false; + return filter(event); + }); + } + return history.filter(filter); + } + return history; }, cardsDiscard:function(cards){ var type=get.itemtype(cards); @@ -38853,13 +38877,13 @@ } intro.innerHTML=get.translation(rarity); } - if((button.link=='xushu'||button.link=='xin_xushu'||button.link=='jsrg_guanyu')&&button.node&&button.node.name&&button.node.group){ + /*if((button.link=='xushu'||button.link=='xin_xushu'||button.link=='jsrg_guanyu')&&button.node&&button.node.name&&button.node.group){ if(button.classList.contains('newstyle')){ button.node.name.dataset.nature='watermm'; button.node.group.dataset.nature='water'; } else button.node.group.style.backgroundColor=get.translation('weiColor'); - } + }*/ }, div:function(){ var str,innerHTML,position,position2,style,divposition,listen; @@ -48076,7 +48100,7 @@ node._link=item; if(_status.noReplaceCharacter&&type=='characterx') type='character'; if(type=='characterx'){ - if(lib.characterReplace[item]&&lib.characterReplace[item].length) item=lib.characterReplace[item][0]; + if(lib.characterReplace[item]&&lib.characterReplace[item].length) item=lib.characterReplace[item].randomGet(); } node.link=item; if(type=='character'||type=='characterx'){ @@ -48111,13 +48135,15 @@ if(lib.config.buttoncharacter_style=='simple'){ node.node.group.style.display='none'; } - node.node.name.dataset.nature=get.groupnature(infoitem[1]); - node.node.group.dataset.nature=get.groupnature(infoitem[1],'raw'); node.classList.add('newstyle'); if(double&&double.length){ node.node.name.dataset.nature=get.groupnature(double[0]); node.node.group.dataset.nature=get.groupnature(double[double.length==2?1:0]); } + else{ + node.node.name.dataset.nature=get.groupnature(get.bordergroup(infoitem)); + node.node.group.dataset.nature=get.groupnature(get.bordergroup(infoitem),'raw'); + } ui.create.div(node.node.hp); var hp=get.infoHp(infoitem[2]),maxHp=get.infoMaxHp(infoitem[2]),hujia=get.infoHujia(infoitem[2]); var str=get.numStr(hp); @@ -48186,7 +48212,7 @@ node.node.group.innerHTML=str; } else node.node.group.innerHTML='
'+get.translation(infoitem[1])+'
'; - node.node.group.style.backgroundColor=get.translation(infoitem[1]+'Color'); + node.node.group.style.backgroundColor=get.translation(get.bordergroup(infoitem)+'Color'); } else{ node.node.group.style.display='none'; @@ -53485,6 +53511,20 @@ if(lib.characterIntro[name]) return lib.characterIntro[name]; return '暂无武将介绍'; }, + bordergroup:function(info){ + if(!Array.isArray(info)){ + info=lib.character[info]; + if(!info) return ''; + } + if(Array.isArray(info[4])){ + for(let str of info[4]){ + if(typeof str=='string'&&str.indexOf('border:')==0){ + return str.slice(7); + } + } + } + return info[1]; + }, groupnature:function(group,method){ var nature=lib.groupnature[group]; if(!nature) return '';