[DRC] implement Aetheric Amplifier (#13316)

This commit is contained in:
Mikołaj Sobiech 2025-02-08 23:10:03 +01:00 committed by GitHub
parent bc120a34c7
commit 57c1fc9ef2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 150 additions and 0 deletions

View file

@ -0,0 +1,149 @@
package mage.cards.a;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.mana.AnyColorManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
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;
/**
* @author sobiech
*/
public final class AethericAmplifier extends CardImpl {
public AethericAmplifier(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// {T}: Add one mana of any color.
this.addAbility(new AnyColorManaAbility());
// {4}, {T}: Choose one. Activate only as a sorcery.
// * Double the number of each kind of counter on target permanent.
final Ability ability = new ActivateAsSorceryActivatedAbility(new AethericAmplifierDoublePermanentEffect(), new GenericManaCost(4))
.withShowActivateText(false);
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPermanent());
ability.getModes().setChooseText("choose one. Activate only as a sorcery.");
// * Double the number of each kind of counter you have.
ability.addMode(new Mode(new AethericAmplifierDoubleControllerEffect()));
this.addAbility(ability);
}
private AethericAmplifier(final AethericAmplifier card) {
super(card);
}
@Override
public AethericAmplifier copy() {
return new AethericAmplifier(this);
}
}
class AethericAmplifierDoublePermanentEffect extends OneShotEffect {
AethericAmplifierDoublePermanentEffect() {
super(Outcome.Benefit);
this.staticText = "double the number of each kind of counter on target permanent";
}
private AethericAmplifierDoublePermanentEffect(OneShotEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
final Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (permanent == null) {
return false;
}
final Set<Counter> counters = permanent
.getCounters(game)
.values()
.stream()
.map(counter -> CounterType
.findByName(counter.getName())
.createInstance(counter.getCount()))
.collect(Collectors.toSet());
if (counters.isEmpty()) {
return false;
}
counters.forEach(counter -> permanent.addCounters(counter, source, game));
return true;
}
@Override
public AethericAmplifierDoublePermanentEffect copy() {
return new AethericAmplifierDoublePermanentEffect(this);
}
}
class AethericAmplifierDoubleControllerEffect extends OneShotEffect {
AethericAmplifierDoubleControllerEffect() {
super(Outcome.Benefit);
this.staticText = "double the number of each kind of counter you have";
}
private AethericAmplifierDoubleControllerEffect(OneShotEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
final Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
final Set<Counter> counters = controller.getCountersAsCopy()
.values()
.stream()
.map(counter -> CounterType
.findByName(counter.getName())
.createInstance(counter.getCount()))
.collect(Collectors.toSet());
if (counters.isEmpty()) {
return false;
}
counters.forEach(counter -> controller.addCounters(
counter,
source.getControllerId(),
source,
game));
return true;
}
@Override
public AethericAmplifierDoubleControllerEffect copy() {
return new AethericAmplifierDoubleControllerEffect(this);
}
}

View file

@ -25,6 +25,7 @@ public final class AetherdriftCommander extends ExpansionSet {
cards.add(new SetCardInfo("Adarkar Wastes", 144, Rarity.RARE, mage.cards.a.AdarkarWastes.class));
cards.add(new SetCardInfo("Aether Hub", 145, Rarity.UNCOMMON, mage.cards.a.AetherHub.class));
cards.add(new SetCardInfo("Aetherflux Conduit", 17, Rarity.RARE, mage.cards.a.AetherfluxConduit.class));
cards.add(new SetCardInfo("Aetheric Amplifier", 18, Rarity.RARE, mage.cards.a.AethericAmplifier.class));
cards.add(new SetCardInfo("Aethersquall Ancient", 68, Rarity.RARE, mage.cards.a.AethersquallAncient.class));
cards.add(new SetCardInfo("Aethertide Whale", 69, Rarity.RARE, mage.cards.a.AethertideWhale.class));
cards.add(new SetCardInfo("Aetherwind Basker", 107, Rarity.MYTHIC, mage.cards.a.AetherwindBasker.class));