This commit is contained in:
Alex W. Jackson 2022-10-09 11:40:39 -04:00
parent fd281ca483
commit 0bf03d1f92
3 changed files with 4 additions and 80 deletions

View file

@ -1,20 +0,0 @@
package mage.abilities.mana.conditional;
import mage.ConditionalMana;
import mage.Mana;
/**
*
* @author LevelX2
*/
public class ArtifactCastConditionalMana extends ConditionalMana {
public ArtifactCastConditionalMana(Mana mana) {
super(mana);
staticText = "Spend this mana only to cast artifact spells";
addCondition(new ArtifactCastManaCondition());
}
}

View file

@ -1,33 +0,0 @@
package mage.abilities.mana.conditional;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.Cost;
import mage.game.Game;
/**
*
* @author LevelX2
*/
public class ArtifactCastManaCondition extends ManaCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
if (source instanceof SpellAbility) {
MageObject object = game.getObject(source);
if (object != null && object.isArtifact(game)) {
return true;
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) {
return apply(game, source);
}
}

View file

@ -10,14 +10,9 @@ import mage.abilities.costs.Cost;
import mage.abilities.mana.ConditionalColorlessManaAbility;
import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.abilities.mana.conditional.ManaCondition;
import mage.cards.Card;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.command.Commander;
import mage.game.stack.Spell;
import mage.game.stack.StackAbility;
import mage.game.stack.StackObject;
import java.util.Arrays;
import java.util.UUID;
@ -82,31 +77,13 @@ class PowerstoneTokenManaCondition extends ManaCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
if (!(source instanceof SpellAbility)) {
return false;
return true;
}
MageObject object = game.getObject(source);
if (object instanceof StackObject) {
return object instanceof StackAbility || !object.isArtifact(game);
if (object != null && object.isArtifact(game)) {
return true;
}
if (!game.inCheckPlayableState()) {
return false;
}
Spell spell;
if (object instanceof Card) {
spell = new Spell(
(Card) object, (SpellAbility) source, source.getControllerId(),
game.getState().getZone(source.getSourceId()), game
);
} else if (object instanceof Commander) {
spell = new Spell(
((Commander) object).getSourceObject(),
(SpellAbility) source, source.getControllerId(),
game.getState().getZone(source.getSourceId()), game
);
} else {
spell = null;
}
return spell == null || spell.isArtifact(game);
return false;
}
@Override