From 087b6126a0deffda3565ca792454c3a939f06581 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 2 Sep 2018 22:18:16 -0400 Subject: [PATCH] Implemented Boros Challenger --- .../src/mage/cards/b/BorosChallenger.java | 49 ++++++++++++++++ Mage.Sets/src/mage/sets/GuildsOfRavnica.java | 1 + .../mage/abilities/keyword/MentorAbility.java | 56 +++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BorosChallenger.java create mode 100644 Mage/src/main/java/mage/abilities/keyword/MentorAbility.java diff --git a/Mage.Sets/src/mage/cards/b/BorosChallenger.java b/Mage.Sets/src/mage/cards/b/BorosChallenger.java new file mode 100644 index 00000000000..b05423b33fd --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BorosChallenger.java @@ -0,0 +1,49 @@ +package mage.cards.b; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.constants.SubType; +import mage.abilities.keyword.MentorAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Zone; + +/** + * + * @author TheElk801 + */ +public final class BorosChallenger extends CardImpl { + + public BorosChallenger(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{W}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Mentor + this.addAbility(new MentorAbility()); + + // {2}{R}{W}: Boros Challenger gets +1/+1 until end of turn. + this.addAbility(new SimpleActivatedAbility( + Zone.BATTLEFIELD, + new BoostSourceEffect(1, 1, Duration.EndOfTurn), + new ManaCostsImpl("{2}{R}{W}") + )); + } + + public BorosChallenger(final BorosChallenger card) { + super(card); + } + + @Override + public BorosChallenger copy() { + return new BorosChallenger(this); + } +} diff --git a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java index 8b5d5bda115..b8fb13f75ff 100644 --- a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java +++ b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java @@ -22,6 +22,7 @@ public final class GuildsOfRavnica extends ExpansionSet { this.numBoosterRare = 1; this.ratioBoosterMythic = 8; + cards.add(new SetCardInfo("Boros Challenger", 156, Rarity.UNCOMMON, mage.cards.b.BorosChallenger.class)); cards.add(new SetCardInfo("Emmara, Soul of the Accord", 168, Rarity.RARE, mage.cards.e.EmmaraSoulOfTheAccord.class)); cards.add(new SetCardInfo("Impervious Greatwurm", 273, Rarity.MYTHIC, mage.cards.i.ImperviousGreatwurm.class)); cards.add(new SetCardInfo("Narcomoeba", 47, Rarity.RARE, mage.cards.n.Narcomoeba.class)); diff --git a/Mage/src/main/java/mage/abilities/keyword/MentorAbility.java b/Mage/src/main/java/mage/abilities/keyword/MentorAbility.java new file mode 100644 index 00000000000..bd579657dac --- /dev/null +++ b/Mage/src/main/java/mage/abilities/keyword/MentorAbility.java @@ -0,0 +1,56 @@ +package mage.abilities.keyword; + +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.cards.Card; +import mage.counters.CounterType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.filter.predicate.permanent.AttackingPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author TheElk801 + */ +public class MentorAbility extends AttacksTriggeredAbility { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("attacking creature with lesser power"); + + static { + filter.add(new AttackingPredicate()); + filter.add(new MentorAbilityPredicate()); + } + + public MentorAbility() { + super(new AddCountersTargetEffect(CounterType.P1P1.createInstance()), false); + this.addTarget(new TargetCreaturePermanent(filter)); + } + + public MentorAbility(final MentorAbility ability) { + super(ability); + } + + @Override + public String getRule() { + return "mentor (Whenever this creature attacks, put a +1/+1 counter on target attacking creature with lesser power.)"; + } + + @Override + public MentorAbility copy() { + return new MentorAbility(this); + } + +} + +class MentorAbilityPredicate implements ObjectSourcePlayerPredicate> { + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(input.getSourceId()); + return sourcePermanent != null && input.getObject().getPower().getValue() < sourcePermanent.getPower().getValue(); + } +}