Merge pull request #1111 from zhichaoxi2006/feature-branch
chooseToEnable和chooseToDisable方法添加source参数
This commit is contained in:
commit
45ec5c7f30
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue