mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 20:59:14 -08:00
* Created ecomesColorOrColorsTargetEffect and updated 3 cards to use it.
This commit is contained in:
parent
f36a10fb45
commit
ed41e33deb
6 changed files with 145 additions and 219 deletions
|
|
@ -117,7 +117,7 @@ class WaveOfVitriolEffect extends OneShotEffect {
|
|||
}
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
if (count > 0 && player.chooseUse(Outcome.PutLandInPlay, "Search your libraray for up to " + count + " basic lands?", game)) {
|
||||
if (count > 0 && player.chooseUse(Outcome.PutLandInPlay, "Search your library for up to " + count + " basic lands?", game)) {
|
||||
Target target = new TargetCardInLibrary(0,count, new FilterBasicLandCard());
|
||||
player.chooseTarget(outcome, target, source, game);
|
||||
for(UUID targetId: target.getTargets()) {
|
||||
|
|
|
|||
|
|
@ -27,29 +27,18 @@
|
|||
*/
|
||||
package mage.sets.eventide;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continious.BecomesColorTargetEffect;
|
||||
import mage.abilities.effects.common.continious.BecomesColorOrColorsTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -63,12 +52,11 @@ public class SwirlingSpriggan extends CardImpl {
|
|||
this.subtype.add("Goblin");
|
||||
this.subtype.add("Shaman");
|
||||
|
||||
this.color.setGreen(true);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// {GU}{GU}: Target creature you control becomes the color or colors of your choice until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ChangeColorOrColorsTargetEffect(), new ManaCostsImpl("G/U}{G/U}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorOrColorsTargetEffect(Duration.EndOfTurn), new ManaCostsImpl("G/U}{G/U}"));
|
||||
ability.addTarget(new TargetControlledCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
@ -82,58 +70,3 @@ public class SwirlingSpriggan extends CardImpl {
|
|||
return new SwirlingSpriggan(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ChangeColorOrColorsTargetEffect extends OneShotEffect {
|
||||
|
||||
public ChangeColorOrColorsTargetEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "target creature you control becomes the color or colors of your choice until end of turn";
|
||||
}
|
||||
|
||||
public ChangeColorOrColorsTargetEffect(final ChangeColorOrColorsTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Permanent target = game.getPermanent(source.getFirstTarget());
|
||||
List<ObjectColor> chosenColors = new ArrayList<>();
|
||||
if (you != null && target != null) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (!you.chooseUse(Outcome.Neutral, "Do you wish to choose another color?", game)) {
|
||||
break;
|
||||
}
|
||||
ChoiceColor choiceColor = new ChoiceColor();
|
||||
you.choose(Outcome.Benefit, choiceColor, game);
|
||||
if (!you.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
game.informPlayers(target.getName() + ": " + you.getName() + " has chosen " + choiceColor.getChoice());
|
||||
if (choiceColor.getColor().isBlack()) {
|
||||
chosenColors.add(ObjectColor.BLACK);
|
||||
} else if (choiceColor.getColor().isBlue()) {
|
||||
chosenColors.add(ObjectColor.BLUE);
|
||||
} else if (choiceColor.getColor().isRed()) {
|
||||
chosenColors.add(ObjectColor.RED);
|
||||
} else if (choiceColor.getColor().isGreen()) {
|
||||
chosenColors.add(ObjectColor.GREEN);
|
||||
} else if (choiceColor.getColor().isWhite()) {
|
||||
chosenColors.add(ObjectColor.WHITE);
|
||||
}
|
||||
}
|
||||
for (ObjectColor color : chosenColors) {
|
||||
ContinuousEffect effect = new BecomesColorTargetEffect(color, Duration.EndOfTurn, "is " + color);
|
||||
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeColorOrColorsTargetEffect copy() {
|
||||
return new ChangeColorOrColorsTargetEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class ThirstforKnowledgeEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (you != null) {
|
||||
you.discard(2, source, game);
|
||||
you.discard(2, false, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -27,28 +27,17 @@
|
|||
*/
|
||||
package mage.sets.shadowmoor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continious.BecomesColorTargetEffect;
|
||||
import mage.abilities.effects.common.continious.BecomesColorOrColorsTargetEffect;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -62,7 +51,6 @@ public class PrismwakeMerrow extends CardImpl {
|
|||
this.subtype.add("Merfolk");
|
||||
this.subtype.add("Wizard");
|
||||
|
||||
this.color.setBlue(true);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
|
|
@ -70,7 +58,7 @@ public class PrismwakeMerrow extends CardImpl {
|
|||
this.addAbility(FlashAbility.getInstance());
|
||||
|
||||
// When Prismwake Merrow enters the battlefield, target permanent becomes the color or colors of your choice until end of turn.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ChangeColorOrColorsTargetEffect(), false);
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new BecomesColorOrColorsTargetEffect(Duration.EndOfTurn), false);
|
||||
ability.addTarget(new TargetPermanent());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
@ -85,58 +73,3 @@ public class PrismwakeMerrow extends CardImpl {
|
|||
return new PrismwakeMerrow(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ChangeColorOrColorsTargetEffect extends OneShotEffect {
|
||||
|
||||
public ChangeColorOrColorsTargetEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "target permanent becomes the color or colors of your choice until end of turn";
|
||||
}
|
||||
|
||||
public ChangeColorOrColorsTargetEffect(final ChangeColorOrColorsTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Permanent target = game.getPermanent(source.getFirstTarget());
|
||||
List<ObjectColor> chosenColors = new ArrayList<>();
|
||||
if (you != null && target != null) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (!you.chooseUse(Outcome.Neutral, "Do you wish to choose another color?", game)) {
|
||||
break;
|
||||
}
|
||||
ChoiceColor choiceColor = new ChoiceColor();
|
||||
you.choose(Outcome.Benefit, choiceColor, game);
|
||||
if (!you.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
game.informPlayers(target.getName() + ": " + you.getName() + " has chosen " + choiceColor.getChoice());
|
||||
if (choiceColor.getColor().isBlack()) {
|
||||
chosenColors.add(ObjectColor.BLACK);
|
||||
} else if (choiceColor.getColor().isBlue()) {
|
||||
chosenColors.add(ObjectColor.BLUE);
|
||||
} else if (choiceColor.getColor().isRed()) {
|
||||
chosenColors.add(ObjectColor.RED);
|
||||
} else if (choiceColor.getColor().isGreen()) {
|
||||
chosenColors.add(ObjectColor.GREEN);
|
||||
} else if (choiceColor.getColor().isWhite()) {
|
||||
chosenColors.add(ObjectColor.WHITE);
|
||||
}
|
||||
}
|
||||
for (ObjectColor color : chosenColors) {
|
||||
ContinuousEffect effect = new BecomesColorTargetEffect(color, Duration.EndOfTurn, "is " + color);
|
||||
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeColorOrColorsTargetEffect copy() {
|
||||
return new ChangeColorOrColorsTargetEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,26 +29,17 @@ package mage.sets.shadowmoor;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.mana.AnyColorManaAbility;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continious.BecomesColorTargetEffect;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.abilities.effects.common.continious.BecomesColorOrColorsTargetEffect;
|
||||
import mage.abilities.mana.AnyColorManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -63,10 +54,11 @@ public class Scuttlemutt extends CardImpl {
|
|||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// {tap}: Add one mana of any color to your mana pool.
|
||||
// {T}: Add one mana of any color to your mana pool.
|
||||
this.addAbility(new AnyColorManaAbility());
|
||||
// {tap}: Target creature becomes the color or colors of your choice until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ChangeColorsTargetEffect(), new TapSourceCost());
|
||||
|
||||
// {T}: Target creature becomes the color or colors of your choice until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorOrColorsTargetEffect(Duration.EndOfTurn), new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
@ -80,64 +72,3 @@ public class Scuttlemutt extends CardImpl {
|
|||
return new Scuttlemutt(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ChangeColorsTargetEffect extends OneShotEffect {
|
||||
|
||||
public ChangeColorsTargetEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "target creature becomes the color or colors of your choice until end of turn";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Permanent target = game.getPermanent(source.getFirstTarget());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (you != null && target != null) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (!you.chooseUse(Outcome.Neutral, "Do you wish to choose another color?", game)) {
|
||||
break;
|
||||
}
|
||||
ChoiceColor choiceColor = new ChoiceColor();
|
||||
you.choose(Outcome.Benefit, choiceColor, game);
|
||||
if (!you.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
game.informPlayers(target.getName() + ": " + you.getName() + " has chosen " + choiceColor.getChoice());
|
||||
if (choiceColor.getColor().isBlack()) {
|
||||
sb.append("B");
|
||||
} else if (choiceColor.getColor().isBlue()) {
|
||||
sb.append("U");
|
||||
} else if (choiceColor.getColor().isRed()) {
|
||||
sb.append("R");
|
||||
} else if (choiceColor.getColor().isGreen()) {
|
||||
sb.append("G");
|
||||
} else if (choiceColor.getColor().isWhite()) {
|
||||
sb.append("W");
|
||||
}
|
||||
}
|
||||
String colors = new String(sb);
|
||||
ObjectColor chosenColors = new ObjectColor(colors);
|
||||
|
||||
|
||||
ContinuousEffect effect = new BecomesColorTargetEffect(chosenColors, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
|
||||
game.addEffect(effect, source);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ChangeColorsTargetEffect(final ChangeColorsTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeColorsTargetEffect copy() {
|
||||
return new ChangeColorsTargetEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue