Fixed conditional restriction and requirement effects that were handled as layered affects and did not work (Gift of theDeity, Tanglewalker, Way of the Thief, Bonds of Faith, Neurok Spy, Hazy Homunculus, Scrapdiver Serpent, Snapsail Glider, Steel of the Godhead, Bubbling Beebles, Bouncing Beebles).

This commit is contained in:
LevelX2 2013-08-04 17:51:54 +02:00
parent c452bdbc51
commit ee277c7e0d
12 changed files with 73 additions and 135 deletions

View file

@ -35,7 +35,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.DefendingPlayerControlsCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalRestrictionEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.UnblockableAllEffect;
import mage.cards.CardImpl;
@ -66,10 +66,10 @@ public class Tanglewalker extends CardImpl<Tanglewalker> {
this.toughness = new MageInt(2);
// Each creature you control is unblockable as long as defending player controls an artifact land.
Effect effect = new ConditionalContinousEffect(
Effect effect = new ConditionalRestrictionEffect(
new UnblockableAllEffect(new FilterControlledCreaturePermanent("Creatures you control"), Duration.WhileOnBattlefield),
new DefendingPlayerControlsCondition(filter),
"Each creature you control is unblockable as long as defending player controls an artifact land");
new DefendingPlayerControlsCondition(filter));
effect.setText("Each creature you control is unblockable as long as defending player controls an artifact land");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}

View file

@ -33,6 +33,8 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.EnchantedCreatureColorCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalRequirementEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.MustBlockAttachedEffect;
import mage.abilities.effects.common.continious.BoostEnchantedEffect;
@ -42,6 +44,7 @@ import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
@ -73,8 +76,13 @@ public class GiftOfTheDeity extends CardImpl<GiftOfTheDeity> {
blackAbility.addEffect(new ConditionalContinousEffect(new GainAbilityAttachedEffect(DeathtouchAbility.getInstance(), AttachmentType.AURA), new EnchantedCreatureColorCondition(ObjectColor.BLACK), "and has deathtouch"));
this.addAbility(blackAbility);
// As long as enchanted creature is green, it gets +1/+1 and all creatures able to block it do so.
SimpleStaticAbility greenAbility = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new BoostEnchantedEffect(1, 1), new EnchantedCreatureColorCondition(ObjectColor.GREEN), "As long as enchanted creature is green, it gets +1/+1"));
greenAbility.addEffect(new ConditionalContinousEffect(new MustBlockAttachedEffect(AttachmentType.AURA), new EnchantedCreatureColorCondition(ObjectColor.GREEN), "and all creatures able to block it do so"));
SimpleStaticAbility greenAbility = new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinousEffect(new BoostEnchantedEffect(1, 1),
new EnchantedCreatureColorCondition(ObjectColor.GREEN),
"As long as enchanted creature is green, it gets +1/+1"));
Effect effect = new ConditionalRequirementEffect(new MustBlockAttachedEffect(AttachmentType.AURA), new EnchantedCreatureColorCondition(ObjectColor.GREEN));
effect.setText("and all creatures able to block it do so");
greenAbility.addEffect(effect);
this.addAbility(greenAbility);
}

View file

