mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
[C21] Implemented Oversimplify
This commit is contained in:
parent
689efae076
commit
12cb2caecd
2 changed files with 99 additions and 0 deletions
98
Mage.Sets/src/mage/cards/o/Oversimplify.java
Normal file
98
Mage.Sets/src/mage/cards/o/Oversimplify.java
Normal file
|
@ -0,0 +1,98 @@
|
|||
package mage.cards.o;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
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.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Controllable;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.QuandrixToken;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class Oversimplify extends CardImpl {
|
||||
|
||||
public Oversimplify(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}{U}");
|
||||
|
||||
// Exile all creatures. Each player creates a 0/0 green and blue Fractal creature token and puts a number of +1/+1 counters on it equal to the total power of creatures they controlled that were exiled this way.
|
||||
this.getSpellAbility().addEffect(new OversimplifyEffect());
|
||||
}
|
||||
|
||||
private Oversimplify(final Oversimplify card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Oversimplify copy() {
|
||||
return new Oversimplify(this);
|
||||
}
|
||||
}
|
||||
|
||||
class OversimplifyEffect extends OneShotEffect {
|
||||
|
||||
OversimplifyEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "exile all creatures. Each player creates a 0/0 green and blue Fractal creature token " +
|
||||
"and puts a number of +1/+1 counters on it equal to " +
|
||||
"the total power of creatures they controlled that were exiled this way";
|
||||
}
|
||||
|
||||
private OversimplifyEffect(final OversimplifyEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OversimplifyEffect copy() {
|
||||
return new OversimplifyEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE,
|
||||
source.getControllerId(), source.getSourceId(), game
|
||||
);
|
||||
Map<UUID, Integer> playerMap = permanents
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toMap(
|
||||
Controllable::getControllerId,
|
||||
p -> p.getPower().getValue(),
|
||||
Integer::sum
|
||||
));
|
||||
controller.moveCards(new CardsImpl(permanents), Zone.EXILED, source, game);
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Token token = new QuandrixToken();
|
||||
token.putOntoBattlefield(1, game, source, playerId);
|
||||
int counter = playerMap.getOrDefault(playerId, 0);
|
||||
for (UUID tokenId : token.getLastAddedTokenIds()) {
|
||||
Permanent permanent = game.getPermanent(tokenId);
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(counter), playerId, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -60,6 +60,7 @@ public final class Commander2021Edition extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Mind Stone", 251, Rarity.COMMON, mage.cards.m.MindStone.class));
|
||||
cards.add(new SetCardInfo("Monologue Tax", 19, Rarity.RARE, mage.cards.m.MonologueTax.class));
|
||||
cards.add(new SetCardInfo("Myr Battlesphere", 253, Rarity.RARE, mage.cards.m.MyrBattlesphere.class));
|
||||
cards.add(new SetCardInfo("Oversimplify", 72, Rarity.RARE, mage.cards.o.Oversimplify.class));
|
||||
cards.add(new SetCardInfo("Paradox Zone", 64, Rarity.RARE, mage.cards.p.ParadoxZone.class));
|
||||
cards.add(new SetCardInfo("Phyrexia's Core", 309, Rarity.UNCOMMON, mage.cards.p.PhyrexiasCore.class));
|
||||
cards.add(new SetCardInfo("Pia Nalaar", 177, Rarity.RARE, mage.cards.p.PiaNalaar.class));
|
||||
|
|
Loading…
Reference in a new issue