mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
[MKM] Implement Case of the Uneaten Feast (#11731)
--------- Co-authored-by: Matthew Wilson <matthew_w@vaadin.com>
This commit is contained in:
parent
52a73f4383
commit
9aae17d3f0
2 changed files with 151 additions and 0 deletions
150
Mage.Sets/src/mage/cards/c/CaseOfTheUneatenFeast.java
Normal file
150
Mage.Sets/src/mage/cards/c/CaseOfTheUneatenFeast.java
Normal file
|
|
@ -0,0 +1,150 @@
|
||||||
|
package mage.cards.c;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mage.MageObjectReference;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.CaseAbility;
|
||||||
|
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||||
|
import mage.abilities.common.MayCastFromGraveyardSourceAbility;
|
||||||
|
import mage.abilities.condition.Condition;
|
||||||
|
import mage.abilities.condition.common.SolvedSourceCondition;
|
||||||
|
import mage.abilities.condition.common.YouGainedLifeCondition;
|
||||||
|
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||||
|
import mage.abilities.decorator.ConditionalActivatedAbility;
|
||||||
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
import mage.abilities.effects.common.GainLifeEffect;
|
||||||
|
import mage.abilities.hint.common.CaseSolvedHint;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.constants.ComparisonType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Layer;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubLayer;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.watchers.common.PlayerGainedLifeWatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author DominionSpy
|
||||||
|
*/
|
||||||
|
public final class CaseOfTheUneatenFeast extends CardImpl {
|
||||||
|
|
||||||
|
private static final Condition condition = new YouGainedLifeCondition(ComparisonType.MORE_THAN, 4);
|
||||||
|
|
||||||
|
public CaseOfTheUneatenFeast(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.CASE);
|
||||||
|
|
||||||
|
// Whenever a creature enters the battlefield under your control, you gain 1 life.
|
||||||
|
Ability initialAbility = new EntersBattlefieldControlledTriggeredAbility(
|
||||||
|
new GainLifeEffect(1), StaticFilters.FILTER_PERMANENT_CREATURE);
|
||||||
|
// To solve -- You've gained 5 or more life this turn.
|
||||||
|
// Solved -- Sacrifice this Case: Creature cards in your graveyard gain "You may cast this card from your graveyard" until end of turn.
|
||||||
|
Ability solvedAbility = new ConditionalActivatedAbility(
|
||||||
|
new CaseOfTheUneatenFeastEffect(),
|
||||||
|
new SacrificeSourceCost().setText("sacrifice this Case"),
|
||||||
|
SolvedSourceCondition.SOLVED);
|
||||||
|
|
||||||
|
this.addAbility(new CaseAbility(initialAbility, condition, solvedAbility)
|
||||||
|
.addHint(new CaseOfTheUneatenFeastHint(condition)),
|
||||||
|
new PlayerGainedLifeWatcher());
|
||||||
|
}
|
||||||
|
|
||||||
|
private CaseOfTheUneatenFeast(final CaseOfTheUneatenFeast card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CaseOfTheUneatenFeast copy() {
|
||||||
|
return new CaseOfTheUneatenFeast(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CaseOfTheUneatenFeastEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
|
CaseOfTheUneatenFeastEffect() {
|
||||||
|
super(Duration.EndOfTurn, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||||
|
this.staticText = "Creature cards in your graveyard gain \"You may cast this card from your graveyard\" until end of turn";
|
||||||
|
}
|
||||||
|
|
||||||
|
private CaseOfTheUneatenFeastEffect(final CaseOfTheUneatenFeastEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CaseOfTheUneatenFeastEffect copy() {
|
||||||
|
return new CaseOfTheUneatenFeastEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Ability source, Game game) {
|
||||||
|
super.init(source, game);
|
||||||
|
if (!this.affectedObjectsSet) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
if (player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
player.getGraveyard()
|
||||||
|
.stream()
|
||||||
|
.map(game::getCard)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(card -> card.isCreature(game))
|
||||||
|
.forEach(card -> affectedObjectList.add(new MageObjectReference(card, game)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
if (player == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
player.getGraveyard()
|
||||||
|
.stream()
|
||||||
|
.filter(cardId -> affectedObjectList.contains(new MageObjectReference(cardId, game)))
|
||||||
|
.forEach(cardId -> {
|
||||||
|
Card card = game.getCard(cardId);
|
||||||
|
if (card == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MayCastFromGraveyardSourceAbility ability = new MayCastFromGraveyardSourceAbility();
|
||||||
|
ability.setSourceId(cardId);
|
||||||
|
ability.setControllerId(card.getOwnerId());
|
||||||
|
game.getState().addOtherAbility(card, ability);
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CaseOfTheUneatenFeastHint extends CaseSolvedHint {
|
||||||
|
|
||||||
|
CaseOfTheUneatenFeastHint(Condition condition) {
|
||||||
|
super(condition);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CaseOfTheUneatenFeastHint(final CaseOfTheUneatenFeastHint hint) {
|
||||||
|
super(hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CaseOfTheUneatenFeastHint copy() {
|
||||||
|
return new CaseOfTheUneatenFeastHint(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getConditionText(Game game, Ability ability) {
|
||||||
|
int lifeGained = game.getState().getWatcher(PlayerGainedLifeWatcher.class)
|
||||||
|
.getLifeGained(ability.getControllerId());
|
||||||
|
return "Life gained: " + lifeGained + " (need 5).";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -58,6 +58,7 @@ public final class MurdersAtKarlovManor extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Case of the Shattered Pact", 1, Rarity.UNCOMMON, mage.cards.c.CaseOfTheShatteredPact.class));
|
cards.add(new SetCardInfo("Case of the Shattered Pact", 1, Rarity.UNCOMMON, mage.cards.c.CaseOfTheShatteredPact.class));
|
||||||
cards.add(new SetCardInfo("Case of the Stashed Skeleton", 80, Rarity.RARE, mage.cards.c.CaseOfTheStashedSkeleton.class));
|
cards.add(new SetCardInfo("Case of the Stashed Skeleton", 80, Rarity.RARE, mage.cards.c.CaseOfTheStashedSkeleton.class));
|
||||||
cards.add(new SetCardInfo("Case of the Trampled Garden", 156, Rarity.UNCOMMON, mage.cards.c.CaseOfTheTrampledGarden.class));
|
cards.add(new SetCardInfo("Case of the Trampled Garden", 156, Rarity.UNCOMMON, mage.cards.c.CaseOfTheTrampledGarden.class));
|
||||||
|
cards.add(new SetCardInfo("Case of the Uneaten Feast", 10, Rarity.RARE, mage.cards.c.CaseOfTheUneatenFeast.class));
|
||||||
cards.add(new SetCardInfo("Caught Red-Handed", 115, Rarity.UNCOMMON, mage.cards.c.CaughtRedHanded.class));
|
cards.add(new SetCardInfo("Caught Red-Handed", 115, Rarity.UNCOMMON, mage.cards.c.CaughtRedHanded.class));
|
||||||
cards.add(new SetCardInfo("Cease // Desist", 246, Rarity.UNCOMMON, mage.cards.c.CeaseDesist.class));
|
cards.add(new SetCardInfo("Cease // Desist", 246, Rarity.UNCOMMON, mage.cards.c.CeaseDesist.class));
|
||||||
cards.add(new SetCardInfo("Cerebral Confiscation", 81, Rarity.COMMON, mage.cards.c.CerebralConfiscation.class));
|
cards.add(new SetCardInfo("Cerebral Confiscation", 81, Rarity.COMMON, mage.cards.c.CerebralConfiscation.class));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue