forked from External/mage
Implemented Carrion Grub
This commit is contained in:
parent
d0de282d2d
commit
c4283cd591
3 changed files with 91 additions and 10 deletions
89
Mage.Sets/src/mage/cards/c/CarrionGrub.java
Normal file
89
Mage.Sets/src/mage/cards/c/CarrionGrub.java
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class CarrionGrub extends CardImpl {
|
||||
|
||||
public CarrionGrub(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
|
||||
|
||||
this.subtype.add(SubType.INSECT);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
// Carrion Grub gets +X/+0, where X is the greatest power among creature cards in your graveyard.
|
||||
this.addAbility(new SimpleStaticAbility(new BoostSourceEffect(
|
||||
CarrionGrubValue.instance, StaticValue.get(0), Duration.WhileOnBattlefield
|
||||
)));
|
||||
|
||||
// When Carrion Grub enters the battlefield, mill four cards.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new PutTopCardOfLibraryIntoGraveControllerEffect(4)));
|
||||
}
|
||||
|
||||
private CarrionGrub(final CarrionGrub card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarrionGrub copy() {
|
||||
return new CarrionGrub(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum CarrionGrubValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Player player = game.getPlayer(sourceAbility.getControllerId());
|
||||
if (player == null) {
|
||||
return 0;
|
||||
}
|
||||
return player.getGraveyard()
|
||||
.getCards(game)
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(MageObject::isCreature)
|
||||
.map(MageObject::getPower)
|
||||
.mapToInt(MageInt::getValue)
|
||||
.max()
|
||||
.orElse(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarrionGrubValue copy() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "the greatest power among creature cards in your graveyard";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
|
|
@ -39,6 +39,7 @@ public final class CoreSet2021 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Baneslayer Angel", 6, Rarity.MYTHIC, mage.cards.b.BaneslayerAngel.class));
|
||||
cards.add(new SetCardInfo("Basri's Aegis", 322, Rarity.RARE, mage.cards.b.BasrisAegis.class));
|
||||
cards.add(new SetCardInfo("Basri, Devoted Paladin", 320, Rarity.MYTHIC, mage.cards.b.BasriDevotedPaladin.class));
|
||||
cards.add(new SetCardInfo("Carrion Grub", 92, Rarity.UNCOMMON, mage.cards.c.CarrionGrub.class));
|
||||
cards.add(new SetCardInfo("Chandra's Firemaw", 333, Rarity.RARE, mage.cards.c.ChandrasFiremaw.class));
|
||||
cards.add(new SetCardInfo("Chandra, Flame's Catalyst", 332, Rarity.MYTHIC, mage.cards.c.ChandraFlamesCatalyst.class));
|
||||
cards.add(new SetCardInfo("Chromatic Orrery", 228, Rarity.MYTHIC, mage.cards.c.ChromaticOrrery.class));
|
||||
|
|
|
|||
|
|
@ -42,15 +42,6 @@ public class PutTopCardOfLibraryIntoGraveControllerEffect extends OneShotEffect
|
|||
}
|
||||
|
||||
private String setText() {
|
||||
StringBuilder sb = new StringBuilder("put the top");
|
||||
if (numberCards == 1) {
|
||||
sb.append(" card");
|
||||
} else {
|
||||
sb.append(" ");
|
||||
sb.append(CardUtil.numberToText(numberCards));
|
||||
sb.append(" cards");
|
||||
}
|
||||
sb.append(" of your library into your graveyard");
|
||||
return sb.toString();
|
||||
return "mill " + (numberCards == 1 ? "a card" : CardUtil.numberToText(numberCards) + " cards");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue