From 0e64df5d9300c7d291a7684424fe5a579a41bf94 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 29 Mar 2015 22:44:46 +0200 Subject: [PATCH] * Fixed a bug that tap enchanted effect did not work because causing enchantment was already gone. Fixed a bug of SacrificeEffect of handling static filter. --- .../mage/abilities/effects/common/SacrificeEffect.java | 10 +++++----- .../abilities/effects/common/TapEnchantedEffect.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Mage/src/mage/abilities/effects/common/SacrificeEffect.java b/Mage/src/mage/abilities/effects/common/SacrificeEffect.java index 3b635c7b7f..e03acac332 100644 --- a/Mage/src/mage/abilities/effects/common/SacrificeEffect.java +++ b/Mage/src/mage/abilities/effects/common/SacrificeEffect.java @@ -32,9 +32,8 @@ import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; -import mage.constants.TargetController; import mage.filter.FilterPermanent; -import mage.filter.predicate.permanent.ControllerPredicate; +import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -79,13 +78,14 @@ public class SacrificeEffect extends OneShotEffect{ return false; } - filter.add(new ControllerPredicate(TargetController.YOU)); + FilterPermanent newFilter = filter.copy(); // filter can be static, so it's important to copy here + newFilter.add(new ControllerIdPredicate(player.getId())); int amount = count.calculate(game, source, this); - int realCount = game.getBattlefield().countAll(filter, player.getId(), game); + int realCount = game.getBattlefield().countAll(newFilter, player.getId(), game); amount = Math.min(amount, realCount); - Target target = new TargetPermanent(amount, amount, filter, true); + Target target = new TargetPermanent(amount, amount, newFilter, true); // A spell or ability could have removed the only legal target this player // had, if thats the case this ability should fizzle. diff --git a/Mage/src/mage/abilities/effects/common/TapEnchantedEffect.java b/Mage/src/mage/abilities/effects/common/TapEnchantedEffect.java index 29fea7b08c..fdb5b5a3a8 100644 --- a/Mage/src/mage/abilities/effects/common/TapEnchantedEffect.java +++ b/Mage/src/mage/abilities/effects/common/TapEnchantedEffect.java @@ -51,7 +51,7 @@ public class TapEnchantedEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); + Permanent permanent = (Permanent) source.getSourceObject(game); if (permanent != null) { Permanent attach = game.getPermanent(permanent.getAttachedTo()); if (attach != null) {