Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions Mage.Sets/src/mage/cards/m/ManaSculpt.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package mage.cards.m;

import java.util.UUID;

import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility.PhaseSelection;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect;
import mage.abilities.hint.ConditionHint;
import mage.abilities.hint.Hint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.target.TargetSpell;
import mage.target.targetpointer.FixedTarget;

/**
*
* @author muz
*/
public final class ManaSculpt extends CardImpl {

private static final FilterPermanent filter = new FilterControlledPermanent(SubType.WIZARD);
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter);
private static final Hint hint = new ConditionHint(condition, "You control a Wizard");

public ManaSculpt(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");

// Counter target spell. If you control a Wizard, add an amount of {C} equal to the amount of mana spent to cast that spell at the beginning of your next main phase.
this.getSpellAbility().addEffect(new ManaSculptEffect());
this.getSpellAbility().addTarget(new TargetSpell());
this.getSpellAbility().addHint(hint);
}

private ManaSculpt(final ManaSculpt card) {
super(card);
}

@Override
public ManaSculpt copy() {
return new ManaSculpt(this);
}
}

class ManaSculptEffect extends OneShotEffect {

ManaSculptEffect() {
super(Outcome.Benefit);
this.staticText = "counter target spell. If you control a Wizard, add an amount of {C} equal to the amount of mana spent to cast that spell at the beginning of your next main phase";
}

private ManaSculptEffect(final ManaSculptEffect effect) {
super(effect);
}

@Override
public ManaSculptEffect copy() {
return new ManaSculptEffect(this);
}

@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
if (spell != null) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invert this into a guard statement

game.getStack().counter(source.getFirstTarget(), source, game);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should use spell.getId() instead of source.getFirstTarget()


for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why you're checking this way, you should just do a filter check instead of looping like this

if (permanent.hasSubtype(SubType.WIZARD, game)) {
int cmc = spell.getManaValue();
Effect effect = new AddManaToManaPoolTargetControllerEffect(Mana.ColorlessMana(cmc), "your");
effect.setTargetPointer(new FixedTarget(source.getControllerId()));
AtTheBeginOfMainPhaseDelayedTriggeredAbility delayedAbility
= new AtTheBeginOfMainPhaseDelayedTriggeredAbility(effect, false, TargetController.YOU, PhaseSelection.NEXT_MAIN);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
return true;
}
return false;
}
}
2 changes: 2 additions & 0 deletions Mage.Sets/src/mage/sets/SecretsOfStrixhaven.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ private SecretsOfStrixhaven() {
cards.add(new SetCardInfo("Lumaret's Favor", 153, Rarity.UNCOMMON, mage.cards.l.LumaretsFavor.class));
cards.add(new SetCardInfo("Maelstrom Artisan", 122, Rarity.RARE, mage.cards.m.MaelstromArtisan.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Maelstrom Artisan", 334, Rarity.RARE, mage.cards.m.MaelstromArtisan.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mana Sculpt", 319, Rarity.RARE, mage.cards.m.ManaSculpt.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mana Sculpt", 57, Rarity.RARE, mage.cards.m.ManaSculpt.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mathemagics", 320, Rarity.MYTHIC, mage.cards.m.Mathemagics.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mathemagics", 58, Rarity.MYTHIC, mage.cards.m.Mathemagics.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Molten Note", 204, Rarity.UNCOMMON, mage.cards.m.MoltenNote.class));
Expand Down
Loading