fixed Damping Sphere not reducing sources of conditional mana (such as Eldrazi Temple and Mishra's Workshop)

This commit is contained in:
Evan Kranzler 2018-05-14 13:53:09 -04:00
parent 211f36c3cd
commit 342b4486e8
2 changed files with 5 additions and 35 deletions

View file

@ -6,57 +6,24 @@
package mage.abilities.effects.mana; package mage.abilities.effects.mana;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.game.Game;
import mage.players.Player;
/** /**
* *
* @author LevelX2 * @author LevelX2
*/ */
public class AddConditionalColorlessManaEffect extends ManaEffect { public class AddConditionalColorlessManaEffect extends AddConditionalManaEffect {
private final int amount;
private final ConditionalManaBuilder manaBuilder;
public AddConditionalColorlessManaEffect(int amount, ConditionalManaBuilder manaBuilder) { public AddConditionalColorlessManaEffect(int amount, ConditionalManaBuilder manaBuilder) {
super(); super(Mana.ColorlessMana(amount), manaBuilder);
this.amount = amount;
this.manaBuilder = manaBuilder;
staticText = "Add " + String.format(String.format("%%%ds", amount), " ").replace(" ", "{C}")
+ ". " + manaBuilder.getRule();
} }
public AddConditionalColorlessManaEffect(final AddConditionalColorlessManaEffect effect) { public AddConditionalColorlessManaEffect(final AddConditionalColorlessManaEffect effect) {
super(effect); super(effect);
this.amount = effect.amount;
this.manaBuilder = effect.manaBuilder;
} }
@Override @Override
public AddConditionalColorlessManaEffect copy() { public AddConditionalColorlessManaEffect copy() {
return new AddConditionalColorlessManaEffect(this); return new AddConditionalColorlessManaEffect(this);
} }
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.getManaPool().addMana(getMana(game, source), game, source);
return true;
}
return false;
}
@Override
public Mana produceMana(boolean netMana, Game game, Ability source) {
return manaBuilder.setMana(Mana.ColorlessMana(amount), source, game).build();
}
public Mana getMana() {
return Mana.ColorlessMana(amount);
}
} }

View file

@ -54,4 +54,7 @@ public class AddConditionalManaEffect extends ManaEffect {
return manaBuilder.setMana(mana, source, game).build(); return manaBuilder.setMana(mana, source, game).build();
} }
public Mana getMana() {
return mana;
}
} }