diff --git a/character/clan/voices.js b/character/clan/voices.js
index dd6a012d4..ec928239a 100644
--- a/character/clan/voices.js
+++ b/character/clan/voices.js
@@ -94,7 +94,9 @@ export default {
"#clanxieshu2": "我有佐国之术,可缚苍龙。",
"#clanbaozu_clan_zhonghui1": "不为刀下脍,且做俎上刀。",
"#clanbaozu_clan_zhonghui2": "吾族恒大,谁敢欺之?",
- "#clan_zhonghui:die": "谋事在人,成事在天……",
+ "#clan_zhonghui:die": "兵来似欲作恶,当云何?",
+ "#clan_zhonghui2:die": "伯约误我!",
+ "#clan_zhonghui3:die": "谋事在人,成事在天……",
"#clanjiejian1": "庙胜之策,不临矢石。",
"#clanjiejian2": "王者之兵,有征无战。",
"#clanhuanghan1": "居天子阶下,故诚惶诚恐。",
diff --git a/noname/game/index.js b/noname/game/index.js
index 13c0d8608..1ad182e66 100644
--- a/noname/game/index.js
+++ b/noname/game/index.js
@@ -1580,6 +1580,60 @@ export class Game {
return getAudioList(skill, { audioname: [], history: [] }, skillInfo);
}
+ /**
+ * 获取角色死亡时能播放的所有阵亡语音
+ * @param { string | Player } player 角色名
+ * @returns { any[] } 语音地址列表
+ */
+ parseDieTextMap(player){
+ let name, rawName;
+ if (typeof player === "string") {
+ name = player;
+ rawName = name;
+ }
+ else if (get.itemtype(player) === "player") {
+ // @ts-ignore
+ name = player.skin.name || player.name;
+ rawName = player.name;
+ }
+ const info = get.character(name), datas = [];
+ let dieAudios;
+ if(info && info.dieAudios.length > 0){
+ dieAudios = info.dieAudios;
+ }
+ //@mengxinzxz写的屎山
+ else if(rawName !== name && lib.characterSubstitute[rawName] && lib.characterSubstitute[rawName].some((i) => i[0] == name)){
+ const trashes = lib.characterSubstitute[rawName].find((i) => i[0] == name)[1];
+ const newCharacter = get.convertedCharacter(['','',0,[],trashes]);
+ dieAudios = newCharacter.dieAudios;
+ }
+ if(dieAudios && dieAudios.length > 0){
+ dieAudios.forEach(item => {
+ let key, file;
+ if(item.startsWith("ext:")){
+ key = item.slice(4).split("/")[1];
+ file = item;
+ }
+ else {
+ key = item;
+ file = `die/${item}.mp3`;
+ }
+ const data = {key, file}
+ if(lib.translate[`#${key}:die`]) data.text = lib.translate[`#${key}:die`];
+ datas.push(data);
+ });
+ }
+ else {
+ const data = {
+ key: name,
+ file: `die/${name}.mp3`,
+ isDefault: true,
+ }
+ if(lib.translate[`#${name}:die`]) data.text = lib.translate[`#${name}:die`];
+ datas.push(data);
+ }
+ return datas;
+ }
/**
*
* @param { string } skill
diff --git a/noname/library/element/character.js b/noname/library/element/character.js
index cd9b9eba8..085de4def 100644
--- a/noname/library/element/character.js
+++ b/noname/library/element/character.js
@@ -145,6 +145,11 @@ export class Character {
* @type { string[] }
**/
clans = [];
+ /**
+ * 武将牌拥有的全部阵亡语音
+ * @type { string[] }
+ **/
+ dieAudios = [];
/**
* 武将牌“无法享受到的主公/地主红利”
* @type { string[] }
@@ -191,6 +196,7 @@ export class Character {
this.clans = [];
this.initFilters = [];
this.trashBin = [];
+ this.dieAudios = [];
}
/**
* @param { any[] } trash
@@ -248,6 +254,10 @@ export class Character {
clans.push(item.slice(5));
} else if (item.startsWith("InitFilter:")) {
this.initFilters = item.slice(11).split(":");
+ } else if (item.startsWith("die:")){
+ this.dieAudios.push(item.slice(4));
+ } else if (item.startsWith("die_audio:")){
+ this.dieAudios = item.slice(10).split(":");
} else {
keptTrashes.push(item);
}
@@ -369,6 +379,10 @@ export class Character {
if (character.initFilters.length > 0) {
trashes.push(`InitFilters:${character.initFilters.join(":")}`);
}
+ if (character.dieAudios.length > 0) {
+ if (character.dieAudios.length === 1) trashes.push(`die:${character.dieAudios[0]}`)
+ else trashes.push(`die_audio:${character.dieAudios.join(":")}`);
+ }
return new Proxy(trashes.concat(character.trashBin), {
set(target, prop, newValue) {
diff --git a/noname/library/element/content.js b/noname/library/element/content.js
index 5eb0e0dbb..cdba51a66 100644
--- a/noname/library/element/content.js
+++ b/noname/library/element/content.js
@@ -8786,38 +8786,16 @@ export const Content = {
_status.dying.remove(player);
if (lib.config.background_speak) {
- 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) {
- var path = match[1];
- if (reg.test(path)) path = path.replace(reg, (_o, p) => `../extension/${p}/`);
- game.playAudio(path);
- }
- } 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.randomGet() : name);
- } else {
+ const audios = game.parseDieTextMap(player).randomGet();
+ if (audios.isDefault) {
+ const name = audios.key;
game.playAudio("die", name, function () {
game.playAudio("die", name.slice(name.indexOf("_") + 1));
});
}
- if (goon) delete lib.character[name];
+ else{
+ game.playAudio(audios.file);
+ }
}
}, player);
diff --git a/noname/ui/click/index.js b/noname/ui/click/index.js
index 97c59fd88..fec5835d3 100644
--- a/noname/ui/click/index.js
+++ b/noname/ui/click/index.js
@@ -3633,21 +3633,23 @@ export class Click {
htmlParser.innerHTML = get.characterIntro(name);
Array.from(htmlParser.childNodes).forEach((value) => introduction.appendChild(value));
//添加技能语音部分
- const dieAudio = lib.translate[`#${name}:die`];
+ const dieAudios = game.parseDieTextMap(name).filter(i => "text" in i);
const skillAudioMap = new Map();
nameInfo.skills.forEach(skill => {
const voiceMap = game.parseSkillText(skill, name, null, true);
if(voiceMap.length) skillAudioMap.set(skill, voiceMap);
});
- if (dieAudio || skillAudioMap.size > 0){
+ if (dieAudios.length || skillAudioMap.size > 0) {
introduction.appendChild(document.createElement("hr"));
- const skillNameSpan = document.createElement("span");
- skillNameSpan.innerHTML = `技能台词
`;
- introduction.appendChild(skillNameSpan);
- if(skillAudioMap.size > 0){
+ if (skillAudioMap.size > 0) {
+ const skillNameSpan = document.createElement("span");
+ skillNameSpan.innerHTML = `技能台词
`;
+ introduction.appendChild(skillNameSpan);
+
skillAudioMap.forEach((texts, skill) => {
- const skillNameSpan = document.createElement("span"), skillNameSpanStyle = skillNameSpan.style;
+ const skillNameSpan = document.createElement("span"),
+ skillNameSpanStyle = skillNameSpan.style;
skillNameSpanStyle.fontWeight = "bold";
skillNameSpan.innerHTML = `
${get.translation(skill)}
`;
introduction.appendChild(skillNameSpan);
@@ -3655,18 +3657,22 @@ export class Click {
const skillTextSpan = document.createElement("span");
skillTextSpan.innerHTML = `${index + 1}. ${text}
`;
introduction.appendChild(skillTextSpan);
- })
+ });
});
}
- if(dieAudio){
- const skillNameSpan = document.createElement("span"), skillNameSpanStyle = skillNameSpan.style;
+
+ if (dieAudios.length > 0) {
+ const skillNameSpan = document.createElement("span"),
+ skillNameSpanStyle = skillNameSpan.style;
skillNameSpanStyle.fontWeight = "bold";
- skillNameSpan.innerHTML = `
阵亡台词
`;
+ skillNameSpan.innerHTML = `
阵亡台词`;
introduction.appendChild(skillNameSpan);
-
- const skillTextSpan = document.createElement("span");
- skillTextSpan.innerHTML = `${dieAudio}`;
- introduction.appendChild(skillTextSpan);
+
+ dieAudios.forEach((item, index) => {
+ const dieTextSpan = document.createElement("span");
+ dieTextSpan.innerHTML = `
${dieAudios.length > 1 ? `${index + 1}. ` : ""}${item.text}`;
+ introduction.appendChild(dieTextSpan);
+ });
}
}
const introduction2 = ui.create.div(".characterintro.intro2", uiintro);