[M20] fixed Flood of Tears

This commit is contained in:
Oleg Agafonov 2019-06-30 11:20:35 +04:00
parent d074846386
commit f264ac5032

View file

@ -27,7 +27,8 @@ public final class FloodOfTears extends CardImpl {
public FloodOfTears(UUID ownerId, CardSetInfo setInfo) { public FloodOfTears(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}{U}"); 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. // 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()); this.getSpellAbility().addEffect(new FloodOfTearsEffect());
} }
@ -45,7 +46,8 @@ class FloodOfTearsEffect extends OneShotEffect {
FloodOfTearsEffect() { FloodOfTearsEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = ""; staticText = "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.";
} }
private FloodOfTearsEffect(final FloodOfTearsEffect effect) { private FloodOfTearsEffect(final FloodOfTearsEffect effect) {
@ -67,12 +69,18 @@ class FloodOfTearsEffect extends OneShotEffect {
StaticFilters.FILTER_PERMANENT_NON_LAND, source.getControllerId(), source.getSourceId(), game StaticFilters.FILTER_PERMANENT_NON_LAND, source.getControllerId(), source.getSourceId(), game
); );
Cards cards = new CardsImpl(); Cards cards = new CardsImpl();
if (cards.size() > 0) {
nonlands.stream().forEach(permanent -> cards.add(permanent)); nonlands.stream().forEach(permanent -> cards.add(permanent));
boolean putIntoPlay = nonlands.stream().filter(permanent -> !(permanent instanceof Token)).count() > 3; boolean putIntoPlay = nonlands.stream()
.filter(permanent -> permanent.isControlledBy(player.getId()))
.filter(permanent -> !(permanent instanceof Token))
.count() > 3;
player.moveCards(cards, Zone.HAND, source, game); player.moveCards(cards, Zone.HAND, source, game);
if (putIntoPlay) { if (putIntoPlay) {
return new PutCardFromHandOntoBattlefieldEffect().apply(game, source); new PutCardFromHandOntoBattlefieldEffect().apply(game, source);
} }
return true; return true;
} }
return false;
}
} }