use of mage.abilities.mana.ColorlessManaAbility in project mage by magefree.
the class ImprisonedInTheMoonEffect method apply.
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent enchantment = source.getSourcePermanentIfItStillExists(game);
if (enchantment == null || enchantment.getAttachedTo() == null) {
return false;
}
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
if (permanent == null) {
return false;
}
switch(layer) {
case TypeChangingEffects_4:
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
// So the ability removing has to be done before Layer 6
permanent.removeAllAbilities(source.getSourceId(), game);
permanent.removeAllCardTypes(game);
permanent.addCardType(game, CardType.LAND);
permanent.retainAllLandSubTypes(game);
break;
case ColorChangingEffects_5:
permanent.getColor(game).setWhite(false);
permanent.getColor(game).setBlue(false);
permanent.getColor(game).setBlack(false);
permanent.getColor(game).setRed(false);
permanent.getColor(game).setGreen(false);
break;
case AbilityAddingRemovingEffects_6:
permanent.removeAllAbilities(source.getSourceId(), game);
permanent.addAbility(new ColorlessManaAbility(), source.getSourceId(), game);
break;
}
return true;
}
use of mage.abilities.mana.ColorlessManaAbility in project mage by magefree.
the class ChangeLandAttachedEffect method apply.
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment == null) {
return false;
}
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
if (permanent == null) {
return true;
}
switch(layer) {
case TypeChangingEffects_4:
permanent.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
break;
case AbilityAddingRemovingEffects_6:
permanent.removeAllAbilities(source.getSourceId(), game);
permanent.addAbility(new ColorlessManaAbility(), source.getSourceId(), game);
Ability ability = new AnyColorManaAbility();
ability.addCost(new PayLifeCost(1));
permanent.addAbility(ability, source.getSourceId(), game);
break;
}
return true;
}
Aggregations