修改调用lib.filter.cardUsable的考虑次数函数默认event参

This commit is contained in:
157 2024-02-04 11:29:04 +08:00
parent 6216b9730c
commit 601a858c1f
3 changed files with 11 additions and 5 deletions

View File

@ -1049,7 +1049,8 @@ export const Content = {
card.cards = cards.slice(0); card.cards = cards.slice(0);
event.card = card; event.card = card;
} }
if (!lib.filter.cardEnabled(card, player) || (event.addCount !== false && !lib.filter.cardUsable(card, player))) { if (!lib.filter.cardEnabled(card, player) || event.addCount !== false &&
!lib.filter.cardUsable(card, player, event.getParent('chooseToUse'))) {
event.result = { bool: false }; event.result = { bool: false };
event.finish(); event.finish();
return; return;

View File

@ -6892,7 +6892,11 @@ export class Player extends HTMLDivElement {
var info = get.info(card); var info = get.info(card);
if (info.multicheck && !info.multicheck(card, this)) return false; if (info.multicheck && !info.multicheck(card, this)) return false;
if (!lib.filter.cardEnabled(card, this)) return false; if (!lib.filter.cardEnabled(card, this)) return false;
if (includecard && !lib.filter.cardUsable(card, this)) return false; if (includecard){
let evt = includecard;
if(typeof evt !== 'object') evt = _status.event.getParent('chooseToUse');
if(!lib.filter.cardUsable(card, this, evt)) return false;
}
if (distance !== false && !lib.filter.targetInRange(card, this, target)) return false; if (distance !== false && !lib.filter.targetInRange(card, this, target)) return false;
return lib.filter[includecard ? 'targetEnabledx' : 'targetEnabled'](card, this, target); return lib.filter[includecard ? 'targetEnabledx' : 'targetEnabled'](card, this, target);
} }

View File

@ -9967,11 +9967,12 @@ export class Library extends Uninstantable {
return filterTarget(card, player, current); return filterTarget(card, player, current);
}); });
}, },
targetEnabledx: function (card, player, target) { targetEnabledx: function (card, player, target, event) {
if (!card) return false; if (!card) return false;
if (!target || !target.isIn()) return false; if (!target || !target.isIn()) return false;
var event = _status.event; if(typeof event !== 'object') event = _status.event.getParent('chooseToUse');
if (event._backup && event._backup.filterCard == lib.filter.filterCard && (!lib.filter.cardEnabled(card, player, event) || !lib.filter.cardUsable(card, player, event))) return false; if (event._backup && event._backup.filterCard == lib.filter.filterCard &&
(!lib.filter.cardEnabled(card, player, event) || !lib.filter.cardUsable(card, player, event))) return false;
if (event.addCount_extra) { if (event.addCount_extra) {
if (!lib.filter.cardUsable2(card, player) && !game.checkMod(card, player, target, false, 'cardUsableTarget', player)) return false; if (!lib.filter.cardUsable2(card, player) && !game.checkMod(card, player, target, false, 'cardUsableTarget', player)) return false;
} }