mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
[TDC] Implement Steward of the Harvest
This commit is contained in:
parent
bf3b662a00
commit
0420d00836
2 changed files with 114 additions and 0 deletions
112
Mage.Sets/src/mage/cards/s/StewardOfTheHarvest.java
Normal file
112
Mage.Sets/src/mage/cards/s/StewardOfTheHarvest.java
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ExileCardFromOwnGraveyardControllerEffect;
|
||||
import mage.abilities.effects.common.ExileTargetEffect;
|
||||
import mage.constants.*;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterLandCard;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jmlundeen
|
||||
*/
|
||||
public final class StewardOfTheHarvest extends CardImpl {
|
||||
|
||||
private static final FilterLandCard filter = new FilterLandCard("land cards from your graveyard");
|
||||
|
||||
public StewardOfTheHarvest(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.DRUID);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// When this creature enters, exile up to three target land cards from your graveyard.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect().setToSourceExileZone(true));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, 3, filter));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Creatures you control have all activated abilities of all land cards exiled with this creature.
|
||||
this.addAbility(new SimpleStaticAbility(new StewardOfTheHarvestEffect()));
|
||||
}
|
||||
|
||||
private StewardOfTheHarvest(final StewardOfTheHarvest card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StewardOfTheHarvest copy() {
|
||||
return new StewardOfTheHarvest(this);
|
||||
}
|
||||
}
|
||||
|
||||
class StewardOfTheHarvestEffect extends ContinuousEffectImpl {
|
||||
|
||||
List<Ability> abilities = new ArrayList<>();
|
||||
ExileZone lastZone;
|
||||
|
||||
public StewardOfTheHarvestEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
staticText = "Creatures you control have all activated abilities of all land cards exiled with this creature.";
|
||||
}
|
||||
|
||||
private StewardOfTheHarvestEffect(StewardOfTheHarvestEffect effect) {
|
||||
super(effect);
|
||||
this.abilities = effect.abilities;
|
||||
this.lastZone = effect.lastZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StewardOfTheHarvestEffect copy() {
|
||||
return new StewardOfTheHarvestEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), CardUtil.getActualSourceObjectZoneChangeCounter(game, source));
|
||||
ExileZone exile = game.getExile().getExileZone(exileId);
|
||||
if (exile != null) {
|
||||
lastZone = exile;
|
||||
if (abilities.isEmpty()) {
|
||||
exile.getCards(game).stream()
|
||||
.map(card -> card.getAbilities(game))
|
||||
.flatMap(List::stream)
|
||||
.filter(ability -> ability instanceof ActivatedAbility)
|
||||
.forEach(ability -> abilities.add(ability));
|
||||
}
|
||||
}
|
||||
else {
|
||||
abilities.clear();
|
||||
if (lastZone != null) {
|
||||
lastZone.getCards(game).forEach(card -> game.getExile().moveToMainExileZone(card, game));
|
||||
}
|
||||
}
|
||||
|
||||
List<Permanent> creatures = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_CREATURE, source.getControllerId(), source, game);
|
||||
for (Ability ability : abilities) {
|
||||
for (Permanent creature : creatures) {
|
||||
creature.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -302,6 +302,8 @@ public final class TarkirDragonstormCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Springbloom Druid", 271, Rarity.COMMON, mage.cards.s.SpringbloomDruid.class));
|
||||
cards.add(new SetCardInfo("Staff of Compleation", 326, Rarity.MYTHIC, mage.cards.s.StaffOfCompleation.class));
|
||||
cards.add(new SetCardInfo("Steel Hellkite", 327, Rarity.RARE, mage.cards.s.SteelHellkite.class));
|
||||
cards.add(new SetCardInfo("Steward of the Harvest", 48, Rarity.RARE, mage.cards.s.StewardOfTheHarvest.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Steward of the Harvest", 88, Rarity.RARE, mage.cards.s.StewardOfTheHarvest.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Stitcher's Supplier", 196, Rarity.UNCOMMON, mage.cards.s.StitchersSupplier.class));
|
||||
cards.add(new SetCardInfo("Storm's Wrath", 236, Rarity.RARE, mage.cards.s.StormsWrath.class));
|
||||
cards.add(new SetCardInfo("Storm-Kiln Artist", 235, Rarity.UNCOMMON, mage.cards.s.StormKilnArtist.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue