Implement Kethek, Crucible Goliath (#10108)

This commit is contained in:
miesma 2023-04-19 15:30:45 +02:00 committed by GitHub
parent dd23e3e08d
commit e71aea90e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 105 additions and 0 deletions

View file

@ -0,0 +1,103 @@
package mage.cards.k;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
/**
* @author miesma
*/
public final class KethekCrucibleGoliath extends CardImpl {
public KethekCrucibleGoliath(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.PHYREXIAN);
this.subtype.add(SubType.BEAST);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// At the beginning of your end step, you may sacrifice another creature.
// If you do, reveal cards from the top of your library
// until you reveal a nonlegendary creature card with lesser mana value, put it onto the battlefield,
// then put the rest on the bottom of your library in a random order.
this.addAbility(new BeginningOfEndStepTriggeredAbility(
new KethekCrucibleGoliathEffect(), TargetController.YOU, false
));
}
private KethekCrucibleGoliath(final KethekCrucibleGoliath card) {
super(card);
}
@Override
public KethekCrucibleGoliath copy() {
return new KethekCrucibleGoliath(this);
}
}
class KethekCrucibleGoliathEffect extends OneShotEffect {
KethekCrucibleGoliathEffect() {
super(Outcome.Benefit);
staticText = "you may sacrifice another creature. " +
"If you do, reveal cards from the top of your library" +
"until you reveal a nonlegendary creature card with lesser mana value" +
", put it onto the battlefield, then put the rest on the bottom of your library in a random order.";
}
private KethekCrucibleGoliathEffect(final mage.cards.k.KethekCrucibleGoliathEffect effect) {
super(effect);
}
@Override
public mage.cards.k.KethekCrucibleGoliathEffect copy() {
return new mage.cards.k.KethekCrucibleGoliathEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
// May sacrifice another creature
TargetPermanent target = (TargetPermanent) new TargetControlledPermanent(
0, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true
).withChooseHint("to sacrifice");
player.choose(Outcome.Sacrifice, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null || !permanent.sacrifice(source, game)) {
return false;
}
// If you do, reveal cards from the top of your library (IF = No second trigger on the Stack)
// until you reveal a nonlegendary creature card with lesser mana value
int xValue = permanent.getManaValue();
FilterCreatureCard filterCreatureCard = new FilterCreatureCard("nonlegendary creature card with lesser mana value");
// Nonlegendary
filterCreatureCard.add(Predicates.not(SuperType.LEGENDARY.getPredicate()));
// Lesser Mana Value
filterCreatureCard.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue));
//put it onto the battlefield, then put the rest on the bottom of your library in a random order.
RevealCardsFromLibraryUntilEffect effect = new RevealCardsFromLibraryUntilEffect(filterCreatureCard, Zone.BATTLEFIELD, Zone.LIBRARY);
effect.apply(game,source);
return true;
}
}

View file

@ -128,6 +128,8 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
cards.add(new SetCardInfo("Karumonix, the Rat King", 98, Rarity.RARE, mage.cards.k.KarumonixTheRatKing.class));
cards.add(new SetCardInfo("Kaya, Intangible Slayer", 205, Rarity.RARE, mage.cards.k.KayaIntangibleSlayer.class));
cards.add(new SetCardInfo("Kemba, Kha Enduring", 19, Rarity.RARE, mage.cards.k.KembaKhaEnduring.class));
cards.add(new SetCardInfo("Kethek, Crucible Goliath", 206, Rarity.RARE, mage.cards.k.KethekCrucibleGoliath.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Kethek, Crucible Goliath", 319, Rarity.RARE, mage.cards.k.KethekCrucibleGoliath.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Koth, Fire of Resistance", 138, Rarity.RARE, mage.cards.k.KothFireOfResistance.class));
cards.add(new SetCardInfo("Kuldotha Cackler", 139, Rarity.COMMON, mage.cards.k.KuldothaCackler.class));
cards.add(new SetCardInfo("Lattice-Blade Mantis", 173, Rarity.COMMON, mage.cards.l.LatticeBladeMantis.class));