* Sludge Strider - fixed rollback error on card usage;

This commit is contained in:
Oleg Agafonov 2020-01-13 10:43:13 +04:00
parent d78e2b91ef
commit 62530b3880

View file

@ -1,7 +1,5 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
@ -10,12 +8,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.DoIfCostPaid;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.SubType; import mage.filter.common.FilterArtifactPermanent;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactCard;
import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
@ -25,14 +19,15 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class SludgeStrider extends CardImpl { public final class SludgeStrider extends CardImpl {
public SludgeStrider(UUID ownerId, CardSetInfo setInfo) { public SludgeStrider(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{1}{W}{U}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}{W}{U}{B}");
this.subtype.add(SubType.INSECT); this.subtype.add(SubType.INSECT);
this.power = new MageInt(3); this.power = new MageInt(3);
@ -57,7 +52,8 @@ public final class SludgeStrider extends CardImpl {
class SludgeStriderTriggeredAbility extends TriggeredAbilityImpl { class SludgeStriderTriggeredAbility extends TriggeredAbilityImpl {
private static final FilterArtifactCard filter = new FilterArtifactCard("another artifact under your control"); private static final FilterArtifactPermanent filter = new FilterArtifactPermanent("another artifact under your control");
static { static {
filter.add(TargetController.YOU.getControllerPredicate()); filter.add(TargetController.YOU.getControllerPredicate());
filter.add(AnotherPredicate.instance); filter.add(AnotherPredicate.instance);
@ -93,9 +89,7 @@ class SludgeStriderTriggeredAbility extends TriggeredAbilityImpl {
if (permanent == null) { if (permanent == null) {
permanent = (Permanent) game.getLastKnownInformation(targetId, Zone.BATTLEFIELD); permanent = (Permanent) game.getLastKnownInformation(targetId, Zone.BATTLEFIELD);
} }
if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { return permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game);
return true;
}
} }
} }
return false; return false;