From c48c4ccf53490ad5fd7fd94c15530170d4ad27dd Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 17 Sep 2022 23:41:13 -0400 Subject: [PATCH] [40K] Implemented Vexilus Praetor --- Mage.Sets/src/mage/cards/h/Hexdrinker.java | 28 +-------- Mage.Sets/src/mage/cards/p/Progenitus.java | 42 ++----------- .../src/mage/cards/t/TeferisProtection.java | 42 +++---------- .../src/mage/cards/v/VexilusPraetor.java | 59 +++++++++++++++++++ Mage.Sets/src/mage/sets/Warhammer40000.java | 1 + .../ProtectionFromEverythingAbility.java | 36 +++++++++++ .../src/main/java/mage/constants/SubType.java | 1 + 7 files changed, 115 insertions(+), 94 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/v/VexilusPraetor.java create mode 100644 Mage/src/main/java/mage/abilities/keyword/ProtectionFromEverythingAbility.java diff --git a/Mage.Sets/src/mage/cards/h/Hexdrinker.java b/Mage.Sets/src/mage/cards/h/Hexdrinker.java index a391bd4a9a..80658c585b 100644 --- a/Mage.Sets/src/mage/cards/h/Hexdrinker.java +++ b/Mage.Sets/src/mage/cards/h/Hexdrinker.java @@ -1,18 +1,17 @@ package mage.cards.h; import mage.MageInt; -import mage.MageObject; import mage.abilities.AbilitiesImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.keyword.LevelUpAbility; import mage.abilities.keyword.LevelerCardBuilder; import mage.abilities.keyword.ProtectionAbility; +import mage.abilities.keyword.ProtectionFromEverythingAbility; import mage.cards.CardSetInfo; import mage.cards.LevelerCard; import mage.constants.CardType; import mage.constants.SubType; import mage.filter.FilterCard; -import mage.game.Game; import java.util.UUID; @@ -45,10 +44,10 @@ public final class Hexdrinker extends LevelerCard { // Protection from everything this.addAbilities(LevelerCardBuilder.construct( new LevelerCardBuilder.LevelAbility( - 3, 7, new AbilitiesImpl(new ProtectionAbility(filter)), 4, 4 + 3, 7, new AbilitiesImpl<>(new ProtectionAbility(filter)), 4, 4 ), new LevelerCardBuilder.LevelAbility( - 8, -1, new AbilitiesImpl(new HexdrinkerProtectionAbility()), 6, 6 + 8, -1, new AbilitiesImpl<>(new ProtectionFromEverythingAbility()), 6, 6 ) )); @@ -64,24 +63,3 @@ public final class Hexdrinker extends LevelerCard { return new Hexdrinker(this); } } - -class HexdrinkerProtectionAbility extends ProtectionAbility { - - HexdrinkerProtectionAbility() { - super(new FilterCard("everything")); - } - - private HexdrinkerProtectionAbility(final HexdrinkerProtectionAbility ability) { - super(ability); - } - - @Override - public HexdrinkerProtectionAbility copy() { - return new HexdrinkerProtectionAbility(this); - } - - @Override - public boolean canTarget(MageObject source, Game game) { - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/p/Progenitus.java b/Mage.Sets/src/mage/cards/p/Progenitus.java index 8229d58ff6..b4674927de 100644 --- a/Mage.Sets/src/mage/cards/p/Progenitus.java +++ b/Mage.Sets/src/mage/cards/p/Progenitus.java @@ -1,28 +1,24 @@ - package mage.cards.p; -import java.util.UUID; import mage.MageInt; -import mage.MageObject; import mage.abilities.common.PutIntoGraveFromAnywhereSourceAbility; import mage.abilities.effects.common.RevealAndShuffleIntoLibrarySourceEffect; -import mage.abilities.keyword.ProtectionAbility; +import mage.abilities.keyword.ProtectionFromEverythingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.SuperType; -import mage.filter.FilterCard; -import mage.game.Game; + +import java.util.UUID; /** - * * @author North */ public final class Progenitus extends CardImpl { public Progenitus(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{W}{U}{U}{B}{B}{R}{R}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{W}{U}{U}{B}{B}{R}{R}{G}{G}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.HYDRA); this.subtype.add(SubType.AVATAR); @@ -30,14 +26,9 @@ public final class Progenitus extends CardImpl { this.power = new MageInt(10); this.toughness = new MageInt(10); - // 2/1/2009: "Protection from everything" means the following: Progenitus can't be blocked, - // Progenitus can't be enchanted or equipped, Progenitus can't be the target of - // spells or abilities, and all damage that would be dealt to Progenitus is prevented. - // 2/1/2009: Progenitus can still be affected by effects that don't target it or deal damage - // to it (such as Day of Judgment). - // Protection from everything - this.addAbility(new ProgenitusProtectionAbility()); + this.addAbility(new ProtectionFromEverythingAbility()); + // If Progenitus would be put into a graveyard from anywhere, reveal Progenitus and shuffle it into its owner's library instead. this.addAbility(new PutIntoGraveFromAnywhereSourceAbility(new RevealAndShuffleIntoLibrarySourceEffect())); } @@ -51,24 +42,3 @@ public final class Progenitus extends CardImpl { return new Progenitus(this); } } - -class ProgenitusProtectionAbility extends ProtectionAbility { - - public ProgenitusProtectionAbility() { - super(new FilterCard("everything")); - } - - public ProgenitusProtectionAbility(final ProgenitusProtectionAbility ability) { - super(ability); - } - - @Override - public ProgenitusProtectionAbility copy() { - return new ProgenitusProtectionAbility(this); - } - - @Override - public boolean canTarget(MageObject source, Game game) { - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/t/TeferisProtection.java b/Mage.Sets/src/mage/cards/t/TeferisProtection.java index 42dc0d65b0..c608d6a2c2 100644 --- a/Mage.Sets/src/mage/cards/t/TeferisProtection.java +++ b/Mage.Sets/src/mage/cards/t/TeferisProtection.java @@ -1,30 +1,27 @@ - package mage.cards.t; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ExileSpellEffect; import mage.abilities.effects.common.PhaseOutAllEffect; import mage.abilities.effects.common.continuous.GainAbilityControllerEffect; import mage.abilities.effects.common.continuous.LifeTotalCantChangeControllerEffect; -import mage.abilities.keyword.ProtectionAbility; +import mage.abilities.keyword.ProtectionFromEverythingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; -import mage.filter.FilterCard; import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** - * * @author spjspj */ public final class TeferisProtection extends CardImpl { @@ -56,18 +53,18 @@ class TeferisProtectionEffect extends OneShotEffect { /** * 25.08.2017 The following rulings focus on the “protection from” keyword - * + *

* 25.08.2017 If a player has protection from everything, it means three * things: 1) All damage that would be dealt to that player is prevented. 2) * Auras can't be attached to that player. 3) That player can't be the * target of spells or abilities. - * + *

