From 17be0c11baabe19e55e83c6e2ae914aaa7ff71bd Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 11 Oct 2022 21:15:53 -0400 Subject: [PATCH] [BOT] Implemented Flamewar, Brash Veteran / Flamewar, Streetwise Operative --- .../mage/cards/f/FlamewarBrashVeteran.java | 106 ++++++++++++++++++ .../cards/f/FlamewarStreetwiseOperative.java | 96 ++++++++++++++++ Mage.Sets/src/mage/sets/Transformers.java | 2 + .../main/java/mage/counters/CounterType.java | 1 + Mage/src/main/java/mage/game/Exile.java | 2 +- 5 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/f/FlamewarBrashVeteran.java create mode 100644 Mage.Sets/src/mage/cards/f/FlamewarStreetwiseOperative.java diff --git a/Mage.Sets/src/mage/cards/f/FlamewarBrashVeteran.java b/Mage.Sets/src/mage/cards/f/FlamewarBrashVeteran.java new file mode 100644 index 0000000000..ef24aec9e5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FlamewarBrashVeteran.java @@ -0,0 +1,106 @@ +package mage.cards.f; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.DiscardHandCost; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.TransformSourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.MoreThanMeetsTheEyeAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledArtifactPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.players.Player; + +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class FlamewarBrashVeteran extends CardImpl { + + private static final FilterControlledPermanent filter + = new FilterControlledArtifactPermanent("another artifact"); + + static { + filter.add(AnotherPredicate.instance); + } + + public FlamewarBrashVeteran(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}{B}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.ROBOT); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + this.secondSideCardClazz = mage.cards.f.FlamewarStreetwiseOperative.class; + + // More Than Meets the Eye {B}{R} + this.addAbility(new MoreThanMeetsTheEyeAbility(this, "{B}{R}")); + + // Sacrifice another artifact: Put a +1/+1 counter on Flamewar and convert it. Activate only as a sorcery. + Ability ability = new ActivateAsSorceryActivatedAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new SacrificeTargetCost(filter) + ); + ability.addEffect(new TransformSourceEffect().setText("and convert it")); + this.addAbility(ability); + + // {1}, Discard your hand: Put all exiled cards you own with intel counters on them into your hand. + ability = new SimpleActivatedAbility(new FlamewarBrashVeteranEffect(), new GenericManaCost(1)); + ability.addCost(new DiscardHandCost()); + this.addAbility(ability); + } + + private FlamewarBrashVeteran(final FlamewarBrashVeteran card) { + super(card); + } + + @Override + public FlamewarBrashVeteran copy() { + return new FlamewarBrashVeteran(this); + } +} + +class FlamewarBrashVeteranEffect extends OneShotEffect { + + FlamewarBrashVeteranEffect() { + super(Outcome.Benefit); + staticText = "put all exiled cards you own with intel counters on them into your hand"; + } + + private FlamewarBrashVeteranEffect(final FlamewarBrashVeteranEffect effect) { + super(effect); + } + + @Override + public FlamewarBrashVeteranEffect copy() { + return new FlamewarBrashVeteranEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Set cards = game + .getExile() + .getAllCards(game, source.getControllerId()) + .stream() + .filter(card -> card.getCounters(game).containsKey(CounterType.INTEL)) + .collect(Collectors.toSet()); + return !cards.isEmpty() && player.moveCards(cards, Zone.HAND, source, game); + } +} diff --git a/Mage.Sets/src/mage/cards/f/FlamewarStreetwiseOperative.java b/Mage.Sets/src/mage/cards/f/FlamewarStreetwiseOperative.java new file mode 100644 index 0000000000..96b1b7a174 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FlamewarStreetwiseOperative.java @@ -0,0 +1,96 @@ +package mage.cards.f; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.TransformSourceEffect; +import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.keyword.LivingMetalAbility; +import mage.abilities.keyword.MenaceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.*; +import mage.counters.CounterType; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FlamewarStreetwiseOperative extends CardImpl { + + public FlamewarStreetwiseOperative(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, ""); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.VEHICLE); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + this.color.setRed(true); + this.color.setBlack(true); + this.nightCard = true; + + // Living metal + this.addAbility(new LivingMetalAbility()); + + // Menace + this.addAbility(new MenaceAbility(false)); + + // Deathtouch + this.addAbility(DeathtouchAbility.getInstance()); + + // Whenever Flamewar deals combat damage to a player, exile that many cards from the top of your library face down. Put an intel counter on each of them. Convert Flamewar. + Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new FlamewarBrashVeteranEffect(), false); + ability.addEffect(new TransformSourceEffect().setText("convert {this}")); + this.addAbility(ability); + } + + private FlamewarStreetwiseOperative(final FlamewarStreetwiseOperative card) { + super(card); + } + + @Override + public FlamewarStreetwiseOperative copy() { + return new FlamewarStreetwiseOperative(this); + } +} + +class FlamewarStreetwiseOperativeEffect extends OneShotEffect { + + FlamewarStreetwiseOperativeEffect() { + super(Outcome.Benefit); + staticText = "exile that many cards from the top of your library face down. " + + "Put an intel counter on each of them"; + } + + private FlamewarStreetwiseOperativeEffect(final FlamewarStreetwiseOperativeEffect effect) { + super(effect); + } + + @Override + public FlamewarStreetwiseOperativeEffect copy() { + return new FlamewarStreetwiseOperativeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + int damage = (Integer) getValue("damage"); + if (player == null || damage < 1) { + return false; + } + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, damage)); + player.moveCards(cards, Zone.EXILED, source, game); + cards.retainZone(Zone.EXILED, game); + cards.getCards(game).stream().forEach(card -> { + card.setFaceDown(true, game); + card.addCounters(CounterType.INTEL.createInstance(), source, game); + }); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Transformers.java b/Mage.Sets/src/mage/sets/Transformers.java index ead76733db..801e19a044 100644 --- a/Mage.Sets/src/mage/sets/Transformers.java +++ b/Mage.Sets/src/mage/sets/Transformers.java @@ -19,6 +19,8 @@ public final class Transformers extends ExpansionSet { super("Transformers", "BOT", ExpansionSet.buildDate(2022, 11, 18), SetType.SUPPLEMENTAL); this.hasBasicLands = false; + cards.add(new SetCardInfo("Flamewar, Brash Veteran", 10, Rarity.MYTHIC, mage.cards.f.FlamewarBrashVeteran.class)); + cards.add(new SetCardInfo("Flamewar, Streetwise Operative", 10, Rarity.MYTHIC, mage.cards.f.FlamewarStreetwiseOperative.class)); cards.add(new SetCardInfo("Goldbug, Humanity's Ally", 11, Rarity.MYTHIC, mage.cards.g.GoldbugHumanitysAlly.class)); cards.add(new SetCardInfo("Goldbug, Scrappy Scout", 11, Rarity.MYTHIC, mage.cards.g.GoldbugScrappyScout.class)); cards.add(new SetCardInfo("Ultra Magnus, Armored Carrier", 15, Rarity.MYTHIC, mage.cards.u.UltraMagnusArmoredCarrier.class)); diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index a7491b2647..4f9b93e79a 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -96,6 +96,7 @@ public enum CounterType { INDESTRUCTIBLE("indestructible"), INFECTION("infection"), INGENUITY("ingenuity"), + INTEL("intel"), INTERVENTION("intervention"), INVITATION("invitation"), ISOLATION("isolation"), diff --git a/Mage/src/main/java/mage/game/Exile.java b/Mage/src/main/java/mage/game/Exile.java index bc0427ffe5..d22721371b 100644 --- a/Mage/src/main/java/mage/game/Exile.java +++ b/Mage/src/main/java/mage/game/Exile.java @@ -86,7 +86,7 @@ public class Exile implements Serializable, Copyable { List res = new ArrayList<>(); for (ExileZone exile : exileZones.values()) { for (Card card : exile.getCards(game)) { - if (fromPlayerId == null || card.getOwnerId().equals(fromPlayerId)) { + if (fromPlayerId == null || card.isOwnedBy(fromPlayerId)) { res.add(card); } }