diff --git a/audio/die/ol_sb_yuanshao_shadow.mp3 b/audio/die/ol_sb_yuanshao_shadow.mp3 new file mode 100644 index 000000000..9be859c7d Binary files /dev/null and b/audio/die/ol_sb_yuanshao_shadow.mp3 differ diff --git a/audio/skill/olsbhetao3.mp3 b/audio/skill/olsbhetao3.mp3 new file mode 100644 index 000000000..3bf9631c6 Binary files /dev/null and b/audio/skill/olsbhetao3.mp3 differ diff --git a/audio/skill/olsbhetao_ol_sb_yuanshao_shadow1.mp3 b/audio/skill/olsbhetao_ol_sb_yuanshao_shadow1.mp3 new file mode 100644 index 000000000..d20356e60 Binary files /dev/null and b/audio/skill/olsbhetao_ol_sb_yuanshao_shadow1.mp3 differ diff --git a/audio/skill/olsbhetao_ol_sb_yuanshao_shadow2.mp3 b/audio/skill/olsbhetao_ol_sb_yuanshao_shadow2.mp3 new file mode 100644 index 000000000..450e2ac05 Binary files /dev/null and b/audio/skill/olsbhetao_ol_sb_yuanshao_shadow2.mp3 differ diff --git a/audio/skill/olsbhetao_ol_sb_yuanshao_shadow3.mp3 b/audio/skill/olsbhetao_ol_sb_yuanshao_shadow3.mp3 new file mode 100644 index 000000000..ee336aa86 Binary files /dev/null and b/audio/skill/olsbhetao_ol_sb_yuanshao_shadow3.mp3 differ diff --git a/audio/skill/olsbshenli3.mp3 b/audio/skill/olsbshenli3.mp3 new file mode 100644 index 000000000..22e9cef29 Binary files /dev/null and b/audio/skill/olsbshenli3.mp3 differ diff --git a/audio/skill/olsbshenli_ol_sb_yuanshao_shadow1.mp3 b/audio/skill/olsbshenli_ol_sb_yuanshao_shadow1.mp3 new file mode 100644 index 000000000..28d57444d Binary files /dev/null and b/audio/skill/olsbshenli_ol_sb_yuanshao_shadow1.mp3 differ diff --git a/audio/skill/olsbshenli_ol_sb_yuanshao_shadow2.mp3 b/audio/skill/olsbshenli_ol_sb_yuanshao_shadow2.mp3 new file mode 100644 index 000000000..be65b1609 Binary files /dev/null and b/audio/skill/olsbshenli_ol_sb_yuanshao_shadow2.mp3 differ diff --git a/audio/skill/olsbshenli_ol_sb_yuanshao_shadow3.mp3 b/audio/skill/olsbshenli_ol_sb_yuanshao_shadow3.mp3 new file mode 100644 index 000000000..22526e164 Binary files /dev/null and b/audio/skill/olsbshenli_ol_sb_yuanshao_shadow3.mp3 differ diff --git a/audio/skill/olsbshishou3.mp3 b/audio/skill/olsbshishou3.mp3 new file mode 100644 index 000000000..56babae04 Binary files /dev/null and b/audio/skill/olsbshishou3.mp3 differ diff --git a/audio/skill/olsbshishou_ol_sb_yuanshao_shadow1.mp3 b/audio/skill/olsbshishou_ol_sb_yuanshao_shadow1.mp3 new file mode 100644 index 000000000..45aba89e8 Binary files /dev/null and b/audio/skill/olsbshishou_ol_sb_yuanshao_shadow1.mp3 differ diff --git a/audio/skill/olsbshishou_ol_sb_yuanshao_shadow2.mp3 b/audio/skill/olsbshishou_ol_sb_yuanshao_shadow2.mp3 new file mode 100644 index 000000000..63dea5d57 Binary files /dev/null and b/audio/skill/olsbshishou_ol_sb_yuanshao_shadow2.mp3 differ diff --git a/audio/skill/olsbshishou_ol_sb_yuanshao_shadow3.mp3 b/audio/skill/olsbshishou_ol_sb_yuanshao_shadow3.mp3 new file mode 100644 index 000000000..9183bb7c5 Binary files /dev/null and b/audio/skill/olsbshishou_ol_sb_yuanshao_shadow3.mp3 differ diff --git a/audio/skill/olsbyufeng2.mp3 b/audio/skill/olsbyufeng2.mp3 new file mode 100644 index 000000000..1b7a92a15 Binary files /dev/null and b/audio/skill/olsbyufeng2.mp3 differ diff --git a/audio/skill/olsbyufeng_ol_sb_yuanshao_shadow1.mp3 b/audio/skill/olsbyufeng_ol_sb_yuanshao_shadow1.mp3 new file mode 100644 index 000000000..ad0c6ee97 Binary files /dev/null and b/audio/skill/olsbyufeng_ol_sb_yuanshao_shadow1.mp3 differ diff --git a/character/onlyOL.js b/character/onlyOL.js index 9ac091b48..d5c633b77 100644 --- a/character/onlyOL.js +++ b/character/onlyOL.js @@ -24,6 +24,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, characterReplace:{ }, + characterSubstitute:{ + ol_sb_yuanshao:[ + ], + }, card:{ sizhaojian:{ derivation:'ol_sb_yuanshao', @@ -47,7 +51,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ //OL谋袁绍 //真·四世三公——袁神,启动 olsbhetao:{ - audio:2, + audio:3, + audioname:['ol_sb_yuanshao_shadow'], trigger:{global:'useCardToPlayered'}, filter(event,player){ return event.player!=player&&event.isFirstTarget&&event.targets.length>1&&player.countCards('he',card=>{ @@ -80,6 +85,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(bool){ const target=targets[0]; player.logSkill('olsbhetao',target); + player.changeSkin('olsbhetao','ol_sb_yuanshao'); player.discard(cards); trigger.getParent().effectCount++; trigger.getParent().excluded.addArray(game.filterPlayer(i=>trigger.targets.includes(i)&&target!=i)); @@ -110,7 +116,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, olsbshenli:{ - audio:2, + audio:3, + audioname:['ol_sb_yuanshao_shadow'], trigger:{player:'useCardToPlayered'}, filter(event,player){ if(!player.isPhaseUsing()||player.hasSkill('olsbshenli_used')) return false; @@ -145,6 +152,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return num2+(sum>player.countCards('h')?Math.min(5,sum):0)+(sum>player.getHp()?num2:0)>=num1; }, async content(event,trigger,player){ + player.changeSkin('olsbshenli','ol_sb_yuanshao_shadow'); player.addTempSkill('olsbshenli_used','phaseUseAfter'); trigger.getParent().targets.addArray(game.filterPlayer(target=>{ return !trigger.targets.includes(target)&&player.canUse(trigger.card,target,false); @@ -168,7 +176,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ subSkill:{used:{charlotte:true}}, }, olsbyufeng:{ - audio:1, + audio:2, + audioname2:{ + ol_sb_yuanshao_shadow:'olsbyufeng_ol_sb_yuanshao_shadow', + }, trigger:{ global:'phaseBefore', player:'enterGame', @@ -192,6 +203,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.equip(card); }, subSkill:{ + ol_sb_yuanshao_shadow:{ + audio:1, + }, sizhaojian:{ equipSkill:true, mod:{ @@ -249,7 +263,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, olsbshishou:{ unique:true, - audio:2, + audio:3, + audioname:['ol_sb_yuanshao_shadow'], trigger:{global:['loseAfter','equipAfter','addJudgeAfter','gainAfter','loseAsyncAfter','addToExpansionAfter']}, filter(event,player){ if(player.getEquip(1)) return false; diff --git a/image/character/ol_sb_yuanshao.jpg b/image/character/ol_sb_yuanshao.jpg index 96af5734a..8bc400a7e 100644 Binary files a/image/character/ol_sb_yuanshao.jpg and b/image/character/ol_sb_yuanshao.jpg differ diff --git a/image/character/ol_sb_yuanshao_shadow.jpg b/image/character/ol_sb_yuanshao_shadow.jpg new file mode 100644 index 000000000..1dc211365 Binary files /dev/null and b/image/character/ol_sb_yuanshao_shadow.jpg differ diff --git a/noname/library/element/content.js b/noname/library/element/content.js index 83fb76409..7b6dc4883 100644 --- a/noname/library/element/content.js +++ b/noname/library/element/content.js @@ -8092,8 +8092,11 @@ export const Content = { _status.dying.remove(player); if (lib.config.background_speak) { - if (lib.character[player.name] && lib.character[player.name][4].some(tag => /^die:.+$/.test(tag))) { - var tag = lib.character[player.name][4].find(tag => /^die:.+$/.test(tag)); + const name = (player.skin.name || player.name); + const goon = (!lib.character[name]); + if (goon) lib.character[name] = ['', '', 0, [], ((lib.characterSubstitute[player.name] || []).find(i => i[0] == name) || [name, []])[1]]; + if (lib.character[name][4].some(tag => /^die:.+$/.test(tag))) { + var tag = lib.character[name][4].find(tag => /^die:.+$/.test(tag)); var reg = new RegExp("^ext:(.+)?/"); var match = tag.match(/^die:(.+)$/); if (match) { @@ -8102,16 +8105,17 @@ export const Content = { game.playAudio(path); } } - else if (lib.character[player.name] && lib.character[player.name][4].some(tag => tag.startsWith('die_audio'))) { - var tag = lib.character[player.name][4].find(tag => tag.startsWith('die_audio')); + else if (lib.character[name][4].some(tag => tag.startsWith('die_audio'))) { + var tag = lib.character[name][4].find(tag => tag.startsWith('die_audio')); var list = tag.split(':').slice(1); - game.playAudio('die', list.length ? list[0] : player.name); + game.playAudio('die', list.length ? list[0] : name); } else { - game.playAudio('die', player.name, function () { - game.playAudio('die', player.name.slice(player.name.indexOf('_') + 1)); + game.playAudio('die', name, function () { + game.playAudio('die', name.slice(name.indexOf('_') + 1)); }); } + if (goon) delete lib.character[name]; } }, player); diff --git a/noname/library/element/player.js b/noname/library/element/player.js index b0f1bf01e..69a02610f 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -2128,6 +2128,10 @@ export class Player extends HTMLDivElement { this.name = character; this.name1 = character; this.tempname = []; + this.skin = { + name: character, + name2: character2, + }; this.sex = info[0]; this.group = info[1]; this.hp = hp1; @@ -2310,6 +2314,42 @@ export class Player extends HTMLDivElement { return this; } + /** + * 换肤换音:想要支持某个武将更换皮肤,必须在lib.character.characterSubstitute中存在该武将的id(以下以name代指武将id,character代指换肤图片名) + * + * 如果换肤换音引用本体的image/character素材作为更换的皮肤且不需要使用本体audio/die以外的地方的配音,则你无需在characterSubstitute中书写关于此皮肤的信息 + * + * 如果lib.character[character]不存在,且想引用其他路径的图片素材或阵亡素材,请以[character,[]]的形式写入lib.character.characterSubstitute[name]中,第二个数组填入形式同lib.character[4]的书写形式 + * + * @param { string | string } + */ + changeSkin(skill, character) { + if (!skill || !character) { + console.log('error: no sourceSkill or character to changeSkin', get.translation(this)); + return; + } + for (const i of ['name', 'name1', 'name2']) { + if (i == 'name1' && this.name === this.name1) continue; + const list = lib.characterSubstitute[this[i]]; + if (this[i] && list) { + if ((get.character(this[i], 3) || []).includes(skill)) { + const name = (i == 'name2' ? 'name2' : 'name'); + if (this.skin[name] != character) { + game.broadcastAll((player, name, character, list) => { + player.tempname.remove(player.skin[name]); + player.tempname.add(character); + player.skin[name] = character; + const goon = (!lib.character[character]); + if (goon) lib.character[character] = ['', '', 0, [], (list.find(i => i[0] == character) || [character, []])[1]]; + player.node['avatar' + name.slice(4)].setBackground(character, 'character'); + player.node['avatar' + name.slice(4)].show(); + if (goon) delete lib.character[character]; + }, this, name, character, list); + } + } + } + } + } initOL(name, character) { this.node.avatar.setBackground(character, 'character'); this.node.avatar.show(); @@ -2568,6 +2608,7 @@ export class Player extends HTMLDivElement { delete this.name; delete this.name1; delete this.tempname; + delete this.skin; delete this.sex; delete this.group; delete this.hp; diff --git a/noname/library/index.js b/noname/library/index.js index b5ee89964..cf09ad9fd 100644 --- a/noname/library/index.js +++ b/noname/library/index.js @@ -63,6 +63,7 @@ export class Library extends Uninstantable { static characterFilter = {}; static characterSort = {}; static characterReplace = {}; + static characterSubstitute = {}; static characterInitFilter = {}; static characterGuozhanFilter = ["mode_guozhan"]; static dynamicTranslate = {};