mirror of
https://github.com/correl/mage.git
synced 2024-12-30 19:10:36 +00:00
[NEO] Implemented Dramatist's Puppet
This commit is contained in:
parent
a978cf8851
commit
93d5fd7404
3 changed files with 122 additions and 31 deletions
94
Mage.Sets/src/mage/cards/d/DramatistsPuppet.java
Normal file
94
Mage.Sets/src/mage/cards/d/DramatistsPuppet.java
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
package mage.cards.d;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
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.counters.Counter;
|
||||||
|
import mage.counters.CounterType;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class DramatistsPuppet extends CardImpl {
|
||||||
|
|
||||||
|
public DramatistsPuppet(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.CONSTRUCT);
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
// When Dramatist's Puppet enters the battlefield, for each kind of counter on target permanent, put another counter of that kind on it or remove one from it.
|
||||||
|
Ability ability = new EntersBattlefieldTriggeredAbility(new DramatistsPuppetEffect());
|
||||||
|
ability.addTarget(new TargetPermanent());
|
||||||
|
this.addAbility(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DramatistsPuppet(final DramatistsPuppet card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DramatistsPuppet copy() {
|
||||||
|
return new DramatistsPuppet(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DramatistsPuppetEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
DramatistsPuppetEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.staticText = "for each kind of counter on target permanent, " +
|
||||||
|
"put another counter of that kind on it or remove one from it";
|
||||||
|
}
|
||||||
|
|
||||||
|
private DramatistsPuppetEffect(final DramatistsPuppetEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DramatistsPuppetEffect copy() {
|
||||||
|
return new DramatistsPuppetEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
|
if (controller == null || permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<String> counterNames = permanent
|
||||||
|
.getCounters(game)
|
||||||
|
.values()
|
||||||
|
.stream()
|
||||||
|
.map(Counter::getName)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
for (String counterName : counterNames) {
|
||||||
|
Counter newCounter = CounterType.findByName(counterName).createInstance();
|
||||||
|
if (controller.chooseUse(
|
||||||
|
Outcome.BoostCreature, "Add or remove a " + counterName + " counter?",
|
||||||
|
null, "Add", "Remove", source, game
|
||||||
|
)) {
|
||||||
|
permanent.addCounters(newCounter, source.getControllerId(), source, game);
|
||||||
|
} else {
|
||||||
|
permanent.removeCounters(newCounter, source, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
package mage.cards.q;
|
package mage.cards.q;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
@ -9,18 +8,20 @@ import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
import mage.counters.Counter;
|
import mage.counters.Counter;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.counters.Counters;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Styxo
|
* @author Styxo
|
||||||
*/
|
*/
|
||||||
public final class QuarryHauler extends CardImpl {
|
public final class QuarryHauler extends CardImpl {
|
||||||
|
@ -52,7 +53,8 @@ class QuarryHaulerEffect extends OneShotEffect {
|
||||||
|
|
||||||
public QuarryHaulerEffect() {
|
public QuarryHaulerEffect() {
|
||||||
super(Outcome.BoostCreature);
|
super(Outcome.BoostCreature);
|
||||||
this.staticText = "for each kind of counter on target permanent, put another counter of that kind on it or remove one from it";
|
this.staticText = "for each kind of counter on target permanent, " +
|
||||||
|
"put another counter of that kind on it or remove one from it";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,33 +71,27 @@ class QuarryHaulerEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null) {
|
if (controller == null || permanent == null) {
|
||||||
if (permanent != null) {
|
return false;
|
||||||
Counters counters = permanent.getCounters(game).copy();
|
|
||||||
CounterType counterType;
|
|
||||||
for (Counter counter : counters.values()) {
|
|
||||||
if (controller.chooseUse(Outcome.BoostCreature, "Choose whether to add or remove a " + counter.getName() + " counter", null, "Add", "Remove", source, game)) {
|
|
||||||
counterType = CounterType.findByName(counter.getName());
|
|
||||||
Counter counterToAdd;
|
|
||||||
if (counterType != null) {
|
|
||||||
counterToAdd = counterType.createInstance();
|
|
||||||
} else {
|
|
||||||
counterToAdd = new Counter(counter.getName());
|
|
||||||
}
|
|
||||||
permanent.addCounters(counterToAdd, source.getControllerId(), source, game);
|
|
||||||
} else {
|
|
||||||
counterType = CounterType.findByName(counter.getName());
|
|
||||||
if (counterType != null) {
|
|
||||||
permanent.removeCounters(counterType.createInstance(), source, game);
|
|
||||||
} else {
|
|
||||||
permanent.removeCounters(counter.getName(), 1, source, game);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
List<String> counterNames = permanent
|
||||||
|
.getCounters(game)
|
||||||
|
.values()
|
||||||
|
.stream()
|
||||||
|
.map(Counter::getName)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
for (String counterName : counterNames) {
|
||||||
|
Counter newCounter = CounterType.findByName(counterName).createInstance();
|
||||||
|
if (controller.chooseUse(
|
||||||
|
Outcome.BoostCreature, "Add or remove a " + counterName + " counter?",
|
||||||
|
null, "Add", "Remove", source, game
|
||||||
|
)) {
|
||||||
|
permanent.addCounters(newCounter, source.getControllerId(), source, game);
|
||||||
|
} else {
|
||||||
|
permanent.removeCounters(newCounter, source, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Dokuchi Silencer", 95, Rarity.UNCOMMON, mage.cards.d.DokuchiSilencer.class));
|
cards.add(new SetCardInfo("Dokuchi Silencer", 95, Rarity.UNCOMMON, mage.cards.d.DokuchiSilencer.class));
|
||||||
cards.add(new SetCardInfo("Dragonfly Suit", 9, Rarity.COMMON, mage.cards.d.DragonflySuit.class));
|
cards.add(new SetCardInfo("Dragonfly Suit", 9, Rarity.COMMON, mage.cards.d.DragonflySuit.class));
|
||||||
cards.add(new SetCardInfo("Dragonspark Reactor", 137, Rarity.UNCOMMON, mage.cards.d.DragonsparkReactor.class));
|
cards.add(new SetCardInfo("Dragonspark Reactor", 137, Rarity.UNCOMMON, mage.cards.d.DragonsparkReactor.class));
|
||||||
|
cards.add(new SetCardInfo("Dramatist's Puppet", 244, Rarity.COMMON, mage.cards.d.DramatistsPuppet.class));
|
||||||
cards.add(new SetCardInfo("Echo of Death's Wail", 124, Rarity.RARE, mage.cards.e.EchoOfDeathsWail.class));
|
cards.add(new SetCardInfo("Echo of Death's Wail", 124, Rarity.RARE, mage.cards.e.EchoOfDeathsWail.class));
|
||||||
cards.add(new SetCardInfo("Ecologist's Terrarium", 246, Rarity.COMMON, mage.cards.e.EcologistsTerrarium.class));
|
cards.add(new SetCardInfo("Ecologist's Terrarium", 246, Rarity.COMMON, mage.cards.e.EcologistsTerrarium.class));
|
||||||
cards.add(new SetCardInfo("Eiganjo Exemplar", 10, Rarity.COMMON, mage.cards.e.EiganjoExemplar.class));
|
cards.add(new SetCardInfo("Eiganjo Exemplar", 10, Rarity.COMMON, mage.cards.e.EiganjoExemplar.class));
|
||||||
|
|
Loading…
Reference in a new issue