mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Implement Neurok Transmuter
This commit is contained in:
parent
878f3ba132
commit
9b68e0860b
7 changed files with 204 additions and 58 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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>";
|
||||
}
|
||||
}
|
||||
|
|
@ -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()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue