mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
fixed Damping Sphere not reducing sources of conditional mana (such as Eldrazi Temple and Mishra's Workshop)
This commit is contained in:
parent
211f36c3cd
commit
342b4486e8
2 changed files with 5 additions and 35 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,4 +54,7 @@ public class AddConditionalManaEffect extends ManaEffect {
|
|||
return manaBuilder.setMana(mana, source, game).build();
|
||||
}
|
||||
|
||||
public Mana getMana() {
|
||||
return mana;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue