mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
[MKM] Implement Doppelgang
This commit is contained in:
parent
9fa7d257d6
commit
d9f9bf0e60
2 changed files with 84 additions and 0 deletions
83
Mage.Sets/src/mage/cards/d/Doppelgang.java
Normal file
83
Mage.Sets/src/mage/cards/d/Doppelgang.java
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
package mage.cards.d;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.target.TargetPermanent;
|
||||||
|
import mage.target.targetadjustment.TargetAdjuster;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class Doppelgang extends CardImpl {
|
||||||
|
|
||||||
|
public Doppelgang(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{X}{X}{G}{U}");
|
||||||
|
|
||||||
|
// For each of X target permanents, create X tokens that are copies of that permanent.
|
||||||
|
this.getSpellAbility().addEffect(new DoppelgangEffect());
|
||||||
|
this.getSpellAbility().setTargetAdjuster(DoppelgangAdjuster.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Doppelgang(final Doppelgang card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Doppelgang copy() {
|
||||||
|
return new Doppelgang(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DoppelgangAdjuster implements TargetAdjuster {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
|
ability.getTargets().clear();
|
||||||
|
ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), StaticFilters.FILTER_PERMANENTS));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DoppelgangEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
DoppelgangEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "create X tokens that are copies of that permanent";
|
||||||
|
}
|
||||||
|
|
||||||
|
private DoppelgangEffect(final DoppelgangEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DoppelgangEffect copy() {
|
||||||
|
return new DoppelgangEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
int xValue = source.getManaCostsToPay().getX();
|
||||||
|
if (xValue < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (UUID permanentId : getTargetPointer().getTargets(game, source)) {
|
||||||
|
Permanent permanent = game.getPermanent(permanentId);
|
||||||
|
if (permanent != null) {
|
||||||
|
new CreateTokenCopyTargetEffect(
|
||||||
|
null, null, false, xValue
|
||||||
|
).setSavedPermanent(permanent).apply(game, source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -41,6 +41,7 @@ public final class MurdersAtKarlovManor extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Defenestrated Phantom", 11, Rarity.COMMON, mage.cards.d.DefenestratedPhantom.class));
|
cards.add(new SetCardInfo("Defenestrated Phantom", 11, Rarity.COMMON, mage.cards.d.DefenestratedPhantom.class));
|
||||||
cards.add(new SetCardInfo("Demand Answers", 122, Rarity.COMMON, mage.cards.d.DemandAnswers.class));
|
cards.add(new SetCardInfo("Demand Answers", 122, Rarity.COMMON, mage.cards.d.DemandAnswers.class));
|
||||||
cards.add(new SetCardInfo("Dog Walker", 197, Rarity.COMMON, mage.cards.d.DogWalker.class));
|
cards.add(new SetCardInfo("Dog Walker", 197, Rarity.COMMON, mage.cards.d.DogWalker.class));
|
||||||
|
cards.add(new SetCardInfo("Doppelgang", 198, Rarity.RARE, mage.cards.d.Doppelgang.class));
|
||||||
cards.add(new SetCardInfo("Elegant Parlor", 260, Rarity.RARE, mage.cards.e.ElegantParlor.class));
|
cards.add(new SetCardInfo("Elegant Parlor", 260, Rarity.RARE, mage.cards.e.ElegantParlor.class));
|
||||||
cards.add(new SetCardInfo("Essence of Antiquity", 15, Rarity.UNCOMMON, mage.cards.e.EssenceOfAntiquity.class));
|
cards.add(new SetCardInfo("Essence of Antiquity", 15, Rarity.UNCOMMON, mage.cards.e.EssenceOfAntiquity.class));
|
||||||
cards.add(new SetCardInfo("Faerie Snoop", 203, Rarity.COMMON, mage.cards.f.FaerieSnoop.class));
|
cards.add(new SetCardInfo("Faerie Snoop", 203, Rarity.COMMON, mage.cards.f.FaerieSnoop.class));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue