chooseToDisable与chooseToEnable添加source参数

This commit is contained in:
Lee_Code 2024-03-20 12:55:29 +08:00
parent 608b1e700d
commit bd0d47c708
2 changed files with 21 additions and 9 deletions

View File

@ -1542,8 +1542,8 @@ export const Content = {
event._result = { control: list[0] };
}
else {
var next = player.chooseControl(list);
next.set('prompt', '请选择恢复一个装备栏');
var next = source.chooseControl(list);
next.set('prompt', '请选择恢复'+get.translation(player.name)+'的一个装备栏');
if (!event.ai) event.ai = function (event, player, list) {
return list.randomGet();
};
@ -1575,8 +1575,8 @@ export const Content = {
else {
list.sort();
event.list = list;
var next = player.chooseControl(list);
next.set('prompt', '请选择废除一个装备栏');
var next = source.chooseControl(list);
next.set('prompt', '请选择废除'+get.translation(player.name)+'的一个装备栏');
if (!event.ai) event.ai = function (event, player, list) {
return list.randomGet();
};

View File

@ -2046,17 +2046,29 @@ export class Player extends HTMLDivElement {
}
chooseToEnable() {
var next = game.createEvent('chooseToEnable');
for (var i = 0; i < arguments.length; i++) {
if (get.itemtype(arguments[i]) == 'player') {
next.source = arguments[i];
}
}
if (next.source == undefined) next.source = this;
next.player = this;
next.setContent('chooseToEnable');
return next;
}
/**
* @param { boolean } [horse]
*/
chooseToDisable(horse) {
chooseToDisable() {
var next = game.createEvent('chooseToDisable');
for (var i = 0; i < arguments.length; i++) {
if (get.itemtype(arguments[i]) == 'player') {
next.source = arguments[i];
}
else if(typeof arguments[i] == 'boolean' ){
next.horse = arguments[i];
}
}
if (next.horse == undefined) next.horse = false;
if (next.source == undefined) next.source = this;
next.player = this;
if (horse) next.horse = true;
next.setContent('chooseToDisable');
return next;
}