mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Implemented Witch's Oven
This commit is contained in:
parent
efffc53552
commit
d7d376cf06
2 changed files with 88 additions and 0 deletions
87
Mage.Sets/src/mage/cards/w/WitchsOven.java
Normal file
87
Mage.Sets/src/mage/cards/w/WitchsOven.java
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
package mage.cards.w;
|
||||||
|
|
||||||
|
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.effects.Effect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.game.permanent.token.FoodToken;
|
||||||
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class WitchsOven extends CardImpl {
|
||||||
|
|
||||||
|
public WitchsOven(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
|
||||||
|
|
||||||
|
// {T}, Sacrifice a creature: Create a Food token. If the sacrificed creature's toughness was 4 or greater, create two Food tokens instead.
|
||||||
|
Ability ability = new SimpleActivatedAbility(new WitchsOvenEffect(), new TapSourceCost());
|
||||||
|
ability.addCost(new SacrificeTargetCost(
|
||||||
|
new TargetControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT)
|
||||||
|
));
|
||||||
|
this.addAbility(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
private WitchsOven(final WitchsOven card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WitchsOven copy() {
|
||||||
|
return new WitchsOven(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class WitchsOvenEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
private static final Effect effect1 = new CreateTokenEffect(new FoodToken(), 1);
|
||||||
|
private static final Effect effect2 = new CreateTokenEffect(new FoodToken(), 2);
|
||||||
|
|
||||||
|
WitchsOvenEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "Create a Food token. If the sacrificed creature's toughness " +
|
||||||
|
"was 4 or greater, create two Food tokens instead";
|
||||||
|
}
|
||||||
|
|
||||||
|
private WitchsOvenEffect(final WitchsOvenEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WitchsOvenEffect copy() {
|
||||||
|
return new WitchsOvenEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
boolean big = source
|
||||||
|
.getCosts()
|
||||||
|
.stream()
|
||||||
|
.filter(SacrificeTargetCost.class::isInstance)
|
||||||
|
.map(SacrificeTargetCost.class::cast)
|
||||||
|
.map(SacrificeTargetCost::getPermanents)
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.map(Permanent::getToughness)
|
||||||
|
.mapToInt(MageInt::getValue)
|
||||||
|
.anyMatch(i -> i > 3);
|
||||||
|
if (big) {
|
||||||
|
return effect2.apply(game, source);
|
||||||
|
}
|
||||||
|
return effect1.apply(game, source);
|
||||||
|
}
|
||||||
|
}
|
|
@ -128,6 +128,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Wishclaw Talisman", 110, Rarity.RARE, mage.cards.w.WishclawTalisman.class));
|
cards.add(new SetCardInfo("Wishclaw Talisman", 110, Rarity.RARE, mage.cards.w.WishclawTalisman.class));
|
||||||
cards.add(new SetCardInfo("Wishful Merfolk", 73, Rarity.COMMON, mage.cards.w.WishfulMerfolk.class));
|
cards.add(new SetCardInfo("Wishful Merfolk", 73, Rarity.COMMON, mage.cards.w.WishfulMerfolk.class));
|
||||||
cards.add(new SetCardInfo("Witch's Cottage", 249, Rarity.COMMON, mage.cards.w.WitchsCottage.class));
|
cards.add(new SetCardInfo("Witch's Cottage", 249, Rarity.COMMON, mage.cards.w.WitchsCottage.class));
|
||||||
|
cards.add(new SetCardInfo("Witch's Oven", 237, Rarity.UNCOMMON, mage.cards.w.WitchsOven.class));
|
||||||
cards.add(new SetCardInfo("Witch's Vengeance", 111, Rarity.RARE, mage.cards.w.WitchsVengeance.class));
|
cards.add(new SetCardInfo("Witch's Vengeance", 111, Rarity.RARE, mage.cards.w.WitchsVengeance.class));
|
||||||
cards.add(new SetCardInfo("Witching Well", 74, Rarity.COMMON, mage.cards.w.WitchingWell.class));
|
cards.add(new SetCardInfo("Witching Well", 74, Rarity.COMMON, mage.cards.w.WitchingWell.class));
|
||||||
cards.add(new SetCardInfo("Workshop Elders", 318, Rarity.RARE, mage.cards.w.WorkshopElders.class));
|
cards.add(new SetCardInfo("Workshop Elders", 318, Rarity.RARE, mage.cards.w.WorkshopElders.class));
|
||||||
|
|
Loading…
Reference in a new issue