mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Implemented The Elderspell
This commit is contained in:
parent
e90c8071fc
commit
fe83f6ac25
3 changed files with 94 additions and 0 deletions
87
Mage.Sets/src/mage/cards/t/TheElderspell.java
Normal file
87
Mage.Sets/src/mage/cards/t/TheElderspell.java
Normal file
|
@ -0,0 +1,87 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledPlaneswalkerPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TheElderspell extends CardImpl {
|
||||
|
||||
public TheElderspell(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}{B}");
|
||||
|
||||
// Destroy any number of target planeswalkers. Choose a planeswalker you control. Put two loyalty counters on it for each planeswalker destroyed this way.
|
||||
this.getSpellAbility().addEffect(new TheElderspellEffect());
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(
|
||||
0, Integer.MAX_VALUE, StaticFilters.FILTER_PERMANENT_PLANESWALKERS, false
|
||||
));
|
||||
}
|
||||
|
||||
private TheElderspell(final TheElderspell card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TheElderspell copy() {
|
||||
return new TheElderspell(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TheElderspellEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterPermanent filter = new FilterControlledPlaneswalkerPermanent();
|
||||
|
||||
TheElderspellEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Destroy any number of target planeswalkers. Choose a planeswalker you control. " +
|
||||
"Put two loyalty counters on it for each planeswalker destroyed this way.";
|
||||
}
|
||||
|
||||
private TheElderspellEffect(final TheElderspellEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TheElderspellEffect copy() {
|
||||
return new TheElderspellEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
int count = 0;
|
||||
for (UUID permId : source.getTargets().get(0).getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permId);
|
||||
if (permanent != null && permanent.destroy(source.getSourceId(), game, false)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
TargetPermanent targetPermanent = new TargetPermanent(filter);
|
||||
if (!player.choose(outcome, targetPermanent, source.getSourceId(), game)) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(targetPermanent.getFirstTarget());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
return permanent.addCounters(CounterType.LOYALTY.createInstance(2 * count), source, game);
|
||||
}
|
||||
}
|
|
@ -205,6 +205,7 @@ public final class WarOfTheSpark extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Teyo's Lightshield", 33, Rarity.COMMON, mage.cards.t.TeyosLightshield.class));
|
||||
cards.add(new SetCardInfo("Teyo, the Shieldmage", 32, Rarity.UNCOMMON, mage.cards.t.TeyoTheShieldmage.class));
|
||||
cards.add(new SetCardInfo("Tezzeret, Master of the Bridge", 275, Rarity.MYTHIC, mage.cards.t.TezzeretMasterOfTheBridge.class));
|
||||
cards.add(new SetCardInfo("The Elderspell", 89, Rarity.RARE, mage.cards.t.TheElderspell.class));
|
||||
cards.add(new SetCardInfo("The Wanderer", 37, Rarity.UNCOMMON, mage.cards.t.TheWanderer.class));
|
||||
cards.add(new SetCardInfo("Thundering Ceratok", 179, Rarity.COMMON, mage.cards.t.ThunderingCeratok.class));
|
||||
cards.add(new SetCardInfo("Tibalt's Rager", 147, Rarity.UNCOMMON, mage.cards.t.TibaltsRager.class));
|
||||
|
|
|
@ -417,6 +417,12 @@ public final class StaticFilters {
|
|||
FILTER_PERMANENT_PLANESWALKER.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterPlaneswalkerPermanent FILTER_PERMANENT_PLANESWALKERS = new FilterPlaneswalkerPermanent("planeswalkers");
|
||||
|
||||
static {
|
||||
FILTER_PERMANENT_PLANESWALKERS.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterNonlandPermanent FILTER_PERMANENT_NON_LAND = new FilterNonlandPermanent();
|
||||
|
||||
static {
|
||||
|
|
Loading…
Reference in a new issue