mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[KHM] Implemented Skemfar Shadowsage
This commit is contained in:
parent
599cc2673c
commit
d515496b6e
4 changed files with 135 additions and 27 deletions
|
@ -1,11 +1,11 @@
|
||||||
package mage.cards.l;
|
package mage.cards.l;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||||
|
import mage.abilities.dynamicvalue.common.GreatestSharedCreatureTypeCount;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.abilities.effects.keyword.ScryEffect;
|
import mage.abilities.effects.keyword.ScryEffect;
|
||||||
import mage.abilities.keyword.ChangelingAbility;
|
import mage.abilities.keyword.ChangelingAbility;
|
||||||
|
@ -14,11 +14,9 @@ import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.StaticFilters;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -45,7 +43,7 @@ public final class LittjaraKinseekers extends CardImpl {
|
||||||
"put a +1/+1 counter on {this}, then scry 1."
|
"put a +1/+1 counter on {this}, then scry 1."
|
||||||
);
|
);
|
||||||
ability.addEffect(new ScryEffect(1));
|
ability.addEffect(new ScryEffect(1));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability.addHint(GreatestSharedCreatureTypeCount.getHint()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private LittjaraKinseekers(final LittjaraKinseekers card) {
|
private LittjaraKinseekers(final LittjaraKinseekers card) {
|
||||||
|
@ -63,26 +61,6 @@ enum LittjaraKinseekersCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> permanentList = game.getBattlefield().getActivePermanents(
|
return GreatestSharedCreatureTypeCount.instance.calculate(game, source, null) >= 3;
|
||||||
StaticFilters.FILTER_CONTROLLED_CREATURE,
|
|
||||||
source.getControllerId(), source.getSourceId(), game
|
|
||||||
);
|
|
||||||
permanentList.removeIf(Objects::isNull);
|
|
||||||
long changelings = permanentList
|
|
||||||
.stream()
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.filter(MageObject::isAllCreatureTypes)
|
|
||||||
.count();
|
|
||||||
if (changelings > 2) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
permanentList.removeIf(MageObject::isAllCreatureTypes);
|
|
||||||
Map<SubType, Integer> typeMap = new HashMap<>();
|
|
||||||
return permanentList
|
|
||||||
.stream()
|
|
||||||
.map(permanent -> permanent.getSubtype(game))
|
|
||||||
.flatMap(Collection::stream)
|
|
||||||
.mapToInt(subType -> typeMap.compute(subType, (s, i) -> i == null ? 1 : Integer.sum(i, 1)))
|
|
||||||
.anyMatch(x -> x + changelings > 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
54
Mage.Sets/src/mage/cards/s/SkemfarShadowsage.java
Normal file
54
Mage.Sets/src/mage/cards/s/SkemfarShadowsage.java
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
import mage.abilities.dynamicvalue.common.GreatestSharedCreatureTypeCount;
|
||||||
|
import mage.abilities.effects.common.GainLifeEffect;
|
||||||
|
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class SkemfarShadowsage extends CardImpl {
|
||||||
|
|
||||||
|
public SkemfarShadowsage(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.ELF);
|
||||||
|
this.subtype.add(SubType.CLERIC);
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(5);
|
||||||
|
|
||||||
|
// When Skemfar Shadowsage enters the battlefield, choose one —
|
||||||
|
// • Each opponent loses X life, where X is the greatest number of creatures you control that have a creature type in common.
|
||||||
|
Ability ability = new EntersBattlefieldTriggeredAbility(new LoseLifeOpponentsEffect(
|
||||||
|
GreatestSharedCreatureTypeCount.instance
|
||||||
|
).setText("each opponent loses X life, where X is the greatest number " +
|
||||||
|
"of creatures you control that have a creature type in common"));
|
||||||
|
|
||||||
|
// • You gain X life, where X is the greatest number of creatures you control that have a creature type in common.
|
||||||
|
ability.addMode(new Mode(new GainLifeEffect(
|
||||||
|
GreatestSharedCreatureTypeCount.instance
|
||||||
|
).setText("you gain X life, where X is the greatest number " +
|
||||||
|
"of creatures you control that have a creature type in common")));
|
||||||
|
|
||||||
|
this.addAbility(ability.addHint(GreatestSharedCreatureTypeCount.getHint()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private SkemfarShadowsage(final SkemfarShadowsage card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SkemfarShadowsage copy() {
|
||||||
|
return new SkemfarShadowsage(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -133,6 +133,7 @@ public final class Kaldheim extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Seize the Spoils", 149, Rarity.COMMON, mage.cards.s.SeizeTheSpoils.class));
|
cards.add(new SetCardInfo("Seize the Spoils", 149, Rarity.COMMON, mage.cards.s.SeizeTheSpoils.class));
|
||||||
cards.add(new SetCardInfo("Showdown of the Skalds", 229, Rarity.RARE, mage.cards.s.ShowdownOfTheSkalds.class));
|
cards.add(new SetCardInfo("Showdown of the Skalds", 229, Rarity.RARE, mage.cards.s.ShowdownOfTheSkalds.class));
|
||||||
cards.add(new SetCardInfo("Sigrid, God-Favored", 29, Rarity.RARE, mage.cards.s.SigridGodFavored.class));
|
cards.add(new SetCardInfo("Sigrid, God-Favored", 29, Rarity.RARE, mage.cards.s.SigridGodFavored.class));
|
||||||
|
cards.add(new SetCardInfo("Skemfar Shadowsage", 110, Rarity.UNCOMMON, mage.cards.s.SkemfarShadowsage.class));
|
||||||
cards.add(new SetCardInfo("Snakeskin Veil", 194, Rarity.COMMON, mage.cards.s.SnakeskinVeil.class));
|
cards.add(new SetCardInfo("Snakeskin Veil", 194, Rarity.COMMON, mage.cards.s.SnakeskinVeil.class));
|
||||||
cards.add(new SetCardInfo("Snow-Covered Forest", 284, Rarity.LAND, mage.cards.s.SnowCoveredForest.class));
|
cards.add(new SetCardInfo("Snow-Covered Forest", 284, Rarity.LAND, mage.cards.s.SnowCoveredForest.class));
|
||||||
cards.add(new SetCardInfo("Snow-Covered Island", 278, Rarity.LAND, mage.cards.s.SnowCoveredIsland.class));
|
cards.add(new SetCardInfo("Snow-Covered Island", 278, Rarity.LAND, mage.cards.s.SnowCoveredIsland.class));
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
package mage.abilities.dynamicvalue.common;
|
||||||
|
|
||||||
|
import mage.MageObject;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.hint.Hint;
|
||||||
|
import mage.abilities.hint.ValueHint;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.SubTypeSet;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public enum GreatestSharedCreatureTypeCount implements DynamicValue {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
private static final Hint hint = new ValueHint(
|
||||||
|
"Greatest number of creatures you control that share a creature type", instance
|
||||||
|
);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
|
List<Permanent> permanentList = game.getBattlefield().getActivePermanents(
|
||||||
|
StaticFilters.FILTER_CONTROLLED_CREATURE,
|
||||||
|
sourceAbility.getControllerId(), sourceAbility.getSourceId(), game
|
||||||
|
);
|
||||||
|
permanentList.removeIf(Objects::isNull);
|
||||||
|
int changelings = permanentList
|
||||||
|
.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(MageObject::isAllCreatureTypes)
|
||||||
|
.mapToInt(x -> 1)
|
||||||
|
.sum();
|
||||||
|
permanentList.removeIf(MageObject::isAllCreatureTypes);
|
||||||
|
Map<SubType, Integer> typeMap = new HashMap<>();
|
||||||
|
permanentList
|
||||||
|
.stream()
|
||||||
|
.map(permanent -> permanent.getSubtype(game))
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.filter(subType -> subType.getSubTypeSet() == SubTypeSet.CreatureType)
|
||||||
|
.forEach(subType -> typeMap.compute(subType, (s, i) -> i == null ? 1 : Integer.sum(i, 1)));
|
||||||
|
return changelings
|
||||||
|
+ typeMap
|
||||||
|
.values()
|
||||||
|
.stream()
|
||||||
|
.mapToInt(x -> x)
|
||||||
|
.max()
|
||||||
|
.getAsInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GreatestSharedCreatureTypeCount copy() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "X";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "greatest number of creatures you control that have a creature type in common";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Hint getHint() {
|
||||||
|
return hint;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue