Merge pull request #1056 from mengxinzxz/PR-Branch

增加换肤换音系统,谋袁绍原画画质提升,谋袁绍配音素材补充
This commit is contained in:
Spmario233 2024-03-10 14:45:37 +08:00 committed by GitHub
commit 1ca710f6f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 75 additions and 11 deletions

Binary file not shown.

BIN
audio/skill/olsbhetao3.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
audio/skill/olsbshenli3.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
audio/skill/olsbyufeng2.mp3 Normal file

Binary file not shown.

Binary file not shown.

View File

@ -24,6 +24,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
characterReplace:{ characterReplace:{
}, },
characterSubstitute:{
ol_sb_yuanshao:[
],
},
card:{ card:{
sizhaojian:{ sizhaojian:{
derivation:'ol_sb_yuanshao', derivation:'ol_sb_yuanshao',
@ -47,7 +51,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
//OL谋袁绍 //OL谋袁绍
//真·四世三公——袁神,启动 //真·四世三公——袁神,启动
olsbhetao:{ olsbhetao:{
audio:2, audio:3,
audioname:['ol_sb_yuanshao_shadow'],
trigger:{global:'useCardToPlayered'}, trigger:{global:'useCardToPlayered'},
filter(event,player){ filter(event,player){
return event.player!=player&&event.isFirstTarget&&event.targets.length>1&&player.countCards('he',card=>{ 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){ if(bool){
const target=targets[0]; const target=targets[0];
player.logSkill('olsbhetao',target); player.logSkill('olsbhetao',target);
player.changeSkin('olsbhetao','ol_sb_yuanshao');
player.discard(cards); player.discard(cards);
trigger.getParent().effectCount++; trigger.getParent().effectCount++;
trigger.getParent().excluded.addArray(game.filterPlayer(i=>trigger.targets.includes(i)&&target!=i)); 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:{ olsbshenli:{
audio:2, audio:3,
audioname:['ol_sb_yuanshao_shadow'],
trigger:{player:'useCardToPlayered'}, trigger:{player:'useCardToPlayered'},
filter(event,player){ filter(event,player){
if(!player.isPhaseUsing()||player.hasSkill('olsbshenli_used')) return false; 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; return num2+(sum>player.countCards('h')?Math.min(5,sum):0)+(sum>player.getHp()?num2:0)>=num1;
}, },
async content(event,trigger,player){ async content(event,trigger,player){
player.changeSkin('olsbshenli','ol_sb_yuanshao_shadow');
player.addTempSkill('olsbshenli_used','phaseUseAfter'); player.addTempSkill('olsbshenli_used','phaseUseAfter');
trigger.getParent().targets.addArray(game.filterPlayer(target=>{ trigger.getParent().targets.addArray(game.filterPlayer(target=>{
return !trigger.targets.includes(target)&&player.canUse(trigger.card,target,false); 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}}, subSkill:{used:{charlotte:true}},
}, },
olsbyufeng:{ olsbyufeng:{
audio:1, audio:2,
audioname2:{
ol_sb_yuanshao_shadow:'olsbyufeng_ol_sb_yuanshao_shadow',
},
trigger:{ trigger:{
global:'phaseBefore', global:'phaseBefore',
player:'enterGame', player:'enterGame',
@ -192,6 +203,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.equip(card); player.equip(card);
}, },
subSkill:{ subSkill:{
ol_sb_yuanshao_shadow:{
audio:1,
},
sizhaojian:{ sizhaojian:{
equipSkill:true, equipSkill:true,
mod:{ mod:{
@ -249,7 +263,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
olsbshishou:{ olsbshishou:{
unique:true, unique:true,
audio:2, audio:3,
audioname:['ol_sb_yuanshao_shadow'],
trigger:{global:['loseAfter','equipAfter','addJudgeAfter','gainAfter','loseAsyncAfter','addToExpansionAfter']}, trigger:{global:['loseAfter','equipAfter','addJudgeAfter','gainAfter','loseAsyncAfter','addToExpansionAfter']},
filter(event,player){ filter(event,player){
if(player.getEquip(1)) return false; if(player.getEquip(1)) return false;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -8092,8 +8092,11 @@ export const Content = {
_status.dying.remove(player); _status.dying.remove(player);
if (lib.config.background_speak) { if (lib.config.background_speak) {
if (lib.character[player.name] && lib.character[player.name][4].some(tag => /^die:.+$/.test(tag))) { const name = (player.skin.name || player.name);
var tag = lib.character[player.name][4].find(tag => /^die:.+$/.test(tag)); 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 reg = new RegExp("^ext:(.+)?/");
var match = tag.match(/^die:(.+)$/); var match = tag.match(/^die:(.+)$/);
if (match) { if (match) {
@ -8102,16 +8105,17 @@ export const Content = {
game.playAudio(path); game.playAudio(path);
} }
} }
else if (lib.character[player.name] && lib.character[player.name][4].some(tag => tag.startsWith('die_audio'))) { else if (lib.character[name][4].some(tag => tag.startsWith('die_audio'))) {
var tag = lib.character[player.name][4].find(tag => tag.startsWith('die_audio')); var tag = lib.character[name][4].find(tag => tag.startsWith('die_audio'));
var list = tag.split(':').slice(1); var list = tag.split(':').slice(1);
game.playAudio('die', list.length ? list[0] : player.name); game.playAudio('die', list.length ? list[0] : name);
} }
else { else {
game.playAudio('die', player.name, function () { game.playAudio('die', name, function () {
game.playAudio('die', player.name.slice(player.name.indexOf('_') + 1)); game.playAudio('die', name.slice(name.indexOf('_') + 1));
}); });
} }
if (goon) delete lib.character[name];
} }
}, player); }, player);

View File

@ -2128,6 +2128,10 @@ export class Player extends HTMLDivElement {
this.name = character; this.name = character;
this.name1 = character; this.name1 = character;
this.tempname = []; this.tempname = [];
this.skin = {
name: character,
name2: character2,
};
this.sex = info[0]; this.sex = info[0];
this.group = info[1]; this.group = info[1];
this.hp = hp1; this.hp = hp1;
@ -2310,6 +2314,42 @@ export class Player extends HTMLDivElement {
return this; return this;
} }
/**
* 换肤换音想要支持某个武将更换皮肤必须在lib.character.characterSubstitute中存在该武将的id以下以name代指武将idcharacter代指换肤图片名
*
* 如果换肤换音引用本体的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) { initOL(name, character) {
this.node.avatar.setBackground(character, 'character'); this.node.avatar.setBackground(character, 'character');
this.node.avatar.show(); this.node.avatar.show();
@ -2470,13 +2510,16 @@ export class Player extends HTMLDivElement {
} }
if (this.name2 == from) { if (this.name2 == from) {
this.name2 = to; this.name2 = to;
this.skin.name2 = to;
} }
else if (this.name == from || this.name1 == from) { else if (this.name == from || this.name1 == from) {
if (this.name1 == from) { if (this.name1 == from) {
this.name1 = to; this.name1 = to;
this.skin.name = to;
} }
if (!this.isUnseen(1)) { if (!this.isUnseen(1)) {
this.name = to; this.name = to;
if (this.skin.name != to) this.skin.name = to;
this.sex = info2[0]; this.sex = info2[0];
} }
} }
@ -2568,6 +2611,7 @@ export class Player extends HTMLDivElement {
delete this.name; delete this.name;
delete this.name1; delete this.name1;
delete this.tempname; delete this.tempname;
delete this.skin;
delete this.sex; delete this.sex;
delete this.group; delete this.group;
delete this.hp; delete this.hp;

View File

@ -63,6 +63,7 @@ export class Library extends Uninstantable {
static characterFilter = {}; static characterFilter = {};
static characterSort = {}; static characterSort = {};
static characterReplace = {}; static characterReplace = {};
static characterSubstitute = {};
static characterInitFilter = {}; static characterInitFilter = {};
static characterGuozhanFilter = ["mode_guozhan"]; static characterGuozhanFilter = ["mode_guozhan"];
static dynamicTranslate = {}; static dynamicTranslate = {};