forked from External/mage
[NEO] Implemented Reckoner's Bargain
This commit is contained in:
parent
d08bbc3c78
commit
b15ccc15eb
2 changed files with 85 additions and 0 deletions
84
Mage.Sets/src/mage/cards/r/ReckonersBargain.java
Normal file
84
Mage.Sets/src/mage/cards/r/ReckonersBargain.java
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ReckonersBargain extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter
|
||||
= new FilterControlledPermanent("an artifact or creature");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
CardType.ARTIFACT.getPredicate(),
|
||||
CardType.CREATURE.getPredicate()
|
||||
));
|
||||
}
|
||||
|
||||
public ReckonersBargain(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
|
||||
|
||||
// As an additional cost to cast this spell, sacrifice an artifact or creature.
|
||||
this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter)));
|
||||
|
||||
// You gain life equal to the sacrificed permanent's mana value. Draw two cards.
|
||||
this.getSpellAbility().addEffect(new GainLifeEffect(
|
||||
ReckonersBargainValue.instance, "you gain life " +
|
||||
"equal to the sacrificed permanent's mana value"
|
||||
));
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2));
|
||||
}
|
||||
|
||||
private ReckonersBargain(final ReckonersBargain card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReckonersBargain copy() {
|
||||
return new ReckonersBargain(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum ReckonersBargainValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return CardUtil.castStream(sourceAbility.getCosts().stream(), SacrificeTargetCost.class)
|
||||
.map(SacrificeTargetCost::getPermanents)
|
||||
.flatMap(Collection::stream)
|
||||
.filter(Objects::nonNull)
|
||||
.mapToInt(MageObject::getManaValue)
|
||||
.sum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReckonersBargainValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -211,6 +211,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Raiyuu, Storm's Edge", 232, Rarity.RARE, mage.cards.r.RaiyuuStormsEdge.class));
|
||||
cards.add(new SetCardInfo("Reality Heist", 75, Rarity.UNCOMMON, mage.cards.r.RealityHeist.class));
|
||||
cards.add(new SetCardInfo("Reckoner Bankbuster", 255, Rarity.RARE, mage.cards.r.ReckonerBankbuster.class));
|
||||
cards.add(new SetCardInfo("Reckoner's Bargain", 120, Rarity.COMMON, mage.cards.r.ReckonersBargain.class));
|
||||
cards.add(new SetCardInfo("Regent's Authority", 32, Rarity.COMMON, mage.cards.r.RegentsAuthority.class));
|
||||
cards.add(new SetCardInfo("Reinforced Ronin", 158, Rarity.UNCOMMON, mage.cards.r.ReinforcedRonin.class));
|
||||
cards.add(new SetCardInfo("Reito Sentinel", 256, Rarity.UNCOMMON, mage.cards.r.ReitoSentinel.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue