Skip to content

Commit

Permalink
Merge pull request #476 from libccy/PR-Branch
Browse files Browse the repository at this point in the history
v1.10.3.1
  • Loading branch information
Spmario233 authored Oct 5, 2023
2 parents cb642c5 + 96d7a74 commit 4298361
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 182 deletions.
3 changes: 1 addition & 2 deletions character/extra.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
skillAnimation:true,
animationColor:'orange',
filter:function(event,player){
return true;
//return player.getStorage('dctuoyu').length==3;
return player.getStorage('dctuoyu').length==3;
},
content:function(){
'step 0'
Expand Down
2 changes: 1 addition & 1 deletion character/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14881,7 +14881,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
zhaotongzhaoguang:"手杀赵统赵广",
zhaotongzhaoguang_prefix:'手杀',
re_liru:'手杀李儒',
re_liru_prefix:'李儒',
re_liru_prefix:'手杀',
re_chenqun:'手杀陈群',
re_chenqun_prefix:'手杀',
old_yuanshu:'手杀袁术',
Expand Down
10 changes: 9 additions & 1 deletion game/asset.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
window.noname_asset_list=[
'v1.10.2.1',
'v1.10.3.1',
/*audio start*/
'audio/background/aozhan_chaoming.mp3',
'audio/background/aozhan_online.mp3',
Expand Down Expand Up @@ -724,6 +724,7 @@ window.noname_asset_list=[
'audio/die/re_taishici.mp3',
'audio/die/re_taoqian.mp3',
'audio/die/re_weiyan.mp3',
'audio/die/re_wenpin.mp3',
'audio/die/re_wuguotai.mp3',
'audio/die/re_wuyi.mp3',
'audio/die/re_xiahoudun.mp3',
Expand Down Expand Up @@ -753,6 +754,7 @@ window.noname_asset_list=[
'audio/die/re_zhaoyun.mp3',
'audio/die/re_zhenji.mp3',
'audio/die/re_zhonghui.mp3',
'audio/die/re_zhongyao.mp3',
'audio/die/re_zhoucang.mp3',
'audio/die/re_zhouyu.mp3',
'audio/die/re_zhugeliang.mp3',
Expand Down Expand Up @@ -2679,6 +2681,8 @@ window.noname_asset_list=[
'audio/skill/huoji2.mp3',
'audio/skill/huomo_huzhao1.mp3',
'audio/skill/huomo_huzhao2.mp3',
'audio/skill/huomo_re_zhongyao1.mp3',
'audio/skill/huomo_re_zhongyao2.mp3',
'audio/skill/huomo1.mp3',
'audio/skill/huomo2.mp3',
'audio/skill/huoshou1_re_menghuo1.mp3',
Expand Down Expand Up @@ -5734,6 +5738,8 @@ window.noname_asset_list=[
'audio/skill/zhenshan2.mp3',
'audio/skill/zhente1.mp3',
'audio/skill/zhente2.mp3',
'audio/skill/zhenwei_re_wenpin1.mp3',
'audio/skill/zhenwei_re_wenpin2.mp3',
'audio/skill/zhenwei1.mp3',
'audio/skill/zhenwei2.mp3',
'audio/skill/zhiba2_re_sunben1.mp3',
Expand Down Expand Up @@ -5888,6 +5894,8 @@ window.noname_asset_list=[
'audio/skill/zuixiang.mp3',
'audio/skill/zunwei1.mp3',
'audio/skill/zunwei2.mp3',
'audio/skill/zuoding_re_zhongyao1.mp3',
'audio/skill/zuoding_re_zhongyao2.mp3',
'audio/skill/zuoding1.mp3',
'audio/skill/zuoding2.mp3',
'audio/skill/zuoxing1.mp3',
Expand Down
257 changes: 124 additions & 133 deletions game/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -26111,60 +26111,72 @@
return list;
},
addSkillTrigger:function(skill,hidden,triggeronly){
let skills=game.expandSkills([skill]);
for(let skill of skills){
let info=lib.skill[skill];
if(!info){
console.trace(`Cannot find skill: ${skill}\nPlease check if game.expandSkills is overwritten`);
continue;
var info=lib.skill[skill];
if(!info) return;
if(typeof info.group=='string'){
this.addSkillTrigger(info.group,hidden);
}
else if(Array.isArray(info.group)){
for(var i=0;i<info.group.length;i++){
this.addSkillTrigger(info.group[i],hidden);
}
if(!triggeronly){
if(info.global&&(!hidden||info.globalSilent)){
if(typeof info.global=='string'){
game.addGlobalSkill(info.global,this);
}
else{
for(let j=0;j<info.global.length;j++){
game.addGlobalSkill(info.global[j],this);
}
}
if(!triggeronly){
if(info.global&&(!hidden||info.globalSilent)){
if(typeof info.global=='string'){
game.addGlobalSkill(info.global,this);
}
else{
for(var j=0;j<info.global.length;j++){
game.addGlobalSkill(info.global[j],this);
}
}
if(this.initedSkills.contains(skill)) return this;
this.initedSkills.push(skill);
if(info.init&&!_status.video) info.init(this,skill);
}
if(info.trigger&&this.playerid){
let playerid=this.playerid;
let setTrigger=function(i,evt){
if(i=='global'){
if(!lib.hook.globaltrigger[evt]){
lib.hook.globaltrigger[evt]={};
}
if(!lib.hook.globaltrigger[evt][playerid]){
lib.hook.globaltrigger[evt][playerid]=[];
}
lib.hook.globaltrigger[evt][playerid].add(skill);
if(this.initedSkills.contains(skill)) return this;
this.initedSkills.push(skill);
if(info.init&&!_status.video){
info.init(this,skill);
}
}
if(info.trigger&&this.playerid){
var playerid=this.playerid;
var setTrigger=function(i,evt){
if(i=='global'){
if(!lib.hook.globaltrigger[evt]){
lib.hook.globaltrigger[evt]={};
}
else{
let name=playerid+'_'+i+'_'+evt;
if(!lib.hook[name]) lib.hook[name]=[];
lib.hook[name].add(skill);
if(!lib.hook.globaltrigger[evt][playerid]){
lib.hook.globaltrigger[evt][playerid]=[];
}
lib.hookmap[evt]=true;
lib.hook.globaltrigger[evt][playerid].add(skill);
}
for(let i in info.trigger){
if(typeof info.trigger[i]=='string') setTrigger(i,info.trigger[i]);
else if(Array.isArray(info.trigger[i])){
for(let trigger of info.trigger[i]) setTrigger(i,trigger);
else{
var name=playerid+'_'+i+'_'+evt;
if(!lib.hook[name]){
lib.hook[name]=[];
}
lib.hook[name].add(skill);
}
lib.hookmap[evt]=true;
}
if(info.hookTrigger){
if(!this._hookTrigger) this._hookTrigger=[];
this._hookTrigger.add(skill);
for(var i in info.trigger){
if(typeof info.trigger[i]=='string'){
setTrigger(i,info.trigger[i]);
}
else if(Array.isArray(info.trigger[i])){
for(var j=0;j<info.trigger[i].length;j++){
setTrigger(i,info.trigger[i][j]);
}
}
}
}
if(info.hookTrigger){
if(!this._hookTrigger){
this._hookTrigger=[];
}
if(_status.event&&_status.event.addTrigger) _status.event.addTrigger(skill,this);
this._hookTrigger.add(skill);
}
if(_status.event&&_status.event.addTrigger) _status.event.addTrigger(skill,this);
return this;
},
addSkillLog:function(skill){
Expand Down Expand Up @@ -26462,49 +26474,59 @@
return this;
},
removeSkillTrigger:function(skill,triggeronly){
let skills=game.expandSkills([skill]);
for(let skill of skills){
let info=lib.skill[skill];
if(!info){
console.trace(`Cannot find skill: ${skill}\nPlease check if game.expandSkills is overwritten`);
continue;
var info=lib.skill[skill];
if(!info) return;
if(typeof info.group=='string'){
this.removeSkillTrigger(info.group);
}
else if(Array.isArray(info.group)){
for(var i=0;i<info.group.length;i++){
this.removeSkillTrigger(info.group[i]);
}
if(!triggeronly) this.initedSkills.remove(skill);
if(info.trigger){
let playerid=this.playerid;
let removeTrigger=function(i,evt){
if(i=='global'){
for(let j in lib.hook.globaltrigger){
if(lib.hook.globaltrigger[j][playerid]){
lib.hook.globaltrigger[j][playerid].remove(skill);
if(lib.hook.globaltrigger[j][playerid].length==0){
delete lib.hook.globaltrigger[j][playerid];
}
if(get.is.empty(lib.hook.globaltrigger[j])){
delete lib.hook.globaltrigger[j];
}
}
if(!triggeronly) this.initedSkills.remove(skill);
if(info.trigger){
var playerid=this.playerid;
var removeTrigger=function(i,evt){
if(i=='global'){
for(var j in lib.hook.globaltrigger){
if(lib.hook.globaltrigger[j][playerid]){
lib.hook.globaltrigger[j][playerid].remove(skill);
if(lib.hook.globaltrigger[j][playerid].length==0){
delete lib.hook.globaltrigger[j][playerid];
}
if(get.is.empty(lib.hook.globaltrigger[j])){
delete lib.hook.globaltrigger[j];
}
}
}
else{
let name=playerid+'_'+i+'_'+evt;
if(lib.hook[name]){
lib.hook[name].remove(skill);
if(lib.hook[name].length==0) delete lib.hook[name];
}
else{
var name=playerid+'_'+i+'_'+evt;
if(lib.hook[name]){
lib.hook[name].remove(skill);
if(lib.hook[name].length==0){
delete lib.hook[name];
}
}
}
for(let i in info.trigger){
if(typeof info.trigger[i]=='string') removeTrigger(i,info.trigger[i]);
else if(Array.isArray(info.trigger[i])){
for(let trigger of info.trigger[i]) removeTrigger(i,trigger);
}
for(var i in info.trigger){
if(typeof info.trigger[i]=='string'){
removeTrigger(i,info.trigger[i]);
}
else if(Array.isArray(info.trigger[i])){
for(var j=0;j<info.trigger[i].length;j++){
removeTrigger(i,info.trigger[i][j]);
}
}
}
if(info.hookTrigger){
if(this._hookTrigger){
this._hookTrigger.remove(skill);
if(!this._hookTrigger.length) delete this._hookTrigger;
}
if(info.hookTrigger){
if(this._hookTrigger){
this._hookTrigger.remove(skill);
if(!this._hookTrigger.length){
delete this._hookTrigger;
}
}
}
Expand Down Expand Up @@ -40250,7 +40272,7 @@
if(drawDeck&&drawDeck.drawDeck) players[0].draw(num2,drawDeck);
else players[0].draw(num2);
},
finishSkill:(i,history)=>{
finishSkill:(i,sub)=>{
const mode=get.mode(),info=lib.skill[i],iInfo=`${i}_info`;
if(info.alter){
lib.translate[`${iInfo}_origin`]=lib.translate[iInfo];
Expand Down Expand Up @@ -40293,25 +40315,14 @@
});
}
if(info.inherit){
var inheritHistory=[];
while(true){
if(!info.inherit) break;
if(inheritHistory.includes(info.inherit)){
console.trace(`Inherit Error: ${info.inherit} in ${i}'s inherit forms a deadlock`);
break;
}
inheritHistory.push(info.inherit);

const inheritInfo=lib.skill[info.inherit];
if(inheritInfo) Object.keys(inheritInfo).forEach(value=>{
if(info[value]!=undefined) return;
if(value=='audio'&&(typeof info[value]=='number'||typeof info[value]=='boolean')) info[value]=info.inherit;
else info[value]=inheritInfo[value];
});
if(lib.translate[i]==undefined) lib.translate[i]=lib.translate[info.inherit];
if(lib.translate[`${i}_info`]==undefined) lib.translate[`${i}_info`]=lib.translate[`${info.inherit}_info`];
if(!inheritInfo||!inheritInfo.inherit) info.inherit=void 0;
}
const skill=lib.skill[info.inherit];
if(skill) Object.keys(skill).forEach(value=>{
if(info[value]!=undefined) return;
if(value=='audio'&&(typeof info[value]=='number'||typeof info[value]=='boolean')) info[value]=info.inherit;
else info[value]=skill[value];
});
if(lib.translate[i]==undefined) lib.translate[i]=lib.translate[info.inherit];
if(lib.translate[iInfo]==undefined) lib.translate[iInfo]=lib.translate[`${info.inherit}_info`];
}
if(info.limited){
if(info.mark===undefined) info.mark=true;
Expand All @@ -40320,26 +40331,16 @@
if(info.skillAnimation===undefined) info.skillAnimation=true;
if(info.init===undefined) info.init=(player,skill)=>player.storage[skill]=false;
}
if(info.subSkill){
let subSkillHistory=Array.isArray(history)?history:[];
for(let value in info.subSkill){
if(subSkillHistory.includes(value)){
console.trace(`SubSkill Error: ${value} in ${i} forms a deadlock`);
continue;
}
let history=subSkillHistory.slice(0);
history.push(value);

const iValue=`${i}_${value}`;
lib.skill[iValue]=info.subSkill[value];
lib.skill[iValue].sub=true;
if(info.subSkill[value].name) lib.translate[iValue]=info.subSkill[value].name;
else lib.translate[iValue]=lib.translate[iValue]||lib.translate[i];
if(info.subSkill[value].description) lib.translate[`${iValue}_info`]=info.subSkill[value].description;
if(info.subSkill[value].marktext) lib.translate[`${iValue}_bg`]=info.subSkill[value].marktext;
game.finishSkill(iValue,history);
}
}
if(info.subSkill&&!sub) Object.keys(info.subSkill).forEach(value=>{
const iValue=`${i}_${value}`;
lib.skill[iValue]=info.subSkill[value];
lib.skill[iValue].sub=true;
if(info.subSkill[value].name) lib.translate[iValue]=info.subSkill[value].name;
else lib.translate[iValue]=lib.translate[iValue]||lib.translate[i];
if(info.subSkill[value].description) lib.translate[`${iValue}_info`]=info.subSkill[value].description;
if(info.subSkill[value].marktext) lib.translate[`${iValue}_bg`]=info.subSkill[value].marktext;
game.finishSkill(iValue,true);
});
if(info.round){
const k=`${i}_roundcount`;
if(typeof info.group=='string') info.group=[info.group,k];
Expand Down Expand Up @@ -41237,25 +41238,15 @@
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));
},
expandSkills:(skill,oldHistory)=>{
let history=[];
if(oldHistory) history.addArray(oldHistory);
if(Array.isArray(skill)){
return skill.reduce((previous,current)=>previous.addArray(game.expandSkills(current,history)),[]);
}

let info=get.info(skill);
if(!info){
console.trace(`Cannot find skill: ${skill}`);
return history;
}
history.add(skill);
if(info.group){
let group=Array.isArray(info.group)?info.group:[info.group];
history.addArray(game.expandSkills([].addArray(group.filter(skill=>!history.includes(skill))),history));
expandSkills:skills=>skills.addArray(skills.reduce((previousValue,currentValue)=>{
const info=get.info(currentValue);
if(info){
if(Array.isArray(info.group)) previousValue.push(...info.group);
else if(info.group) previousValue.push(info.group);
}
return history;
},
else console.log(currentValue);
return previousValue;
},[])),
css:style=>Object.keys(style).forEach(value=>{
let uiStyle=ui.style[value];
if(!uiStyle){
Expand Down
Loading

0 comments on commit 4298361

Please sign in to comment.