mirror of
https://github.com/correl/mage.git
synced 2025-01-13 11:01:58 +00:00
Implemented Chrome Replicator
This commit is contained in:
parent
71dce18df9
commit
dd10125d1c
2 changed files with 81 additions and 0 deletions
80
Mage.Sets/src/mage/cards/c/ChromeReplicator.java
Normal file
80
Mage.Sets/src/mage/cards/c/ChromeReplicator.java
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
package mage.cards.c;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
import mage.abilities.condition.Condition;
|
||||||
|
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||||
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
|
import mage.filter.predicate.Predicates;
|
||||||
|
import mage.filter.predicate.permanent.TokenPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.token.RetrofitterFoundryToken;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class ChromeReplicator extends CardImpl {
|
||||||
|
|
||||||
|
public ChromeReplicator(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.CONSTRUCT);
|
||||||
|
this.power = new MageInt(4);
|
||||||
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
// When Chrome Replicator enters the battlefield, if you control two or more nonland, nontoken permanents with the same name as one another, create a 4/4 colorless Construct artifact creature token.
|
||||||
|
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||||
|
new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new RetrofitterFoundryToken())),
|
||||||
|
ChromeReplicatorCondition.instance, "When {this} enters the battlefield, " +
|
||||||
|
"if you control two or more nonland, nontoken permanents with the same name as one another, " +
|
||||||
|
"create a 4/4 colorless Construct artifact creature token."
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ChromeReplicator(final ChromeReplicator card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ChromeReplicator copy() {
|
||||||
|
return new ChromeReplicator(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ChromeReplicatorCondition implements Condition {
|
||||||
|
instance;
|
||||||
|
private static final FilterPermanent filter = new FilterControlledPermanent();
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(Predicates.not(CardType.LAND.getPredicate()));
|
||||||
|
filter.add(Predicates.not(TokenPredicate.instance));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Map<String, Integer> nameMap = new HashMap<>();
|
||||||
|
return game
|
||||||
|
.getBattlefield()
|
||||||
|
.getActivePermanents(
|
||||||
|
filter, source.getControllerId(), source.getSourceId(), game
|
||||||
|
).stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(MageObject::getName)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(s -> !"".equals(s))
|
||||||
|
.anyMatch(s -> nameMap.compute(s, (x, i) -> i == null ? 1 : Integer.sum(i, 1)) >= 2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -69,6 +69,7 @@ public final class CoreSet2021 extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Chandra, Flame's Catalyst", 332, Rarity.MYTHIC, mage.cards.c.ChandraFlamesCatalyst.class));
|
cards.add(new SetCardInfo("Chandra, Flame's Catalyst", 332, Rarity.MYTHIC, mage.cards.c.ChandraFlamesCatalyst.class));
|
||||||
cards.add(new SetCardInfo("Chandra, Heart of Fire", 135, Rarity.MYTHIC, mage.cards.c.ChandraHeartOfFire.class));
|
cards.add(new SetCardInfo("Chandra, Heart of Fire", 135, Rarity.MYTHIC, mage.cards.c.ChandraHeartOfFire.class));
|
||||||
cards.add(new SetCardInfo("Chromatic Orrery", 228, Rarity.MYTHIC, mage.cards.c.ChromaticOrrery.class));
|
cards.add(new SetCardInfo("Chromatic Orrery", 228, Rarity.MYTHIC, mage.cards.c.ChromaticOrrery.class));
|
||||||
|
cards.add(new SetCardInfo("Chrome Replicator", 229, Rarity.UNCOMMON, mage.cards.c.ChromeReplicator.class));
|
||||||
cards.add(new SetCardInfo("Colossal Dreadmaw", 176, Rarity.COMMON, mage.cards.c.ColossalDreadmaw.class));
|
cards.add(new SetCardInfo("Colossal Dreadmaw", 176, Rarity.COMMON, mage.cards.c.ColossalDreadmaw.class));
|
||||||
cards.add(new SetCardInfo("Conclave Mentor", 216, Rarity.UNCOMMON, mage.cards.c.ConclaveMentor.class));
|
cards.add(new SetCardInfo("Conclave Mentor", 216, Rarity.UNCOMMON, mage.cards.c.ConclaveMentor.class));
|
||||||
cards.add(new SetCardInfo("Concordia Pegasus", 12, Rarity.COMMON, mage.cards.c.ConcordiaPegasus.class));
|
cards.add(new SetCardInfo("Concordia Pegasus", 12, Rarity.COMMON, mage.cards.c.ConcordiaPegasus.class));
|
||||||
|
|
Loading…
Reference in a new issue