forked from External/mage
* no need to specify mana cost, just add cost * handle all mana costs through addcost method only * eliminate another constructor * more constructor cleanup
45 lines
1.5 KiB
Java
45 lines
1.5 KiB
Java
|
|
|
|
package mage.abilities.common;
|
|
|
|
import mage.abilities.ActivatedAbilityImpl;
|
|
import mage.abilities.costs.common.PayLifeCost;
|
|
import mage.abilities.costs.common.SacrificeSourceCost;
|
|
import mage.abilities.costs.common.TapSourceCost;
|
|
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
|
import mage.constants.SubType;
|
|
import mage.constants.Zone;
|
|
import mage.filter.FilterCard;
|
|
import mage.filter.predicate.Predicates;
|
|
import mage.target.common.TargetCardInLibrary;
|
|
|
|
/**
|
|
* @author BetaSteward_at_googlemail.com
|
|
*/
|
|
public class FetchLandActivatedAbility extends ActivatedAbilityImpl {
|
|
|
|
public FetchLandActivatedAbility(SubType subType1, SubType subType2) {
|
|
this(true, subType1, subType2);
|
|
}
|
|
|
|
public FetchLandActivatedAbility(boolean withDamage, SubType subType1, SubType subType2) {
|
|
super(Zone.BATTLEFIELD, null, new TapSourceCost());
|
|
if (withDamage) {
|
|
addCost(new PayLifeCost(1));
|
|
}
|
|
addCost(new SacrificeSourceCost());
|
|
FilterCard filter = new FilterCard(subType1.getDescription() + " or " + subType2.getDescription() + " card");
|
|
filter.add(Predicates.or(subType1.getPredicate(), subType2.getPredicate()));
|
|
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
|
addEffect(new SearchLibraryPutInPlayEffect(target, false));
|
|
}
|
|
|
|
private FetchLandActivatedAbility(FetchLandActivatedAbility ability) {
|
|
super(ability);
|
|
}
|
|
|
|
@Override
|
|
public FetchLandActivatedAbility copy() {
|
|
return new FetchLandActivatedAbility(this);
|
|
}
|
|
}
|