mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
fixing choosing creature types
This commit is contained in:
parent
c12bdf1dcd
commit
449e82a796
15 changed files with 55 additions and 81 deletions
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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:";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue