mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 12:49:39 -08:00
* Fixed that a spell that becomes a permanent didn't had the colors of the spell (e.g. ERsatz Gnomes).
This commit is contained in:
parent
72b23acf23
commit
ee96531de5
5 changed files with 135 additions and 56 deletions
|
|
@ -49,17 +49,17 @@ import mage.target.TargetSpell;
|
|||
public class ErsatzGnomes extends CardImpl {
|
||||
|
||||
public ErsatzGnomes(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{3}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
|
||||
this.subtype.add("Gnome");
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// {tap}: Target spell becomes colorless.
|
||||
// {T}: Target spell becomes colorless.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorTargetEffect(new ObjectColor(), Duration.Custom), new TapSourceCost());
|
||||
ability.addTarget(new TargetSpell());
|
||||
this.addAbility(ability);
|
||||
|
||||
// {tap}: Target permanent becomes colorless until end of turn.
|
||||
// {T}: Target permanent becomes colorless until end of turn.
|
||||
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorTargetEffect(new ObjectColor(), Duration.EndOfTurn), new TapSourceCost());
|
||||
ability.addTarget(new TargetPermanent());
|
||||
this.addAbility(ability);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ import mage.sets.Commander;
|
|||
public class PaintersServant extends CardImpl {
|
||||
|
||||
public PaintersServant(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{2}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}");
|
||||
this.subtype.add("Scarecrow");
|
||||
|
||||
this.power = new MageInt(1);
|
||||
|
|
@ -97,24 +97,23 @@ class PaintersServantEffect extends ContinuousEffectImpl {
|
|||
if (color == null) {
|
||||
return false;
|
||||
}
|
||||
String colorString = color.toString();
|
||||
for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
|
||||
setObjectColor(perm, colorString, game);
|
||||
perm.getColor(game).addColor(color);
|
||||
}
|
||||
// Stack
|
||||
for (MageObject object : game.getStack()) {
|
||||
if (object instanceof Spell) {
|
||||
setObjectColor(object, colorString, game);
|
||||
object.getColor(game).addColor(color);
|
||||
}
|
||||
}
|
||||
// Exile
|
||||
for (Card card : game.getExile().getAllCards(game)) {
|
||||
setCardColor(card, colorString, game);
|
||||
game.getState().getCreateCardAttribute(card).getColor().addColor(color);
|
||||
}
|
||||
// Command
|
||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
if (commandObject instanceof Commander) {
|
||||
setObjectColor(commandObject, colorString, game);
|
||||
commandObject.getColor(game).addColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -123,15 +122,15 @@ class PaintersServantEffect extends ContinuousEffectImpl {
|
|||
if (player != null) {
|
||||
// Hand
|
||||
for (Card card : player.getHand().getCards(game)) {
|
||||
setCardColor(card, colorString, game);
|
||||
game.getState().getCreateCardAttribute(card).getColor().addColor(color);
|
||||
}
|
||||
// Library
|
||||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
setCardColor(card, colorString, game);
|
||||
game.getState().getCreateCardAttribute(card).getColor().addColor(color);
|
||||
}
|
||||
// Graveyard
|
||||
for (Card card : player.getGraveyard().getCards(game)) {
|
||||
setCardColor(card, colorString, game);
|
||||
game.getState().getCreateCardAttribute(card).getColor().addColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -140,47 +139,6 @@ class PaintersServantEffect extends ContinuousEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected static void setCardColor(Card card, String colorString, Game game) {
|
||||
ObjectColor color = game.getState().getCreateCardAttribute(card).getColor();
|
||||
switch (colorString) {
|
||||
case "W":
|
||||
color.setWhite(true);
|
||||
break;
|
||||
case "B":
|
||||
color.setBlack(true);
|
||||
break;
|
||||
case "U":
|
||||
color.setBlue(true);
|
||||
break;
|
||||
case "G":
|
||||
color.setGreen(true);
|
||||
break;
|
||||
case "R":
|
||||
color.setRed(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected static void setObjectColor(MageObject obj, String colorString, Game game) {
|
||||
switch (colorString) {
|
||||
case "W":
|
||||
obj.getColor(game).setWhite(true);
|
||||
break;
|
||||
case "B":
|
||||
obj.getColor(game).setBlack(true);
|
||||
break;
|
||||
case "U":
|
||||
obj.getColor(game).setBlue(true);
|
||||
break;
|
||||
case "G":
|
||||
obj.getColor(game).setGreen(true);
|
||||
break;
|
||||
case "R":
|
||||
obj.getColor(game).setRed(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaintersServantEffect copy() {
|
||||
return new PaintersServantEffect(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue