diff --git a/Mage.Sets/src/mage/cards/v/VonasHunger.java b/Mage.Sets/src/mage/cards/v/VonasHunger.java new file mode 100644 index 00000000000..ea03ce1a4c2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/v/VonasHunger.java @@ -0,0 +1,123 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.v; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.condition.InvertCondition; +import mage.abilities.condition.common.CitysBlessingCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.SacrificeOpponentsEffect; +import mage.abilities.effects.keyword.AscendEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; + +/** + * + * @author LevelX2 + */ +public class VonasHunger extends CardImpl { + + public VonasHunger(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}"); + + // Ascend (If you control ten or more permanents, you get the city's blessing for the rest of the game.) + this.getSpellAbility().addEffect(new AscendEffect()); + + // Each opponent sacrifices a creature. + this.getSpellAbility().addEffect(new ConditionalOneShotEffect( + new SacrificeOpponentsEffect(StaticFilters.FILTER_PERMANENT_A_CREATURE), + new InvertCondition(CitysBlessingCondition.instance), + "Each opponent sacrifices a creature")); + // If you have the city's blessing, instead each opponent sacrifices half the creatures he or she controls rounded up. + this.getSpellAbility().addEffect(new ConditionalOneShotEffect( + new VonasHungerEffect(), + CitysBlessingCondition.instance, + "If you have the city's blessing, instead each opponent sacrifices half the creatures he or she controls rounded up")); + } + + public VonasHunger(final VonasHunger card) { + super(card); + } + + @Override + public VonasHunger copy() { + return new VonasHunger(this); + } +} + +class VonasHungerEffect extends OneShotEffect { + + public VonasHungerEffect() { + super(Outcome.Sacrifice); + } + + public VonasHungerEffect(final VonasHungerEffect effect) { + super(effect); + } + + @Override + public VonasHungerEffect copy() { + return new VonasHungerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + List perms = new ArrayList<>(); + for (UUID playerId : game.getOpponents(source.getControllerId())) { + Player player = game.getPlayer(playerId); + if (player != null) { + int numTargets = (game.getBattlefield().countAll(StaticFilters.FILTER_CONTROLLED_CREATURE, player.getId(), game) + 1) / 2; + if (numTargets > 0) { + TargetPermanent target = new TargetPermanent(numTargets, numTargets, StaticFilters.FILTER_CONTROLLED_CREATURE, true); + if (target.canChoose(player.getId(), game)) { + player.chooseTarget(Outcome.Sacrifice, target, source, game); + perms.addAll(target.getTargets()); + } + } + } + } + for (UUID permID : perms) { + Permanent permanent = game.getPermanent(permID); + if (permanent != null) { + permanent.sacrifice(source.getSourceId(), game); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/RivalsOfIxalan.java b/Mage.Sets/src/mage/sets/RivalsOfIxalan.java index 9db8aebc722..13449dd3e68 100644 --- a/Mage.Sets/src/mage/sets/RivalsOfIxalan.java +++ b/Mage.Sets/src/mage/sets/RivalsOfIxalan.java @@ -60,5 +60,6 @@ public class RivalsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Silvergill Adept", 53, Rarity.UNCOMMON, mage.cards.s.SilvergillAdept.class)); cards.add(new SetCardInfo("Storm the Vault", 173, Rarity.RARE, mage.cards.s.StormTheVault.class)); cards.add(new SetCardInfo("Vault of Catlacan", 173, Rarity.RARE, mage.cards.v.VaultOfCatlacan.class)); + cards.add(new SetCardInfo("Vona's Hunger", 90, Rarity.RARE, mage.cards.v.VonasHunger.class)); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 68b35334ca3..1d017f284d4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -49,6 +49,8 @@ import mage.choices.Choice; import mage.constants.*; import mage.counters.Counter; import mage.counters.Counters; +import mage.designations.Designation; +import mage.designations.DesignationType; import mage.filter.Filter; import mage.filter.FilterPermanent; import mage.filter.StaticFilters; @@ -1835,7 +1837,6 @@ public class TestPlayer implements Player { return computerPlayer.rollDice(game, appliedEffects, numSides); } - @Override public List getAvailableAttackers(Game game) { return computerPlayer.getAvailableAttackers(game); @@ -2301,6 +2302,21 @@ public class TestPlayer implements Player { return computerPlayer.moveCards(cards, toZone, source, game, tapped, faceDown, byOwner, appliedEffects); } + @Override + public boolean hasDesignation(DesignationType designationName) { + return computerPlayer.hasDesignation(designationName); + } + + @Override + public void addDesignation(Designation designation) { + computerPlayer.addDesignation(designation); + } + + @Override + public List getDesignations() { + return computerPlayer.getDesignations(); + } + public void setAIPlayer(boolean AIPlayer) { this.AIPlayer = AIPlayer; } diff --git a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java index fd469eb8fc7..3caaeedf537 100644 --- a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java +++ b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java @@ -45,6 +45,8 @@ import mage.choices.Choice; import mage.constants.*; import mage.counters.Counter; import mage.counters.Counters; +import mage.designations.Designation; +import mage.designations.DesignationType; import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.Graveyard; @@ -656,7 +658,6 @@ public class PlayerStub implements Player { return 1; } - @Override public void discard(int amount, Ability source, Game game) { @@ -1252,4 +1253,19 @@ public class PlayerStub implements Player { } + @Override + public boolean hasDesignation(DesignationType designationName) { + return false; + } + + @Override + public void addDesignation(Designation designation) { + + } + + @Override + public List getDesignations() { + return null; + } + } diff --git a/Mage/src/main/java/mage/abilities/condition/common/CitysBlessingCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CitysBlessingCondition.java new file mode 100644 index 00000000000..d8f333d9259 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/condition/common/CitysBlessingCondition.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.abilities.condition.common; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.designations.DesignationType; +import mage.game.Game; + +/** + * + * @author LvelX2 + */ +public enum CitysBlessingCondition implements Condition { + + instance; + + @Override + public boolean apply(Game game, Ability source) { + return game.getPlayer(source.getControllerId()).hasDesignation(DesignationType.CITYS_BLESSING); + } + + @Override + public String toString() { + return "If you have the city's blessing"; + } +} diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/AscendEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/AscendEffect.java new file mode 100644 index 00000000000..11d7bbba84d --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/keyword/AscendEffect.java @@ -0,0 +1,77 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.abilities.effects.keyword; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.designations.CitysBlessing; +import mage.designations.DesignationType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class AscendEffect extends OneShotEffect { + + public AscendEffect() { + super(Outcome.Detriment); + staticText = "Ascend (If you control ten or more permanents, you get the city's blessing for the rest of the game.)
"; + } + + public AscendEffect(final AscendEffect effect) { + super(effect); + } + + @Override + public AscendEffect copy() { + return new AscendEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + if (game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_ARTIFACT_CREATURE_ENCHANTMENT_OR_LAND, controller.getId(), game) > 9) { + if (!controller.hasDesignation(DesignationType.CITYS_BLESSING)) { + controller.addDesignation(new CitysBlessing()); + game.informPlayers(controller.getLogName() + " gets the city's blessing for the rest of the game."); + } else { + game.informPlayers(controller.getLogName() + " already has the city's blessing."); + } + } else { + game.informPlayers(controller.getLogName() + " does not get the city's blessing."); + } + return true; + } + return false; + } +} diff --git a/Mage/src/main/java/mage/designations/CitysBlessing.java b/Mage/src/main/java/mage/designations/CitysBlessing.java new file mode 100644 index 00000000000..78cc5185d5c --- /dev/null +++ b/Mage/src/main/java/mage/designations/CitysBlessing.java @@ -0,0 +1,39 @@ +/* +* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are +* permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this list of +* conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, this list +* of conditions and the following disclaimer in the documentation and/or other materials +* provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* The views and conclusions contained in the software and documentation are those of the +* authors and should not be interpreted as representing official policies, either expressed +* or implied, of BetaSteward_at_googlemail.com. + */ +package mage.designations; + +/** + * + * @author LevelX2 + */ +public class CitysBlessing extends Designation { + + public CitysBlessing() { + super(DesignationType.CITYS_BLESSING, "RIX"); + } +} diff --git a/Mage/src/main/java/mage/designations/Designation.java b/Mage/src/main/java/mage/designations/Designation.java index 7d3d842a9c8..ffd52dd4f04 100644 --- a/Mage/src/main/java/mage/designations/Designation.java +++ b/Mage/src/main/java/mage/designations/Designation.java @@ -5,6 +5,10 @@ */ package mage.designations; +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; +import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.ObjectColor; @@ -14,6 +18,7 @@ import mage.abilities.Ability; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.text.TextPart; import mage.cards.FrameStyle; import mage.constants.CardType; import mage.constants.SubType; @@ -23,11 +28,6 @@ import mage.game.events.ZoneChangeEvent; import mage.util.GameLog; import mage.util.SubTypeList; -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.List; -import java.util.UUID; - /** * * @author LevelX2 @@ -40,27 +40,35 @@ public abstract class Designation implements MageObject { private static ManaCostsImpl emptyCost = new ManaCostsImpl(); private String name; + private DesignationType designationType; private UUID id; private FrameStyle frameStyle; private Abilities abilites = new AbilitiesImpl<>(); private String expansionSetCodeForImage; + private final boolean unique; // can a designation be added multiple times (false) or only once to an object (true) - public Designation(String name, String expansionSetCode) { - this.name = name; + public Designation(DesignationType designationType, String expansionSetCode) { + this(designationType, expansionSetCode, true); + } + + public Designation(DesignationType designationType, String expansionSetCode, boolean unique) { + this.name = designationType.name(); + this.designationType = designationType; this.id = UUID.randomUUID(); this.frameStyle = FrameStyle.M15_NORMAL; this.expansionSetCodeForImage = expansionSetCode; + this.unique = unique; } public Designation(final Designation designation) { this.id = designation.id; this.name = designation.name; + this.designationType = designation.designationType; this.frameStyle = designation.frameStyle; this.abilites = designation.abilites.copy(); + this.unique = designation.unique; } - public abstract void start(Game game, UUID controllerId); - @Override public FrameStyle getFrameStyle() { return frameStyle; @@ -110,6 +118,10 @@ public abstract class Designation implements MageObject { return this.id; } + public DesignationType getDesignationType() { + return designationType; + } + public void setExpansionSetCodeForImage(String expansionSetCodeForImage) { this.expansionSetCodeForImage = expansionSetCodeForImage; } @@ -218,4 +230,38 @@ public abstract class Designation implements MageObject { @Override public void removePTCDA() { } + + /** + * + * @param game + * @param controllerId + */ + public void start(Game game, UUID controllerId) { + + } + + @Override + public boolean isAllCreatureTypes() { + return false; + } + + @Override + public void setIsAllCreatureTypes(boolean value) { + + } + + @Override + public List getTextParts() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public TextPart addTextPart(TextPart textPart) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + public boolean isUnique() { + return unique; + } + } diff --git a/Mage/src/main/java/mage/designations/DesignationType.java b/Mage/src/main/java/mage/designations/DesignationType.java new file mode 100644 index 00000000000..04111df5188 --- /dev/null +++ b/Mage/src/main/java/mage/designations/DesignationType.java @@ -0,0 +1,49 @@ +/* +* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are +* permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this list of +* conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, this list +* of conditions and the following disclaimer in the documentation and/or other materials +* provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* The views and conclusions contained in the software and documentation are those of the +* authors and should not be interpreted as representing official policies, either expressed +* or implied, of BetaSteward_at_googlemail.com. + */ +package mage.designations; + +/** + * + * @author LevelX2 + */ +public enum DesignationType { + THE_MONARCH("The Monarch"), + CITYS_BLESSING("City's Blessing"); + + private final String text; + + DesignationType(String text) { + this.text = text; + } + + @Override + public String toString() { + return text; + } + +} diff --git a/Mage/src/main/java/mage/designations/Monarch.java b/Mage/src/main/java/mage/designations/Monarch.java index 6f6cd57404e..b0b8e923b9d 100644 --- a/Mage/src/main/java/mage/designations/Monarch.java +++ b/Mage/src/main/java/mage/designations/Monarch.java @@ -27,14 +27,11 @@ */ package mage.designations; -import java.util.List; -import java.util.UUID; import mage.MageObject; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; import mage.abilities.effects.common.BecomesMonarchTargetEffect; import mage.abilities.effects.common.DrawCardTargetEffect; -import mage.abilities.text.TextPart; import mage.constants.TargetController; import mage.constants.Zone; import mage.game.Game; @@ -50,40 +47,10 @@ import mage.target.targetpointer.FixedTarget; public class Monarch extends Designation { public Monarch() { - super("The Monarch", "CN2"); + super(DesignationType.THE_MONARCH, "CN2"); addAbility(new MonarchDrawTriggeredAbility()); addAbility(new MonarchDealsCombatDamageToAPlayerTriggeredAbility()); } - - /** - * - * @param game - * @param controllerId - */ - @Override - public void start(Game game, UUID controllerId) { - - } - - @Override - public boolean isAllCreatureTypes() { - return false; - } - - @Override - public void setIsAllCreatureTypes(boolean value) { - - } - - @Override - public List getTextParts() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public TextPart addTextPart(TextPart textPart) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } } // At the beginning of the monarch’s end step, that player draws a card diff --git a/Mage/src/main/java/mage/filter/StaticFilters.java b/Mage/src/main/java/mage/filter/StaticFilters.java index 23e3d752d34..2de923335ec 100644 --- a/Mage/src/main/java/mage/filter/StaticFilters.java +++ b/Mage/src/main/java/mage/filter/StaticFilters.java @@ -34,6 +34,7 @@ public final class StaticFilters { public static final FilterNonlandCard FILTER_CARD_A_NON_LAND = new FilterNonlandCard("a nonland card"); public static final FilterCard FILTER_CARD_ARTIFACT_OR_CREATURE = new FilterCard("artifact or creature card"); + public static final FilterPermanent FILTER_PERMANENT = new FilterPermanent(); public static final FilterCreaturePermanent FILTER_ARTIFACT_CREATURE_PERMANENT = new FilterArtifactCreaturePermanent(); public static final FilterPermanent FILTER_PERMANENT_ARTIFACT_OR_CREATURE = new FilterPermanent("artifact or creature"); public static final FilterPermanent FILTER_PERMANENT_ARTIFACT_CREATURE_OR_ENCHANTMENT = new FilterPermanent("artifact, creature, or enchantment"); diff --git a/Mage/src/main/java/mage/players/Player.java b/Mage/src/main/java/mage/players/Player.java index eb72ad1fac4..b947530716b 100644 --- a/Mage/src/main/java/mage/players/Player.java +++ b/Mage/src/main/java/mage/players/Player.java @@ -62,6 +62,8 @@ import mage.constants.RangeOfInfluence; import mage.constants.Zone; import mage.counters.Counter; import mage.counters.Counters; +import mage.designations.Designation; +import mage.designations.DesignationType; import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.Graveyard; @@ -840,4 +842,11 @@ public interface Player extends MageItem, Copyable { boolean addTargets(Ability ability, Game game); String getHistory(); + + boolean hasDesignation(DesignationType designationName); + + void addDesignation(Designation designation); + + List getDesignations(); + } diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 423aee4372d..de7e06268aa 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -62,6 +62,8 @@ import static mage.constants.Zone.LIBRARY; import mage.counters.Counter; import mage.counters.CounterType; import mage.counters.Counters; +import mage.designations.Designation; +import mage.designations.DesignationType; import mage.filter.FilterCard; import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledPermanent; @@ -199,6 +201,8 @@ public abstract class PlayerImpl implements Player, Serializable { protected UserData userData; protected MatchPlayer matchPlayer; + protected List designations = new ArrayList<>(); + /** * During some steps we can't play anything */ @@ -300,6 +304,8 @@ public abstract class PlayerImpl implements Player, Serializable { this.castSourceIdManaCosts = player.castSourceIdManaCosts; this.castSourceIdCosts = player.castSourceIdCosts; this.payManaMode = player.payManaMode; + + this.designations.addAll(player.designations); } @Override @@ -363,6 +369,9 @@ public abstract class PlayerImpl implements Player, Serializable { this.castSourceIdManaCosts = player.getCastSourceIdManaCosts(); this.castSourceIdCosts = player.getCastSourceIdCosts(); + this.designations.clear(); + this.designations.addAll(player.getDesignations()); + // Don't restore! // this.storedBookmark // this.usersAllowedToSeeHandCards @@ -435,6 +444,8 @@ public abstract class PlayerImpl implements Player, Serializable { this.castSourceIdManaCosts = null; this.castSourceIdCosts = null; this.getManaPool().init(); // needed to remove mana that not empties on step change from previous game if left + + this.designations.clear(); } /** @@ -3620,9 +3631,7 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public boolean scry(int value, Ability source, - Game game - ) { + public boolean scry(int value, Ability source, Game game) { game.informPlayers(getLogName() + " scries " + value); Cards cards = new CardsImpl(); cards.addAll(getLibrary().getTopCards(game, value)); @@ -3655,4 +3664,25 @@ public abstract class PlayerImpl implements Player, Serializable { return "no available"; } + @Override + public boolean hasDesignation(DesignationType designationName) { + for (Designation designation : designations) { + if (designation.getDesignationType().equals(designationName)) { + return true; + } + } + return false; + } + + @Override + public void addDesignation(Designation designation) { + if (!designation.isUnique() || !this.hasDesignation(designation.getDesignationType())) { + designations.add(designation); + } + } + + @Override + public List getDesignations() { + return designations; + } }