mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 06:22:01 -08:00
* Cavern of Souls - Fixed that conditional mana in the mana pool remembers correctly for which creature subtrype its usable.
This commit is contained in:
parent
35d3c14dc6
commit
1f196f0bc7
11 changed files with 133 additions and 36 deletions
|
|
@ -44,7 +44,7 @@ public class AddConditionalColorlessManaEffect extends ManaEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.getManaPool().addMana(manaBuilder.setMana(Mana.ColorlessMana(amount)).build(), game, source);
|
||||
player.getManaPool().addMana(manaBuilder.setMana(Mana.ColorlessMana(amount), source, game).build(), game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ import mage.players.Player;
|
|||
*/
|
||||
public class AddConditionalManaOfAnyColorEffect extends ManaEffect {
|
||||
|
||||
private int amount;
|
||||
private ConditionalManaBuilder manaBuilder;
|
||||
private final int amount;
|
||||
private final ConditionalManaBuilder manaBuilder;
|
||||
|
||||
public AddConditionalManaOfAnyColorEffect(int amount, ConditionalManaBuilder manaBuilder) {
|
||||
super();
|
||||
|
|
@ -73,15 +73,15 @@ public class AddConditionalManaOfAnyColorEffect extends ManaEffect {
|
|||
|
||||
Mana mana = null;
|
||||
if (choice.getColor().isBlack()) {
|
||||
mana = manaBuilder.setMana(Mana.BlackMana(1)).build();
|
||||
mana = manaBuilder.setMana(Mana.BlackMana(1), source, game).build();
|
||||
} else if (choice.getColor().isBlue()) {
|
||||
mana = manaBuilder.setMana(Mana.BlueMana(1)).build();
|
||||
mana = manaBuilder.setMana(Mana.BlueMana(1), source, game).build();
|
||||
} else if (choice.getColor().isRed()) {
|
||||
mana = manaBuilder.setMana(Mana.RedMana(1)).build();
|
||||
mana = manaBuilder.setMana(Mana.RedMana(1), source, game).build();
|
||||
} else if (choice.getColor().isGreen()) {
|
||||
mana = manaBuilder.setMana(Mana.GreenMana(1)).build();
|
||||
mana = manaBuilder.setMana(Mana.GreenMana(1), source, game).build();
|
||||
} else if (choice.getColor().isWhite()) {
|
||||
mana = manaBuilder.setMana(Mana.WhiteMana(1)).build();
|
||||
mana = manaBuilder.setMana(Mana.WhiteMana(1), source, game).build();
|
||||
}
|
||||
|
||||
if (mana != null) {
|
||||
|
|
|
|||
|
|
@ -78,8 +78,9 @@ public class ManaOptions extends ArrayList<Mana> {
|
|||
}
|
||||
|
||||
public void addManaWithCost(List<ManaAbility> abilities, Game game) {
|
||||
if (isEmpty())
|
||||
if (isEmpty()) {
|
||||
this.add(new Mana());
|
||||
}
|
||||
if (!abilities.isEmpty()) {
|
||||
if (abilities.size() == 1) {
|
||||
//if there is only one mana option available add it to all the existing options
|
||||
|
|
@ -121,16 +122,18 @@ public class ManaOptions extends ArrayList<Mana> {
|
|||
}
|
||||
|
||||
public void addMana(Mana addMana) {
|
||||
if (isEmpty())
|
||||
if (isEmpty()) {
|
||||
this.add(new Mana());
|
||||
}
|
||||
for (Mana mana: this) {
|
||||
mana.add(addMana);
|
||||
}
|
||||
}
|
||||
|
||||
public void addMana(ManaOptions options) {
|
||||
if (isEmpty())
|
||||
if (isEmpty()) {
|
||||
this.add(new Mana());
|
||||
}
|
||||
if (!options.isEmpty()) {
|
||||
if (options.size() == 1) {
|
||||
//if there is only one mana option available add it to all the existing options
|
||||
|
|
@ -157,8 +160,9 @@ public class ManaOptions extends ArrayList<Mana> {
|
|||
}
|
||||
|
||||
public void addMana(Mana cost, Mana addMana) {
|
||||
if (isEmpty())
|
||||
if (isEmpty()) {
|
||||
this.add(new Mana());
|
||||
}
|
||||
for (Mana mana: this) {
|
||||
if (mana.contains(cost)) {
|
||||
mana.subtract(cost);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ package mage.abilities.mana.builder;
|
|||
|
||||
import mage.ConditionalMana;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
|
|
@ -37,7 +39,7 @@ public abstract class ConditionalManaBuilder implements Builder<ConditionalMana>
|
|||
|
||||
protected Mana mana;
|
||||
|
||||
public ConditionalManaBuilder setMana(Mana mana) {
|
||||
public ConditionalManaBuilder setMana(Mana mana, Ability source, Game game) {
|
||||
this.mana = mana;
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue