- * 5/1/2009 The ability grants you control of all creatures that are blocking it - * as the ability resolves. This will include any creatures that were put onto - * the battlefield blocking it. - *
- * 5/1/2009 Any blocking creatures that regenerated during combat will have been - * removed from combat. Since such creatures are no longer in combat, they - * cannot be blocking The Wretched, which means you won't be able to gain - * control of them. - *
- * 5/1/2009 If The Wretched itself regenerated during combat, then it will have - * been removed from combat. Since it is no longer in combat, there cannot be - * any creatures blocking it, which means you won't be able to gain control of - * any creatures. - *
- * 10/1/2009 The Wretched's ability triggers only if it's still on the - * battlefield when the end of combat step begins (after the combat damage - * step). For example, if it's blocked by a 7/7 creature and is destroyed, its - * ability won't trigger at all. - *
- * 10/1/2009 If The Wretched leaves the battlefield, you no longer control it, - * so the duration of its control-change effect ends. - *
- * 10/1/2009 If you lose control of The Wretched before its ability resolves, - * you won't gain control of the creatures blocking it at all. - *
- * 10/1/2009 Once the ability resolves, it doesn't care whether the permanents
- * you gained control of remain creatures, only that they remain on the
- * battlefield.
+ * @author awjackson
*/
public final class TheWretched extends CardImpl {
+ private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures blocking {this}");
+
+ static {
+ filter.add(BlockingOrBlockedBySourcePredicate.BLOCKING);
+ }
+
public TheWretched(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.subtype.add(SubType.DEMON);
@@ -61,7 +31,7 @@ public final class TheWretched extends CardImpl {
this.toughness = new MageInt(5);
// At end of combat, gain control of all creatures blocking The Wretched for as long as you control The Wretched.
- this.addAbility(new EndOfCombatTriggeredAbility(new TheWretchedEffect(), false), new BlockedAttackerWatcher());
+ this.addAbility(new EndOfCombatTriggeredAbility(new GainControlAllEffect(Duration.WhileControlled, filter), false));
}
private TheWretched(final TheWretched card) {
@@ -73,47 +43,3 @@ public final class TheWretched extends CardImpl {
return new TheWretched(this);
}
}
-
-class TheWretchedEffect extends OneShotEffect {
-
- TheWretchedEffect() {
- super(Outcome.Benefit);
- staticText = "gain control of all creatures blocking {this} for as long as you control {this}";
- }
-
- TheWretchedEffect(final TheWretchedEffect effect) {
- super(effect);
- }
-
- @Override
- public boolean apply(Game game, Ability source) {
- Permanent theWretched = source.getSourcePermanentIfItStillExists(game);
- if (theWretched == null
- || !theWretched.isAttacking()
- || !source.isControlledBy(theWretched.getControllerId())) {
- return false;
- }
- // Check if control of source has changed since ability triggered????? (does it work is it neccessary???)
- for (CombatGroup combatGroup : game.getCombat().getGroups()) {
- if (!combatGroup.getAttackers().contains(source.getSourceId())) {
- continue;
- }
- for (UUID creatureId : combatGroup.getBlockers()) {
- Permanent blocker = game.getPermanent(creatureId);
- if (blocker == null
- || blocker.getBlocking() <= 0) {
- continue;
- }
- ContinuousEffect effect = new GainControlTargetEffect(Duration.WhileControlled, source.getControllerId());
- effect.setTargetPointer(new FixedTarget(blocker.getId(), game));
- game.addEffect(effect, source);
- }
- }
- return true;
- }
-
- @Override
- public TheWretchedEffect copy() {
- return new TheWretchedEffect(this);
- }
-}
diff --git a/Mage.Sets/src/mage/cards/t/TibaltTheFiendBlooded.java b/Mage.Sets/src/mage/cards/t/TibaltTheFiendBlooded.java
index f1d8f37d7f0..29835e73403 100644
--- a/Mage.Sets/src/mage/cards/t/TibaltTheFiendBlooded.java
+++ b/Mage.Sets/src/mage/cards/t/TibaltTheFiendBlooded.java
@@ -1,34 +1,29 @@
-
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.dynamicvalue.common.CardsInTargetHandCount;
-import mage.abilities.effects.ContinuousEffect;
-import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
-import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
+import mage.abilities.effects.common.UntapAllEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
-import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
+import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
+import mage.abilities.effects.common.continuous.GainControlAllEffect;
import mage.abilities.effects.common.discard.DiscardControllerEffect;
import mage.abilities.keyword.HasteAbility;
-import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.*;
+import mage.constants.CardType;
+import mage.constants.Duration;
+import mage.constants.SubType;
+import mage.constants.SuperType;
import mage.filter.StaticFilters;
-import mage.game.Game;
-import mage.game.permanent.Permanent;
-import mage.players.Player;
import mage.target.TargetPlayer;
-import mage.target.targetpointer.FixedTarget;
-import java.util.List;
import java.util.UUID;
/**
- * @author North
+ * @author awjackson
*/
public final class TibaltTheFiendBlooded extends CardImpl {
@@ -40,19 +35,27 @@ public final class TibaltTheFiendBlooded extends CardImpl {
this.setStartingLoyalty(2);
// +1: Draw a card, then discard a card at random.
- LoyaltyAbility ability = new LoyaltyAbility(new DrawCardSourceControllerEffect(1), 1);
- Effect effect = new DiscardControllerEffect(1, true);
- effect.setText(", then discard a card at random");
- ability.addEffect(effect);
+ Ability ability = new LoyaltyAbility(new DrawCardSourceControllerEffect(1), 1);
+ ability.addEffect(new DiscardControllerEffect(1, true).concatBy(", then"));
this.addAbility(ability);
+
// -4: Tibalt, the Fiend-Blooded deals damage equal to the number of cards in target player's hand to that player.
- effect = new DamageTargetEffect(CardsInTargetHandCount.instance, true);
+ Effect effect = new DamageTargetEffect(CardsInTargetHandCount.instance);
effect.setText("{this} deals damage equal to the number of cards in target player's hand to that player");
ability = new LoyaltyAbility(effect, -4);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
+
// -6: Gain control of all creatures until end of turn. Untap them. They gain haste until end of turn.
- this.addAbility(new LoyaltyAbility(new TibaltTheFiendBloodedThirdEffect(), -6));
+ ability = new LoyaltyAbility(new GainControlAllEffect(Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES), -6);
+ ability.addEffect(new UntapAllEffect(StaticFilters.FILTER_PERMANENT_CREATURES).setText("untap them"));
+ ability.addEffect(new GainAbilityAllEffect(
+ HasteAbility.getInstance(),
+ Duration.EndOfTurn,
+ StaticFilters.FILTER_PERMANENT_CREATURES,
+ "they gain haste until end of turn"
+ ));
+ this.addAbility(ability);
}
private TibaltTheFiendBlooded(final TibaltTheFiendBlooded card) {
@@ -64,95 +67,3 @@ public final class TibaltTheFiendBlooded extends CardImpl {
return new TibaltTheFiendBlooded(this);
}
}
-
-class TibaltTheFiendBloodedFirstEffect extends OneShotEffect {
-
- public TibaltTheFiendBloodedFirstEffect() {
- super(Outcome.Benefit);
- this.staticText = "Draw a card, then discard a card at random";
- }
-
- public TibaltTheFiendBloodedFirstEffect(final TibaltTheFiendBloodedFirstEffect effect) {
- super(effect);
- }
-
- @Override
- public TibaltTheFiendBloodedFirstEffect copy() {
- return new TibaltTheFiendBloodedFirstEffect(this);
- }
-
- @Override
- public boolean apply(Game game, Ability source) {
- Player player = game.getPlayer(source.getControllerId());
- if (player != null) {
- player.drawCards(1, source, game);
- Card card = player.getHand().getRandom(game);
- player.discard(card, false, source, game);
- return true;
- }
- return false;
- }
-}
-
-class TibaltTheFiendBloodedThirdEffect extends OneShotEffect {
-
- public TibaltTheFiendBloodedThirdEffect() {
- super(Outcome.GainControl);
- this.staticText = "Gain control of all creatures until end of turn. Untap them. They gain haste until end of turn";
- }
-
- public TibaltTheFiendBloodedThirdEffect(final TibaltTheFiendBloodedThirdEffect effect) {
- super(effect);
- }
-
- @Override
- public TibaltTheFiendBloodedThirdEffect copy() {
- return new TibaltTheFiendBloodedThirdEffect(this);
- }
-
- @Override
- public boolean apply(Game game, Ability source) {
- List