fix WX13-029 3rd effect

Bug:

* WX13-029 3rd effect also affects LRIG

Fix:

* Change `player.canNotGainAbility` to `player.signiCanNotGainAbility`
* Extract `card.canGainAbility`
This commit is contained in:
WEBXOSS 2017-02-09 22:30:09 +08:00
parent d3ec7909f9
commit 23c4247afd
4 changed files with 12 additions and 14 deletions

View file

@ -1480,4 +1480,12 @@ Card.prototype.canBeBanished = function () {
return true;
};
Card.prototype.canGainAbility = function (source) {
let canNotGainAbility =
this.canNotGainAbility ||
(this.player.signiCanNotGainAbility && this.type === 'SIGNI') ||
(this.canNotGainAbilityBySelfPlayer && source && source.player === this.player);
return !canNotGainAbility;
};
global.Card = Card;

View file

@ -109951,7 +109951,7 @@ var CardInfo = {
source: this,
description: '1801-attached-2',
actionAsyn: function () {
this.game.tillTurnEndSet(this,this.player,'canNotGainAbility',true,{forced: true});
this.game.tillTurnEndSet(this,this.player,'signiCanNotGainAbility',true,{forced: true});
}
},{
source: this,

14
Mask.js
View file

@ -28,14 +28,9 @@ Mask.prototype.set = function (reset) {
var effect = this.value;
var source = effect.source;
// 不能获得新能力
if (source.canNotGainAbility || source.player.canNotGainAbility) {
if (!source.canGainAbility(this.source)) {
return;
}
if (source.canNotGainAbilityBySelfPlayer) {
if (this.source && (this.source.player === source.player)) {
return;
}
}
effect.disabled = false;
timming.effects.push(effect);
effect.source.registeredEffects.push(effect);
@ -54,14 +49,9 @@ Mask.prototype.set = function (reset) {
} else {
if (!reset && target.player && inArr(this.prop,Card.abilityProps)) {
// 不能获得新能力
if (target.canNotGainAbility && target.player.canNotGainAbility) {
if (!target.canGainAbility(this.source)) {
return;
}
if (target.canNotGainAbilityBySelfPlayer) {
if (this.source && (this.source === target.player)) {
return;
}
}
}
target[this.prop] = this.value;
}

View file

@ -133,7 +133,7 @@ function Player (game,io,mainDeck,lrigDeck) {
this.wontLoseGame = false; // <紅蓮乙女 遊月・肆>
this.canNotBeBanished = false;
this.canNotBeBounced = false;
this.canNotGainAbility = false;
this.signiCanNotGainAbility = false;
this.canNotBeDownedByOpponentEffect = false;
this.canNotUseColorlessSigni = false; // <绿罗植 世界树>
this.canNotUseColorlessSpell = false; // <绿罗植 世界树>