mirror of
https://github.com/correl/mage.git
synced 2025-01-12 11:08:01 +00:00
[ZNR] Implemented Yasharn, Implacable Earth
This commit is contained in:
parent
b7fd186dff
commit
b5f537e3c7
3 changed files with 182 additions and 5 deletions
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -22,6 +21,8 @@ import mage.filter.predicate.mageobject.ColorPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
|
@ -46,8 +47,9 @@ public final class AngelOfJubilation extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filterNonBlack, true)));
|
||||
|
||||
// Players can't pay life or sacrifice creatures to cast spells or activate abilities.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AngelOfJubilationEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AngelOfJubilationSacrificeFilterEffect()));
|
||||
Ability ability = new SimpleStaticAbility(new AngelOfJubilationEffect());
|
||||
ability.addEffect(new AngelOfJubilationSacrificeFilterEffect());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public AngelOfJubilation(final AngelOfJubilation card) {
|
||||
|
@ -64,7 +66,7 @@ class AngelOfJubilationEffect extends ContinuousEffectImpl {
|
|||
|
||||
public AngelOfJubilationEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.PlayerEffects, SubLayer.NA, Outcome.Detriment);
|
||||
staticText = "Players can't pay life or sacrifice creatures to cast spells or activate abilities";
|
||||
staticText = "Players can't pay life or sacrifice creatures to cast spells";
|
||||
}
|
||||
|
||||
public AngelOfJubilationEffect(final AngelOfJubilationEffect effect) {
|
||||
|
@ -91,7 +93,7 @@ class AngelOfJubilationSacrificeFilterEffect extends CostModificationEffectImpl
|
|||
|
||||
public AngelOfJubilationSacrificeFilterEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.SET_COST);
|
||||
staticText = "Players can't pay life or sacrifice creatures to cast spells or activate abilities";
|
||||
staticText = "or activate abilities";
|
||||
}
|
||||
|
||||
protected AngelOfJubilationSacrificeFilterEffect(AngelOfJubilationSacrificeFilterEffect effect) {
|
||||
|
|
174
Mage.Sets/src/mage/cards/y/YasharnImplacableEarth.java
Normal file
174
Mage.Sets/src/mage/cards/y/YasharnImplacableEarth.java
Normal file
|
@ -0,0 +1,174 @@
|
|||
package mage.cards.y;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class YasharnImplacableEarth extends CardImpl {
|
||||
|
||||
public YasharnImplacableEarth(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{W}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
this.subtype.add(SubType.BOAR);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// When Yasharn, Implacable Earth enters the battlefield, search your library for a basic Forest card and a basic Plains card, reveal those cards, put them into your hand, then shuffle your library.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(
|
||||
new SearchLibraryPutInHandEffect(new YasharnImplacableEarthTarget())
|
||||
.setText("search your library for a basic Forest card and a basic Plains card, " +
|
||||
"reveal those cards, put them into your hand, then shuffle your library")
|
||||
));
|
||||
|
||||
// Players can't pay life or sacrifice nonland permanents to cast spells or activate abilities.
|
||||
Ability ability = new SimpleStaticAbility(new YasharnImplacableEarthEffect());
|
||||
ability.addEffect(new YasharnImplacableEarthSacrificeFilterEffect());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private YasharnImplacableEarth(final YasharnImplacableEarth card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public YasharnImplacableEarth copy() {
|
||||
return new YasharnImplacableEarth(this);
|
||||
}
|
||||
}
|
||||
|
||||
class YasharnImplacableEarthTarget extends TargetCardInLibrary {
|
||||
|
||||
private static final FilterCard filter
|
||||
= new FilterCard("a basic Forest card and a basic Plains card");
|
||||
|
||||
static {
|
||||
filter.add(SuperType.BASIC.getPredicate());
|
||||
filter.add(Predicates.or(
|
||||
SubType.FOREST.getPredicate(),
|
||||
SubType.PLAINS.getPredicate()
|
||||
));
|
||||
}
|
||||
|
||||
YasharnImplacableEarthTarget() {
|
||||
super(0, 2, filter);
|
||||
}
|
||||
|
||||
private YasharnImplacableEarthTarget(final YasharnImplacableEarthTarget target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public YasharnImplacableEarthTarget copy() {
|
||||
return new YasharnImplacableEarthTarget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceId, UUID playerId, Game game) {
|
||||
Set<UUID> possibleTargets = super.possibleTargets(sourceId, playerId, game);
|
||||
Set<SubType> subTypes = this.getTargets()
|
||||
.stream()
|
||||
.map(game::getCard)
|
||||
.map(card -> card.getSubtype(game))
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toSet());
|
||||
subTypes.removeIf(subType -> subType != SubType.FOREST && subType != SubType.PLAINS);
|
||||
possibleTargets.removeIf(uuid -> {
|
||||
Card card = game.getCard(uuid);
|
||||
return card != null && subTypes.stream().noneMatch(subType -> card.hasSubtype(subType, game));
|
||||
});
|
||||
return possibleTargets;
|
||||
}
|
||||
}
|
||||
|
||||
class YasharnImplacableEarthEffect extends ContinuousEffectImpl {
|
||||
|
||||
public YasharnImplacableEarthEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.PlayerEffects, SubLayer.NA, Outcome.Detriment);
|
||||
staticText = "Players can't pay life or sacrifice creatures to cast spells";
|
||||
}
|
||||
|
||||
public YasharnImplacableEarthEffect(final YasharnImplacableEarthEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public YasharnImplacableEarthEffect copy() {
|
||||
return new YasharnImplacableEarthEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
player.setCanPayLifeCost(false);
|
||||
player.setCanPaySacrificeCostFilter(new FilterCreaturePermanent());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class YasharnImplacableEarthSacrificeFilterEffect extends CostModificationEffectImpl {
|
||||
|
||||
public YasharnImplacableEarthSacrificeFilterEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.SET_COST);
|
||||
staticText = "or activate abilities";
|
||||
}
|
||||
|
||||
protected YasharnImplacableEarthSacrificeFilterEffect(YasharnImplacableEarthSacrificeFilterEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
for (Cost cost : abilityToModify.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost) {
|
||||
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
|
||||
Filter filter = sacrificeCost.getTargets().get(0).getFilter();
|
||||
filter.add(Predicates.not(CardType.CREATURE.getPredicate()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
|
||||
return (abilityToModify.getAbilityType() == AbilityType.ACTIVATED
|
||||
|| abilityToModify instanceof SpellAbility)
|
||||
&& game.getState().getPlayersInRange(source.getControllerId(), game).contains(abilityToModify.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public YasharnImplacableEarthSacrificeFilterEffect copy() {
|
||||
return new YasharnImplacableEarthSacrificeFilterEffect(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -353,6 +353,7 @@ public final class ZendikarRising extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Vastwood Thicket", 216, Rarity.UNCOMMON, mage.cards.v.VastwoodThicket.class));
|
||||
cards.add(new SetCardInfo("Veteran Adventurer", 218, Rarity.UNCOMMON, mage.cards.v.VeteranAdventurer.class));
|
||||
cards.add(new SetCardInfo("Windrider Wizard", 87, Rarity.UNCOMMON, mage.cards.w.WindriderWizard.class));
|
||||
cards.add(new SetCardInfo("Yasharn, Implacable Earth", 240, Rarity.RARE, mage.cards.y.YasharnImplacableEarth.class));
|
||||
cards.add(new SetCardInfo("Zof Bloodbog", 132, Rarity.UNCOMMON, mage.cards.z.ZofBloodbog.class));
|
||||
cards.add(new SetCardInfo("Zof Consumption", 132, Rarity.UNCOMMON, mage.cards.z.ZofConsumption.class));
|
||||
cards.add(new SetCardInfo("Zulaport Duelist", 88, Rarity.COMMON, mage.cards.z.ZulaportDuelist.class));
|
||||
|
|
Loading…
Reference in a new issue