[SNC] Implemented Luxor, Giada's Gift

This commit is contained in:
Evan Kranzler 2022-04-20 19:18:44 -04:00
parent d2136310a6
commit 40cae5bef5
2 changed files with 126 additions and 0 deletions

View file

@ -0,0 +1,125 @@
package mage.cards.l;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.Counter;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPlaneswalkerPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import java.util.*;
import java.util.stream.IntStream;
/**
* @author TheElk801
*/
public final class LuxiorGiadasGift extends CardImpl {
private static final FilterPermanent filter = new FilterControlledPlaneswalkerPermanent("planeswalker");
public LuxiorGiadasGift(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.EQUIPMENT);
// Equipped creature gets +1/+1 for each counter on it.
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(
LuxiorGiadasGiftValue.instance, LuxiorGiadasGiftValue.instance
)));
// Equipped permanent isn't a planeswalker and is a creature in addition to its other types.
this.addAbility(new SimpleStaticAbility(new LuxiorGiadasGiftEffect()));
// Equip planeswalker {1}
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(1), new TargetPermanent(filter)));
// Equip {3}
this.addAbility(new EquipAbility(3));
}
private LuxiorGiadasGift(final LuxiorGiadasGift card) {
super(card);
}
@Override
public LuxiorGiadasGift copy() {
return new LuxiorGiadasGift(this);
}
}
enum LuxiorGiadasGiftValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return Optional.of(sourceAbility.getSourcePermanentIfItStillExists(game))
.filter(Objects::nonNull)
.map(Permanent::getAttachedTo)
.map(game::getPermanent)
.filter(Objects::nonNull)
.map(permanent -> permanent.getCounters(game))
.map(HashMap::values)
.map(Collection::stream)
.map(x -> x.mapToInt(Counter::getCount))
.map(IntStream::sum)
.orElse(0);
}
@Override
public LuxiorGiadasGiftValue copy() {
return this;
}
@Override
public String getMessage() {
return "counter on it";
}
@Override
public String toString() {
return "1";
}
}
class LuxiorGiadasGiftEffect extends ContinuousEffectImpl {
LuxiorGiadasGiftEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
staticText = "equipped permanent isn't a planeswalker and is a creature in addition to its other types";
}
private LuxiorGiadasGiftEffect(final LuxiorGiadasGiftEffect effect) {
super(effect);
}
@Override
public LuxiorGiadasGiftEffect copy() {
return new LuxiorGiadasGiftEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Optional.of(source.getSourcePermanentIfItStillExists(game))
.filter(Objects::nonNull)
.map(Permanent::getAttachedTo)
.map(game::getPermanent)
.ifPresent(permanent -> {
permanent.removeCardType(game, CardType.PLANESWALKER);
permanent.removeAllSubTypes(game, SubTypeSet.PlaneswalkerType);
permanent.addCardType(game, CardType.CREATURE);
});
return true;
}
}

View file

@ -151,6 +151,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
cards.add(new SetCardInfo("Ledger Shredder", 46, Rarity.RARE, mage.cards.l.LedgerShredder.class)); cards.add(new SetCardInfo("Ledger Shredder", 46, Rarity.RARE, mage.cards.l.LedgerShredder.class));
cards.add(new SetCardInfo("Light 'Em Up", 113, Rarity.COMMON, mage.cards.l.LightEmUp.class)); cards.add(new SetCardInfo("Light 'Em Up", 113, Rarity.COMMON, mage.cards.l.LightEmUp.class));
cards.add(new SetCardInfo("Lord Xander, the Collector", 197, Rarity.MYTHIC, mage.cards.l.LordXanderTheCollector.class)); cards.add(new SetCardInfo("Lord Xander, the Collector", 197, Rarity.MYTHIC, mage.cards.l.LordXanderTheCollector.class));
cards.add(new SetCardInfo("Luxior, Giada's Gift", 240, Rarity.MYTHIC, mage.cards.l.LuxiorGiadasGift.class));
cards.add(new SetCardInfo("Luxurious Libation", 152, Rarity.UNCOMMON, mage.cards.l.LuxuriousLibation.class)); cards.add(new SetCardInfo("Luxurious Libation", 152, Rarity.UNCOMMON, mage.cards.l.LuxuriousLibation.class));
cards.add(new SetCardInfo("Maestros Charm", 199, Rarity.UNCOMMON, mage.cards.m.MaestrosCharm.class)); cards.add(new SetCardInfo("Maestros Charm", 199, Rarity.UNCOMMON, mage.cards.m.MaestrosCharm.class));
cards.add(new SetCardInfo("Maestros Diabolist", 200, Rarity.RARE, mage.cards.m.MaestrosDiabolist.class)); cards.add(new SetCardInfo("Maestros Diabolist", 200, Rarity.RARE, mage.cards.m.MaestrosDiabolist.class));