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;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class AddConditionalColorlessManaEffect extends ManaEffect {
private final int amount;
private final ConditionalManaBuilder manaBuilder;
public class AddConditionalColorlessManaEffect extends AddConditionalManaEffect {
public AddConditionalColorlessManaEffect(int amount, ConditionalManaBuilder manaBuilder) {
super();
this.amount = amount;
this.manaBuilder = manaBuilder;
staticText = "Add " + String.format(String.format("%%%ds", amount), " ").replace(" ", "{C}")
+ ". " + manaBuilder.getRule();
super(Mana.ColorlessMana(amount), manaBuilder);
}
public AddConditionalColorlessManaEffect(final AddConditionalColorlessManaEffect effect) {
super(effect);
this.amount = effect.amount;
this.manaBuilder = effect.manaBuilder;
}
@Override
public AddConditionalColorlessManaEffect copy() {
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();
}
public Mana getMana() {
return mana;
}
}