From 87078057e0bf025c078818950adf17ca18c482fe Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 4 Oct 2015 09:45:22 +0200 Subject: [PATCH] * Some fixed to cards submitted by BursegSardaukar. --- .../mage/sets/archenemy/SkirkCommando.java | 55 ++++++++---------- .../src/mage/sets/guildpact/RabbleRouser.java | 14 ++--- .../src/mage/sets/iceage/GoblinSnowman.java | 24 +++++--- .../src/mage/sets/iceage/TinderWall.java | 36 +----------- .../mage/sets/lorwyn/BoggartSpriteChaser.java | 22 ++++---- .../src/mage/sets/lorwyn/FodderLaunch.java | 56 ++----------------- .../mage/sets/lorwyn/QuillSlingerBoggart.java | 2 +- .../mage/sets/planarchaos/FirefrightMage.java | 17 +++--- .../mage/sets/ravnica/GoblinFireFiend.java | 13 ++--- .../src/mage/sets/tempest/MoggSquad.java | 8 +-- .../CantBeBlockedByAllTargetEffect.java | 51 +++++++++++++++++ 11 files changed, 131 insertions(+), 167 deletions(-) create mode 100644 Mage/src/mage/abilities/effects/common/combat/CantBeBlockedByAllTargetEffect.java diff --git a/Mage.Sets/src/mage/sets/archenemy/SkirkCommando.java b/Mage.Sets/src/mage/sets/archenemy/SkirkCommando.java index d995faa763..a97f8981cb 100644 --- a/Mage.Sets/src/mage/sets/archenemy/SkirkCommando.java +++ b/Mage.Sets/src/mage/sets/archenemy/SkirkCommando.java @@ -28,21 +28,18 @@ package mage.sets.archenemy; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.keyword.MorphAbility; import mage.cards.CardImpl; -import mage.constants.Outcome; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; -import mage.players.Player; +import mage.game.events.GameEvent; import mage.target.common.TargetCreaturePermanent; /** @@ -50,7 +47,7 @@ import mage.target.common.TargetCreaturePermanent; * @author BursegSardaukar */ public class SkirkCommando extends CardImpl { - + public SkirkCommando(UUID ownerId) { super(ownerId, 47, "Skirk Commando", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}{R}"); this.expansionSetCode = "ARC"; @@ -59,13 +56,13 @@ public class SkirkCommando extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(1); - + //Whenever Skirk Commando deals combat damage to a player, you may have it deal 2 damage to target creature that player controls. - this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new SkirkCommandoEffect(), true, true)); - + this.addAbility(new SkirkCommandoTriggeredAbility()); + //Morph {2}{R} (You may cast this card face down as a 2/2 creature for 3. Turn it face up any time for its morph cost.) this.addAbility(new MorphAbility(this, new ManaCostsImpl("{2}{R}"))); - + } public SkirkCommando(final SkirkCommando card) { @@ -78,37 +75,29 @@ public class SkirkCommando extends CardImpl { } } -class SkirkCommandoEffect extends OneShotEffect { +class SkirkCommandoTriggeredAbility extends DealsCombatDamageToAPlayerTriggeredAbility { + + public SkirkCommandoTriggeredAbility() { + super(new DamageTargetEffect(2), true, false); - public SkirkCommandoEffect() { - super(Outcome.Damage); - staticText = "have it deal 2 damage to target creature that player controls"; } - public SkirkCommandoEffect(final SkirkCommandoEffect effect) { - super(effect); + public SkirkCommandoTriggeredAbility(SkirkCommandoTriggeredAbility ability) { + super(ability); } @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null) { - FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + player.getLogName() + " controls"); - filter.add(new ControllerIdPredicate(player.getId())); - TargetCreaturePermanent target = new TargetCreaturePermanent(filter); - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Damage, source.getControllerId(), source.getSourceId(), game)) { - UUID creature = target.getFirstTarget(); - if (creature != null) { - game.getPermanent(creature).damage(2, source.getSourceId(), game, false, true); - return true; - } - } + public boolean checkTrigger(GameEvent event, Game game) { + if (super.checkTrigger(event, game)) { + FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that player controls"); + filter.add(new ControllerIdPredicate(event.getPlayerId())); + addTarget(new TargetCreaturePermanent(filter)); } return false; } @Override - public SkirkCommandoEffect copy() { - return new SkirkCommandoEffect(this); + public SkirkCommandoTriggeredAbility copy() { + return new SkirkCommandoTriggeredAbility(this); } } diff --git a/Mage.Sets/src/mage/sets/guildpact/RabbleRouser.java b/Mage.Sets/src/mage/sets/guildpact/RabbleRouser.java index aafc1493d0..fc935905f7 100644 --- a/Mage.Sets/src/mage/sets/guildpact/RabbleRouser.java +++ b/Mage.Sets/src/mage/sets/guildpact/RabbleRouser.java @@ -28,9 +28,6 @@ package mage.sets.guildpact; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -42,7 +39,9 @@ import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.abilities.keyword.BloodthirstAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterAttackingCreature; @@ -51,9 +50,7 @@ import mage.filter.common.FilterAttackingCreature; * @author BursegSardaukar */ public class RabbleRouser extends CardImpl { - - final static private String rule = "Attacking creatures get +X/+0 until end of turn, where X is Rabble-Rouser's power."; - + public RabbleRouser(UUID ownerId) { super(ownerId, 73, "Rabble-Rouser", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); this.expansionSetCode = "GPT"; @@ -68,7 +65,10 @@ public class RabbleRouser extends CardImpl { //{R}, {T}: Attacking creatures get +X/+0 until end of turn, where X is Rabble-Rouser's power. DynamicValue amount = new SourcePermanentPowerCount(); - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(amount, new StaticValue(0), Duration.EndOfTurn, new FilterAttackingCreature(), false, rule), new ManaCostsImpl("{R}")); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + new BoostAllEffect(amount, new StaticValue(0), Duration.EndOfTurn, new FilterAttackingCreature(), false, + "Attacking creatures get +X/+0 until end of turn, where X is {this}'s power"), + new ManaCostsImpl("{R}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/iceage/GoblinSnowman.java b/Mage.Sets/src/mage/sets/iceage/GoblinSnowman.java index 9fb3b18c09..775512bd9a 100644 --- a/Mage.Sets/src/mage/sets/iceage/GoblinSnowman.java +++ b/Mage.Sets/src/mage/sets/iceage/GoblinSnowman.java @@ -28,21 +28,22 @@ package mage.sets.iceage; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.BlocksTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.PreventCombatDamageBySourceEffect; import mage.abilities.effects.common.PreventCombatDamageToSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterAttackingCreature; +import mage.filter.predicate.permanent.BlockedByIdPredicate; import mage.target.common.TargetCreaturePermanent; /** @@ -60,15 +61,20 @@ public class GoblinSnowman extends CardImpl { this.toughness = new MageInt(1); //Whenever Goblin Snowman blocks, prevent all combat damage that would be dealt to and dealt by it this turn. - this.addAbility(new BlocksTriggeredAbility(new PreventCombatDamageBySourceEffect(Duration.EndOfTurn), false)); - this.addAbility(new BlocksTriggeredAbility(new PreventCombatDamageToSourceEffect(Duration.EndOfTurn), false)); - + Effect effect = new PreventCombatDamageBySourceEffect(Duration.EndOfTurn); + effect.setText("prevent all combat damage that would be dealt to"); + Ability ability = new BlocksTriggeredAbility(effect, false); + effect = new PreventCombatDamageToSourceEffect(Duration.EndOfTurn); + effect.setText("and dealt by it this turn"); + ability.addEffect(effect); + this.addAbility(ability); + //{T}: Goblin Snowman deals 1 damage to target creature it's blocking. FilterAttackingCreature filter = new FilterAttackingCreature("creature it's blocking"); - filter.add(new BlockingByPredicate(this.getId())); - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost()); + filter.add(new BlockedByIdPredicate(this.getId())); + ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent(filter)); - this.addAbility(ability, new BlockedByWatcher()); + this.addAbility(ability); } public GoblinSnowman(final GoblinSnowman card) { diff --git a/Mage.Sets/src/mage/sets/iceage/TinderWall.java b/Mage.Sets/src/mage/sets/iceage/TinderWall.java index 5ee8dc535c..048387e294 100644 --- a/Mage.Sets/src/mage/sets/iceage/TinderWall.java +++ b/Mage.Sets/src/mage/sets/iceage/TinderWall.java @@ -43,16 +43,15 @@ import mage.cards.CardImpl; import mage.constants.WatcherScope; import mage.constants.Zone; import mage.filter.common.FilterAttackingCreature; -import mage.filter.predicate.Predicate; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; import mage.watchers.Watcher; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import mage.filter.predicate.permanent.BlockedByIdPredicate; /** * @@ -75,7 +74,7 @@ public class TinderWall extends CardImpl { this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new BasicManaEffect(Mana.RedMana(2)), new SacrificeSourceCost())); // {R}, Sacrifice Tinder Wall: Tinder Wall deals 2 damage to target creature it's blocking. FilterAttackingCreature filter = new FilterAttackingCreature("creature it's blocking"); - filter.add(new BlockingByPredicate(this.getId())); + filter.add(new BlockedByIdPredicate(this.getId())); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), new ManaCostsImpl("{R}")); ability.addTarget(new TargetCreaturePermanent(filter)); ability.addCost(new SacrificeSourceCost()); @@ -92,10 +91,9 @@ public class TinderWall extends CardImpl { } } - class BlockedByWatcher extends Watcher { - public List blockedByWatcher = new ArrayList(); + public List blockedByWatcher = new ArrayList<>(); public BlockedByWatcher() { super("BlockedByWatcher", WatcherScope.CARD); @@ -127,31 +125,3 @@ class BlockedByWatcher extends Watcher { } } - -class BlockingByPredicate implements Predicate { - - private UUID source; - - public BlockingByPredicate(UUID source) { - this.source = source; - } - - @Override - public boolean apply(Permanent input, Game game) { - BlockedByWatcher watcher = (BlockedByWatcher) game.getState().getWatchers().get("BlockedByWatcher", source); - - for(UUID uuid :watcher.blockedByWatcher){ - Permanent creature = game.getPermanent(uuid); - if(creature != null && creature.getId().equals(input.getId())){ - return true; - } - } - return false; - - } - - @Override - public String toString() { - return "creature it's blocking"; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/lorwyn/BoggartSpriteChaser.java b/Mage.Sets/src/mage/sets/lorwyn/BoggartSpriteChaser.java index 9d6b6e441b..22c0d5a9e6 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/BoggartSpriteChaser.java +++ b/Mage.Sets/src/mage/sets/lorwyn/BoggartSpriteChaser.java @@ -29,9 +29,11 @@ package mage.sets.lorwyn; import java.util.UUID; import mage.MageInt; +import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostSourceWhileControlsEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.keyword.FlyingAbility; @@ -41,7 +43,6 @@ import mage.constants.Duration; import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; /** * @@ -49,14 +50,6 @@ import mage.filter.predicate.mageobject.SubtypePredicate; */ public class BoggartSpriteChaser extends CardImpl { - final static private String rule = "{this} has flying as long as you control a Faerie"; - - private static final FilterPermanent filter = new FilterPermanent("Faerie"); - - static { - filter.add(new SubtypePredicate("Faerie")); - } - public BoggartSpriteChaser(UUID ownerId) { super(ownerId, 156, "Boggart Sprite-Chaser", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}"); this.expansionSetCode = "LRW"; @@ -67,8 +60,15 @@ public class BoggartSpriteChaser extends CardImpl { this.toughness = new MageInt(2); // As long as you control a Faerie, Boggart Sprite-Chaser gets +1/+1 and has flying. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceWhileControlsEffect(filter, 1, 1))); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield), new PermanentsOnTheBattlefieldCondition(filter), rule))); + FilterPermanent filter = new FilterPermanent("Faerie", "Faerie"); + Effect effect = new BoostSourceWhileControlsEffect(filter, 1, 1); + effect.setText("As long as you control a Faerie, {this} gets +1/+1"); + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect); + ability.addEffect(new ConditionalContinuousEffect( + new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield), + new PermanentsOnTheBattlefieldCondition(filter), "and has flying")); + this.addAbility(ability); + } public BoggartSpriteChaser(final BoggartSpriteChaser card) { diff --git a/Mage.Sets/src/mage/sets/lorwyn/FodderLaunch.java b/Mage.Sets/src/mage/sets/lorwyn/FodderLaunch.java index d8d8cbebbc..5fbf233ad1 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/FodderLaunch.java +++ b/Mage.Sets/src/mage/sets/lorwyn/FodderLaunch.java @@ -25,26 +25,18 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.lorwyn; import java.util.UUID; -import mage.MageObject; -import mage.abilities.Ability; import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.costs.common.SacrificeTargetCost; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageTargetControllerEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.cards.CardImpl; import mage.constants.Duration; -import mage.constants.Outcome; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; @@ -53,24 +45,18 @@ import mage.target.common.TargetCreaturePermanent; */ public class FodderLaunch extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a Goblin"); - - static { - filter.add(new SubtypePredicate("Goblin")); - } - public FodderLaunch(UUID ownerId) { super(ownerId, 114, "Fodder Launch", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{B}"); this.expansionSetCode = "LRW"; this.subtype.add("Goblin"); - + //As an additional cost to cast Fodder Launch, sacrifice a Goblin. - this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); - + this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent("Goblin", "a Goblin"), true))); + //Target creature gets -5/-5 until end of turn. Fodder Launch deals 5 damage to that creature's controller. this.getSpellAbility().addEffect(new BoostTargetEffect(-5, -5, Duration.EndOfTurn)); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); - this.getSpellAbility().addEffect(new FodderLaunchEffect()); + this.getSpellAbility().addEffect(new DamageTargetControllerEffect(5)); } public FodderLaunch(final FodderLaunch card) { @@ -83,35 +69,3 @@ public class FodderLaunch extends CardImpl { } } - -class FodderLaunchEffect extends OneShotEffect { - - public FodderLaunchEffect() { - super(Outcome.Damage); - this.staticText = "Target creature gets -5/-5 until end of turn. Fodder Launch deals 5 damage to that creature's controller."; - } - - public FodderLaunchEffect(final FodderLaunchEffect effect) { - super(effect); - } - - @Override - public FodderLaunchEffect copy() { - return new FodderLaunchEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - MageObject sourceObject = game.getObject(source.getSourceId()); - if (controller != null && sourceObject != null) { - Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); - if (targetCreature != null) { - Player controllerOfTargetCreature = game.getPlayer(targetCreature.getControllerId()); - controllerOfTargetCreature.damage(5, source.getSourceId(), game, false, true); - return true; - } - } - return false; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/lorwyn/QuillSlingerBoggart.java b/Mage.Sets/src/mage/sets/lorwyn/QuillSlingerBoggart.java index 513bf353a4..cdb736215b 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/QuillSlingerBoggart.java +++ b/Mage.Sets/src/mage/sets/lorwyn/QuillSlingerBoggart.java @@ -61,7 +61,7 @@ public class QuillSlingerBoggart extends CardImpl { this.toughness = new MageInt(2); // Whenever a player casts a Kithkin spell, you may have target player lose 1 life. - Ability ability = new SpellCastAllTriggeredAbility(new LoseLifeTargetEffect(2), filter, true); + Ability ability = new SpellCastAllTriggeredAbility(new LoseLifeTargetEffect(1), filter, true); ability.addTarget(new TargetPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/planarchaos/FirefrightMage.java b/Mage.Sets/src/mage/sets/planarchaos/FirefrightMage.java index 741bfabb0a..729e237799 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/FirefrightMage.java +++ b/Mage.Sets/src/mage/sets/planarchaos/FirefrightMage.java @@ -28,21 +28,18 @@ package mage.sets.planarchaos; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.common.SimpleEvasionAbility; import mage.abilities.costs.common.DiscardCardCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; -import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.effects.common.combat.CantBeBlockedByAllTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; @@ -55,7 +52,7 @@ import mage.target.common.TargetCreaturePermanent; * @author BursegSardaukar */ public class FirefrightMage extends CardImpl { - + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("except by artifact creatures and/or red creatures"); static { @@ -65,7 +62,7 @@ public class FirefrightMage extends CardImpl { Predicates.and(new CardTypePredicate(CardType.CREATURE), new ColorPredicate(ObjectColor.RED) )))); } - + public FirefrightMage(UUID ownerId) { super(ownerId, 99, "Firefright Mage", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{R}"); this.expansionSetCode = "PLC"; @@ -75,8 +72,8 @@ public class FirefrightMage extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(1); - //{1} {R}, {T}, Discard a card: Target creature can't be blocked this turn except by artifact creatures and/or red creatures. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.EndOfTurn)), Duration.EndOfTurn),new ManaCostsImpl("{1}{R}")); + //{1}{R}, {T}, Discard a card: Target creature can't be blocked this turn except by artifact creatures and/or red creatures. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBeBlockedByAllTargetEffect(filter, Duration.EndOfTurn), new ManaCostsImpl("{1}{R}")); ability.addCost(new TapSourceCost()); ability.addCost(new DiscardCardCost()); ability.addTarget(new TargetCreaturePermanent()); diff --git a/Mage.Sets/src/mage/sets/ravnica/GoblinFireFiend.java b/Mage.Sets/src/mage/sets/ravnica/GoblinFireFiend.java index 053454589d..1c7d12327e 100644 --- a/Mage.Sets/src/mage/sets/ravnica/GoblinFireFiend.java +++ b/Mage.Sets/src/mage/sets/ravnica/GoblinFireFiend.java @@ -32,11 +32,9 @@ import java.util.UUID; import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.common.combat.MustBeBlockedByAtLeastOneSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.keyword.HasteAbility; @@ -49,7 +47,7 @@ import mage.constants.Zone; * @author BursegSardaukar */ public class GoblinFireFiend extends CardImpl { - + public GoblinFireFiend(UUID ownerId) { super(ownerId, 127, "Goblin Fire Fiend", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); this.expansionSetCode = "RAV"; @@ -58,16 +56,15 @@ public class GoblinFireFiend extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(1); - + //Haste this.addAbility(HasteAbility.getInstance()); - + //Goblin Fire Fiend must be blocked if able. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MustBeBlockedByAtLeastOneSourceEffect())); - + //{R}: Goblin Fire Fiend gets +1/+0 until end of turn. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(new StaticValue(1), new StaticValue(0), Duration.EndOfTurn), new ManaCostsImpl("{R}")); - this.addAbility(ability); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}"))); } public GoblinFireFiend(final GoblinFireFiend card) { diff --git a/Mage.Sets/src/mage/sets/tempest/MoggSquad.java b/Mage.Sets/src/mage/sets/tempest/MoggSquad.java index 6188bc2083..1bc3a474e7 100644 --- a/Mage.Sets/src/mage/sets/tempest/MoggSquad.java +++ b/Mage.Sets/src/mage/sets/tempest/MoggSquad.java @@ -28,9 +28,6 @@ package mage.sets.tempest; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; @@ -39,7 +36,9 @@ import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.SignInversionDynamicValue; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; @@ -63,7 +62,8 @@ public class MoggSquad extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(3); - + + // Mogg Squad gets -1/-1 for each other creature on the battlefield. DynamicValue amount = new SignInversionDynamicValue(new PermanentsOnBattlefieldCount(filter)); Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(amount, amount, Duration.WhileOnBattlefield)); this.addAbility(ability); diff --git a/Mage/src/mage/abilities/effects/common/combat/CantBeBlockedByAllTargetEffect.java b/Mage/src/mage/abilities/effects/common/combat/CantBeBlockedByAllTargetEffect.java new file mode 100644 index 0000000000..ec697e3ba8 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/combat/CantBeBlockedByAllTargetEffect.java @@ -0,0 +1,51 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.effects.common.combat; + +import mage.abilities.Ability; +import mage.abilities.effects.RestrictionEffect; +import mage.constants.Duration; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ +public class CantBeBlockedByAllTargetEffect extends RestrictionEffect { + + private final FilterCreaturePermanent filterBlockedBy; + + public CantBeBlockedByAllTargetEffect(FilterCreaturePermanent filterBlockedBy, Duration duration) { + super(Duration.WhileOnBattlefield); + this.filterBlockedBy = filterBlockedBy; + staticText = "Target creature" + + " can't be blocked " + + (filterBlockedBy.getMessage().startsWith("except by") ? "" : "by ") + + filterBlockedBy.getMessage(); + } + + public CantBeBlockedByAllTargetEffect(final CantBeBlockedByAllTargetEffect effect) { + super(effect); + this.filterBlockedBy = effect.filterBlockedBy; + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return getTargetPointer().getTargets(game, source).contains(permanent.getId()); + } + + @Override + public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) { + return !filterBlockedBy.match(blocker, source.getSourceId(), source.getControllerId(), game); + } + + @Override + public CantBeBlockedByAllTargetEffect copy() { + return new CantBeBlockedByAllTargetEffect(this); + } +}