@ -37,7 +37,8 @@ import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.ControlsPermanentCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalRestrictionEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.UnblockableAttachedEffect;
import mage.abilities.effects.common.continious.BoostEnchantedEffect;
@ -59,9 +60,8 @@ public class WayOfTheThief extends CardImpl<WayOfTheThief> {
static {
filter.add(new SubtypePredicate("Gate"));
}
private String rule = "Enchanted creature is unblockable as long as you control a Gate";
}
private final String rule = "Enchanted creature is unblockable as long as you control a Gate";
public WayOfTheThief(UUID ownerId) {
super(ownerId, 56, "Way of the Thief", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
@ -81,7 +81,9 @@ public class WayOfTheThief extends CardImpl<WayOfTheThief> {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(2, 2, Duration.WhileOnBattlefield)));
// Enchanted creature is unblockable as long as you control a Gate.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new UnblockableAttachedEffect(AttachmentType.AURA), new ControlsPermanentCondition(filter), rule)));
Effect effect = new ConditionalRestrictionEffect(new UnblockableAttachedEffect(AttachmentType.AURA), new ControlsPermanentCondition(filter));
effect.setText(rule);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
public WayOfTheThief(final WayOfTheThief card) {

View file

@ -28,20 +28,23 @@
package mage.sets.innistrad;
import java.util.UUID;
import mage.constants.*;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.common.EquippedHasSubtypeCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.decorator.ConditionalRestrictionEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.CantAttackBlockAttachedEffect;
import mage.abilities.effects.common.continious.BoostEquippedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -68,7 +71,9 @@ public class BondsOfFaith extends CardImpl<BondsOfFaith> {
// Enchanted creature gets +2/+2 as long as it's a Human. Otherwise, it can't attack or block.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new BoostEquippedEffect(2, 2), new EquippedHasSubtypeCondition("Human"), rule)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BondsOfFaithEffect()));
Effect effect = new ConditionalRestrictionEffect(new CantAttackBlockAttachedEffect(AttachmentType.AURA), new InvertCondition(new EquippedHasSubtypeCondition("Human")));
effect.setText("Otherwise, it can't attack or block");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
public BondsOfFaith(final BondsOfFaith card) {
@ -80,43 +85,3 @@ public class BondsOfFaith extends CardImpl<BondsOfFaith> {
return new BondsOfFaith(this);
}
}
class BondsOfFaithEffect extends RestrictionEffect<BondsOfFaithEffect> {
private static final Condition condition = new EquippedHasSubtypeCondition("Human");
public BondsOfFaithEffect() {
super(Duration.WhileOnBattlefield);
staticText = "Otherwise, it can't attack or block";
}
public BondsOfFaithEffect(final BondsOfFaithEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getAttachments().contains((source.getSourceId()))) {
if (!condition.apply(game, source)) {
return true;
}
}
return false;
}
@Override
public boolean canAttack(Game game) {
return false;
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
return false;
}
@Override
public BondsOfFaithEffect copy() {
return new BondsOfFaithEffect(this);
}
}

View file

@ -29,11 +29,11 @@ package mage.sets.magic2014;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.ControlsPermanentCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.RequirementEffect;
import mage.abilities.decorator.ConditionalRequirementEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttacksIfAbleSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
@ -41,8 +41,6 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
@ -65,7 +63,12 @@ public class MaraudingMaulhorn extends CardImpl<MaraudingMaulhorn> {
this.toughness = new MageInt(3);
// Marauding Maulhorn attacks each combat if able unless you control a creature named Advocate of the Beast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MaraudingMaulhornEffect()));
Effect effect = new ConditionalRequirementEffect(
new AttacksIfAbleSourceEffect(Duration.WhileOnBattlefield),
new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.FEWER_THAN, 1));
effect.setText("{this} attacks each combat if able unless you control a creature named Advocate of the Beast");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
@ -78,46 +81,3 @@ public class MaraudingMaulhorn extends CardImpl<MaraudingMaulhorn> {
return new MaraudingMaulhorn(this);
}
}
class MaraudingMaulhornEffect extends RequirementEffect<MaraudingMaulhornEffect> {
private final static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature named Advocate of the Beast");
static {
filter.add(new NamePredicate("Advocate of the Beast"));
}
public MaraudingMaulhornEffect() {
super(Duration.WhileOnBattlefield);
staticText = "{this} attacks each combat if able unless you control a creature named Advocate of the Beast";
}
public MaraudingMaulhornEffect(final MaraudingMaulhornEffect effect) {
super(effect);
}
@Override
public MaraudingMaulhornEffect copy() {
return new MaraudingMaulhornEffect(this);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getId().equals(source.getSourceId())) {
if (new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.FEWER_THAN, 1).apply(game, source)) {
return true;
}
}
return false;
}
@Override
public boolean mustAttack(Game game) {
return true;
}
@Override
public boolean mustBlock(Game game) {
return false;
}
}

View file

