mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[ECL] Implement Winnowing
This commit is contained in:
parent
c14c10a2e4
commit
3e1283268c
2 changed files with 106 additions and 0 deletions
102
Mage.Sets/src/mage/cards/w/Winnowing.java
Normal file
102
Mage.Sets/src/mage/cards/w/Winnowing.java
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
package mage.cards.w;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.ConvokeAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.SharesCreatureTypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.filter.predicate.permanent.PermanentIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class Winnowing extends CardImpl {
|
||||
|
||||
public Winnowing(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{W}{W}");
|
||||
|
||||
// Convoke
|
||||
this.addAbility(new ConvokeAbility());
|
||||
|
||||
// For each player, you choose a creature that player controls. Then each player sacrifices all other creatures they control that don't share a creature type with the chosen creature they control.
|
||||
this.getSpellAbility().addEffect(new WinnowingEffect());
|
||||
}
|
||||
|
||||
private Winnowing(final Winnowing card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Winnowing copy() {
|
||||
return new Winnowing(this);
|
||||
}
|
||||
}
|
||||
|
||||
class WinnowingEffect extends OneShotEffect {
|
||||
|
||||
WinnowingEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "for each player, you choose a creature that player controls. " +
|
||||
"Then each player sacrifices all other creatures they control " +
|
||||
"that don't share a creature type with the chosen creature they control";
|
||||
}
|
||||
|
||||
private WinnowingEffect(final WinnowingEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WinnowingEffect copy() {
|
||||
return new WinnowingEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Set<Permanent> permanents = new HashSet<>();
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
FilterPermanent filter = new FilterCreaturePermanent("creature controlled by " + player.getName());
|
||||
filter.add(new ControllerIdPredicate(playerId));
|
||||
if (!game.getBattlefield().contains(filter, source, game, 1)) {
|
||||
continue;
|
||||
}
|
||||
TargetPermanent target = new TargetPermanent(filter);
|
||||
target.withNotTarget(true);
|
||||
controller.choose(outcome, target, source, game);
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent == null) {
|
||||
continue;
|
||||
}
|
||||
game.informPlayers(controller.getLogName() + " chooses " + permanent.getLogName() + " controlled by " + player.getLogName());
|
||||
filter.add(Predicates.not(new PermanentIdPredicate(permanent.getId())));
|
||||
filter.add(Predicates.not(new SharesCreatureTypePredicate(permanent)));
|
||||
permanents.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game));
|
||||
}
|
||||
for (Permanent permanent : permanents) {
|
||||
permanent.sacrifice(source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -360,6 +360,10 @@ public final class LorwynEclipsed extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Warren Torchmaster", 163, Rarity.UNCOMMON, mage.cards.w.WarrenTorchmaster.class));
|
||||
cards.add(new SetCardInfo("Wary Farmer", 251, Rarity.COMMON, mage.cards.w.WaryFarmer.class));
|
||||
cards.add(new SetCardInfo("Wild Unraveling", 84, Rarity.COMMON, mage.cards.w.WildUnraveling.class));
|
||||
cards.add(new SetCardInfo("Winnowing", 355, Rarity.RARE, mage.cards.w.Winnowing.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Winnowing", 382, Rarity.MYTHIC, mage.cards.w.Winnowing.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Winnowing", 392, Rarity.MYTHIC, mage.cards.w.Winnowing.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Winnowing", 43, Rarity.RARE, mage.cards.w.Winnowing.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Wistfulness", 252, Rarity.MYTHIC, mage.cards.w.Wistfulness.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Wistfulness", 296, Rarity.MYTHIC, mage.cards.w.Wistfulness.class, NON_FULL_USE_VARIOUS));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue