From 29ecfb9f084fdd35a1cbf6ee2bdf405766745da4 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 28 Sep 2022 08:37:57 -0400 Subject: [PATCH] [UNF] Implemented Non-Human Cannonball --- .../src/mage/cards/n/NonHumanCannonball.java | 72 +++++++++++++++++++ Mage.Sets/src/mage/sets/Unfinity.java | 1 + 2 files changed, 73 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/n/NonHumanCannonball.java diff --git a/Mage.Sets/src/mage/cards/n/NonHumanCannonball.java b/Mage.Sets/src/mage/cards/n/NonHumanCannonball.java new file mode 100644 index 0000000000..94538d0d5b --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NonHumanCannonball.java @@ -0,0 +1,72 @@ +package mage.cards.n; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesSourceTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class NonHumanCannonball extends CardImpl { + + public NonHumanCannonball(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{R}"); + + this.subtype.add(SubType.CLOWN); + this.subtype.add(SubType.ROBOT); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // When Non-Human Cannonball dies, roll a six-sided die. If the result is 4 or less, Non-Human Cannonball deals that much damage to you. + this.addAbility(new DiesSourceTriggeredAbility(new NonHumanCannonballEffect())); + } + + private NonHumanCannonball(final NonHumanCannonball card) { + super(card); + } + + @Override + public NonHumanCannonball copy() { + return new NonHumanCannonball(this); + } +} + +class NonHumanCannonballEffect extends OneShotEffect { + + NonHumanCannonballEffect() { + super(Outcome.Benefit); + staticText = "roll a six-sided die. If the result is 4 or less, {this} deals that much damage to you"; + } + + private NonHumanCannonballEffect(final NonHumanCannonballEffect effect) { + super(effect); + } + + @Override + public NonHumanCannonballEffect copy() { + return new NonHumanCannonballEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + int result = player.rollDice(outcome, source, game, 6); + if (result <= 4) { + player.damage(result, source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Unfinity.java b/Mage.Sets/src/mage/sets/Unfinity.java index df409e8d12..5509b5a940 100644 --- a/Mage.Sets/src/mage/sets/Unfinity.java +++ b/Mage.Sets/src/mage/sets/Unfinity.java @@ -33,6 +33,7 @@ public final class Unfinity extends ExpansionSet { cards.add(new SetCardInfo("Lila, Hospitality Hostess", 170, Rarity.MYTHIC, mage.cards.l.LilaHospitalityHostess.class)); cards.add(new SetCardInfo("Monoxa, Midway Manager", 173, Rarity.UNCOMMON, mage.cards.m.MonoxaMidwayManager.class)); cards.add(new SetCardInfo("Mountain", 238, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS)); + cards.add(new SetCardInfo("Non-Human Cannonball", 115, Rarity.COMMON, mage.cards.n.NonHumanCannonball.class)); cards.add(new SetCardInfo("One-Clown Band", 117, Rarity.COMMON, mage.cards.o.OneClownBand.class)); cards.add(new SetCardInfo("Overgrown Tomb", 284, Rarity.RARE, mage.cards.o.OvergrownTomb.class)); cards.add(new SetCardInfo("Plains", 235, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS));