mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
[FDN] Implement Lunar Insight
This commit is contained in:
parent
bb56923618
commit
acc601f0cd
2 changed files with 102 additions and 0 deletions
101
Mage.Sets/src/mage/cards/l/LunarInsight.java
Normal file
101
Mage.Sets/src/mage/cards/l/LunarInsight.java
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class LunarInsight extends CardImpl {
|
||||
|
||||
public LunarInsight(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}");
|
||||
|
||||
// Draw a card for each different mana value among nonland permanents you control.
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(LunarInsightValue.instance));
|
||||
this.getSpellAbility().addHint(LunarInsightHint.instance);
|
||||
}
|
||||
|
||||
private LunarInsight(final LunarInsight card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LunarInsight copy() {
|
||||
return new LunarInsight(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum LunarInsightValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return game
|
||||
.getBattlefield()
|
||||
.getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT_NON_LAND,
|
||||
sourceAbility.getControllerId(), sourceAbility, game
|
||||
)
|
||||
.stream()
|
||||
.map(MageObject::getManaValue)
|
||||
.distinct()
|
||||
.mapToInt(x -> 1)
|
||||
.sum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LunarInsightValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "different mana value among nonland permanents you control";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
|
||||
enum LunarInsightHint implements Hint {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public String getText(Game game, Ability ability) {
|
||||
List<String> powers = game
|
||||
.getBattlefield()
|
||||
.getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT_NON_LAND,
|
||||
ability.getControllerId(), ability, game
|
||||
)
|
||||
.stream()
|
||||
.mapToInt(MageObject::getManaValue)
|
||||
.distinct()
|
||||
.sorted()
|
||||
.mapToObj(String::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
return "Different mana values among nonland permanents you control: " + powers.size()
|
||||
+ (powers.size() > 0 ? " (" + String.join(", ", powers) + ')' : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public LunarInsightHint copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -86,6 +86,7 @@ public final class Foundations extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Lightshell Duo", 157, Rarity.COMMON, mage.cards.l.LightshellDuo.class));
|
||||
cards.add(new SetCardInfo("Liliana, Dreadhorde General", 176, Rarity.MYTHIC, mage.cards.l.LilianaDreadhordeGeneral.class));
|
||||
cards.add(new SetCardInfo("Llanowar Elves", 227, Rarity.COMMON, mage.cards.l.LlanowarElves.class));
|
||||
cards.add(new SetCardInfo("Lunar Insight", 46, Rarity.RARE, mage.cards.l.LunarInsight.class));
|
||||
cards.add(new SetCardInfo("Lyra Dawnbringer", 707, Rarity.MYTHIC, mage.cards.l.LyraDawnbringer.class));
|
||||
cards.add(new SetCardInfo("Maelstrom Pulse", 661, Rarity.RARE, mage.cards.m.MaelstromPulse.class));
|
||||
cards.add(new SetCardInfo("Mindsparker", 628, Rarity.UNCOMMON, mage.cards.m.Mindsparker.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue