diff --git a/Mage.Sets/src/mage/cards/b/BodyOfKnowledge.java b/Mage.Sets/src/mage/cards/b/BodyOfKnowledge.java new file mode 100644 index 00000000000..b0dc71a4373 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BodyOfKnowledge.java @@ -0,0 +1,85 @@ +package mage.cards.b; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealtDamageToSourceTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.CardsInControllerHandCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect; +import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BodyOfKnowledge extends CardImpl { + + public BodyOfKnowledge(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}"); + + this.subtype.add(SubType.AVATAR); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Body of Knowledge's power and toughness are each equal to the number of cards in your hand. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, + new SetPowerToughnessSourceEffect( + CardsInControllerHandCount.instance, Duration.EndOfGame + ) + )); + + // You have no maximum hand size. + this.addAbility(new SimpleStaticAbility(new MaximumHandSizeControllerEffect( + Integer.MAX_VALUE, Duration.WhileOnBattlefield, + MaximumHandSizeControllerEffect.HandSizeModification.SET + ))); + + // Whenever Body of Knowledge is dealt damage, draw that many cards. + this.addAbility(new DealtDamageToSourceTriggeredAbility( + new BodyOfKnowledgeEffect(), false, false, true + )); + } + + private BodyOfKnowledge(final BodyOfKnowledge card) { + super(card); + } + + @Override + public BodyOfKnowledge copy() { + return new BodyOfKnowledge(this); + } +} + +class BodyOfKnowledgeEffect extends OneShotEffect { + + BodyOfKnowledgeEffect() { + super(Outcome.Benefit); + staticText = "draw that many cards"; + } + + private BodyOfKnowledgeEffect(final BodyOfKnowledgeEffect effect) { + super(effect); + } + + @Override + public BodyOfKnowledgeEffect copy() { + return new BodyOfKnowledgeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int amount = (Integer) getValue("damage"); + Player player = game.getPlayer(source.getControllerId()); + return player != null + && amount > 0 + && player.drawCards(amount, source.getSourceId(), game) > 0; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegends.java b/Mage.Sets/src/mage/sets/CommanderLegends.java index 51f83312e03..772c5d39cb1 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegends.java +++ b/Mage.Sets/src/mage/sets/CommanderLegends.java @@ -76,6 +76,7 @@ public final class CommanderLegends extends ExpansionSet { cards.add(new SetCardInfo("Blighted Woodland", 476, Rarity.UNCOMMON, mage.cards.b.BlightedWoodland.class)); cards.add(new SetCardInfo("Blim, Comedic Genius", 272, Rarity.RARE, mage.cards.b.BlimComedicGenius.class)); cards.add(new SetCardInfo("Boarding Party", 163, Rarity.COMMON, mage.cards.b.BoardingParty.class)); + cards.add(new SetCardInfo("Body of Knowledge", 59, Rarity.RARE, mage.cards.b.BodyOfKnowledge.class)); cards.add(new SetCardInfo("Bonesplitter", 458, Rarity.COMMON, mage.cards.b.Bonesplitter.class)); cards.add(new SetCardInfo("Boros Charm", 442, Rarity.UNCOMMON, mage.cards.b.BorosCharm.class)); cards.add(new SetCardInfo("Boros Garrison", 477, Rarity.UNCOMMON, mage.cards.b.BorosGarrison.class));