mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
[LTR] Implement Last March of the Ents
This commit is contained in:
parent
f247e08eac
commit
294ccedc45
3 changed files with 91 additions and 8 deletions
77
Mage.Sets/src/mage/cards/l/LastMarchOfTheEnts.java
Normal file
77
Mage.Sets/src/mage/cards/l/LastMarchOfTheEnts.java
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
package mage.cards.l;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.CantBeCounteredSourceAbility;
|
||||||
|
import mage.abilities.dynamicvalue.common.GreatestToughnessAmongControlledCreaturesValue;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.cards.CardsImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetCard;
|
||||||
|
import mage.target.common.TargetCardInHand;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class LastMarchOfTheEnts extends CardImpl {
|
||||||
|
|
||||||
|
public LastMarchOfTheEnts(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{6}{G}{G}");
|
||||||
|
|
||||||
|
// This spell can't be countered.
|
||||||
|
this.addAbility(new CantBeCounteredSourceAbility());
|
||||||
|
|
||||||
|
// Draw cards equal to the greatest toughness among creatures you control, then put any number of creature cards from your hand onto the battlefield.
|
||||||
|
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(
|
||||||
|
GreatestToughnessAmongControlledCreaturesValue.instance
|
||||||
|
).setText("draw cards equal to the greatest toughness among creatures you control"));
|
||||||
|
this.getSpellAbility().addEffect(new LastMarchOfTheEntsEffect());
|
||||||
|
}
|
||||||
|
|
||||||
|
private LastMarchOfTheEnts(final LastMarchOfTheEnts card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LastMarchOfTheEnts copy() {
|
||||||
|
return new LastMarchOfTheEnts(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LastMarchOfTheEntsEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
LastMarchOfTheEntsEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = ", then put any number of creature cards from your hand onto the battlefield";
|
||||||
|
}
|
||||||
|
|
||||||
|
private LastMarchOfTheEntsEffect(final LastMarchOfTheEntsEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LastMarchOfTheEntsEffect copy() {
|
||||||
|
return new LastMarchOfTheEntsEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
if (player == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
TargetCard target = new TargetCardInHand(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_CREATURES);
|
||||||
|
player.choose(outcome, player.getHand(), target, source, game);
|
||||||
|
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -60,6 +60,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Island", 264, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Island", 264, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Knight of the Keep", 291, Rarity.COMMON, mage.cards.k.KnightOfTheKeep.class));
|
cards.add(new SetCardInfo("Knight of the Keep", 291, Rarity.COMMON, mage.cards.k.KnightOfTheKeep.class));
|
||||||
cards.add(new SetCardInfo("Knights of Dol Amroth", 59, Rarity.COMMON, mage.cards.k.KnightsOfDolAmroth.class));
|
cards.add(new SetCardInfo("Knights of Dol Amroth", 59, Rarity.COMMON, mage.cards.k.KnightsOfDolAmroth.class));
|
||||||
|
cards.add(new SetCardInfo("Last March of the Ents", 172, Rarity.MYTHIC, mage.cards.l.LastMarchOfTheEnts.class));
|
||||||
cards.add(new SetCardInfo("Lobelia Sackville-Baggins", 93, Rarity.RARE, mage.cards.l.LobeliaSackvilleBaggins.class));
|
cards.add(new SetCardInfo("Lobelia Sackville-Baggins", 93, Rarity.RARE, mage.cards.l.LobeliaSackvilleBaggins.class));
|
||||||
cards.add(new SetCardInfo("Long List of the Ents", 174, Rarity.UNCOMMON, mage.cards.l.LongListOfTheEnts.class));
|
cards.add(new SetCardInfo("Long List of the Ents", 174, Rarity.UNCOMMON, mage.cards.l.LongListOfTheEnts.class));
|
||||||
cards.add(new SetCardInfo("Lotho, Corrupt Shirriff", 213, Rarity.RARE, mage.cards.l.LothoCorruptShirriff.class));
|
cards.add(new SetCardInfo("Lotho, Corrupt Shirriff", 213, Rarity.RARE, mage.cards.l.LothoCorruptShirriff.class));
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
|
|
||||||
package mage.abilities.dynamicvalue.common;
|
package mage.abilities.dynamicvalue.common;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -16,13 +17,17 @@ public enum GreatestToughnessAmongControlledCreaturesValue implements DynamicVal
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
int amount = 0;
|
return game
|
||||||
for (Permanent p : game.getBattlefield().getActivePermanents(
|
.getBattlefield()
|
||||||
StaticFilters.FILTER_CONTROLLED_CREATURE, sourceAbility.getControllerId(), game
|
.getActivePermanents(
|
||||||
)) {
|
StaticFilters.FILTER_CONTROLLED_CREATURE,
|
||||||
amount = Math.max(p.getToughness().getValue(), amount);
|
sourceAbility.getControllerId(), game
|
||||||
}
|
)
|
||||||
return amount;
|
.stream()
|
||||||
|
.map(MageObject::getToughness)
|
||||||
|
.mapToInt(MageInt::getValue)
|
||||||
|
.max()
|
||||||
|
.orElse(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue