Implemented Flood of Tears

This commit is contained in:
Evan Kranzler 2019-06-18 10:21:59 -04:00
parent a631fc3d9b
commit 1a5138d972
2 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,78 @@
package mage.cards.f;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
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.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.players.Player;
import java.util.List;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class FloodOfTears extends CardImpl {
public FloodOfTears(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}{U}");
// Return all nonland permanents to their owners' hands. If you return four or more nontoken permanents you control this way, you may put a permanent card from your hand onto the battlefield.
this.getSpellAbility().addEffect(new FloodOfTearsEffect());
}
private FloodOfTears(final FloodOfTears card) {
super(card);
}
@Override
public FloodOfTears copy() {
return new FloodOfTears(this);
}
}
class FloodOfTearsEffect extends OneShotEffect {
FloodOfTearsEffect() {
super(Outcome.Benefit);
staticText = "";
}
private FloodOfTearsEffect(final FloodOfTearsEffect effect) {
super(effect);
}
@Override
public FloodOfTearsEffect copy() {
return new FloodOfTearsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
List<Permanent> nonlands = game.getBattlefield().getActivePermanents(
StaticFilters.FILTER_PERMANENT_NON_LAND, source.getControllerId(), source.getSourceId(), game
);
Cards cards = new CardsImpl();
nonlands.stream().forEach(permanent -> cards.add(permanent));
boolean putIntoPlay = nonlands.stream().filter(permanent -> !(permanent instanceof Token)).count() > 3;
player.moveCards(cards, Zone.HAND, source, game);
if (putIntoPlay) {
return new PutCardFromHandOntoBattlefieldEffect().apply(game, source);
}
return true;
}
}

View file

@ -44,6 +44,7 @@ public final class CoreSet2020 extends ExpansionSet {
cards.add(new SetCardInfo("Ember Hauler", 137, Rarity.UNCOMMON, mage.cards.e.EmberHauler.class));
cards.add(new SetCardInfo("Empyrean Eagle", 208, Rarity.UNCOMMON, mage.cards.e.EmpyreanEagle.class));
cards.add(new SetCardInfo("Flame Sweep", 139, Rarity.UNCOMMON, mage.cards.f.FlameSweep.class));
cards.add(new SetCardInfo("Flood of Tears", 59, Rarity.RARE, mage.cards.f.FloodOfTears.class));
cards.add(new SetCardInfo("Goblin Ringleader", 141, Rarity.UNCOMMON, mage.cards.g.GoblinRingleader.class));
cards.add(new SetCardInfo("Infuriate", 145, Rarity.COMMON, mage.cards.i.Infuriate.class));
cards.add(new SetCardInfo("Ironroot Warlord", 209, Rarity.UNCOMMON, mage.cards.i.IronrootWarlord.class));