Merge pull request #640 from SkySpiral7/default_color

Default color
This commit is contained in:
LevelX2 2014-12-12 08:56:06 +01:00
commit 90cd79b81f

View file

@ -43,6 +43,7 @@ import mage.abilities.PlayLandAbility;
import mage.abilities.SpellAbility; import mage.abilities.SpellAbility;
import mage.abilities.mana.ManaAbility; import mage.abilities.mana.ManaAbility;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.SpellAbilityType; import mage.constants.SpellAbilityType;
import mage.constants.TimingRule; import mage.constants.TimingRule;
@ -103,6 +104,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
this.cardNumber = cardNumber; this.cardNumber = cardNumber;
this.cardType.addAll(Arrays.asList(cardTypes)); this.cardType.addAll(Arrays.asList(cardTypes));
this.manaCost.load(costs); this.manaCost.load(costs);
setDefaultColor();
if (cardType.contains(CardType.LAND)) { if (cardType.contains(CardType.LAND)) {
Ability ability = new PlayLandAbility(name); Ability ability = new PlayLandAbility(name);
ability.setSourceId(this.getId()); ability.setSourceId(this.getId());
@ -121,6 +123,14 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
this.morphCard = false; this.morphCard = false;
} }
private void setDefaultColor() {
this.color.setWhite(this.manaCost.containsColor(ColoredManaSymbol.W));
this.color.setBlue(this.manaCost.containsColor(ColoredManaSymbol.U));
this.color.setBlack(this.manaCost.containsColor(ColoredManaSymbol.B));
this.color.setRed(this.manaCost.containsColor(ColoredManaSymbol.R));
this.color.setGreen(this.manaCost.containsColor(ColoredManaSymbol.G));
}
protected CardImpl(UUID ownerId, String name) { protected CardImpl(UUID ownerId, String name) {
this.ownerId = ownerId; this.ownerId = ownerId;
this.name = name; this.name = name;