From b13136d34d52600436bf8861906c9a1accc4c405 Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Wed, 13 Mar 2024 09:37:29 +0800 Subject: [PATCH] bugfix --- game/update.js | 2 ++ noname/library/element/content.js | 47 ++++++++++++++++++------------- noname/library/element/player.js | 27 +++++++++++++++++- 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/game/update.js b/game/update.js index a7c83417e..d611bae10 100644 --- a/game/update.js +++ b/game/update.js @@ -43,6 +43,8 @@ window.noname_update={ 'game/pinyinjs.js', 'game/vue.esm-browser.js', + 'layout/default/layout.css', + 'mode/boss.js', 'mode/versus.js', diff --git a/noname/library/element/content.js b/noname/library/element/content.js index 7b6dc4883..3fecb7472 100644 --- a/noname/library/element/content.js +++ b/noname/library/element/content.js @@ -2890,35 +2890,40 @@ export const Content = { }, phaseUse: function () { "step 0"; + const stat = player.getStat(); + for (let i in stat.skill) { + let bool = false; + const info = lib.skill[i]; + if (!info) continue; + if (info.enable != undefined) { + if (typeof info.enable == 'string' && info.enable == 'phaseUse') bool = true; + else if (typeof info.enable == 'object' && info.enable.includes('phaseUse')) bool = true; + } + if (bool) stat.skill[i] = 0; + } + for (let i in stat.card) { + let bool = false; + const info = lib.card[i]; + if (!info) continue; + if (info.updateUsable == 'phaseUse') stat.card[i] = 0; + } + "step 1"; + event.trigger('phaseUseBefore'); + "step 2"; + event.trigger('phaseUseBegin'); + "step 3"; if (!event.logged) { game.log(player, '进入了出牌阶段'); event.logged = true; - const stat = player.getStat(); - for (let i in stat.skill) { - let bool = false; - const info = lib.skill[i]; - if (!info) continue; - if (info.enable != undefined) { - if (typeof info.enable == 'string' && info.enable == 'phaseUse') bool = true; - else if (typeof info.enable == 'object' && info.enable.includes('phaseUse')) bool = true; - } - if (bool) stat.skill[i] = 0; - } - for (let i in stat.card) { - let bool = false; - const info = lib.card[i]; - if (!info) continue; - if (info.updateUsable == 'phaseUse') stat.card[i] = 0; - } } var next = player.chooseToUse(); if (!lib.config.show_phaseuse_prompt) { next.set('prompt', false); } next.set('type', 'phase'); - "step 1"; + "step 4"; if (result.bool && !event.skipped) { - event.goto(0); + event.goto(3); } game.broadcastAll(function () { if (ui.tempnowuxie) { @@ -2926,6 +2931,10 @@ export const Content = { delete ui.tempnowuxie; } }); + "step 5"; + event.trigger('phaseUseEnd'); + "step 6"; + event.trigger('phaseUseAfter'); }, phaseDiscard: function () { "step 0"; diff --git a/noname/library/element/player.js b/noname/library/element/player.js index b72b3f7fe..037f9b29b 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -2365,6 +2365,31 @@ export class Player extends HTMLDivElement { } } } + changeSkinByName(character, index){ + const name = (index == 2 ? 'name2' : 'name'); + const list = lib.characterSubstitute[this[name]]; + if (list && lib.characterSubstitute[this[name]]) { + const origin = this.skin[name]; + game.broadcastAll((player, name, character, list, origin) => { + player.tempname.remove(origin); + 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.smoothAvatar(name == 'name2'); + 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, origin); + game.addVideo('changeSkin', this, { + from: origin, + to: character, + name: name, + list: list, + avatar2: name == 'name2', + }); + } + } initOL(name, character) { this.node.avatar.setBackground(character, 'character'); this.node.avatar.show(); @@ -3949,7 +3974,7 @@ export class Player extends HTMLDivElement { return next; } phaseUse() { - var next = game.createEvent('phaseUse'); + var next = game.createEvent('phaseUse', false); next.player = this; next.setContent('phaseUse'); return next;