Implemented Liliana's Scrounger

This commit is contained in:
Evan Kranzler 2020-06-06 17:18:40 -04:00
parent bb3e58994b
commit d1da9ad843
2 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,90 @@
package mage.cards.l;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.common.MorbidCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPlaneswalkerPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.watchers.common.MorbidWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class LilianasScrounger extends CardImpl {
public LilianasScrounger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// At the beginning of each end step, if a creature died this turn, you may put a loyalty counter on a Liliana planeswalker you control.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new BeginningOfEndStepTriggeredAbility(
new LilianasScroungerEffect(), TargetController.ANY, false
), MorbidCondition.instance, "At the beginning of each end step, " +
"if a creature died this turn, you may put a loyalty counter on a Liliana planeswalker you control."
), new MorbidWatcher());
}
private LilianasScrounger(final LilianasScrounger card) {
super(card);
}
@Override
public LilianasScrounger copy() {
return new LilianasScrounger(this);
}
}
class LilianasScroungerEffect extends OneShotEffect {
private static final FilterPermanent filter
= new FilterControlledPlaneswalkerPermanent(SubType.LILIANA, "Liliana planeswalker you control");
LilianasScroungerEffect() {
super(Outcome.Benefit);
}
private LilianasScroungerEffect(final LilianasScroungerEffect effect) {
super(effect);
}
@Override
public LilianasScroungerEffect copy() {
return new LilianasScroungerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || game.getBattlefield().count(
filter, source.getSourceId(), source.getControllerId(), game
) < 1 || !player.chooseUse(
outcome, "Put a loyalty counter on a Liliana planeswalker you control?", source, game
)) {
return false;
}
TargetPermanent target = new TargetPermanent(0, 1, filter, true);
player.choose(outcome, target, source.getSourceId(), game);
Permanent permanent = game.getPermanent(target.getFirstTarget());
return permanent != null && permanent.addCounters(CounterType.LOYALTY.createInstance(), source, game);
}
}

View file

@ -46,6 +46,7 @@ public final class CoreSet2021 extends ExpansionSet {
cards.add(new SetCardInfo("Indulging Patrician", 219, Rarity.UNCOMMON, mage.cards.i.IndulgingPatrician.class));
cards.add(new SetCardInfo("Island", 310, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Jeskai Elder", 53, Rarity.UNCOMMON, mage.cards.j.JeskaiElder.class));
cards.add(new SetCardInfo("Liliana's Scrounger", 330, Rarity.UNCOMMON, mage.cards.l.LilianasScrounger.class));
cards.add(new SetCardInfo("Llanowar Visionary", 193, Rarity.COMMON, mage.cards.l.LlanowarVisionary.class));
cards.add(new SetCardInfo("Mangara, the Diplomat", 27, Rarity.MYTHIC, mage.cards.m.MangaraTheDiplomat.class));
cards.add(new SetCardInfo("Mystic Skyfish", 326, Rarity.COMMON, mage.cards.m.MysticSkyfish.class));