mirror of
https://github.com/correl/mage.git
synced 2025-02-18 03:00:15 +00:00
[MIC] Implemented Cleaver Skaab
This commit is contained in:
parent
3d0571d5e9
commit
affd33c23b
4 changed files with 107 additions and 1 deletions
95
Mage.Sets/src/mage/cards/c/CleaverSkaab.java
Normal file
95
Mage.Sets/src/mage/cards/c/CleaverSkaab.java
Normal file
|
@ -0,0 +1,95 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class CleaverSkaab extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter
|
||||
= new FilterControlledPermanent(SubType.ZOMBIE, "another Zombie");
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
public CleaverSkaab(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
|
||||
|
||||
this.subtype.add(SubType.ZOMBIE);
|
||||
this.subtype.add(SubType.HORROR);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// {3}, {T}, Sacrifice another Zombie: Create two tokens that are copies of the sacrificed creature.
|
||||
Ability ability = new SimpleActivatedAbility(new CleaverSkaabEffect(), new GenericManaCost(3));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeTargetCost(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private CleaverSkaab(final CleaverSkaab card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CleaverSkaab copy() {
|
||||
return new CleaverSkaab(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CleaverSkaabEffect extends OneShotEffect {
|
||||
|
||||
CleaverSkaabEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "create two tokens that are copies of the sacrificed creature";
|
||||
}
|
||||
|
||||
private CleaverSkaabEffect(final CleaverSkaabEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CleaverSkaabEffect copy() {
|
||||
return new CleaverSkaabEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = CardUtil.castStream(
|
||||
source.getCosts().stream(), SacrificeTargetCost.class
|
||||
)
|
||||
.map(SacrificeTargetCost::getPermanents)
|
||||
.flatMap(Collection::stream)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect();
|
||||
effect.setSavedPermanent(permanent);
|
||||
effect.setNumber(2);
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@ public final class MidnightHuntCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Choked Estuary", 169, Rarity.RARE, mage.cards.c.ChokedEstuary.class));
|
||||
cards.add(new SetCardInfo("Citadel Siege", 81, Rarity.RARE, mage.cards.c.CitadelSiege.class));
|
||||
cards.add(new SetCardInfo("Cleansing Nova", 82, Rarity.RARE, mage.cards.c.CleansingNova.class));
|
||||
cards.add(new SetCardInfo("Cleaver Skaab", 11, Rarity.RARE, mage.cards.c.CleaverSkaab.class));
|
||||
cards.add(new SetCardInfo("Command Tower", 170, Rarity.COMMON, mage.cards.c.CommandTower.class));
|
||||
cards.add(new SetCardInfo("Commander's Sphere", 159, Rarity.COMMON, mage.cards.c.CommandersSphere.class));
|
||||
cards.add(new SetCardInfo("Corpse Augur", 109, Rarity.UNCOMMON, mage.cards.c.CorpseAugur.class));
|
||||
|
|
|
@ -33,7 +33,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
private final UUID playerId;
|
||||
private final CardType additionalCardType;
|
||||
private boolean hasHaste;
|
||||
private final int number;
|
||||
private int number;
|
||||
private final List<Permanent> addedTokenPermanents;
|
||||
private SubType additionalSubType;
|
||||
private SubType onlySubType;
|
||||
|
@ -302,6 +302,10 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
this.startingLoyalty = startingLoyalty;
|
||||
}
|
||||
|
||||
public void setNumber(int number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public void exileTokensCreatedAtNextEndStep(Game game, Ability source) {
|
||||
for (Permanent tokenPermanent : addedTokenPermanents) {
|
||||
ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);
|
||||
|
|
|
@ -41,6 +41,7 @@ import java.net.URLEncoder;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
|
@ -1365,4 +1366,9 @@ public final class CardUtil {
|
|||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static <T> Stream<T> castStream(Stream<?> stream, Class<T> clazz) {
|
||||
return stream.filter(clazz::isInstance).map(clazz::cast);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue