forked from External/mage
Most obvious bugs ironed out. Ready for PR.
This commit is contained in:
parent
d5415d2d04
commit
d33f8a636e
19 changed files with 415 additions and 101 deletions
|
|
@ -38,6 +38,7 @@ import mage.abilities.costs.mana.ManaCost;
|
|||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.keyword.ChangelingAbility;
|
||||
import mage.abilities.mana.ManaAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
|
@ -176,7 +177,48 @@ public abstract class MageObjectImpl implements MageObject {
|
|||
|
||||
@Override
|
||||
public ObjectColor getFrameColor(Game game) {
|
||||
return frameColor;
|
||||
// For lands, add any colors of mana the land can produce to
|
||||
// its frame colors.
|
||||
if (getCardType().contains(CardType.LAND)) {
|
||||
ObjectColor cl = frameColor.copy();
|
||||
for (Ability ab: getAbilities()) {
|
||||
if (ab instanceof ManaAbility) {
|
||||
ManaAbility mana = (ManaAbility)ab;
|
||||
try {
|
||||
List<Mana> manaAdded = mana.getNetMana(game);
|
||||
for (Mana m: manaAdded) {
|
||||
if (m.getAny() > 0) {
|
||||
return new ObjectColor("WUBRG");
|
||||
}
|
||||
if (m.getWhite() > 0) {
|
||||
cl.setWhite(true);
|
||||
}
|
||||
if (m.getBlue() > 0) {
|
||||
cl.setBlue(true);
|
||||
}
|
||||
if (m.getBlack() > 0) {
|
||||
cl.setBlack(true);
|
||||
}
|
||||
if (m.getRed() > 0) {
|
||||
cl.setRed(true);
|
||||
}
|
||||
if (m.getGreen() > 0) {
|
||||
cl.setGreen(true);
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
// Ability depends on game
|
||||
// but no game passed
|
||||
// All such abilities are 5-color ones
|
||||
return new ObjectColor("WUBRG");
|
||||
}
|
||||
}
|
||||
}
|
||||
return cl;
|
||||
} else {
|
||||
// For everything else, just return the frame colors
|
||||
return frameColor;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue