From 9ba023ce6693e98c63439188b1da67070995ffbe Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 3 Sep 2018 23:18:13 -0400 Subject: [PATCH] Implemented Legion Warboss --- Mage.Sets/src/mage/cards/l/LegionWarboss.java | 121 ++++++++++++++++++ Mage.Sets/src/mage/sets/GuildsOfRavnica.java | 1 + .../combat/AttacksIfAbleSourceEffect.java | 2 +- 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/l/LegionWarboss.java diff --git a/Mage.Sets/src/mage/cards/l/LegionWarboss.java b/Mage.Sets/src/mage/cards/l/LegionWarboss.java new file mode 100644 index 0000000000..84e78b19e1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LegionWarboss.java @@ -0,0 +1,121 @@ +package mage.cards.l; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.StaticAbility; +import mage.abilities.common.BeginningOfCombatTriggeredAbility; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.combat.AttacksIfAbleSourceEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.HasteAbility; +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.Outcome; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.token.GoblinToken; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author TheElk801 + */ +public final class LegionWarboss extends CardImpl { + + public LegionWarboss(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); + + this.subtype.add(SubType.GOBLIN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Mentor + this.addAbility(new MentorAbility()); + + // At the beginning of combat on your turn, create a 1/1 red Goblin creature token. That token gains haste until end of turn and attacks this combat if able. + this.addAbility(new BeginningOfCombatTriggeredAbility( + new LegionWarbossEffect(), + TargetController.YOU, false + )); + } + + public LegionWarboss(final LegionWarboss card) { + super(card); + } + + @Override + public LegionWarboss copy() { + return new LegionWarboss(this); + } +} + +class LegionWarbossEffect extends OneShotEffect { + + public LegionWarbossEffect() { + super(Outcome.Benefit); + staticText = "create a 1/1 red Goblin creature token. " + + "That token gains haste until end of turn " + + "and attacks this combat if able"; + } + + public LegionWarbossEffect(final LegionWarbossEffect effect) { + super(effect); + } + + @Override + public LegionWarbossEffect copy() { + return new LegionWarbossEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + CreateTokenEffect effect = new CreateTokenEffect(new GoblinToken()); + effect.apply(game, source); + effect.getLastAddedTokenIds().stream().map((tokenId) -> { + ContinuousEffect continuousEffect = new GainAbilityTargetEffect( + HasteAbility.getInstance(), Duration.EndOfTurn + ); + continuousEffect.setTargetPointer(new FixedTarget(tokenId, game)); + return continuousEffect; + }).forEachOrdered((continuousEffect) -> { + game.addEffect(continuousEffect, source); + }); + effect.getLastAddedTokenIds().stream().map((tokenId) -> { + ContinuousEffect continuousEffect = new GainAbilityTargetEffect( + new LegionWarbossAbility(), Duration.EndOfCombat + ); + continuousEffect.setTargetPointer(new FixedTarget(tokenId, game)); + return continuousEffect; + }).forEachOrdered((continuousEffect) -> { + game.addEffect(continuousEffect, source); + }); + return true; + } +} + +class LegionWarbossAbility extends StaticAbility { + + public LegionWarbossAbility() { + super(Zone.BATTLEFIELD, new AttacksIfAbleSourceEffect( + Duration.WhileOnBattlefield, false + )); + } + + public LegionWarbossAbility(LegionWarbossAbility ability) { + super(ability); + } + + @Override + public LegionWarbossAbility copy() { + return new LegionWarbossAbility(this); + } +} diff --git a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java index 31afee8ebb..9f15bb000f 100644 --- a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java +++ b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java @@ -27,6 +27,7 @@ public final class GuildsOfRavnica extends ExpansionSet { cards.add(new SetCardInfo("Emmara, Soul of the Accord", 168, Rarity.RARE, mage.cards.e.EmmaraSoulOfTheAccord.class)); cards.add(new SetCardInfo("Firemind's Research", 171, Rarity.RARE, mage.cards.f.FiremindsResearch.class)); cards.add(new SetCardInfo("Impervious Greatwurm", 273, Rarity.MYTHIC, mage.cards.i.ImperviousGreatwurm.class)); + cards.add(new SetCardInfo("Legion Warboss", 109, Rarity.RARE, mage.cards.l.LegionWarboss.class)); cards.add(new SetCardInfo("Narcomoeba", 47, Rarity.RARE, mage.cards.n.Narcomoeba.class)); cards.add(new SetCardInfo("Necrotic Wound", 79, Rarity.UNCOMMON, mage.cards.n.NecroticWound.class)); cards.add(new SetCardInfo("Overgrown Tomb", 253, Rarity.RARE, mage.cards.o.OvergrownTomb.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/AttacksIfAbleSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/AttacksIfAbleSourceEffect.java index 66f45a13dd..44b4356b8e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/AttacksIfAbleSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/AttacksIfAbleSourceEffect.java @@ -25,7 +25,7 @@ public class AttacksIfAbleSourceEffect extends RequirementEffect { super(duration); this.eachCombat = eachCombat; if (this.duration == Duration.EndOfTurn) { - staticText = "{this} attacks " + (eachCombat ? "each combat" : "this turn") + " if able"; + staticText = "{this} attacks " + (eachCombat ? "each combat" : "this combat") + " if able"; } else { staticText = "{this} attacks each " + (eachCombat ? "combat" : "turn") + " if able"; }