远野美凪~中津静流 cost分离修改

This commit is contained in:
Spmario233 2024-03-13 22:44:16 +08:00
parent 29da9c7ec6
commit c34bd7fb33
4 changed files with 486 additions and 523 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2306,12 +2306,10 @@ export const Content = {
targets = [targets]; targets = [targets];
} }
if (info.popup != false && !info.direct) { if (info.popup != false && !info.direct) {
if (info.popup) { let popup_info = event.skill;
player.popup(info.popup); if(typeof info.popup === 'string') popup_info = [event.skill, info.popup];
game.log(player, '发动了', '【' + get.skillTranslation(event.skill, player) + '】'); if (info.logLine === false) player.logSkill(popup_info, false, info.line);
} else player.logSkill(popup_info, targets, info.line);
if (info.logLine === false) player.logSkill(event.skill, false, info.line);
else player.logSkill(event.skill, targets, info.line);
} }
var next = game.createEvent(event.skill); var next = game.createEvent(event.skill);
if (typeof info.usable == 'number') { if (typeof info.usable == 'number') {

View File

@ -333,10 +333,10 @@ export class GameEvent {
this.untrigger(arg1, arg2); this.untrigger(arg1, arg2);
this.finish(); this.finish();
if (notrigger != 'notrigger') { if (notrigger != 'notrigger') {
this.trigger(this.name + 'Cancelled');
if (this.player && lib.phaseName.includes(this.name)) this.player.getHistory('skipped').add(this.name); if (this.player && lib.phaseName.includes(this.name)) this.player.getHistory('skipped').add(this.name);
return this.trigger(this.name + 'Cancelled');
} }
return this; return null;
} }
neutralize(event) { neutralize(event) {
this.untrigger(); this.untrigger();

View File

@ -371,6 +371,7 @@ export class Player extends HTMLDivElement {
* ``` * ```
*/ */
when() { when() {
const player = this;
if (!_status.postReconnect.player_when) _status.postReconnect.player_when = [ if (!_status.postReconnect.player_when) _status.postReconnect.player_when = [
function (map) { function (map) {
"use strict"; "use strict";
@ -386,7 +387,13 @@ export class Player extends HTMLDivElement {
]; ];
let triggerNames = Array.from(arguments); let triggerNames = Array.from(arguments);
let trigger; let trigger;
let instantlyAdd = true;
if (triggerNames.length == 0) throw 'player.when的参数数量应大于0'; if (triggerNames.length == 0) throw 'player.when的参数数量应大于0';
//从triggerNames中取出instantlyAdd的部分
if (triggerNames.includes(false)) {
instantlyAdd = false;
triggerNames.remove(false);
}
// add other triggerNames // add other triggerNames
// arguments.length = 1 // arguments.length = 1
if (triggerNames.length == 1) { if (triggerNames.length == 1) {
@ -506,7 +513,7 @@ export class Player extends HTMLDivElement {
} }
}); });
}, skillName); }, skillName);
this.addSkill(skillName); if (instantlyAdd !== false) this.addSkill(skillName);
_status.postReconnect.player_when[1][skillName] = true; _status.postReconnect.player_when[1][skillName] = true;
return { return {
/** /**
@ -603,6 +610,14 @@ export class Player extends HTMLDivElement {
if (skill.contentFuns.length > 0) createContent(); if (skill.contentFuns.length > 0) createContent();
return this; return this;
}, },
/**
* 获得技能
* 如果instantlyAdd为false则需要以此法获得技能
**/
finish() {
player.addSkill(skillName);
return this;
}
}; };
} }
/** /**
@ -7877,14 +7892,14 @@ export class Player extends HTMLDivElement {
skillName = 'player_tempSkills_' + Math.random().toString(36).slice(-8); skillName = 'player_tempSkills_' + Math.random().toString(36).slice(-8);
} while (player.additionalSkills[skillName] != null); } while (player.additionalSkills[skillName] != null);
player.addAdditionalSkill(skillName, skillsToAdd); player.addAdditionalSkill(skillName, skillsToAdd);
player.when(expire).assign({ player.when(expire,false).assign({
firstDo: true, firstDo: true,
priority: Infinity, priority: Infinity,
}).vars({ }).vars({
skillName skillName
}).then(() => { }).then(() => {
player.removeAdditionalSkills(skillName); player.removeAdditionalSkills(skillName);
}); }).finish();
} }
}); });
} }
@ -7927,13 +7942,13 @@ export class Player extends HTMLDivElement {
if (!expire) expire = { global: ['phaseAfter', 'phaseBeforeStart'] }; if (!expire) expire = { global: ['phaseAfter', 'phaseBeforeStart'] };
else if (typeof expire == 'string' || Array.isArray(expire)) expire = { global: expire }; else if (typeof expire == 'string' || Array.isArray(expire)) expire = { global: expire };
this.when(expire).assign({ this.when(expire,false).assign({
firstDo: true, firstDo: true,
}).vars({ }).vars({
bannedSkill: skill, bannedSkill: skill,
}).then(() => { }).then(() => {
delete player.storage[`temp_ban_${bannedSkill}`]; delete player.storage[`temp_ban_${bannedSkill}`];
}); }).finish();
} }
return skill; return skill;
} }