diff --git a/Mage.Sets/src/mage/cards/t/TheTriumphOfAnax.java b/Mage.Sets/src/mage/cards/t/TheTriumphOfAnax.java new file mode 100644 index 0000000000..150e93adad --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheTriumphOfAnax.java @@ -0,0 +1,78 @@ +package mage.cards.t; + +import mage.abilities.common.SagaAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.CountersSourceCount; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effects; +import mage.abilities.effects.common.FightTargetsEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.target.TargetPermanent; +import mage.target.Targets; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TheTriumphOfAnax extends CardImpl { + + private static final DynamicValue xValue = new CountersSourceCount(CounterType.LORE); + private static final FilterPermanent filter = new FilterCreaturePermanent("creature you don't control"); + + static { + filter.add(new ControllerPredicate(TargetController.NOT_YOU)); + } + + public TheTriumphOfAnax(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); + + this.subtype.add(SubType.SAGA); + + // (As this Saga enters and after your draw step, add a lore counter. Sacrifice after IV.) + SagaAbility sagaAbility = new SagaAbility(this, SagaChapter.CHAPTER_IV); + + // I, II, III — Until end of turn, target creature gains trample and gets +X/+0, where X is the number of lore counters on The Triumph of Anax. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_I, SagaChapter.CHAPTER_III, + new Effects(new GainAbilityTargetEffect( + TrampleAbility.getInstance(), Duration.EndOfTurn, + "Until end of turn, target creature gains trample" + ), new BoostTargetEffect( + xValue, StaticValue.getZeroValue(), Duration.EndOfTurn, true + ).setText("and gets +X/+0, where X is the number of lore counters on {this}")), + new TargetCreaturePermanent() + ); + + // IV — Target creature you control fights up to one target creature you don't control. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_IV, SagaChapter.CHAPTER_IV, + new Effects(new FightTargetsEffect( + "Target creature you control fights up to one target creature you don't control" + )), new Targets( + new TargetControlledCreaturePermanent(), + new TargetPermanent(0, 1, filter, false) + ) + ); + } + + private TheTriumphOfAnax(final TheTriumphOfAnax card) { + super(card); + } + + @Override + public TheTriumphOfAnax copy() { + return new TheTriumphOfAnax(this); + } +} diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 9a1fb77545..e2094245c2 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -105,6 +105,7 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("The Akroan War", 124, Rarity.RARE, mage.cards.t.TheAkroanWar.class)); cards.add(new SetCardInfo("The Binding of the Titans", 166, Rarity.UNCOMMON, mage.cards.t.TheBindingOfTheTitans.class)); cards.add(new SetCardInfo("The Birth of Meletis", 5, Rarity.UNCOMMON, mage.cards.t.TheBirthOfMeletis.class)); + cards.add(new SetCardInfo("The Triumph of Anax", 160, Rarity.UNCOMMON, mage.cards.t.TheTriumphOfAnax.class)); cards.add(new SetCardInfo("Thirst for Meaning", 74, Rarity.COMMON, mage.cards.t.ThirstForMeaning.class)); cards.add(new SetCardInfo("Towering-Wave Mystic", 77, Rarity.COMMON, mage.cards.t.ToweringWaveMystic.class)); cards.add(new SetCardInfo("Treacherous Blessing", 316, Rarity.RARE, mage.cards.t.TreacherousBlessing.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/Effects.java b/Mage/src/main/java/mage/abilities/effects/Effects.java index df2661806b..97f2675244 100644 --- a/Mage/src/main/java/mage/abilities/effects/Effects.java +++ b/Mage/src/main/java/mage/abilities/effects/Effects.java @@ -14,11 +14,10 @@ import java.util.Set; */ public class Effects extends ArrayList { - public Effects() { - } - - public Effects(Effect effect) { - this.add(effect); + public Effects(Effect... effects) { + for (Effect effect : effects) { + this.add(effect); + } } public Effects(final Effects effects) { diff --git a/Mage/src/main/java/mage/constants/SagaChapter.java b/Mage/src/main/java/mage/constants/SagaChapter.java index a41338581d..17b1e95117 100644 --- a/Mage/src/main/java/mage/constants/SagaChapter.java +++ b/Mage/src/main/java/mage/constants/SagaChapter.java @@ -1,14 +1,19 @@ - package mage.constants; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + /** - * * @author LevelX2 */ public enum SagaChapter { CHAPTER_I(1, "I"), CHAPTER_II(2, "II"), - CHAPTER_III(3, "III"); + CHAPTER_III(3, "III"), + CHAPTER_IV(4, "IV"); + + private static final Map chapterMap = new HashMap(); private final String text; private final int number; @@ -28,15 +33,14 @@ public enum SagaChapter { } public static SagaChapter getChapter(int number) { - switch (number) { - case 1: - return CHAPTER_I; - case 2: - return CHAPTER_II; - case 3: - return CHAPTER_III; - default: - return null; + initMap(); + return chapterMap.get(number); + } + + private static void initMap() { + if (!chapterMap.isEmpty()) { + return; } + Arrays.stream(SagaChapter.values()).forEach(sagaChapter -> chapterMap.put(sagaChapter.getNumber(), sagaChapter)); } } diff --git a/Mage/src/main/java/mage/target/Targets.java b/Mage/src/main/java/mage/target/Targets.java index 7b3af1ca0c..0409700fe4 100644 --- a/Mage/src/main/java/mage/target/Targets.java +++ b/Mage/src/main/java/mage/target/Targets.java @@ -19,11 +19,10 @@ public class Targets extends ArrayList { private static final Logger logger = Logger.getLogger(Targets.class); - public Targets() { - } - - public Targets(Target target) { - this.add(target); + public Targets(Target... targets) { + for (Target target : targets) { + this.add(target); + } } public Targets(final Targets targets) {