From 23c4247afdbafd7d9027ef56c7ad02d7b8291cbe Mon Sep 17 00:00:00 2001 From: WEBXOSS Date: Thu, 9 Feb 2017 22:30:09 +0800 Subject: [PATCH] fix WX13-029 3rd effect Bug: * WX13-029 3rd effect also affects LRIG Fix: * Change `player.canNotGainAbility` to `player.signiCanNotGainAbility` * Extract `card.canGainAbility` --- Card.js | 8 ++++++++ CardInfo.js | 2 +- Mask.js | 14 ++------------ Player.js | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Card.js b/Card.js index 5b360d7..cb3f6aa 100644 --- a/Card.js +++ b/Card.js @@ -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; \ No newline at end of file diff --git a/CardInfo.js b/CardInfo.js index cbf3c0b..ce745e8 100644 --- a/CardInfo.js +++ b/CardInfo.js @@ -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, diff --git a/Mask.js b/Mask.js index ae4ded9..fe7b9fb 100644 --- a/Mask.js +++ b/Mask.js @@ -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; } diff --git a/Player.js b/Player.js index c56bc52..d3fb680 100644 --- a/Player.js +++ b/Player.js @@ -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; // <绿罗植 世界树>