mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
Added TargetController parameter to DiscardEachPlayerEffect.
This commit is contained in:
parent
6022c01af8
commit
d5feac4bfe
8 changed files with 128 additions and 158 deletions
|
|
@ -28,16 +28,12 @@
|
||||||
package mage.sets.magic2010;
|
package mage.sets.magic2010;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.constants.Outcome;
|
import mage.abilities.effects.common.DiscardEachPlayerEffect;
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.effects.OneShotEffect;
|
|
||||||
import mage.abilities.effects.common.DrawCardAllEffect;
|
import mage.abilities.effects.common.DrawCardAllEffect;
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.game.Game;
|
import mage.constants.CardType;
|
||||||
import mage.players.Player;
|
import mage.constants.Rarity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -53,7 +49,9 @@ public class BurningInquiry extends CardImpl<BurningInquiry> {
|
||||||
|
|
||||||
// Each player draws three cards, then discards three cards at random.
|
// Each player draws three cards, then discards three cards at random.
|
||||||
this.getSpellAbility().addEffect(new DrawCardAllEffect(3));
|
this.getSpellAbility().addEffect(new DrawCardAllEffect(3));
|
||||||
this.getSpellAbility().addEffect(new BurningInquiryEffect());
|
Effect effect = new DiscardEachPlayerEffect(3, true);
|
||||||
|
effect.setText("then discards three cards at random");
|
||||||
|
this.getSpellAbility().addEffect(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BurningInquiry(final BurningInquiry card) {
|
public BurningInquiry(final BurningInquiry card) {
|
||||||
|
|
@ -65,41 +63,3 @@ public class BurningInquiry extends CardImpl<BurningInquiry> {
|
||||||
return new BurningInquiry(this);
|
return new BurningInquiry(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BurningInquiryEffect extends OneShotEffect<BurningInquiryEffect> {
|
|
||||||
|
|
||||||
public BurningInquiryEffect() {
|
|
||||||
super(Outcome.Discard);
|
|
||||||
this.staticText = "Each player discards three cards at random";
|
|
||||||
}
|
|
||||||
|
|
||||||
public BurningInquiryEffect(final BurningInquiryEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BurningInquiryEffect copy() {
|
|
||||||
return new BurningInquiryEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (UUID playerId : controller.getInRange()) {
|
|
||||||
Player player = game.getPlayer(playerId);
|
|
||||||
if (player != null) {
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
Card card = player.getHand().getRandom(game);
|
|
||||||
if (card != null) {
|
|
||||||
player.discard(card, source, game);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -29,15 +29,17 @@
|
||||||
package mage.sets.magic2011;
|
package mage.sets.magic2011;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DiscardEachPlayerEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.TargetController;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
|
@ -56,7 +58,7 @@ public class LilianasSpecter extends CardImpl<LilianasSpecter> {
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new LilianasSpecterEffect(), false));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new DiscardEachPlayerEffect(TargetController.OPPONENT), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public LilianasSpecter(final LilianasSpecter card) {
|
public LilianasSpecter(final LilianasSpecter card) {
|
||||||
|
|
@ -69,30 +71,3 @@ public class LilianasSpecter extends CardImpl<LilianasSpecter> {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class LilianasSpecterEffect extends OneShotEffect<LilianasSpecterEffect> {
|
|
||||||
|
|
||||||
public LilianasSpecterEffect() {
|
|
||||||
super(Outcome.Discard);
|
|
||||||
staticText = "each opponent discards a card";
|
|
||||||
}
|
|
||||||
|
|
||||||
public LilianasSpecterEffect(final LilianasSpecterEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
for (UUID playerId: game.getOpponents(source.getControllerId())) {
|
|
||||||
Player player = game.getPlayer(playerId);
|
|
||||||
player.discard(1, source, game);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LilianasSpecterEffect copy() {
|
|
||||||
return new LilianasSpecterEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.magic2012;
|
package mage.sets.magic2012;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
|
@ -85,37 +86,37 @@ class SmallpoxEffect extends OneShotEffect<SmallpoxEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (UUID playerId : game.getPlayerList()) {
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller != null) {
|
||||||
|
Set <UUID> players = controller.getInRange();
|
||||||
|
for (UUID playerId : players) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.loseLife(1, game);
|
player.loseLife(1, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (UUID playerId : players) {
|
||||||
for (UUID playerId : game.getPlayerList()) {
|
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.discard(1, source, game);
|
player.discard(1, source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (UUID playerId : players) {
|
||||||
|
|
||||||
for (UUID playerId : game.getPlayerList()) {
|
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
sacrifice(game, source, player, filterCreature);
|
sacrifice(game, source, player, filterCreature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (UUID playerId : players) {
|
||||||
for (UUID playerId : game.getPlayerList()) {
|
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
sacrifice(game, source, player, filterLand);
|
sacrifice(game, source, player, filterLand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SmallpoxEffect copy() {
|
public SmallpoxEffect copy() {
|
||||||
|
|
@ -125,7 +126,7 @@ class SmallpoxEffect extends OneShotEffect<SmallpoxEffect> {
|
||||||
private void sacrifice(Game game, Ability source, Player player, FilterPermanent filter) {
|
private void sacrifice(Game game, Ability source, Player player, FilterPermanent filter) {
|
||||||
Target target = new TargetControlledPermanent(1, 1, filter, false);
|
Target target = new TargetControlledPermanent(1, 1, filter, false);
|
||||||
if (target.canChoose(player.getId(), game)) {
|
if (target.canChoose(player.getId(), game)) {
|
||||||
while (!target.isChosen() && target.canChoose(player.getId(), game)) {
|
while (!target.isChosen() && target.canChoose(player.getId(), game) && player.isInGame()) {
|
||||||
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.DiscardEachPlayerEffect;
|
import mage.abilities.effects.common.DiscardEachPlayerEffect;
|
||||||
import mage.abilities.effects.common.LoseLifePlayersEffect;
|
import mage.abilities.effects.common.LoseLifePlayersEffect;
|
||||||
import mage.abilities.effects.common.SacrificeAllEffect;
|
import mage.abilities.effects.common.SacrificeAllEffect;
|
||||||
|
|
@ -54,9 +55,15 @@ public class DeathCloud extends CardImpl<DeathCloud> {
|
||||||
// Each player loses X life, discards X cards, sacrifices X creatures, then sacrifices X lands.
|
// Each player loses X life, discards X cards, sacrifices X creatures, then sacrifices X lands.
|
||||||
DynamicValue xValue = new ManacostVariableValue();
|
DynamicValue xValue = new ManacostVariableValue();
|
||||||
this.getSpellAbility().addEffect(new LoseLifePlayersEffect(xValue));
|
this.getSpellAbility().addEffect(new LoseLifePlayersEffect(xValue));
|
||||||
this.getSpellAbility().addEffect(new DiscardEachPlayerEffect(xValue, false));
|
Effect effect = new DiscardEachPlayerEffect(xValue, false);
|
||||||
this.getSpellAbility().addEffect(new SacrificeAllEffect(xValue, new FilterControlledCreaturePermanent("creatures")));
|
effect.setText(", discards X cards");
|
||||||
this.getSpellAbility().addEffect(new SacrificeAllEffect(xValue, new FilterControlledLandPermanent("lands")));
|
this.getSpellAbility().addEffect(effect);
|
||||||
|
effect = new SacrificeAllEffect(xValue, new FilterControlledCreaturePermanent("creatures"));
|
||||||
|
effect.setText(", sacrifices X creatures");
|
||||||
|
this.getSpellAbility().addEffect(effect);
|
||||||
|
effect = new SacrificeAllEffect(xValue, new FilterControlledLandPermanent("lands"));
|
||||||
|
effect.setText("then sacrifices X lands");
|
||||||
|
this.getSpellAbility().addEffect(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeathCloud(final DeathCloud card) {
|
public DeathCloud(final DeathCloud card) {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.sets.planeshift;
|
package mage.sets.planeshift;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.abilities.effects.common.DiscardEachPlayerEffect;
|
import mage.abilities.effects.common.DiscardEachPlayerEffect;
|
||||||
|
|
@ -50,9 +51,12 @@ public class UrzasGuilt extends CardImpl<UrzasGuilt> {
|
||||||
|
|
||||||
// Each player draws two cards, then discards three cards, then loses 4 life.
|
// Each player draws two cards, then discards three cards, then loses 4 life.
|
||||||
this.getSpellAbility().addEffect(new DrawCardAllEffect(2));
|
this.getSpellAbility().addEffect(new DrawCardAllEffect(2));
|
||||||
this.getSpellAbility().addEffect(new DiscardEachPlayerEffect(3, false));
|
Effect effect = new DiscardEachPlayerEffect(3, false);
|
||||||
this.getSpellAbility().addEffect(new LoseLifeAllEffect(4));
|
effect.setText("then discards three cards");
|
||||||
|
this.getSpellAbility().addEffect(effect);
|
||||||
|
effect = new LoseLifeAllEffect(4);
|
||||||
|
effect.setText("then loses 4 life");
|
||||||
|
this.getSpellAbility().addEffect(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UrzasGuilt(final UrzasGuilt card) {
|
public UrzasGuilt(final UrzasGuilt card) {
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,10 @@ import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DiscardEachPlayerEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.TargetController;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
|
@ -56,7 +58,7 @@ public class CacklingFiend extends CardImpl<CacklingFiend> {
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new CacklingFiendEffect(), false));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new DiscardEachPlayerEffect(TargetController.OPPONENT), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CacklingFiend(final CacklingFiend card) {
|
public CacklingFiend(final CacklingFiend card) {
|
||||||
|
|
@ -69,30 +71,3 @@ public class CacklingFiend extends CardImpl<CacklingFiend> {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CacklingFiendEffect extends OneShotEffect<CacklingFiendEffect> {
|
|
||||||
|
|
||||||
public CacklingFiendEffect() {
|
|
||||||
super(Outcome.Discard);
|
|
||||||
staticText = "each opponent discards a card";
|
|
||||||
}
|
|
||||||
|
|
||||||
public CacklingFiendEffect(final CacklingFiendEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
for (UUID playerId: game.getOpponents(source.getControllerId())) {
|
|
||||||
Player player = game.getPlayer(playerId);
|
|
||||||
player.discard(1, source, game);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CacklingFiendEffect copy() {
|
|
||||||
return new CacklingFiendEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -11,6 +11,9 @@ import mage.cards.Card;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.TargetController;
|
||||||
|
import static mage.constants.TargetController.NOT_YOU;
|
||||||
|
import static mage.constants.TargetController.OPPONENT;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
@ -22,25 +25,36 @@ public class DiscardEachPlayerEffect extends OneShotEffect<DiscardEachPlayerEffe
|
||||||
|
|
||||||
protected DynamicValue amount;
|
protected DynamicValue amount;
|
||||||
protected boolean randomDiscard;
|
protected boolean randomDiscard;
|
||||||
|
private TargetController targetController;
|
||||||
|
|
||||||
public DiscardEachPlayerEffect() {
|
public DiscardEachPlayerEffect() {
|
||||||
this(new StaticValue(1), false);
|
this(new StaticValue(1), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DiscardEachPlayerEffect(TargetController targetController) {
|
||||||
|
this(new StaticValue(1), false, targetController);
|
||||||
|
}
|
||||||
|
|
||||||
public DiscardEachPlayerEffect(int amount, boolean randomDiscard) {
|
public DiscardEachPlayerEffect(int amount, boolean randomDiscard) {
|
||||||
this(new StaticValue(amount), randomDiscard);
|
this(new StaticValue(amount), randomDiscard);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiscardEachPlayerEffect(DynamicValue amount, boolean randomDiscard) {
|
public DiscardEachPlayerEffect(DynamicValue amount, boolean randomDiscard) {
|
||||||
|
this(amount, randomDiscard, TargetController.ANY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DiscardEachPlayerEffect(DynamicValue amount, boolean randomDiscard, TargetController targetController) {
|
||||||
super(Outcome.Discard);
|
super(Outcome.Discard);
|
||||||
this.randomDiscard = randomDiscard;
|
this.randomDiscard = randomDiscard;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
|
this.targetController = targetController;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiscardEachPlayerEffect(final DiscardEachPlayerEffect effect) {
|
public DiscardEachPlayerEffect(final DiscardEachPlayerEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.randomDiscard = effect.randomDiscard;
|
this.randomDiscard = effect.randomDiscard;
|
||||||
this.amount = effect.amount;
|
this.amount = effect.amount;
|
||||||
|
this.targetController = effect.targetController;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -53,6 +67,18 @@ public class DiscardEachPlayerEffect extends OneShotEffect<DiscardEachPlayerEffe
|
||||||
for (UUID playerId : controller.getInRange()) {
|
for (UUID playerId : controller.getInRange()) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
switch(targetController) {
|
||||||
|
case NOT_YOU:
|
||||||
|
if (playerId.equals(source.getControllerId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OPPONENT:
|
||||||
|
if (!game.getOpponents(source.getControllerId()).contains(playerId)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
int numberOfCardsToDiscard = Math.min(amount.calculate(game, source), player.getHand().size());
|
int numberOfCardsToDiscard = Math.min(amount.calculate(game, source), player.getHand().size());
|
||||||
Cards cards = new CardsImpl();
|
Cards cards = new CardsImpl();
|
||||||
if (randomDiscard) {
|
if (randomDiscard) {
|
||||||
|
|
@ -83,7 +109,7 @@ public class DiscardEachPlayerEffect extends OneShotEffect<DiscardEachPlayerEffe
|
||||||
player.discard(card, source, game);
|
player.discard(card, source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
game.informPlayers(new StringBuilder(player.getName()).append(" discards ").append(Integer.toString(cardsPlayer.size())).append(" card").append(cardsPlayer.size() > 1?"s":"").toString());
|
game.informPlayers(new StringBuilder(player.getName()).append(" discards ").append(Integer.toString(cardsPlayer.size())).append(" card").append(cardsPlayer.size() > 1 ? "s" : "").toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -98,8 +124,23 @@ public class DiscardEachPlayerEffect extends OneShotEffect<DiscardEachPlayerEffe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getText(Mode mode) {
|
public String getText(Mode mode) {
|
||||||
|
if (staticText != null && !staticText.isEmpty()) {
|
||||||
|
return staticText;
|
||||||
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Each player discards ");
|
sb.append("each ");
|
||||||
|
switch(targetController) {
|
||||||
|
case NOT_YOU:
|
||||||
|
sb.append("other player");
|
||||||
|
break;
|
||||||
|
case OPPONENT:
|
||||||
|
sb.append("opponent");
|
||||||
|
break;
|
||||||
|
case ANY:
|
||||||
|
sb.append("player");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sb.append(" discards ");
|
||||||
sb.append(CardUtil.numberToText(amount.toString())).append(" card");
|
sb.append(CardUtil.numberToText(amount.toString())).append(" card");
|
||||||
try {
|
try {
|
||||||
if (Integer.parseInt(amount.toString()) > 1) {
|
if (Integer.parseInt(amount.toString()) > 1) {
|
||||||
|
|
@ -113,5 +154,4 @@ public class DiscardEachPlayerEffect extends OneShotEffect<DiscardEachPlayerEffe
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -350,8 +350,16 @@ public class CardUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String numberToText(String number) {
|
public static String numberToText(String number) {
|
||||||
|
return numberToText(number, "one");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String numberToText(String number, String forOne) {
|
||||||
if (checkNumeric(number)) {
|
if (checkNumeric(number)) {
|
||||||
return numberToText(Integer.parseInt(number));
|
int intNumber = Integer.parseInt(number);
|
||||||
|
if (forOne != null && intNumber == 1) {
|
||||||
|
return forOne;
|
||||||
|
}
|
||||||
|
return numberToText(intNumber);
|
||||||
}
|
}
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue