From 44214d65fc6c8e5bb67f31c7cd07d60abee34926 Mon Sep 17 00:00:00 2001 From: Thomas Winwood Date: Mon, 8 Apr 2019 05:10:32 +0100 Subject: [PATCH] Implement Miss Demeanour --- Mage.Sets/src/mage/cards/m/MissDemeanour.java | 83 +++++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 1 + .../BeginningOfUpkeepTriggeredAbility.java | 10 +++ .../src/main/java/mage/constants/SubType.java | 1 + 4 files changed, 95 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MissDemeanour.java diff --git a/Mage.Sets/src/mage/cards/m/MissDemeanour.java b/Mage.Sets/src/mage/cards/m/MissDemeanour.java new file mode 100644 index 0000000000..87520d1095 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MissDemeanour.java @@ -0,0 +1,83 @@ + +package mage.cards.m; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author Ketsuban + */ +public final class MissDemeanour extends CardImpl { + + public MissDemeanour(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); + + this.subtype.add(SubType.LADYOFPROPERETIQUETTE); + this.power = new MageInt(3); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // First strike + this.addAbility(FirstStrikeAbility.getInstance()); + + // At the beginning of each other player's upkeep, you may compliment that player on their game play. If you don't, sacrifice Miss Demeanour. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new MissDemeanourEffect(), TargetController.NOT_YOU, false, true)); + } + + public MissDemeanour(final MissDemeanour card) { + super(card); + } + + @Override + public MissDemeanour copy() { + return new MissDemeanour(this); + } +} + +class MissDemeanourEffect extends OneShotEffect { + + public MissDemeanourEffect() { + super(Outcome.Sacrifice); + this.staticText = "you may compliment that player on their game play. If you don't, sacrifice {this}"; + } + + public MissDemeanourEffect(final MissDemeanourEffect effect) { + super(effect); + } + + @Override + public MissDemeanourEffect copy() { + return new MissDemeanourEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent sourceObject = (Permanent) source.getSourceObjectIfItStillExists(game); + if (sourceObject != null) { + if (!controller.chooseUse(outcome, "Compliment " + game.getPlayer(game.getActivePlayerId()).getName() + " on their game play?", source, game)) { + sourceObject.sacrifice(source.getSourceId(), game); + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index 10a415d087..9157469f18 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -46,6 +46,7 @@ public final class Unglued extends ExpansionSet { cards.add(new SetCardInfo("Jumbo Imp", 34, Rarity.UNCOMMON, mage.cards.j.JumboImp.class)); cards.add(new SetCardInfo("Krazy Kow", 48, Rarity.COMMON, mage.cards.k.KrazyKow.class)); cards.add(new SetCardInfo("Mine, Mine, Mine!", 65, Rarity.RARE, mage.cards.m.MineMineMine.class)); + cards.add(new SetCardInfo("Miss Demeanour", 10, Rarity.UNCOMMON, mage.cards.m.MissDemeanour.class)); cards.add(new SetCardInfo("Mountain", 87, Rarity.LAND, mage.cards.basiclands.Mountain.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Once More with Feeling", 11, Rarity.RARE, mage.cards.o.OnceMoreWithFeeling.class)); cards.add(new SetCardInfo("Paper Tiger", 78, Rarity.COMMON, mage.cards.p.PaperTiger.class)); diff --git a/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java index 49d7c0a70e..87ed534a99 100644 --- a/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java @@ -70,6 +70,16 @@ public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl { } } return yours; + case NOT_YOU: + boolean notYours = !event.getPlayerId().equals(this.controllerId); + if (notYours && setTargetPointer) { + if (getTargets().isEmpty()) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + } + } + return notYours; case OPPONENT: if (game.getPlayer(this.controllerId).hasOpponent(event.getPlayerId(), game)) { if (setTargetPointer && getTargets().isEmpty()) { diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 7c29322629..733c23fa96 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -201,6 +201,7 @@ public enum SubType { KOR("Kor", SubTypeSet.CreatureType), KRAKEN("Kraken", SubTypeSet.CreatureType), // L + LADYOFPROPERETIQUETTE("Lady of Proper Etiquette", SubTypeSet.CreatureType), // Unglued LAMIA("Lamia", SubTypeSet.CreatureType), LAMMASU("Lammasu", SubTypeSet.CreatureType), LEECH("Leech", SubTypeSet.CreatureType),