diff --git a/Mage.Sets/src/mage/cards/t/ThunderousOrator.java b/Mage.Sets/src/mage/cards/t/ThunderousOrator.java new file mode 100644 index 0000000000..ca16ff18ed --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/ThunderousOrator.java @@ -0,0 +1,112 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.MageSingleton; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.keyword.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.game.Game; + +import java.util.*; + +/** + * @author TheElk801 + */ +public final class ThunderousOrator extends CardImpl { + + public ThunderousOrator(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); + + this.subtype.add(SubType.KOR); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // Whenever Thunderous Orator attacks, it gains flying until end of turn if you control a creature with flying. The same is true for first strike, double strike, deathtouch, indestructible, lifelink, menace, and trample. + this.addAbility(new AttacksTriggeredAbility(new ThunderousOratorEffect(), false)); + } + + private ThunderousOrator(final ThunderousOrator card) { + super(card); + } + + @Override + public ThunderousOrator copy() { + return new ThunderousOrator(this); + } +} + +class ThunderousOratorEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent(); + + static { + filter.add(new AbilityPredicate(MenaceAbility.class)); + } + + private static final List keywords = Arrays.asList( + FlyingAbility.getInstance(), + FirstStrikeAbility.getInstance(), + DoubleStrikeAbility.getInstance(), + DeathtouchAbility.getInstance(), + IndestructibleAbility.getInstance(), + LifelinkAbility.getInstance(), + TrampleAbility.getInstance() + ); + + ThunderousOratorEffect() { + super(Outcome.Benefit); + staticText = "it gains flying until end of turn if you control a creature with flying. The same is true " + + "for first strike, double strike, deathtouch, indestructible, lifelink, menace, and trample"; + } + + private ThunderousOratorEffect(final ThunderousOratorEffect effect) { + super(effect); + } + + @Override + public ThunderousOratorEffect copy() { + return new ThunderousOratorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + List abilities = new ArrayList<>(); + if (game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) { + abilities.add(new MenaceAbility()); + } + game.getBattlefield() + .getActivePermanents( + StaticFilters.FILTER_CONTROLLED_CREATURE, + source.getControllerId(), source.getSourceId(), game + ).stream() + .filter(Objects::nonNull) + .map(p -> p.getAbilities(game)) + .flatMap(Collection::stream) + .filter(keywords::contains) + .distinct() + .forEach(abilities::add); + if (abilities.isEmpty()) { + return false; + } + for (Ability ability : abilities) { + game.addEffect(new GainAbilitySourceEffect(ability, Duration.EndOfTurn), source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java index 166550b2f6..24bd1f1b4a 100644 --- a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java +++ b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java @@ -98,6 +98,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { cards.add(new SetCardInfo("Swamp", 370, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Swamp", 371, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Thrilling Discovery", 243, Rarity.COMMON, mage.cards.t.ThrillingDiscovery.class)); + cards.add(new SetCardInfo("Thunderous Orator", 35, Rarity.UNCOMMON, mage.cards.t.ThunderousOrator.class)); cards.add(new SetCardInfo("Torrent Sculptor", 159, Rarity.RARE, mage.cards.t.TorrentSculptor.class)); cards.add(new SetCardInfo("Valentin, Dean of the Vein", 161, Rarity.RARE, mage.cards.v.ValentinDeanOfTheVein.class)); cards.add(new SetCardInfo("Venerable Warsinger", 355, Rarity.RARE, mage.cards.v.VenerableWarsinger.class)); diff --git a/Mage/src/main/java/mage/abilities/keyword/IndestructibleAbility.java b/Mage/src/main/java/mage/abilities/keyword/IndestructibleAbility.java index 2286fc15c2..09da61c1ad 100644 --- a/Mage/src/main/java/mage/abilities/keyword/IndestructibleAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/IndestructibleAbility.java @@ -1,5 +1,6 @@ package mage.abilities.keyword; +import mage.abilities.MageSingleton; import mage.abilities.StaticAbility; import mage.abilities.icon.abilities.IndestructibleAbilityIcon; import mage.constants.Zone; @@ -21,7 +22,7 @@ import java.io.ObjectStreamException; * * @author BetaSteward_at_googlemail.com */ -public class IndestructibleAbility extends StaticAbility { +public class IndestructibleAbility extends StaticAbility implements MageSingleton { private static final IndestructibleAbility instance;