diff --git a/Mage.Sets/src/mage/cards/u/UglukOfTheWhiteHand.java b/Mage.Sets/src/mage/cards/u/UglukOfTheWhiteHand.java new file mode 100644 index 00000000000..9204b4af5dd --- /dev/null +++ b/Mage.Sets/src/mage/cards/u/UglukOfTheWhiteHand.java @@ -0,0 +1,106 @@ +package mage.cards.u; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesCreatureTriggeredAbility; +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.constants.SuperType; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * + * @author Susucr + */ +public final class UglukOfTheWhiteHand extends CardImpl { + + public UglukOfTheWhiteHand(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{R}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.ORC); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Whenever another creature you control dies, put a +1/+1 counter on Ugluk of the White Hand. + // If that creature was a Goblin or Orc, put two +1/+1 counters on Ugluk instead. + this.addAbility(new DiesCreatureTriggeredAbility( + new UglukOfTheWhiteHandEffect(), + false, + StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, + true + )); + } + + private UglukOfTheWhiteHand(final UglukOfTheWhiteHand card) { + super(card); + } + + @Override + public UglukOfTheWhiteHand copy() { + return new UglukOfTheWhiteHand(this); + } +} + + +class UglukOfTheWhiteHandEffect extends OneShotEffect { + + private static FilterPermanent filterOrcOrGoblin = new FilterCreaturePermanent(); + + static { + filterOrcOrGoblin.add( + Predicates.or( + SubType.ORC.getPredicate(), + SubType.GOBLIN.getPredicate() + )); + } + + public UglukOfTheWhiteHandEffect() { + super(Outcome.Benefit); + staticText = "put a +1/+1 counter on Ugluk of the White Hand. " + + "If that creature was a Goblin or Orc, put two +1/+1 counters on Ugluk instead."; + } + + public UglukOfTheWhiteHandEffect(final UglukOfTheWhiteHandEffect effect) { + super(effect); + } + + @Override + public UglukOfTheWhiteHandEffect copy() { + return new UglukOfTheWhiteHandEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent deadCreature = game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game, source)); + + boolean wasOrcOrGoblin = false; + if (deadCreature != null) { + wasOrcOrGoblin = filterOrcOrGoblin.match(deadCreature, game); + } + + Permanent ugluk = game.getPermanent(source.getSourceId()); + if(ugluk == null){ + return false; + } + + ugluk.addCounters( + CounterType.P1P1.createInstance(wasOrcOrGoblin ? 2 : 1), + source.getControllerId(), source, game); + + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index e3080e4f152..72cea2806a7 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -271,6 +271,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Trailblazer's Boots", 398, Rarity.RARE, mage.cards.t.TrailblazersBoots.class)); cards.add(new SetCardInfo("Treason of Isengard", 74, Rarity.COMMON, mage.cards.t.TreasonOfIsengard.class)); cards.add(new SetCardInfo("Troll of Khazad-dum", 111, Rarity.COMMON, mage.cards.t.TrollOfKhazadDum.class)); + cards.add(new SetCardInfo("Ugluk of the White Hand", 235, Rarity.UNCOMMON, mage.cards.u.UglukOfTheWhiteHand.class)); cards.add(new SetCardInfo("Uruk-hai Berserker", 112, Rarity.COMMON, mage.cards.u.UrukHaiBerserker.class)); cards.add(new SetCardInfo("Voracious Fell Beast", 113, Rarity.UNCOMMON, mage.cards.v.VoraciousFellBeast.class)); cards.add(new SetCardInfo("War of the Last Alliance", 36, Rarity.RARE, mage.cards.w.WarOfTheLastAlliance.class));