mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
[SNC] Implemented Ledger Shredder
This commit is contained in:
parent
495a0ab776
commit
75bd6cf906
6 changed files with 142 additions and 25 deletions
|
@ -56,7 +56,7 @@ public final class HowlingMoon extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class HowlingMoonTriggeredAbility extends TriggeredAbilityImpl {
|
class HowlingMoonTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
// TODO: replace this and others like it with CastSecondSpellTriggeredAbility
|
||||||
public HowlingMoonTriggeredAbility() {
|
public HowlingMoonTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, new CreateTokenEffect(new WolfToken()));
|
super(Zone.BATTLEFIELD, new CreateTokenEffect(new WolfToken()));
|
||||||
}
|
}
|
||||||
|
|
43
Mage.Sets/src/mage/cards/l/LedgerShredder.java
Normal file
43
Mage.Sets/src/mage/cards/l/LedgerShredder.java
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
package mage.cards.l;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.common.CastSecondSpellTriggeredAbility;
|
||||||
|
import mage.abilities.effects.keyword.ConniveSourceEffect;
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.TargetController;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class LedgerShredder extends CardImpl {
|
||||||
|
|
||||||
|
public LedgerShredder(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.BIRD);
|
||||||
|
this.subtype.add(SubType.ADVISOR);
|
||||||
|
this.power = new MageInt(1);
|
||||||
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
// Flying
|
||||||
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
|
// Whenever a player casts their second spell each turn, Ledger Shredder connives.
|
||||||
|
this.addAbility(new CastSecondSpellTriggeredAbility(new ConniveSourceEffect(), TargetController.ANY));
|
||||||
|
}
|
||||||
|
|
||||||
|
private LedgerShredder(final LedgerShredder card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LedgerShredder copy() {
|
||||||
|
return new LedgerShredder(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,6 +31,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Island", 264, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Island", 264, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Jetmir's Garden", 250, Rarity.RARE, mage.cards.j.JetmirsGarden.class));
|
cards.add(new SetCardInfo("Jetmir's Garden", 250, Rarity.RARE, mage.cards.j.JetmirsGarden.class));
|
||||||
cards.add(new SetCardInfo("Jetmir, Nexus of Revels", 193, Rarity.MYTHIC, mage.cards.j.JetmirNexusOfRevels.class));
|
cards.add(new SetCardInfo("Jetmir, Nexus of Revels", 193, Rarity.MYTHIC, mage.cards.j.JetmirNexusOfRevels.class));
|
||||||
|
cards.add(new SetCardInfo("Ledger Shredder", 46, Rarity.RARE, mage.cards.l.LedgerShredder.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("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("Mountain", 268, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Mountain", 268, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
|
||||||
|
|
|
@ -6,6 +6,7 @@ import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.hint.Hint;
|
import mage.abilities.hint.Hint;
|
||||||
import mage.abilities.hint.ValueHint;
|
import mage.abilities.hint.ValueHint;
|
||||||
|
import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
@ -17,19 +18,28 @@ import mage.watchers.common.CastSpellLastTurnWatcher;
|
||||||
public class CastSecondSpellTriggeredAbility extends TriggeredAbilityImpl {
|
public class CastSecondSpellTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
private static final Hint hint = new ValueHint("Spells you cast this turn", SpellCastValue.instance);
|
private static final Hint hint = new ValueHint("Spells you cast this turn", SpellCastValue.instance);
|
||||||
|
private final TargetController targetController;
|
||||||
|
|
||||||
public CastSecondSpellTriggeredAbility(Effect effect) {
|
public CastSecondSpellTriggeredAbility(Effect effect) {
|
||||||
this(Zone.BATTLEFIELD, effect, false);
|
this(effect, TargetController.YOU);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CastSecondSpellTriggeredAbility(Zone zone, Effect effect, boolean optional) {
|
public CastSecondSpellTriggeredAbility(Effect effect, TargetController targetController) {
|
||||||
|
this(Zone.BATTLEFIELD, effect, targetController, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CastSecondSpellTriggeredAbility(Zone zone, Effect effect, TargetController targetController, boolean optional) {
|
||||||
super(zone, effect, optional);
|
super(zone, effect, optional);
|
||||||
this.addWatcher(new CastSpellLastTurnWatcher());
|
this.addWatcher(new CastSpellLastTurnWatcher());
|
||||||
this.addHint(hint);
|
if (targetController == TargetController.YOU) {
|
||||||
|
this.addHint(hint);
|
||||||
|
}
|
||||||
|
this.targetController = targetController;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CastSecondSpellTriggeredAbility(final CastSecondSpellTriggeredAbility ability) {
|
private CastSecondSpellTriggeredAbility(final CastSecondSpellTriggeredAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
|
this.targetController = ability.targetController;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,8 +49,21 @@ public class CastSecondSpellTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (!isControlledBy(event.getPlayerId())) {
|
switch (targetController) {
|
||||||
return false;
|
case YOU:
|
||||||
|
if (!isControlledBy(event.getPlayerId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OPPONENT:
|
||||||
|
if (!game.getOpponents(getControllerId()).contains(event.getPlayerId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ANY:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("TargetController " + targetController + " not supported");
|
||||||
}
|
}
|
||||||
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
|
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
|
||||||
return watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2;
|
return watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2;
|
||||||
|
@ -48,7 +71,16 @@ public class CastSecondSpellTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTriggerPhrase() {
|
public String getTriggerPhrase() {
|
||||||
return "Whenever you cast your second spell each turn, " ;
|
switch (targetController) {
|
||||||
|
case YOU:
|
||||||
|
return "Whenever you cast your second spell each turn, ";
|
||||||
|
case OPPONENT:
|
||||||
|
return "Whenever an opponent casts their second spell each turn, ";
|
||||||
|
case ANY:
|
||||||
|
return "Whenever a player casts their second spell each turn, ";
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("TargetController " + targetController + " not supported");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package mage.abilities.effects.keyword;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.counters.CounterType;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public class ConniveSourceEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public ConniveSourceEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "{this} connives. <i>(Draw a card, then discard a card. " +
|
||||||
|
"If you discarded a nonland card, put a +1/+1 counter on this creature.)</i>";
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConniveSourceEffect(final ConniveSourceEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConniveSourceEffect copy() {
|
||||||
|
return new ConniveSourceEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||||
|
if (permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return permanent != null && connive(permanent, 1, source, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean connive(Permanent permanent, int amount, Ability source, Game game) {
|
||||||
|
if (amount < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Player player = game.getPlayer(permanent.getControllerId());
|
||||||
|
if (player == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
player.drawCards(amount, source, game);
|
||||||
|
int counters = player
|
||||||
|
.discard(amount, false, false, source, game)
|
||||||
|
.count(StaticFilters.FILTER_CARDS_NON_LAND, game);
|
||||||
|
if (counters > 0) {
|
||||||
|
permanent.addCounters(CounterType.P1P1.createInstance(counters), source, game);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,11 +6,8 @@ import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.counters.CounterType;
|
|
||||||
import mage.filter.StaticFilters;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -44,22 +41,8 @@ public class ConniveTargetEffect extends OneShotEffect {
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Player player = game.getPlayer(permanent.getControllerId());
|
|
||||||
if (player == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int amount = xValue.calculate(game, source, this);
|
int amount = xValue.calculate(game, source, this);
|
||||||
if (amount < 1) {
|
return amount > 0 && ConniveSourceEffect.connive(permanent, amount, source, game);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
player.drawCards(amount, source, game);
|
|
||||||
int counters = player.discard(
|
|
||||||
amount, false, false, source, game
|
|
||||||
).count(StaticFilters.FILTER_CARDS_NON_LAND, game);
|
|
||||||
if (counters > 0) {
|
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(counters), source, game);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue