* Blinkmoth Urn - Fixed that the created mana was not removed at the steps end.

This commit is contained in:
LevelX2 2016-08-09 22:52:22 +02:00
parent 7504c58d5a
commit aa5623fd70

View file

@ -26,17 +26,17 @@ import mage.players.Player;
* @author nickmyers
*/
public class BlinkmothUrn extends CardImpl {
public BlinkmothUrn(UUID ownerId) {
super(ownerId, 145, "Blinkmoth Urn", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}");
this.expansionSetCode = "MRD";
// At the beginning of each player's precombat main phase, if
// Blinkmoth Urn is untapped, that player adds {1} to his or her
// At the beginning of each player's precombat main phase, if
// Blinkmoth Urn is untapped, that player adds {1} to his or her
// mana pool for each artifact he or she controls.
this.addAbility(new BeginningOfPreCombatMainTriggeredAbility(new BlinkmothUrnEffect(), TargetController.ANY, false));
}
public BlinkmothUrn(final BlinkmothUrn card) {
super(card);
}
@ -45,37 +45,35 @@ public class BlinkmothUrn extends CardImpl {
public BlinkmothUrn copy() {
return new BlinkmothUrn(this);
}
}
class BlinkmothUrnEffect extends OneShotEffect {
public BlinkmothUrnEffect() {
super(Outcome.PutManaInPool);
this.staticText = "if Blinkmoth Urn is untapped, that player adds {1} to his or her mana pool for each artifact he or she controls";
}
public BlinkmothUrnEffect(final BlinkmothUrnEffect effect) {
super(effect);
}
@java.lang.Override
public BlinkmothUrnEffect copy() {
return new BlinkmothUrnEffect(this);
}
@java.lang.Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getActivePlayerId());
FilterArtifactPermanent filter = new FilterArtifactPermanent("artifacts you control");
filter.add(new ControllerIdPredicate(game.getActivePlayerId()));
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if(player != null && sourcePermanent != null && !sourcePermanent.isTapped()) {
if (player != null && sourcePermanent != null && !sourcePermanent.isTapped()) {
player.getManaPool().addMana(Mana.ColorlessMana(
game.getState().
getBattlefield().
getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game).
size()), game, source, true);
game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game).
size()), game, source, false);
return true;
}
return false;