tempBanSkill修改支持传入数组形式

This commit is contained in:
mengxinzxz 2024-01-22 14:27:44 +08:00
parent f93800fa43
commit 92b93e5b25
1 changed files with 21 additions and 14 deletions

View File

@ -7171,20 +7171,27 @@ export class Player extends HTMLDivElement {
return skill; return skill;
} }
tempBanSkill(skill, expire, log) { tempBanSkill(skill, expire, log) {
if (this.isTempBanned(skill)) return; if (Array.isArray(skill)) {
this.setStorage(`temp_ban_${skill}`, true); for (var i = 0; i < skill.length; i++) {
this.tempBanSkill(skill[i], expire, log);
}
}
else{
if (this.isTempBanned(skill)) return;
this.setStorage(`temp_ban_${skill}`, true);
if (log !== false && this.hasSkill(skill)) game.log(this, '的技能', `#g【${get.translation(skill)}`, '暂时失效了'); if (log !== false && this.hasSkill(skill)) game.log(this, '的技能', `#g【${get.translation(skill)}`, '暂时失效了');
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).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}`];
}); });
}
return skill; return skill;
} }
isTempBanned(skill) { isTempBanned(skill) {