Search in sources :

Example 1 with ColorlessManaAbility

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;
}
Also used : FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) ColorlessManaAbility(mage.abilities.mana.ColorlessManaAbility)

Example 2 with ColorlessManaAbility

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;
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) EnchantAbility(mage.abilities.keyword.EnchantAbility) AnyColorManaAbility(mage.abilities.mana.AnyColorManaAbility) ColorlessManaAbility(mage.abilities.mana.ColorlessManaAbility) Ability(mage.abilities.Ability) TargetLandPermanent(mage.target.common.TargetLandPermanent) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) AnyColorManaAbility(mage.abilities.mana.AnyColorManaAbility) ColorlessManaAbility(mage.abilities.mana.ColorlessManaAbility) PayLifeCost(mage.abilities.costs.common.PayLifeCost)

Aggregations

ColorlessManaAbility (mage.abilities.mana.ColorlessManaAbility)2 Permanent (mage.game.permanent.Permanent)2 TargetPermanent (mage.target.TargetPermanent)2 Ability (mage.abilities.Ability)1 EntersBattlefieldTriggeredAbility (mage.abilities.common.EntersBattlefieldTriggeredAbility)1 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)1 PayLifeCost (mage.abilities.costs.common.PayLifeCost)1 EnchantAbility (mage.abilities.keyword.EnchantAbility)1 AnyColorManaAbility (mage.abilities.mana.AnyColorManaAbility)1 FilterPermanent (mage.filter.FilterPermanent)1 TargetLandPermanent (mage.target.common.TargetLandPermanent)1