* 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:
LevelX2 2016-10-21 00:15:41 +02:00
parent 72b23acf23
commit ee96531de5
5 changed files with 135 additions and 56 deletions

View file

@ -81,19 +81,20 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
red = color.red;
green = color.green;
}
/**
* Returns a new color which contains all of the colors of this ObjectColor
* in addition to all of the colors of the other ObjectColor.
*
* @param other The other ObjectColor to union with
* @return A new color which is the union of this and other
*/
public ObjectColor union(ObjectColor other) {
ObjectColor newColor = new ObjectColor();
newColor.white = white | other.white;
newColor.blue = blue | other.blue;
newColor.blue = blue | other.blue;
newColor.black = black | other.black;
newColor.red = red | other.red;
newColor.red = red | other.red;
newColor.green = green | other.green;
return newColor;
}
@ -146,6 +147,24 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
this.setWhite(color.isWhite());
}
public void addColor(ObjectColor color) {
if (color.isWhite()) {
setWhite(true);
}
if (color.isBlue()) {
setBlue(true);
}
if (color.isBlack()) {
setBlack(true);
}
if (color.isRed()) {
setRed(true);
}
if (color.isGreen()) {
setGreen(true);
}
}
public boolean isColorless() {
return !(hasColor());
}

View file

@ -277,6 +277,9 @@ public class Spell extends StackObjImpl implements Card {
}
} else {
updateOptionalCosts(0);
if (!getColor(game).equals(card.getColor(game))) { // if spell color was changed, the created permanent needs to be of that color
game.getState().getCreateCardAttribute(card).getColor().setColor(getColor(game));
}
return controller.moveCards(card, Zone.BATTLEFIELD, ability, game, false, faceDown, false, null);
}
}