[40K] Implemented Trazyn the Infinite

This commit is contained in:
Evan Kranzler 2022-10-11 19:53:50 -04:00
parent 6857641428
commit 9717d44963
3 changed files with 138 additions and 47 deletions

View file

@ -1,19 +1,24 @@
package mage.cards.n;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.Collection;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -28,7 +33,7 @@ public final class NecroticOoze extends CardImpl {
// As long as Necrotic Ooze is on the battlefield, it has all
// activated abilities of all creature cards in all graveyards
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new NecroticOozeEffect()));
this.addAbility(new SimpleStaticAbility(new NecroticOozeEffect()));
}
private NecroticOoze(final NecroticOoze card) {
@ -39,52 +44,48 @@ public final class NecroticOoze extends CardImpl {
public NecroticOoze copy() {
return new NecroticOoze(this);
}
}
static class NecroticOozeEffect extends ContinuousEffectImpl {
class NecroticOozeEffect extends ContinuousEffectImpl {
public NecroticOozeEffect() {
super(Duration.WhileOnBattlefield,
Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
staticText = "As long as {this} is on the battlefield, "
+ "it has all activated abilities of all creature cards in all graveyards";
this.dependendToTypes.add(DependencyType.AddingAbility); // Yixlid Jailer
}
public NecroticOozeEffect(final NecroticOozeEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent perm = game.getPermanent(source.getSourceId());
if (perm != null) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (Card card : player.getGraveyard().getCards(game)) {
if (card.isCreature(game)) {
for (Ability ability : card.getAbilities(game)) {
if (ability instanceof ActivatedAbility
&& !perm.getAbilities().contains(ability)) {
if (!perm.getAbilities().contains(ability)) {
perm.addAbility(ability, source.getSourceId(), game);
}
}
}
}
}
}
}
return true;
}
return false;
}
@Override
public NecroticOozeEffect copy() {
return new NecroticOozeEffect(this);
}
NecroticOozeEffect() {
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
staticText = "As long as {this} is on the battlefield, "
+ "it has all activated abilities of all creature cards in all graveyards";
this.dependendToTypes.add(DependencyType.AddingAbility); // Yixlid Jailer
}
private NecroticOozeEffect(final NecroticOozeEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null) {
return false;
}
Set<Ability> abilities = game
.getState()
.getPlayersInRange(source.getControllerId(), game)
.stream()
.map(game::getPlayer)
.filter(Objects::nonNull)
.map(Player::getGraveyard)
.map(graveyard -> graveyard.getCards(StaticFilters.FILTER_CARD_CREATURE, game))
.flatMap(Collection::stream)
.map(card -> card.getAbilities(game))
.flatMap(Collection::stream)
.filter(ActivatedAbility.class::isInstance)
.collect(Collectors.toSet());
for (Ability ability : abilities) {
permanent.addAbility(ability, source.getSourceId(), game);
}
return true;
}
@Override
public NecroticOozeEffect copy() {
return new NecroticOozeEffect(this);
}
}

View file

@ -0,0 +1,89 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.Collection;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @author TheElk801
*/
public final class TrazynTheInfinite extends CardImpl {
public TrazynTheInfinite(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}{B}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.NECRON);
this.power = new MageInt(4);
this.toughness = new MageInt(6);
// Deathtouch
this.addAbility(DeathtouchAbility.getInstance());
// Prismatic Gallery -- As long as Trazyn the Infinite is on the battlefield, it has all activated abilities of all artifact cards in your graveyard.
this.addAbility(new SimpleStaticAbility(new TrazynTheInfiniteEffect()).withFlavorWord("Prismatic Gallery"));
}
private TrazynTheInfinite(final TrazynTheInfinite card) {
super(card);
}
@Override
public TrazynTheInfinite copy() {
return new TrazynTheInfinite(this);
}
}
class TrazynTheInfiniteEffect extends ContinuousEffectImpl {
TrazynTheInfiniteEffect() {
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
staticText = "as long as {this} is on the battlefield, " +
"it has all activated abilities of all artifact cards in your graveyard";
this.dependendToTypes.add(DependencyType.AddingAbility); // Yixlid Jailer
}
private TrazynTheInfiniteEffect(final TrazynTheInfiniteEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
Player player = game.getPlayer(source.getControllerId());
if (permanent == null || player == null) {
return false;
}
Set<Ability> abilities = player.getGraveyard()
.getCards(StaticFilters.FILTER_CARD_ARTIFACT, game)
.stream()
.map(card -> card.getAbilities(game))
.flatMap(Collection::stream)
.filter(ActivatedAbility.class::isInstance)
.collect(Collectors.toSet());
for (Ability ability : abilities) {
permanent.addAbility(ability, source.getSourceId(), game);
}
return true;
}
@Override
public TrazynTheInfiniteEffect copy() {
return new TrazynTheInfiniteEffect(this);
}
}

View file

@ -244,6 +244,7 @@ public final class Warhammer40000 extends ExpansionSet {
cards.add(new SetCardInfo("Tomb Blade", 64, Rarity.RARE, mage.cards.t.TombBlade.class));
cards.add(new SetCardInfo("Tomb Fortress", 168, Rarity.RARE, mage.cards.t.TombFortress.class));
cards.add(new SetCardInfo("Tranquil Cove", 303, Rarity.COMMON, mage.cards.t.TranquilCove.class));
cards.add(new SetCardInfo("Trazyn the Infinite", 65, Rarity.RARE, mage.cards.t.TrazynTheInfinite.class));
cards.add(new SetCardInfo("Triarch Praetorian", 66, Rarity.UNCOMMON, mage.cards.t.TriarchPraetorian.class));
cards.add(new SetCardInfo("Trygon Prime", 143, Rarity.UNCOMMON, mage.cards.t.TrygonPrime.class));
cards.add(new SetCardInfo("Tyranid Invasion", 102, Rarity.UNCOMMON, mage.cards.t.TyranidInvasion.class));