mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
[MOC] Implement Liliana's Talent
This commit is contained in:
parent
bc752a2107
commit
3d596d7a0f
2 changed files with 145 additions and 0 deletions
144
Mage.Sets/src/mage/cards/l/LilianasTalent.java
Normal file
144
Mage.Sets/src/mage/cards/l/LilianasTalent.java
Normal file
|
|
@ -0,0 +1,144 @@
|
||||||
|
package mage.cards.l;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.LoyaltyAbility;
|
||||||
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.AttachEffect;
|
||||||
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||||
|
import mage.abilities.keyword.EnchantAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetPermanent;
|
||||||
|
import mage.target.common.TargetPlaneswalkerPermanent;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class LilianasTalent extends CardImpl {
|
||||||
|
|
||||||
|
public LilianasTalent(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}{B}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.AURA);
|
||||||
|
|
||||||
|
// Enchant planeswalker
|
||||||
|
TargetPermanent auraTarget = new TargetPlaneswalkerPermanent();
|
||||||
|
this.getSpellAbility().addTarget(auraTarget);
|
||||||
|
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||||
|
this.addAbility(new EnchantAbility(auraTarget));
|
||||||
|
|
||||||
|
// Enchanted planeswalker has "[-8]: Put all creature cards from all graveyards onto the battlefield under your control."
|
||||||
|
this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect(
|
||||||
|
new LoyaltyAbility(new LilianasTalentEffect(), -8),
|
||||||
|
AttachmentType.AURA, Duration.WhileOnBattlefield,
|
||||||
|
null, "planeswalker"
|
||||||
|
)));
|
||||||
|
|
||||||
|
// Whenever a creature deals damage to enchanted planeswalker, destroy that creature.
|
||||||
|
this.addAbility(new LilianasTalentTriggeredAbility());
|
||||||
|
}
|
||||||
|
|
||||||
|
private LilianasTalent(final LilianasTalent card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LilianasTalent copy() {
|
||||||
|
return new LilianasTalent(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LilianasTalentEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
LilianasTalentEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "put all creature cards from all graveyards onto the battlefield under your control";
|
||||||
|
}
|
||||||
|
|
||||||
|
private LilianasTalentEffect(final LilianasTalentEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LilianasTalentEffect copy() {
|
||||||
|
return new LilianasTalentEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
return player != null
|
||||||
|
&& player
|
||||||
|
.moveCards(
|
||||||
|
game.getState()
|
||||||
|
.getPlayersInRange(source.getControllerId(), game)
|
||||||
|
.stream()
|
||||||
|
.map(game::getPlayer)
|
||||||
|
.map(Player::getGraveyard)
|
||||||
|
.map(gy -> gy.getCards(StaticFilters.FILTER_CARD_CREATURE, game))
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.collect(Collectors.toSet()),
|
||||||
|
Zone.BATTLEFIELD, source, game
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LilianasTalentTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
LilianasTalentTriggeredAbility() {
|
||||||
|
super(Zone.BATTLEFIELD, new DestroyTargetEffect());
|
||||||
|
}
|
||||||
|
|
||||||
|
private LilianasTalentTriggeredAbility(final LilianasTalentTriggeredAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LilianasTalentTriggeredAbility copy() {
|
||||||
|
return new LilianasTalentTriggeredAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
if (!Optional
|
||||||
|
.of(this.getSourcePermanentIfItStillExists(game))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(Permanent::getAttachedTo)
|
||||||
|
.map(event.getTargetId()::equals)
|
||||||
|
.orElse(false)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||||
|
if (permanent == null || !permanent.isCreature(game)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.getEffects().setTargetPointer(new FixedTarget(permanent, game));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRule() {
|
||||||
|
return "Whenever a creature deals damage to enchanted planeswalker, destroy that creature.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -192,6 +192,7 @@ public final class MarchOfTheMachineCommander extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Krosan Verge", 412, Rarity.UNCOMMON, mage.cards.k.KrosanVerge.class));
|
cards.add(new SetCardInfo("Krosan Verge", 412, Rarity.UNCOMMON, mage.cards.k.KrosanVerge.class));
|
||||||
cards.add(new SetCardInfo("Kykar, Wind's Fury", 334, Rarity.MYTHIC, mage.cards.k.KykarWindsFury.class));
|
cards.add(new SetCardInfo("Kykar, Wind's Fury", 334, Rarity.MYTHIC, mage.cards.k.KykarWindsFury.class));
|
||||||
cards.add(new SetCardInfo("Liliana's Standard Bearer", 255, Rarity.RARE, mage.cards.l.LilianasStandardBearer.class));
|
cards.add(new SetCardInfo("Liliana's Standard Bearer", 255, Rarity.RARE, mage.cards.l.LilianasStandardBearer.class));
|
||||||
|
cards.add(new SetCardInfo("Liliana's Talent", 76, Rarity.RARE, mage.cards.l.LilianasTalent.class));
|
||||||
cards.add(new SetCardInfo("Llanowar Reborn", 413, Rarity.UNCOMMON, mage.cards.l.LlanowarReborn.class));
|
cards.add(new SetCardInfo("Llanowar Reborn", 413, Rarity.UNCOMMON, mage.cards.l.LlanowarReborn.class));
|
||||||
cards.add(new SetCardInfo("Locthwain Lancer", 27, Rarity.RARE, mage.cards.l.LocthwainLancer.class));
|
cards.add(new SetCardInfo("Locthwain Lancer", 27, Rarity.RARE, mage.cards.l.LocthwainLancer.class));
|
||||||
cards.add(new SetCardInfo("Managorger Hydra", 307, Rarity.RARE, mage.cards.m.ManagorgerHydra.class));
|
cards.add(new SetCardInfo("Managorger Hydra", 307, Rarity.RARE, mage.cards.m.ManagorgerHydra.class));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue