Merge pull request #12 from magefree/master

merge
This commit is contained in:
theelk801 2017-08-02 13:59:11 -04:00 committed by GitHub
commit 7370baad73
17 changed files with 246 additions and 81 deletions

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -37,7 +35,7 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.*; import mage.cards.*;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -47,6 +45,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
* *
* @author fireshoes * @author fireshoes
@ -98,9 +98,7 @@ class BloodlineShamanEffect extends OneShotEffect {
MageObject sourceObject = game.getObject(source.getSourceId()); MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null) { if (controller != null) {
// Choose a creature type. // Choose a creature type.
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!controller.choose(outcome, typeChoice, game)) { while (!controller.choose(outcome, typeChoice, game)) {
if (!controller.canRespond()) { if (!controller.canRespond()) {
return false; return false;

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -41,17 +39,18 @@ import mage.abilities.effects.common.continuous.SetToughnessSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.ChosenSubtypePredicate; import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
* *
* @author jeffwadsworth * @author jeffwadsworth
@ -133,9 +132,7 @@ class ChooseCreatureTypeEffect extends OneShotEffect { // code by LevelX2, but t
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getObject(source.getSourceId()); MageObject mageObject = game.getObject(source.getSourceId());
if (controller != null && mageObject != null) { if (controller != null && mageObject != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose creature type");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!controller.choose(outcome, typeChoice, game)) { while (!controller.choose(outcome, typeChoice, game)) {
if (!controller.canRespond()) { if (!controller.canRespond()) {
return false; return false;

View file

@ -27,14 +27,12 @@
*/ */
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -45,6 +43,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetAttackingOrBlockingCreature; import mage.target.common.TargetAttackingOrBlockingCreature;
import java.util.UUID;
/** /**
* *
* @author emerald000 * @author emerald000
@ -89,9 +89,7 @@ class CoordinatedBarrageEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
Choice choice = new ChoiceImpl(true); Choice choice = new ChoiceCreatureType();
choice.setMessage("Choose a creature type");
choice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
if (controller.choose(Outcome.Damage, choice, game)) { if (controller.choose(Outcome.Damage, choice, game)) {
String chosenType = choice.getChoice(); String chosenType = choice.getChoice();
FilterControlledPermanent filter = new FilterControlledPermanent(); FilterControlledPermanent filter = new FilterControlledPermanent();

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -36,7 +34,7 @@ import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -45,6 +43,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
* *
* @author emerald000 * @author emerald000
@ -89,9 +89,7 @@ class DistantMelodyEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -0,0 +1,190 @@
/*
* 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.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardIdPredicate;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.other.AuraCardCanAttachToPermanentId;
import mage.filter.predicate.permanent.AttachedToPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author jeffwadsworth
*/
public class HakimLoreweaver extends CardImpl {
private final static String rule = "Return target Aura card from your graveyard to the battlefield attached to Hakim, Loreweaver. Activate this ability only during your upkeep and only if Hakim isn't enchanted.";
UUID originalId;
public HakimLoreweaver(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add("Human");
this.subtype.add("Wizard");
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// {U}{U}: Return target Aura card from your graveyard to the battlefield attached to Hakim, Loreweaver. Activate this ability only during your upkeep and only if Hakim isn't enchanted.
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new HakimLoreweaverEffect(), new ManaCostsImpl("{U}{U}"), new HakimLoreweaverCondition(), rule);
ability.addTarget(new TargetCardInYourGraveyard());
originalId = ability.getOriginalId();
this.addAbility(ability);
// {U}{U}, {tap}: Destroy all Auras attached to Hakim.
FilterPermanent filterAurasOnHakim = new FilterPermanent("Auras attached to Hakim");
filterAurasOnHakim.add(new CardTypePredicate(CardType.ENCHANTMENT));
filterAurasOnHakim.add(new SubtypePredicate(SubType.AURA));
FilterPermanent filterSourceId = new FilterPermanent();
filterSourceId.add(new CardIdPredicate(this.getId()));
filterAurasOnHakim.add(new AttachedToPredicate(filterSourceId));
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyAllEffect(filterAurasOnHakim), new ManaCostsImpl("{U}{U}"));
ability2.addCost(new TapSourceCost());
this.addAbility(ability2);
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getOriginalId().equals(originalId)) {
Player controller = game.getPlayer(ability.getControllerId());
if (controller != null) {
ability.getTargets().clear();
FilterCard filterAuraCard = new FilterCard("target Aura card from your graveyard");
filterAuraCard.add(new CardTypePredicate(CardType.ENCHANTMENT));
filterAuraCard.add(new SubtypePredicate(SubType.AURA));
filterAuraCard.add(new AuraCardCanAttachToPermanentId(ability.getSourceId()));
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filterAuraCard);
ability.addTarget(target);
}
}
}
public HakimLoreweaver(final HakimLoreweaver card) {
super(card);
this.originalId = card.originalId;
}
@Override
public HakimLoreweaver copy() {
return new HakimLoreweaver(this);
}
}
class HakimLoreweaverEffect extends OneShotEffect {
public HakimLoreweaverEffect() {
super(Outcome.Benefit);
this.staticText = "Return target Aura card from your graveyard to the battlefield attached to {this}. Activate this ability only during your upkeep and only if Hakim isn't enchanted";
}
public HakimLoreweaverEffect(final HakimLoreweaverEffect effect) {
super(effect);
}
@Override
public HakimLoreweaverEffect copy() {
return new HakimLoreweaverEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent hakimLoreweaver = game.getPermanent(source.getSourceId());
Card targetAuraCard = game.getCard(source.getFirstTarget());
if (controller != null
&& hakimLoreweaver != null
&& controller.canRespond()
&& targetAuraCard != null) {
Target target = targetAuraCard.getSpellAbility().getTargets().get(0);
if (target != null) {
game.getState().setValue("attachTo:" + targetAuraCard.getId(), hakimLoreweaver);
controller.moveCards(targetAuraCard, Zone.BATTLEFIELD, source, game);
return hakimLoreweaver.addAttachment(targetAuraCard.getId(), game);
}
}
return false;
}
}
class HakimLoreweaverCondition implements Condition {
static private final FilterPermanent auras = new FilterPermanent();
static {
auras.add(new CardTypePredicate(CardType.ENCHANTMENT));
}
@Override
public boolean apply(Game game, Ability source) {
Permanent hakimLoreweaver = game.getPermanent(source.getSourceId());
if (hakimLoreweaver != null) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(auras, game)) {
if (permanent != null
&& hakimLoreweaver.getAttachments().contains(permanent.getId())) {
return false;
}
}
return PhaseStep.UPKEEP == game.getStep().getType()
&& game.getActivePlayerId().equals(source.getControllerId());
}
return false;
}
}

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.l; package mage.cards.l;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -36,7 +34,7 @@ import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -45,6 +43,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
* *
* @author michael.napoleon@gmail.com * @author michael.napoleon@gmail.com
@ -88,9 +88,7 @@ class LuminescentRainEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(p->p.toString()).collect(Collectors.toSet()));
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.o; package mage.cards.o;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.costs.AlternativeCostSourceAbility;
import mage.abilities.costs.common.DiscardTargetCost; import mage.abilities.costs.common.DiscardTargetCost;
@ -38,7 +36,7 @@ import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -50,6 +48,8 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import java.util.UUID;
/** /**
* @author fireshoes * @author fireshoes
*/ */
@ -96,9 +96,7 @@ class OutbreakEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(p -> p.toString()).collect(Collectors.toSet()));
while (!player.choose(outcome, typeChoice, game)) { while (!player.choose(outcome, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -27,15 +27,13 @@
*/ */
package mage.cards.p; package mage.cards.p;
import java.util.*;
import java.util.stream.Collectors;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -47,6 +45,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.*;
/** /**
* @author duncant * @author duncant
*/ */
@ -93,9 +93,7 @@ class PatriarchsBiddingEffect extends OneShotEffect {
Set<String> chosenTypes = new HashSet<>(); Set<String> chosenTypes = new HashSet<>();
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!player.choose(Outcome.PutCreatureInPlay, typeChoice, game)) { while (!player.choose(Outcome.PutCreatureInPlay, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
break; break;

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.p; package mage.cards.p;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
@ -37,7 +35,7 @@ import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -50,6 +48,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
* @author emerald000 * @author emerald000
@ -93,9 +93,7 @@ class PeerPressureEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
Choice choice = new ChoiceImpl(true); Choice choice = new ChoiceCreatureType();
choice.setMessage("Choose creature type");
choice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::getDescription).collect(Collectors.toSet()));
while (!controller.choose(Outcome.GainControl, choice, game)) { while (!controller.choose(Outcome.GainControl, choice, game)) {
if (!controller.canRespond()) { if (!controller.canRespond()) {
return false; return false;

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -39,7 +37,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -50,6 +48,8 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
* @author fireshoes * @author fireshoes
*/ */
@ -94,9 +94,7 @@ class RiptideChronologistEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId()); MageObject sourceObject = game.getObject(source.getSourceId());
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!player.choose(outcome, typeChoice, game)) { while (!player.choose(outcome, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -38,14 +36,15 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.*; import mage.cards.*;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
* *
* @author emerald000 * @author emerald000
@ -96,9 +95,7 @@ class RiptideShapeshifterEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game); MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) { if (controller != null && sourceObject != null) {
Choice choice = new ChoiceImpl(true); Choice choice = new ChoiceCreatureType();
choice.setMessage("Choose a creature type:");
choice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!controller.choose(Outcome.BoostCreature, choice, game)) { while (!controller.choose(Outcome.BoostCreature, choice, game)) {
if (!controller.canRespond()) { if (!controller.canRespond()) {
return false; return false;

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.t; package mage.cards.t;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
@ -38,7 +36,7 @@ import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -48,6 +46,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
* @author anonymous * @author anonymous
*/ */
@ -91,9 +91,7 @@ class TribalUnityEffect extends OneShotEffect {
MageObject sourceObject = game.getObject(source.getSourceId()); MageObject sourceObject = game.getObject(source.getSourceId());
int boost = amount.calculate(game, source, this); int boost = amount.calculate(game, source, this);
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!player.choose(outcome, typeChoice, game)) { while (!player.choose(outcome, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -150,6 +150,7 @@ public class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Gravebane Zombie", 25, Rarity.COMMON, mage.cards.g.GravebaneZombie.class)); cards.add(new SetCardInfo("Gravebane Zombie", 25, Rarity.COMMON, mage.cards.g.GravebaneZombie.class));
cards.add(new SetCardInfo("Grave Servitude", 24, Rarity.COMMON, mage.cards.g.GraveServitude.class)); cards.add(new SetCardInfo("Grave Servitude", 24, Rarity.COMMON, mage.cards.g.GraveServitude.class));
cards.add(new SetCardInfo("Grinning Totem", 268, Rarity.RARE, mage.cards.g.GrinningTotem.class)); cards.add(new SetCardInfo("Grinning Totem", 268, Rarity.RARE, mage.cards.g.GrinningTotem.class));
cards.add(new SetCardInfo("Hakim, Loreweaver", 68, Rarity.RARE, mage.cards.h.HakimLoreweaver.class));
cards.add(new SetCardInfo("Hall of Gemstone", 119, Rarity.RARE, mage.cards.h.HallOfGemstone.class)); cards.add(new SetCardInfo("Hall of Gemstone", 119, Rarity.RARE, mage.cards.h.HallOfGemstone.class));
cards.add(new SetCardInfo("Hammer of Bogardan", 181, Rarity.RARE, mage.cards.h.HammerOfBogardan.class)); cards.add(new SetCardInfo("Hammer of Bogardan", 181, Rarity.RARE, mage.cards.h.HammerOfBogardan.class));
cards.add(new SetCardInfo("Harbinger of Night", 26, Rarity.RARE, mage.cards.h.HarbingerOfNight.class)); cards.add(new SetCardInfo("Harbinger of Night", 26, Rarity.RARE, mage.cards.h.HarbingerOfNight.class));

View file

@ -39,6 +39,7 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.LinkedHashSet;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -65,7 +66,7 @@ public class ChooseCreatureTypeEffect extends OneShotEffect {
if (controller != null && mageObject != null) { if (controller != null && mageObject != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose creature type"); typeChoice.setMessage("Choose creature type");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet())); typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toCollection(LinkedHashSet::new)));
while (!controller.choose(outcome, typeChoice, game)) { while (!controller.choose(outcome, typeChoice, game)) {
if (!controller.canRespond()) { if (!controller.canRespond()) {
return false; return false;

View file

@ -6,16 +6,13 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.util.SubTypeList;
import java.util.stream.Collectors;
public class BecomesChosenCreatureTypeTargetEffect extends OneShotEffect { public class BecomesChosenCreatureTypeTargetEffect extends OneShotEffect {
@ -48,17 +45,15 @@ public class BecomesChosenCreatureTypeTargetEffect extends OneShotEffect {
Card card = game.getCard(source.getSourceId()); Card card = game.getCard(source.getSourceId());
String chosenType = ""; String chosenType = "";
if (player != null && card != null) { if (player != null && card != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
String msg = "Choose a creature type"; String msg = "Choose a creature type";
if(nonWall) { if(nonWall) {
msg += " other than Wall"; msg += " other than Wall";
} }
typeChoice.setMessage(msg); typeChoice.setMessage(msg);
SubTypeList types = SubType.getCreatureTypes(false);
if(nonWall) { if(nonWall) {
types.remove(SubType.WALL); typeChoice.getChoices().remove(SubType.WALL.getDescription());
} }
typeChoice.setChoices(types.stream().map(SubType::toString).collect(Collectors.toSet()));
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -2,13 +2,14 @@ package mage.choices;
import mage.constants.SubType; import mage.constants.SubType;
import java.util.LinkedHashSet;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class ChoiceCreatureType extends ChoiceImpl { public class ChoiceCreatureType extends ChoiceImpl {
public ChoiceCreatureType() { public ChoiceCreatureType() {
super(true); super(true);
this.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet())); this.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toCollection(LinkedHashSet::new)));
this.message = "Choose a creature type:"; this.message = "Choose a creature type:";
} }

View file

@ -3,6 +3,7 @@ package mage.constants;
import mage.util.SubTypeList; import mage.util.SubTypeList;
import java.util.Arrays; import java.util.Arrays;
import java.util.EnumSet;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -418,10 +419,10 @@ public enum SubType {
return subTypeSet; return subTypeSet;
} }
public static SubTypeList getCreatureTypes(boolean customSet) { public static Set<SubType> getCreatureTypes(boolean customSet) {
SubTypeList subTypes = new SubTypeList(); Set<SubType> subTypes = EnumSet.noneOf(SubType.class);
for (SubType s : values()) { for (SubType s : values()) {
if (!s.customSet) { if (s.customSet == customSet && s.getSubTypeSet() == SubTypeSet.CreatureType) {
subTypes.add(s); subTypes.add(s);
} }
} }