@ -28,17 +28,16 @@
package mage.sets.mirrodin;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.DefendingPlayerControlsCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalRestrictionEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.UnblockableSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactPermanent;
/**
@ -57,10 +56,10 @@ public class NeurokSpy extends CardImpl<NeurokSpy> {
this.toughness = new MageInt(2);
//Neurok Spy is unblockable as long as defending player controls an artifact.
Effect effect = new ConditionalContinousEffect(
Effect effect = new ConditionalRestrictionEffect(
new UnblockableSourceEffect(),
new DefendingPlayerControlsCondition(new FilterArtifactPermanent()),
"{this} is unblockable as long as defending player controls an artifact");
new DefendingPlayerControlsCondition(new FilterArtifactPermanent()));
effect.setText("{this} is unblockable as long as defending player controls an artifact");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}

View file

@ -34,7 +34,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.DefendingPlayerControlsCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalRestrictionEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.UnblockableSourceEffect;
import mage.cards.CardImpl;
@ -66,10 +66,10 @@ public class HazyHomunculus extends CardImpl<HazyHomunculus> {
this.toughness = new MageInt(1);
// Hazy Homunculus is unblockable as long as defending player controls an untapped land.
Effect effect = new ConditionalContinousEffect(
Effect effect = new ConditionalRestrictionEffect(
new UnblockableSourceEffect(),
new DefendingPlayerControlsCondition(filter),
"{this} is unblockable as long as defending player controls an untapped land");
new DefendingPlayerControlsCondition(filter));
effect.setText("{this} is unblockable as long as defending player controls an untapped land");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}

View file

@ -36,7 +36,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.DefendingPlayerControlsCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalRestrictionEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.UnblockableSourceEffect;
import mage.cards.CardImpl;
@ -57,10 +57,10 @@ public class ScrapdiverSerpent extends CardImpl<ScrapdiverSerpent> {
this.toughness = new MageInt(5);
// Scrapdiver Serpent is unblockable as long as defending player controls an artifact
Effect effect = new ConditionalContinousEffect(
Effect effect = new ConditionalRestrictionEffect(
new UnblockableSourceEffect(),
new DefendingPlayerControlsCondition(new FilterArtifactPermanent()),
"{this} is unblockable as long as defending player controls an artifact");
new DefendingPlayerControlsCondition(new FilterArtifactPermanent()));
effect.setText("{this} is unblockable as long as defending player controls an artifact");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}

View file

@ -49,7 +49,7 @@ import java.util.UUID;
*/
public class SnapsailGlider extends CardImpl<SnapsailGlider> {
protected static String text = "Metalcraft - Snapsail Glider has flying as long as you control three or more artifacts";
protected static String rule = "Metalcraft - Snapsail Glider has flying as long as you control three or more artifacts";
public SnapsailGlider (UUID ownerId) {
super(ownerId, 203, "Snapsail Glider", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
@ -58,7 +58,7 @@ public class SnapsailGlider extends CardImpl<SnapsailGlider> {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
ContinuousEffect effect = new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(effect, MetalcraftCondition.getInstance(), text)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(effect, MetalcraftCondition.getInstance(), rule)));
}
public SnapsailGlider (final SnapsailGlider card) {

View file

@ -33,7 +33,10 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.EnchantedCreatureColorCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalRestrictionEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.UnblockableAttachedEffect;
import mage.abilities.effects.common.continious.BoostEnchantedEffect;
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
@ -74,7 +77,9 @@ public class SteelOfTheGodhead extends CardImpl<SteelOfTheGodhead> {
this.addAbility(whiteAbility);
// As long as enchanted creature is blue, it gets +1/+1 and is unblockable.
SimpleStaticAbility blueAbility = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new BoostEnchantedEffect(1, 1), new EnchantedCreatureColorCondition(ObjectColor.BLUE), "As long as enchanted creature is blue, it gets +1/+1"));
blueAbility.addEffect(new ConditionalContinousEffect(new GainAbilityAttachedEffect(new UnblockableAbility(), AttachmentType.AURA), new EnchantedCreatureColorCondition(ObjectColor.BLUE), "and is unblockable"));
Effect effect = new ConditionalRestrictionEffect(new UnblockableAttachedEffect(AttachmentType.AURA), new EnchantedCreatureColorCondition(ObjectColor.BLUE));
effect.setText("and is unblockable");
blueAbility.addEffect(effect);
this.addAbility(blueAbility);
}

View file

@ -34,7 +34,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.DefendingPlayerControlsCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalRestrictionEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.UnblockableSourceEffect;
import mage.cards.CardImpl;
@ -48,7 +48,6 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
public class BubblingBeebles extends CardImpl<BubblingBeebles> {
private static final FilterPermanent filter = new FilterPermanent();
static {
filter.add(new CardTypePredicate(CardType.ENCHANTMENT));
}
@ -62,10 +61,10 @@ public class BubblingBeebles extends CardImpl<BubblingBeebles> {
this.toughness = new MageInt(3);
// Bubbling Beebles is unblockable as long as defending player controls an enchantment.
Effect effect = new ConditionalContinousEffect(
Effect effect = new ConditionalRestrictionEffect(
new UnblockableSourceEffect(),
new DefendingPlayerControlsCondition(filter),
"{this} is unblockable as long as defending player controls an enchantment");
new DefendingPlayerControlsCondition(filter));
effect.setText("{this} is unblockable as long as defending player controls an enchantment");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}

View file

@ -35,7 +35,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.DefendingPlayerControlsCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalRestrictionEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.UnblockableSourceEffect;
import mage.cards.CardImpl;
@ -56,10 +56,10 @@ public class BouncingBeebles extends CardImpl<BouncingBeebles> {
this.toughness = new MageInt(2);
//Bouncing Beebles is unblockable as long as defending player controls an artifact.
Effect effect = new ConditionalContinousEffect(
Effect effect = new ConditionalRestrictionEffect(
new UnblockableSourceEffect(),
new DefendingPlayerControlsCondition(new FilterArtifactPermanent()),
"{this} is unblockable as long as defending player controls an artifact");
new DefendingPlayerControlsCondition(new FilterArtifactPermanent()));
effect.setText("{this} is unblockable as long as defending player controls an artifact");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}