[STX] Implemented Thunderous Orator

This commit is contained in:
Evan Kranzler 2021-03-30 20:34:32 -04:00
parent 5d9317586f
commit 2567e56db8
3 changed files with 115 additions and 1 deletions

View file

@ -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<MageSingleton> 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<Ability> 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;
}
}

View file

@ -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));

View file

@ -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;