mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
Implemented Consecrate // Consume
This commit is contained in:
parent
0ad967a5b3
commit
129c7be92c
2 changed files with 95 additions and 0 deletions
94
Mage.Sets/src/mage/cards/c/ConsecrateConsume.java
Normal file
94
Mage.Sets/src/mage/cards/c/ConsecrateConsume.java
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
package mage.cards.c;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
|
import mage.abilities.effects.common.ExileTargetEffect;
|
||||||
|
import mage.abilities.effects.common.SacrificeEffect;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.cards.SplitCard;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.ComparisonType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SpellAbilityType;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetPlayer;
|
||||||
|
import mage.target.common.TargetCardInGraveyard;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class ConsecrateConsume extends SplitCard {
|
||||||
|
|
||||||
|
public ConsecrateConsume(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, new CardType[]{CardType.SORCERY}, "{1}{W/B}", "{2}{W}{B}", SpellAbilityType.SPLIT);
|
||||||
|
|
||||||
|
// Consecrate
|
||||||
|
// Exile target card from a graveyard.
|
||||||
|
this.getLeftHalfCard().getSpellAbility().addEffect(new ExileTargetEffect());
|
||||||
|
this.getLeftHalfCard().getSpellAbility().addTarget(new TargetCardInGraveyard());
|
||||||
|
|
||||||
|
// Draw a card.
|
||||||
|
this.getLeftHalfCard().getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
|
||||||
|
|
||||||
|
// Consume
|
||||||
|
// Target player sacrifices a creature with the greatest power among creatures they control. You gain life equal to its power.
|
||||||
|
this.getRightHalfCard().getSpellAbility().addEffect(new ConsumeEffect());
|
||||||
|
this.getRightHalfCard().getSpellAbility().addTarget(new TargetPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConsecrateConsume(final ConsecrateConsume card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsecrateConsume copy() {
|
||||||
|
return new ConsecrateConsume(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConsumeEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
ConsumeEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "Target player sacrifices a creature " +
|
||||||
|
"with the greatest power among creatures they control. " +
|
||||||
|
"You gain life equal to its power.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConsumeEffect(final ConsumeEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsumeEffect copy() {
|
||||||
|
return new ConsumeEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
Player player = game.getPlayer(source.getFirstTarget());
|
||||||
|
if (player == null || controller == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int greatestPower = 0;
|
||||||
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(player.getId())) {
|
||||||
|
if (permanent != null && permanent.isCreature()) {
|
||||||
|
greatestPower = Math.max(permanent.getPower().getValue(), greatestPower);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FilterPermanent filter = new FilterCreaturePermanent("creature with power " + greatestPower);
|
||||||
|
filter.add(new PowerPredicate(ComparisonType.EQUAL_TO, greatestPower));
|
||||||
|
new SacrificeEffect(filter, 1, "").apply(game, source);
|
||||||
|
controller.gainLife(greatestPower, game, source);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -45,6 +45,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Bolrac-Clan Crusher", 159, Rarity.UNCOMMON, mage.cards.b.BolracClanCrusher.class));
|
cards.add(new SetCardInfo("Bolrac-Clan Crusher", 159, Rarity.UNCOMMON, mage.cards.b.BolracClanCrusher.class));
|
||||||
cards.add(new SetCardInfo("Breeding Pool", 246, Rarity.RARE, mage.cards.b.BreedingPool.class));
|
cards.add(new SetCardInfo("Breeding Pool", 246, Rarity.RARE, mage.cards.b.BreedingPool.class));
|
||||||
cards.add(new SetCardInfo("Carnival // Carnage", 222, Rarity.UNCOMMON, mage.cards.c.CarnivalCarnage.class));
|
cards.add(new SetCardInfo("Carnival // Carnage", 222, Rarity.UNCOMMON, mage.cards.c.CarnivalCarnage.class));
|
||||||
|
cards.add(new SetCardInfo("Consecrate // Consume", 224, Rarity.UNCOMMON, mage.cards.c.ConsecrateConsume.class));
|
||||||
cards.add(new SetCardInfo("Depose // Deploy", 225, Rarity.UNCOMMON, mage.cards.d.DeposeDeploy.class));
|
cards.add(new SetCardInfo("Depose // Deploy", 225, Rarity.UNCOMMON, mage.cards.d.DeposeDeploy.class));
|
||||||
cards.add(new SetCardInfo("Deputy of Detention", 165, Rarity.RARE, mage.cards.d.DeputyOfDetention.class));
|
cards.add(new SetCardInfo("Deputy of Detention", 165, Rarity.RARE, mage.cards.d.DeputyOfDetention.class));
|
||||||
cards.add(new SetCardInfo("Dovin, Grand Arbiter", 167, Rarity.MYTHIC, mage.cards.d.DovinGrandArbiter.class));
|
cards.add(new SetCardInfo("Dovin, Grand Arbiter", 167, Rarity.MYTHIC, mage.cards.d.DovinGrandArbiter.class));
|
||||||
|
|
Loading…
Reference in a new issue