Merge pull request #5049 from NoahGleason/neurok-transmuter

Implement Neurok Transmuter
This commit is contained in:
theelk801 2018-06-22 17:57:45 -04:00 committed by GitHub
commit 42354c1583
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 204 additions and 58 deletions

View file

@ -12,6 +12,7 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.FortifyAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -53,7 +54,7 @@ public final class DarksteelGarrison extends CardImpl {
this.addAbility(ability);
// Fortify {3}
this.addAbility(new FortifyAbility(Outcome.AddAbility, new GenericManaCost(3)));
this.addAbility(new FortifyAbility(3));
}
@ -66,49 +67,3 @@ public final class DarksteelGarrison extends CardImpl {
return new DarksteelGarrison(this);
}
}
class FortifyAbility extends ActivatedAbilityImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("land you control");
static {
filter.add(new CardTypePredicate(CardType.LAND));
}
public FortifyAbility(Outcome outcome, Cost cost) {
this(outcome, cost, new TargetControlledPermanent(filter));
}
public FortifyAbility(Outcome outcome, Cost cost, Target target) {
super(Zone.BATTLEFIELD, new AttachEffect(outcome, "Fortify"), cost);
this.addTarget(target);
this.timing = TimingRule.SORCERY;
}
@Override
public ActivationStatus canActivate(UUID playerId, Game game) {
ActivationStatus activationStatus = super.canActivate(playerId, game);
if (activationStatus.canActivate()) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.hasSubtype(SubType.FORTIFICATION, game)) {
return activationStatus;
}
}
return ActivationStatus.getFalse();
}
public FortifyAbility(final FortifyAbility ability) {
super(ability);
}
@Override
public FortifyAbility copy() {
return new FortifyAbility(this);
}
@Override
public String getRule() {
return "Fortify " + costs.getText() + manaCosts.getText() + " (" + manaCosts.getText() + ": <i>Attach to target land you control. Fortify only as a sorcery.)</i>";
}
}

View file

@ -0,0 +1,71 @@
package mage.cards.n;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ColoredManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.AddCardTypeTargetEffect;
import mage.abilities.effects.common.continuous.BecomesColorTargetEffect;
import mage.abilities.effects.common.continuous.LoseArtifactTypeTargetEffect;
import mage.abilities.effects.common.continuous.LoseCreatureTypeSourceEffect;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetArtifactPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author noahg
*/
public final class NeurokTransmuter extends CardImpl {
final static FilterCreaturePermanent filter = new FilterCreaturePermanent("artifact creature");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public NeurokTransmuter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {U}: Target creature becomes an artifact in addition to its other types until end of turn.
Ability becomeArtifactAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.ARTIFACT), new ManaCostsImpl("{U}"));
becomeArtifactAbility.addTarget(new TargetCreaturePermanent());
this.addAbility(becomeArtifactAbility);
// {U}: Until end of turn, target artifact creature becomes blue and isn't an artifact.
Effect blueEffect = new BecomesColorTargetEffect(ObjectColor.BLUE, Duration.EndOfTurn);
blueEffect.setText("Until end of turn, target artifact creature becomes blue and ");
Ability becomeBlueAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, blueEffect, new ManaCostsImpl("{U}"));
becomeBlueAbility.addTarget(new TargetCreaturePermanent(filter));
Effect loseArtifactEffect = new LoseArtifactTypeTargetEffect(Duration.EndOfTurn);
loseArtifactEffect.setText("isn't an artifact");
becomeBlueAbility.addEffect(loseArtifactEffect);
this.addAbility(becomeBlueAbility);
}
public NeurokTransmuter(final NeurokTransmuter card) {
super(card);
}
@Override
public NeurokTransmuter copy() {
return new NeurokTransmuter(this);
}
}

View file

