From cfad8d5078ea5a74d5922dcb11f9960627559909 Mon Sep 17 00:00:00 2001 From: Daniel Eberhard Date: Wed, 14 Dec 2022 05:29:43 +0100 Subject: [PATCH] Added card "Allegiant General Pryde" and its abilities and effects --- Mage.Sets/src/mage/cards/a/AJedisFervor.java | 2 + .../mage/cards/a/AllegiantGeneralPryde.java | 63 ++++++++++++++++++- .../mage/abilities/TriggeredAbilityImpl.java | 1 + 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/cards/a/AJedisFervor.java b/Mage.Sets/src/mage/cards/a/AJedisFervor.java index 46d34e97b0..05430c7b72 100644 --- a/Mage.Sets/src/mage/cards/a/AJedisFervor.java +++ b/Mage.Sets/src/mage/cards/a/AJedisFervor.java @@ -1,6 +1,7 @@ package mage.cards.a; import mage.abilities.Ability; +import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; import mage.abilities.keyword.IndestructibleAbility; @@ -49,6 +50,7 @@ public final class AJedisFervor extends CardImpl { class AJedisFervorEffect extends OneShotEffect { public AJedisFervorEffect() { super(Outcome.Sacrifice); + staticText = "If an opponent cast a black spell this turn, that player sacrifices a creature or planeswalker."; } public AJedisFervorEffect(final AJedisFervorEffect effect) { diff --git a/Mage.Sets/src/mage/cards/a/AllegiantGeneralPryde.java b/Mage.Sets/src/mage/cards/a/AllegiantGeneralPryde.java index fc9c6aeef9..e2a21b6efb 100644 --- a/Mage.Sets/src/mage/cards/a/AllegiantGeneralPryde.java +++ b/Mage.Sets/src/mage/cards/a/AllegiantGeneralPryde.java @@ -1,4 +1,65 @@ package mage.cards.a; -public class AllegiantGeneralPryde { +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.LoseLifeSourceControllerEffect; +import mage.abilities.effects.common.SacrificeEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreaturePermanent; +import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; + +/** + * @author Merlingilb + */ +public class AllegiantGeneralPryde extends CardImpl { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Trooper creatures"); + + static { + filter.add(TargetController.YOU.getControllerPredicate()); + filter.add(SubType.TROOPER.getPredicate()); + } + + public AllegiantGeneralPryde(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.TROOPER); + this.subtype.add(SubType.ADVISOR); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Trooper creatures you control have "When this creature enters the battlefield, you may sacrifice a creature. If you do, draw two cards and lose 2 life." + SacrificeEffect sacrifceEffect = new SacrificeEffect( + StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED, 1, ""); + EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(sacrifceEffect, true, true); + ability.setTriggerPhrase("When this creature enters the battlefield, "); + ability.addTarget(new TargetControlledCreaturePermanent(1)); + DrawCardSourceControllerEffect drawCardSourceControllerEffect = new DrawCardSourceControllerEffect(2); + drawCardSourceControllerEffect.setText("If you do, draw two cards"); + ability.addEffect(drawCardSourceControllerEffect); + LoseLifeSourceControllerEffect loseLifeSourceControllerEffect = new LoseLifeSourceControllerEffect(2); + loseLifeSourceControllerEffect.setText("and lose 2 life."); + ability.addEffect(loseLifeSourceControllerEffect); + //EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(2), true); + GainAbilityControlledEffect effect = new GainAbilityControlledEffect( + ability, Duration.WhileOnBattlefield, filter); + this.addAbility(new SimpleStaticAbility(effect)); + } + + public AllegiantGeneralPryde(final AllegiantGeneralPryde card) { + super(card); + } + + @Override + public Card copy() { + return new AllegiantGeneralPryde(this); + } } diff --git a/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java b/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java index bf0e81d6b3..df9dd7f054 100644 --- a/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java @@ -203,6 +203,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge || ruleLow.startsWith("attach") || ruleLow.startsWith("counter") || ruleLow.startsWith("destroy") + || ruleLow.startsWith("sacrifice") || ruleLow.startsWith("exchange") || ruleLow.startsWith("exile") || ruleLow.startsWith("gain")