* 25.08.2017 Nothing other than the specified events are prevented or * illegal. An effect that doesn't target you could still cause you to * discard cards, for example. Creatures can still attack you while you have * protection from everything, although combat damage that they would deal * to you will be prevented. - * + *

* 25.08.2017 Gaining protection from everything causes a spell or ability * on the stack to have an illegal target if it targets you. As a spell or * ability tries to resolve, if all its targets are illegal, that spell or @@ -89,7 +86,7 @@ class TeferisProtectionEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - game.addEffect(new GainAbilityControllerEffect(new TeferisProtectionAbility(), Duration.UntilYourNextTurn), source); + game.addEffect(new GainAbilityControllerEffect(new ProtectionFromEverythingAbility(), Duration.UntilYourNextTurn), source); return true; } return false; @@ -101,27 +98,6 @@ class TeferisProtectionEffect extends OneShotEffect { } } -class TeferisProtectionAbility extends ProtectionAbility { - - public TeferisProtectionAbility() { - super(new FilterCard("everything")); - } - - public TeferisProtectionAbility(final TeferisProtectionAbility ability) { - super(ability); - } - - @Override - public TeferisProtectionAbility copy() { - return new TeferisProtectionAbility(this); - } - - @Override - public boolean canTarget(MageObject source, Game game) { - return false; - } -} - class TeferisProtectionPhaseOutEffect extends OneShotEffect { public TeferisProtectionPhaseOutEffect() { diff --git a/Mage.Sets/src/mage/cards/v/VexilusPraetor.java b/Mage.Sets/src/mage/cards/v/VexilusPraetor.java new file mode 100644 index 0000000000..4206ff8508 --- /dev/null +++ b/Mage.Sets/src/mage/cards/v/VexilusPraetor.java @@ -0,0 +1,59 @@ +package mage.cards.v; + +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.keyword.ProtectionFromEverythingAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.CommanderPredicate; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class VexilusPraetor extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledPermanent("commanders you control"); + + static { + filter.add(CommanderPredicate.instance); + } + + public VexilusPraetor(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); + + this.subtype.add(SubType.CUSTODES); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // Aegis of the Emperor -- Commanders you control have protection from everything. + this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect( + new ProtectionFromEverythingAbility(), Duration.WhileOnBattlefield, filter + )).withFlavorWord("Aegis of the Emperor")); + } + + private VexilusPraetor(final VexilusPraetor card) { + super(card); + } + + @Override + public VexilusPraetor copy() { + return new VexilusPraetor(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Warhammer40000.java b/Mage.Sets/src/mage/sets/Warhammer40000.java index 59636eadd2..9c4f6dd21e 100644 --- a/Mage.Sets/src/mage/sets/Warhammer40000.java +++ b/Mage.Sets/src/mage/sets/Warhammer40000.java @@ -210,6 +210,7 @@ public final class Warhammer40000 extends ExpansionSet { cards.add(new SetCardInfo("Vault of Whispers", 305, Rarity.COMMON, mage.cards.v.VaultOfWhispers.class)); cards.add(new SetCardInfo("Venomcrawler", 68, Rarity.RARE, mage.cards.v.Venomcrawler.class)); cards.add(new SetCardInfo("Venomthrope", 147, Rarity.UNCOMMON, mage.cards.v.Venomthrope.class)); + cards.add(new SetCardInfo("Vexilus Praetor", 19, Rarity.RARE, mage.cards.v.VexilusPraetor.class)); cards.add(new SetCardInfo("Warstorm Surge", 209, Rarity.RARE, mage.cards.w.WarstormSurge.class)); cards.add(new SetCardInfo("Wayfarer's Bauble", 261, Rarity.COMMON, mage.cards.w.WayfarersBauble.class)); cards.add(new SetCardInfo("Winged Hive Tyrant", 148, Rarity.RARE, mage.cards.w.WingedHiveTyrant.class)); diff --git a/Mage/src/main/java/mage/abilities/keyword/ProtectionFromEverythingAbility.java b/Mage/src/main/java/mage/abilities/keyword/ProtectionFromEverythingAbility.java new file mode 100644 index 0000000000..064fd1d07f --- /dev/null +++ b/Mage/src/main/java/mage/abilities/keyword/ProtectionFromEverythingAbility.java @@ -0,0 +1,36 @@ +package mage.abilities.keyword; + +import mage.MageObject; +import mage.filter.FilterCard; +import mage.game.Game; + +/** + * @author TheElk801 + */ +public class ProtectionFromEverythingAbility extends ProtectionAbility { + + private static final FilterCard filter = new FilterCard("everything"); + + public ProtectionFromEverythingAbility() { + super(filter); + } + + private ProtectionFromEverythingAbility(final ProtectionFromEverythingAbility ability) { + super(ability); + } + + @Override + public ProtectionFromEverythingAbility copy() { + return new ProtectionFromEverythingAbility(this); + } + + // 2/1/2009: "Protection from everything" means the following: Progenitus can't be blocked, + // Progenitus can't be enchanted or equipped, Progenitus can't be the target of + // spells or abilities, and all damage that would be dealt to Progenitus is prevented. + // 2/1/2009: Progenitus can still be affected by effects that don't target it or deal damage + // to it (such as Day of Judgment). + @Override + public boolean canTarget(MageObject source, Game game) { + return false; + } +} diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 596eebce0b..22343f1863 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -114,6 +114,7 @@ public enum SubType { CRAB("Crab", SubTypeSet.CreatureType), CROCODILE("Crocodile", SubTypeSet.CreatureType), CROLUTE("Crolute", SubTypeSet.CreatureType, true), // Star Wars + CUSTODES("Custodes", SubTypeSet.CreatureType), CYBORG("Cyborg", SubTypeSet.CreatureType, true), // Star Wars CYCLOPS("Cyclops", SubTypeSet.CreatureType), // D