diff --git a/Mage.Sets/src/mage/cards/d/DamiaSageOfStone.java b/Mage.Sets/src/mage/cards/d/DamiaSageOfStone.java index effdfb78226..cbcaf214e65 100644 --- a/Mage.Sets/src/mage/cards/d/DamiaSageOfStone.java +++ b/Mage.Sets/src/mage/cards/d/DamiaSageOfStone.java @@ -1,31 +1,29 @@ - package mage.cards.d; -import java.util.UUID; import mage.MageInt; -import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.dynamicvalue.IntPlusDynamicValue; -import mage.abilities.dynamicvalue.MultipliedValue; -import mage.abilities.dynamicvalue.common.CardsInControllerHandCount; -import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.CardsInHandCondition; +import mage.abilities.effects.common.DrawCardsEqualToDifferenceEffect; import mage.abilities.effects.common.SkipDrawStepEffect; import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.ComparisonType; import mage.constants.SubType; import mage.constants.SuperType; -import mage.constants.TargetController; -import mage.game.Game; -import mage.players.Player; + +import java.util.UUID; /** - * * @author emerald000 */ public final class DamiaSageOfStone extends CardImpl { + private static final Condition condition = new CardsInHandCondition(ComparisonType.FEWER_THAN, 7); + public DamiaSageOfStone(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{G}{U}"); this.supertype.add(SuperType.LEGENDARY); @@ -42,7 +40,7 @@ public final class DamiaSageOfStone extends CardImpl { this.addAbility(new SimpleStaticAbility(new SkipDrawStepEffect())); // At the beginning of your upkeep, if you have fewer than seven cards in hand, draw cards equal to the difference. - this.addAbility(new DamiaSageOfStoneTriggeredAbility()); + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DrawCardsEqualToDifferenceEffect(7)).withInterveningIf(condition)); } private DamiaSageOfStone(final DamiaSageOfStone card) { @@ -54,33 +52,3 @@ public final class DamiaSageOfStone extends CardImpl { return new DamiaSageOfStone(this); } } - -class DamiaSageOfStoneTriggeredAbility extends BeginningOfUpkeepTriggeredAbility { - - DamiaSageOfStoneTriggeredAbility() { - super(TargetController.YOU, new DrawCardSourceControllerEffect(new IntPlusDynamicValue(7, new MultipliedValue(CardsInControllerHandCount.ANY, -1))), false); - } - - private DamiaSageOfStoneTriggeredAbility(final DamiaSageOfStoneTriggeredAbility ability) { - super(ability); - } - - @Override - public DamiaSageOfStoneTriggeredAbility copy() { - return new DamiaSageOfStoneTriggeredAbility(this); - } - - @Override - public boolean checkInterveningIfClause(Game game) { - Player player = game.getPlayer(this.getControllerId()); - if (player != null) { - return player.getHand().size() < 7; - } - return false; - } - - @Override - public String getRule() { - return "At the beginning of your upkeep, if you have fewer than seven cards in hand, draw cards equal to the difference."; - } -} diff --git a/Mage.Sets/src/mage/cards/d/DoctorOctopusMasterPlanner.java b/Mage.Sets/src/mage/cards/d/DoctorOctopusMasterPlanner.java new file mode 100644 index 00000000000..72ae12cb57c --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DoctorOctopusMasterPlanner.java @@ -0,0 +1,58 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.CardsInHandCondition; +import mage.abilities.effects.common.DrawCardsEqualToDifferenceEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect; +import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.common.FilterCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DoctorOctopusMasterPlanner extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.VILLAIN, "Villains"); + private static final Condition condition = new CardsInHandCondition(ComparisonType.FEWER_THAN, 8); + + public DoctorOctopusMasterPlanner(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{B}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SCIENTIST); + this.subtype.add(SubType.VILLAIN); + this.power = new MageInt(4); + this.toughness = new MageInt(8); + + // Other Villains you control get +2/+2. + this.addAbility(new SimpleStaticAbility(new BoostControlledEffect( + 2, 2, Duration.WhileOnBattlefield, filter, true + ))); + + // Your maximum hand size is eight. + this.addAbility(new SimpleStaticAbility(new MaximumHandSizeControllerEffect( + 8, Duration.WhileOnBattlefield, MaximumHandSizeControllerEffect.HandSizeModification.SET + ))); + + // At the beginning of your end step, if you have fewer than eight cards in hand, draw cards equal to the difference. + this.addAbility(new BeginningOfEndStepTriggeredAbility(new DrawCardsEqualToDifferenceEffect(8)).withInterveningIf(condition)); + } + + private DoctorOctopusMasterPlanner(final DoctorOctopusMasterPlanner card) { + super(card); + } + + @Override + public DoctorOctopusMasterPlanner copy() { + return new DoctorOctopusMasterPlanner(this); + } +} diff --git a/Mage.Sets/src/mage/cards/i/IymrithDesertDoom.java b/Mage.Sets/src/mage/cards/i/IymrithDesertDoom.java index 12e07f87554..3d551bc436c 100644 --- a/Mage.Sets/src/mage/cards/i/IymrithDesertDoom.java +++ b/Mage.Sets/src/mage/cards/i/IymrithDesertDoom.java @@ -1,27 +1,27 @@ package mage.cards.i; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.InvertCondition; import mage.abilities.condition.common.SourceTappedCondition; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.decorator.ConditionalContinuousEffect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.DrawCardsEqualToDifferenceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; -import mage.abilities.keyword.WardAbility; -import mage.constants.*; import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.WardAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.game.Game; -import mage.players.Player; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; + +import java.util.UUID; /** - * * @author weirddan455 */ public final class IymrithDesertDoom extends CardImpl { @@ -40,13 +40,13 @@ public final class IymrithDesertDoom extends CardImpl { // Iymrith, Desert Doom has ward {4} as long as it's untapped. this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( new GainAbilitySourceEffect(new WardAbility(new GenericManaCost(4)), Duration.WhileOnBattlefield), - SourceTappedCondition.UNTAPPED, - "{this} has ward {4} as long as it's untapped" + SourceTappedCondition.UNTAPPED, "{this} has ward {4} as long as it's untapped" ))); // Whenever Iymrith deals combat damage to a player, draw a card. Then if you have fewer than three cards in hand, draw cards equal to the difference. - Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1), false); - ability.addEffect(new IymrithDesertDoomEffect()); + Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1)); + ability.addEffect(new DrawCardsEqualToDifferenceEffect(3) + .concatBy("Then if you have fewer than three cards in hand,")); this.addAbility(ability); } @@ -59,33 +59,3 @@ public final class IymrithDesertDoom extends CardImpl { return new IymrithDesertDoom(this); } } - -class IymrithDesertDoomEffect extends OneShotEffect { - - IymrithDesertDoomEffect() { - super(Outcome.DrawCard); - this.staticText = "Then if you have fewer than three cards in hand, draw cards equal to the difference"; - } - - private IymrithDesertDoomEffect(final IymrithDesertDoomEffect effect) { - super(effect); - } - - @Override - public IymrithDesertDoomEffect copy() { - return new IymrithDesertDoomEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - int handSize = controller.getHand().size(); - if (handSize < 3) { - controller.drawCards(3 - handSize, source, game); - return true; - } - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/k/KozilekTheGreatDistortion.java b/Mage.Sets/src/mage/cards/k/KozilekTheGreatDistortion.java index b8842f6f4b9..61396a8b402 100644 --- a/Mage.Sets/src/mage/cards/k/KozilekTheGreatDistortion.java +++ b/Mage.Sets/src/mage/cards/k/KozilekTheGreatDistortion.java @@ -7,9 +7,9 @@ import mage.abilities.condition.Condition; import mage.abilities.condition.common.CardsInHandCondition; import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CastSourceTriggeredAbility; import mage.abilities.effects.common.CounterTargetEffect; +import mage.abilities.effects.common.DrawCardsEqualToDifferenceEffect; import mage.abilities.keyword.MenaceAbility; import mage.cards.Card; import mage.cards.CardImpl; @@ -44,7 +44,7 @@ public final class KozilekTheGreatDistortion extends CardImpl { this.toughness = new MageInt(12); // When you cast Kozilek, the Great Distortion, if you have fewer than seven cards in hand, draw cards equal to the difference. - this.addAbility(new CastSourceTriggeredAbility(new KozilekDrawEffect(), false).withInterveningIf(condition)); + this.addAbility(new CastSourceTriggeredAbility(new DrawCardsEqualToDifferenceEffect(7)).withInterveningIf(condition)); // Menace this.addAbility(new MenaceAbility(false)); @@ -65,33 +65,6 @@ public final class KozilekTheGreatDistortion extends CardImpl { } } -class KozilekDrawEffect extends OneShotEffect { - - KozilekDrawEffect() { - super(Outcome.DrawCard); - this.staticText = "draw cards equal to the difference"; - } - - private KozilekDrawEffect(final KozilekDrawEffect effect) { - super(effect); - } - - @Override - public KozilekDrawEffect copy() { - return new KozilekDrawEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - controller.drawCards(7 - controller.getHand().size(), source, game); - return true; - } - return false; - } -} - class KozilekDiscardCost extends CostImpl { public KozilekDiscardCost() { @@ -156,5 +129,4 @@ class KozilekDiscardCost extends CostImpl { public KozilekDiscardCost copy() { return new KozilekDiscardCost(this); } - } diff --git a/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java b/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java index 2f6aa9bcf8f..773dc33b9d0 100644 --- a/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java +++ b/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java @@ -32,6 +32,8 @@ public final class MarvelsSpiderMan extends ExpansionSet { cards.add(new SetCardInfo("Daily Bugle Reporters", 6, Rarity.COMMON, mage.cards.d.DailyBugleReporters.class)); cards.add(new SetCardInfo("Doc Ock's Henchmen", 30, Rarity.COMMON, mage.cards.d.DocOcksHenchmen.class)); cards.add(new SetCardInfo("Doc Ock, Sinister Scientist", 29, Rarity.COMMON, mage.cards.d.DocOckSinisterScientist.class)); + cards.add(new SetCardInfo("Doctor Octopus, Master Planner", 128, Rarity.MYTHIC, mage.cards.d.DoctorOctopusMasterPlanner.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Doctor Octopus, Master Planner", 228, Rarity.MYTHIC, mage.cards.d.DoctorOctopusMasterPlanner.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Eerie Gravestone", 163, Rarity.COMMON, mage.cards.e.EerieGravestone.class)); cards.add(new SetCardInfo("Electro's Bolt", 77, Rarity.COMMON, mage.cards.e.ElectrosBolt.class)); cards.add(new SetCardInfo("Flying Octobot", 31, Rarity.UNCOMMON, mage.cards.f.FlyingOctobot.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardsEqualToDifferenceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardsEqualToDifferenceEffect.java new file mode 100644 index 00000000000..25c23069aef --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardsEqualToDifferenceEffect.java @@ -0,0 +1,37 @@ +package mage.abilities.effects.common; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; + +/** + * @author TheElk801 + */ +public class DrawCardsEqualToDifferenceEffect extends OneShotEffect { + + private final int amount; + + public DrawCardsEqualToDifferenceEffect(int amount) { + super(Outcome.Benefit); + this.amount = amount; + staticText = "draw cards equal to the difference"; + } + + private DrawCardsEqualToDifferenceEffect(final DrawCardsEqualToDifferenceEffect effect) { + super(effect); + this.amount = effect.amount; + } + + @Override + public DrawCardsEqualToDifferenceEffect copy() { + return new DrawCardsEqualToDifferenceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + return player != null && player.drawCards(Math.max(amount - player.getHand().size(), 0), source, game) > 0; + } +}