Border color, History change

This commit is contained in:
Spmario233 2023-08-24 22:56:06 +08:00
parent a940b9a93c
commit 94a3733d3e
5 changed files with 107 additions and 66 deletions

View File

@ -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_lvbu:['male','qun',5,['jsrgwuchang','jsrgqingjiao','jsrgchengxu'],['doublegroup:qun:shu']],
jsrg_zhanghe:['male','wei',4,['jsrgqiongtu','jsrgxianzhu'],['doublegroup:qun:wei']], jsrg_zhanghe:['male','wei',4,['jsrgqiongtu','jsrgxianzhu'],['doublegroup:qun:wei']],
jsrg_zoushi:['female','qun',3,['jsrgguyin','jsrgzhangdeng']], 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_chendeng:['male','qun',3,['jsrglunshi','jsrgguitu']],
jsrg_zhenji:['female','qun',3,['jsrgjixiang','jsrgchengxian']], jsrg_zhenji:['female','qun',3,['jsrgjixiang','jsrgchengxian']],
jsrg_zhangliao:['male','qun',4,['jsrgzhengbing','jsrgtuwei'],['doublegroup:qun:wei']], jsrg_zhangliao:['male','qun',4,['jsrgzhengbing','jsrgtuwei'],['doublegroup:qun:wei']],

View File

@ -61,7 +61,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
jsp_caoren:['male','wei',4,['kuiwei','yanzheng']], jsp_caoren:['male','wei',4,['kuiwei','yanzheng']],
old_caochun:['male','wei',4,['shanjia']], old_caochun:['male','wei',4,['shanjia']],
masu:['male','shu',3,['xinzhan','huilei']], 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']], liru:['male','qun',3,['juece','mieji','fencheng']],
xin_yujin:['male','wei',4,['jieyue']], xin_yujin:['male','wei',4,['jieyue']],
//lusu:['male','wu',3,['haoshi','dimeng']], //lusu:['male','wu',3,['haoshi','dimeng']],

View File