@ -114,6 +114,7 @@ public final class Darksteel extends ExpansionSet {
cards.add(new SetCardInfo("Myr Moonvessel", 133, Rarity.COMMON, mage.cards.m.MyrMoonvessel.class));
cards.add(new SetCardInfo("Nemesis Mask", 134, Rarity.UNCOMMON, mage.cards.n.NemesisMask.class));
cards.add(new SetCardInfo("Neurok Prodigy", 26, Rarity.COMMON, mage.cards.n.NeurokProdigy.class));
cards.add(new SetCardInfo("Neurok Transmuter", 27, Rarity.UNCOMMON, mage.cards.n.NeurokTransmuter.class));
cards.add(new SetCardInfo("Nim Abomination", 49, Rarity.UNCOMMON, mage.cards.n.NimAbomination.class));
cards.add(new SetCardInfo("Nourish", 78, Rarity.COMMON, mage.cards.n.Nourish.class));
cards.add(new SetCardInfo("Oxidda Golem", 135, Rarity.COMMON, mage.cards.o.OxiddaGolem.class));

View file

@ -0,0 +1,77 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.util.CardUtil;
import java.util.UUID;
/**
*
* @author noahg
*/
public class LoseArtifactTypeTargetEffect extends ContinuousEffectImpl{
public LoseArtifactTypeTargetEffect(Duration duration) {
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
dependencyTypes.add(DependencyType.ArtifactAddingRemoving);
setText("isn't an artifact");
}
public LoseArtifactTypeTargetEffect(final LoseArtifactTypeTargetEffect effect) {
super(effect);
}
@Override
public LoseArtifactTypeTargetEffect copy() {
return new LoseArtifactTypeTargetEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game); //To change body of generated methods, choose Tools | Templates.
if (duration.isOnlyValidIfNoZoneChange()) {
// If source permanent is no longer onto battlefield discard the effect
if (source.getSourcePermanentIfItStillExists(game) == null) {
discard();
}
}
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
for (UUID targetId : targetPointer.getTargets(game, source)) {
if (targetId != null) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
permanent.getCardType().remove(CardType.ARTIFACT);
permanent.getSubtype(game).removeAll(SubType.getArtifactTypes(false));
}
break;
}
return true;
}
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.TypeChangingEffects_4;
}
}

View file

@ -35,14 +35,12 @@ public class EquipAbility extends ActivatedAbilityImpl {
@Override
public ActivationStatus canActivate(UUID playerId, Game game) {
ActivationStatus activationStatus = super.canActivate(playerId, game);
if (activationStatus.canActivate()) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.hasSubtype(SubType.EQUIPMENT, game)) {
return activationStatus;
}
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.hasSubtype(SubType.EQUIPMENT, game) && !permanent.isCreature()) {
return super.canActivate(playerId, game);
} else {
return ActivationStatus.getFalse();
}
return activationStatus;
}
public EquipAbility(final EquipAbility ability) {

View file

@ -2,13 +2,22 @@
package mage.abilities.keyword;
import mage.abilities.costs.mana.GenericManaCost;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.TimingRule;
import mage.constants.Zone;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.effects.common.AttachEffect;
import mage.filter.common.FilterControlledLandPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
@ -17,10 +26,29 @@ import mage.target.TargetPermanent;
//20091005 - 702.64
public class FortifyAbility extends ActivatedAbilityImpl {
public FortifyAbility(Zone zone, AttachEffect effect, Cost cost) {
super(zone, effect, cost);
this.addTarget(new TargetPermanent(new FilterControlledLandPermanent()));
timing = TimingRule.SORCERY;
public FortifyAbility(int cost) {
this(Outcome.AddAbility, new GenericManaCost(cost));
}
public FortifyAbility(Outcome outcome, Cost cost) {
this(outcome, cost, new TargetPermanent(new FilterControlledLandPermanent()));
}
public FortifyAbility(Outcome outcome, Cost cost, Target target) {
super(Zone.BATTLEFIELD, new AttachEffect(outcome, "Fortify"), cost);
this.addTarget(target);
this.timing = TimingRule.SORCERY;
}
@Override
public ActivationStatus canActivate(UUID playerId, Game game) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.hasSubtype(SubType.FORTIFICATION, game) && !permanent.isCreature() && !permanent.isLand()) {
return super.canActivate(playerId, game);
} else {
return ActivationStatus.getFalse();
}
}
public FortifyAbility(final FortifyAbility ability) {
@ -31,4 +59,10 @@ public class FortifyAbility extends ActivatedAbilityImpl {
public FortifyAbility copy() {
return new FortifyAbility(this);
}
@Override
public String getRule() {
return "Fortify " + costs.getText() + manaCosts.getText() + " (" + manaCosts.getText() + ": <i>Attach to target land you control. Fortify only as a sorcery.)</i>";
}
}

View file

@ -462,6 +462,16 @@ public enum SubType {
return subTypeSet;
}
public static Set<SubType> getArtifactTypes(boolean withCustomSets) {
Set<SubType> subTypes = EnumSet.noneOf(SubType.class);
for (SubType subType : values()) {
if (subType.getSubTypeSet() == SubTypeSet.ArtifactType && (withCustomSets || !subType.customSet)) {
subTypes.add(subType);
}
}
return subTypes;
}
public static Set<SubType> getPlaneswalkerTypes(boolean withCustomSets) {
Set<SubType> subTypes = EnumSet.noneOf(SubType.class);
for (SubType subType : values()) {