添加player.recoverTo函数

This commit is contained in:
nineMangos 2024-04-10 21:03:04 +08:00
parent d462dc5cbd
commit 35de175473
1 changed files with 14 additions and 1 deletions

View File

@ -5825,7 +5825,7 @@ export class Player extends HTMLDivElement {
};
return next;
}
recover() {
recover() {
var next = game.createEvent('recover');
next.player = this;
var nocard, nosource;
@ -5864,6 +5864,19 @@ export class Player extends HTMLDivElement {
next.setContent('recover');
return next;
}
recoverTo() {
const newArguments = [];
let num = 1;
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] === 'number') {
num = arguments[i] - this.getHp(true);
newArguments.push(num);
} else {
newArguments.push(arguments[i]);
}
}
if (num > 0) return this.recover(...newArguments);
}
doubleDraw() {
if (get.is.changban()) return;
var next = game.createEvent('doubleDraw');