@ -18118,9 +18118,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
filter:function(event,player){ filter:function(event,player){
if(event.targets.length!=1||!['sha','juedou'].contains(event.card.name)) return false; if(event.targets.length!=1||!['sha','juedou'].contains(event.card.name)) return false;
return player.getHistory('useCard',function(evt){ var evtx=event.getParent();
return evt.card.name==event.card.name; return !player.hasHistory('useCard',function(evt){
}).indexOf(event.getParent())==0; return evt!=evtx&&evt.card.name==event.card.name;
},evtx)
}, },
direct:true, direct:true,
content:function(){ content:function(){

View File

@ -34,7 +34,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
caozhi:['male','wei',3,['luoying','jiushi']], caozhi:['male','wei',3,['luoying','jiushi']],
caochong:['male','wei',3,['chengxiang','renxin']], caochong:['male','wei',3,['chengxiang','renxin']],
xunyou:['male','wei',3,['qice','zhiyu'],['clan:颍川荀氏']], 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']], xin_masu:['male','shu',3,['olsanyao','rezhiman']],
zhuran:['male','wu',4,['danshou']], zhuran:['male','wu',4,['danshou']],
xusheng:['male','wu',4,['xinpojun']], xusheng:['male','wu',4,['xinpojun']],

View File

@ -24523,25 +24523,31 @@
if(!key) return this.actionHistory[this.actionHistory.length-1]; if(!key) return this.actionHistory[this.actionHistory.length-1];
if(!filter) return this.actionHistory[this.actionHistory.length-1][key]; if(!filter) return this.actionHistory[this.actionHistory.length-1][key];
else{ else{
var history=this.getHistory(key).slice(0); const history=this.getHistory(key);
if(last) history=history.slice(0,history.indexOf(last)+1); if(last){
for(var i=0;i<history.length;i++){ const lastIndex=history.indexOf(last);
if(!filter(history[i])) history.splice(i--,1); return history.filter(function(event,index){
if(index>lastIndex) return false;
return filter(event);
})
} }
return history; return history.filter(filter);
} }
}, },
hasHistory:function(key,filter,last){ hasHistory:function(key,filter,last){
var history=this.getHistory(key).slice(0); const history=this.getHistory(key);
if(last) history=history.slice(0,history.indexOf(last)+1); if(last){
for(var i=0;i<history.length;i++){ const lastIndex=history.indexOf(last);
if(filter(history[i])) return true; return history.some(function(event,index){
if(index>lastIndex) return false;
return filter(event);
})
} }
return false; return history.some(filter);
}, },
getLastHistory:function(key,filter,last){ getLastHistory:function(key,filter,last){
var history=false; let history=false;
for(var i=this.actionHistory.length-1;i>=0;i--){ for(let i=this.actionHistory.length-1;i>=0;i--){
if(this.actionHistory[i].isMe){ if(this.actionHistory[i].isMe){
history=this.actionHistory[i];break; history=this.actionHistory[i];break;
} }
@ -24550,42 +24556,52 @@
if(!key) return history; if(!key) return history;
if(!filter) return history[key]; if(!filter) return history[key];
else{ else{
history=history.slice(0); if(last){
if(last) history=history.slice(0,history.indexOf(last)+1); const lastIndex=history.indexOf(last);
for(var i=0;i<history.length;i++){ return history.filter(function(event,index){
if(!filter(history[i])) history.splice(i--,1); if(index>lastIndex) return false;
return filter(event);
})
} }
return history; return history.filter(filter);
} }
}, },
getAllHistory:function(key,filter,last){ getAllHistory:function(key,filter,last){
var list=[]; const history=[];
var all=this.actionHistory; const all=this.actionHistory;
for(var j=0;j<all.length;j++){ for(let j=0;j<all.length;j++){
if(!key||!all[j][key]){ if(!key||!all[j][key]){
list.push(all[j]); history.push(all[j]);
} }
else{ else{
if(!filter) list.addArray(all[j][key]); history.push(...all[j][key]);
else{
var history=all[j][key].slice(0);
if(last) history=history.slice(0,history.indexOf(last)+1);
for(var i=0;i<history.length;i++){
if(filter(history[i])) list.push(history[i]);
} }
} }
if(filter){
if(last){
const lastIndex=history.indexOf(last);
return history.filter(function(event,index){
if(index>lastIndex) return false;
return filter(event);
});
} }
return history.filter(filter);
} }
return list; return history;
}, },
hasAllHistory:function(key,filter,last){ hasAllHistory:function(key,filter,last){
var list=[]; const all=this.actionHistory;
var all=this.actionHistory; for(let j=0;j<all.length;j++){
for(var j=0;j<all.length;j++){ let history=all[j][key];
var history=all[j][key].slice(0); if(last){
if(last) history=history.slice(0,history.indexOf(last)+1); const lastIndex=history.indexOf(last);
for(var i=0;i<history.length;i++){ if(history.some(function(event,index){
if(filter(history[i])) return true; if(index>lastIndex) return false;
return filter(event);
})) return true;
}
else{
if(history.some(filter)) return true;
} }
} }
return false; return false;
@ -31337,35 +31353,43 @@
if(get.mode()!='chess'&&rank.junk.contains(name)) return 'junk'; if(get.mode()!='chess'&&rank.junk.contains(name)) return 'junk';
return 'common'; return 'common';
}, },
getGlobalHistory:function(key,filter){ getGlobalHistory:function(key,filter,last){
if(!key) return _status.globalHistory[_status.globalHistory.length-1]; if(!key) return _status.globalHistory[_status.globalHistory.length-1];
if(!filter) return _status.globalHistory[_status.globalHistory.length-1][key]; if(!filter) return _status.globalHistory[_status.globalHistory.length-1][key];
else{ else{
var history=game.getGlobalHistory(key).slice(0); const history=game.getGlobalHistory(key);
for(var i=0;i<history.length;i++){ if(last){
if(!filter(history[i])) history.splice(i--,1); const lastIndex=history.indexOf(last);
return history.filter(function(event,index){
if(index>lastIndex) return false;
return filter(event);
})
} }
return history; return history.filter(filter);
} }
}, },
getAllGlobalHistory:function(key,filter){ getAllGlobalHistory:function(key,filter,last){
var list=[]; const history=[];
var all=_status.globalHistory; const all=_status.globalHistory;
for(var j=0;j<all.length;j++){ for(var j=0;j<all.length;j++){
if(!key||!all[j][key]){ if(!key||!all[j][key]){
list.push(all[j]); history.push(all[j]);
} }
else{ else{
if(!filter) list.addArray(all[j][key]); list.push(...all[j][key]);
else{
var history=all[j][key].slice(0);
for(var i=0;i<history.length;i++){
if(filter(history[i])) list.push(history[i]);
} }
} }
if(filter){
if(last){
const lastIndex=history.indexOf(last);
return history.filter(function(event,index){
if(index>lastIndex) return false;
return filter(event);
});
} }
return history.filter(filter);
} }
return list; return history;
}, },
cardsDiscard:function(cards){ cardsDiscard:function(cards){
var type=get.itemtype(cards); var type=get.itemtype(cards);
@ -38853,13 +38877,13 @@
} }
intro.innerHTML=get.translation(rarity); 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')){ if(button.classList.contains('newstyle')){
button.node.name.dataset.nature='watermm'; button.node.name.dataset.nature='watermm';
button.node.group.dataset.nature='water'; button.node.group.dataset.nature='water';
} }
else button.node.group.style.backgroundColor=get.translation('weiColor'); else button.node.group.style.backgroundColor=get.translation('weiColor');
} }*/
}, },
div:function(){ div:function(){
var str,innerHTML,position,position2,style,divposition,listen; var str,innerHTML,position,position2,style,divposition,listen;
@ -48076,7 +48100,7 @@
node._link=item; node._link=item;
if(_status.noReplaceCharacter&&type=='characterx') type='character'; if(_status.noReplaceCharacter&&type=='characterx') type='character';
if(type=='characterx'){ 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; node.link=item;
if(type=='character'||type=='characterx'){ if(type=='character'||type=='characterx'){
@ -48111,13 +48135,15 @@
if(lib.config.buttoncharacter_style=='simple'){ if(lib.config.buttoncharacter_style=='simple'){
node.node.group.style.display='none'; 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'); node.classList.add('newstyle');
if(double&&double.length){ if(double&&double.length){
node.node.name.dataset.nature=get.groupnature(double[0]); node.node.name.dataset.nature=get.groupnature(double[0]);
node.node.group.dataset.nature=get.groupnature(double[double.length==2?1: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); ui.create.div(node.node.hp);
var hp=get.infoHp(infoitem[2]),maxHp=get.infoMaxHp(infoitem[2]),hujia=get.infoHujia(infoitem[2]); var hp=get.infoHp(infoitem[2]),maxHp=get.infoMaxHp(infoitem[2]),hujia=get.infoHujia(infoitem[2]);
var str=get.numStr(hp); var str=get.numStr(hp);
@ -48186,7 +48212,7 @@
node.node.group.innerHTML=str; node.node.group.innerHTML=str;
} }
else node.node.group.innerHTML='<div>'+get.translation(infoitem[1])+'</div>'; else node.node.group.innerHTML='<div>'+get.translation(infoitem[1])+'</div>';
node.node.group.style.backgroundColor=get.translation(infoitem[1]+'Color'); node.node.group.style.backgroundColor=get.translation(get.bordergroup(infoitem)+'Color');
} }
else{ else{
node.node.group.style.display='none'; node.node.group.style.display='none';
@ -53485,6 +53511,20 @@
if(lib.characterIntro[name]) return lib.characterIntro[name]; if(lib.characterIntro[name]) return lib.characterIntro[name];
return '暂无武将介绍'; 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){ groupnature:function(group,method){
var nature=lib.groupnature[group]; var nature=lib.groupnature[group];
if(!nature) return ''; if(!nature) return '';