mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
[SNC] Implemented Graveyard Shift
This commit is contained in:
parent
c451ae88c7
commit
b658d60bfd
5 changed files with 135 additions and 56 deletions
50
Mage.Sets/src/mage/cards/g/GraveyardShift.java
Normal file
50
Mage.Sets/src/mage/cards/g/GraveyardShift.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.DifferentManaValuesInGraveCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.hint.common.DifferentManaValuesInGraveHint;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class GraveyardShift extends CardImpl {
|
||||
|
||||
public GraveyardShift(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}");
|
||||
|
||||
// This spell has flash as long as there are five or more mana values among cards in your graveyard.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.ALL,
|
||||
new ConditionalContinuousEffect(new GainAbilitySourceEffect(
|
||||
FlashAbility.getInstance(), Duration.WhileOnBattlefield, true
|
||||
), DifferentManaValuesInGraveCondition.FIVE, "this spell has flash " +
|
||||
"as long as there are five or more mana values among cards in your graveyard")
|
||||
).setRuleAtTheTop(true).addHint(DifferentManaValuesInGraveHint.instance));
|
||||
|
||||
// Return target creature card from your graveyard to the battlefield.
|
||||
this.getSpellAbility().addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
|
||||
}
|
||||
|
||||
private GraveyardShift(final GraveyardShift card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraveyardShift copy() {
|
||||
return new GraveyardShift(this);
|
||||
}
|
||||
}
|
|
@ -1,28 +1,23 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.DifferentManaValuesInGraveCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.common.MillCardsControllerEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.common.DifferentManaValuesInGraveHint;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
@ -43,14 +38,14 @@ public final class SnoopingNewsie extends CardImpl {
|
|||
// As long as there are five or more mana values among cards in your graveyard, Snooping Newsie gets +1/+1 and has lifelink.
|
||||
Ability ability = new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||
new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield),
|
||||
SnoopingNewsieCondition.instance, "as long as there are five or more " +
|
||||
"mana values among cards in your graveyard, {this} gets +1/+1"
|
||||
DifferentManaValuesInGraveCondition.FIVE, "as long as there are " +
|
||||
"five or more mana values among cards in your graveyard, {this} gets +1/+1"
|
||||
));
|
||||
ability.addEffect(new ConditionalContinuousEffect(
|
||||
new GainAbilitySourceEffect(LifelinkAbility.getInstance()),
|
||||
SnoopingNewsieCondition.instance, "and has lifelink"
|
||||
DifferentManaValuesInGraveCondition.FIVE, "and has lifelink"
|
||||
));
|
||||
this.addAbility(ability.addHint(SnoopingNewsieHint.instance));
|
||||
this.addAbility(ability.addHint(DifferentManaValuesInGraveHint.instance));
|
||||
}
|
||||
|
||||
private SnoopingNewsie(final SnoopingNewsie card) {
|
||||
|
@ -62,48 +57,3 @@ public final class SnoopingNewsie extends CardImpl {
|
|||
return new SnoopingNewsie(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum SnoopingNewsieCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
return player != null
|
||||
&& player
|
||||
.getGraveyard()
|
||||
.getCards(game)
|
||||
.stream()
|
||||
.mapToInt(MageObject::getManaValue)
|
||||
.distinct()
|
||||
.count() >= 5;
|
||||
}
|
||||
}
|
||||
|
||||
enum SnoopingNewsieHint implements Hint {
|
||||
instance;;
|
||||
|
||||
@Override
|
||||
public String getText(Game game, Ability ability) {
|
||||
Player player = game.getPlayer(ability.getControllerId());
|
||||
if (player == null) {
|
||||
return null;
|
||||
}
|
||||
List<String> values = player
|
||||
.getGraveyard()
|
||||
.getCards(game)
|
||||
.stream()
|
||||
.mapToInt(MageObject::getManaValue)
|
||||
.distinct()
|
||||
.sorted()
|
||||
.mapToObj(String::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
return "Different mana values among cards in your graveyard: " + values.size()
|
||||
+ (values.size() > 0 ? " (" + String.join(", ", values) + ')' : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SnoopingNewsieHint copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -45,6 +45,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Forest", 270, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Gala Greeters", 148, Rarity.RARE, mage.cards.g.GalaGreeters.class));
|
||||
cards.add(new SetCardInfo("Getaway Car", 237, Rarity.RARE, mage.cards.g.GetawayCar.class));
|
||||
cards.add(new SetCardInfo("Graveyard Shift", 81, Rarity.UNCOMMON, mage.cards.g.GraveyardShift.class));
|
||||
cards.add(new SetCardInfo("Grisly Sigil", 82, Rarity.UNCOMMON, mage.cards.g.GrislySigil.class));
|
||||
cards.add(new SetCardInfo("Halo Fountain", 15, Rarity.MYTHIC, mage.cards.h.HaloFountain.class));
|
||||
cards.add(new SetCardInfo("Incriminate", 84, Rarity.COMMON, mage.cards.i.Incriminate.class));
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum DifferentManaValuesInGraveCondition implements Condition {
|
||||
FIVE(5);
|
||||
private final int amount;
|
||||
|
||||
DifferentManaValuesInGraveCondition(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
return player != null
|
||||
&& player
|
||||
.getGraveyard()
|
||||
.getCards(game)
|
||||
.stream()
|
||||
.mapToInt(MageObject::getManaValue)
|
||||
.distinct()
|
||||
.count() >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "there are " + CardUtil.numberToText(amount) + " or more mana values among cards in your graveyard";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package mage.abilities.hint.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum DifferentManaValuesInGraveHint implements Hint {
|
||||
instance;
|
||||
|
||||
public String getText(Game game, Ability ability) {
|
||||
Player player = game.getPlayer(ability.getControllerId());
|
||||
if (player == null) {
|
||||
return null;
|
||||
}
|
||||
List<String> values = player
|
||||
.getGraveyard()
|
||||
.getCards(game)
|
||||
.stream()
|
||||
.mapToInt(MageObject::getManaValue)
|
||||
.distinct()
|
||||
.sorted()
|
||||
.mapToObj(String::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
return "Different mana values among cards in your graveyard: " + values.size()
|
||||
+ (values.size() > 0 ? " (" + String.join(", ", values) + ')' : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public DifferentManaValuesInGraveHint copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue