mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
Additional fixes for getNetMana from #6132
This commit is contained in:
parent
3fa88d1c88
commit
62636b5071
12 changed files with 243 additions and 247 deletions
|
|
@ -49,7 +49,7 @@ public class AddManaOfAnyColorEffect extends BasicManaEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
return netMana;
|
||||
return new ArrayList<>(this.netMana);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -23,16 +23,16 @@ public class AddManaOfTwoDifferentColorsEffect extends ManaEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Mana produceMana(Game game, Ability source) {
|
||||
Player player = getPlayer(game, source);
|
||||
return ManaChoice.chooseTwoDifferentColors(player, game);
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
ArrayList<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(Mana.AnyMana(2));
|
||||
return netMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
ArrayList<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(new Mana(0, 0, 0, 0, 0, 0, 2, 0));
|
||||
return netMana;
|
||||
public Mana produceMana(Game game, Ability source) {
|
||||
Player player = getPlayer(game, source);
|
||||
return ManaChoice.chooseTwoDifferentColors(player, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ import mage.abilities.effects.common.ManaEffect;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class AddManaToManaPoolTargetControllerEffect extends ManaEffect {
|
||||
|
|
@ -29,12 +29,11 @@ public class AddManaToManaPoolTargetControllerEffect extends ManaEffect {
|
|||
/**
|
||||
* Adds mana to the mana pool of target pointer player
|
||||
*
|
||||
* @param mana mana that will be added to the pool
|
||||
* @param mana mana that will be added to the pool
|
||||
* @param textManaPoolOwner text that references to the mana pool owner
|
||||
* (e.g. "damaged player's")
|
||||
* @param emptyOnTurnsEnd if set, the mana will empty only on end of
|
||||
* turnstep
|
||||
*
|
||||
* (e.g. "damaged player's")
|
||||
* @param emptyOnTurnsEnd if set, the mana will empty only on end of
|
||||
* turnstep
|
||||
*/
|
||||
public AddManaToManaPoolTargetControllerEffect(Mana mana, String textManaPoolOwner, boolean emptyOnTurnsEnd) {
|
||||
super();
|
||||
|
|
@ -59,6 +58,13 @@ public class AddManaToManaPoolTargetControllerEffect extends ManaEffect {
|
|||
return game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
ArrayList<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(mana.copy());
|
||||
return netMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mana produceMana(Game game, Ability source) {
|
||||
return mana.copy();
|
||||
|
|
@ -68,9 +74,4 @@ public class AddManaToManaPoolTargetControllerEffect extends ManaEffect {
|
|||
protected void addManaToPool(Player player, Mana manaToAdd, Game game, Ability source) {
|
||||
player.getManaPool().addMana(manaToAdd, game, source, emptyOnlyOnTurnsEnd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.mana;
|
||||
|
||||
import mage.Mana;
|
||||
|
|
@ -86,6 +85,34 @@ class AnyColorLandsProduceManaEffect extends ManaEffect {
|
|||
this.onlyColors = effect.onlyColors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
List<Mana> netManas = new ArrayList<>();
|
||||
Mana types = getManaTypes(game, source);
|
||||
if (types.getBlack() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.B));
|
||||
}
|
||||
if (types.getRed() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.R));
|
||||
}
|
||||
if (types.getBlue() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.U));
|
||||
}
|
||||
if (types.getGreen() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.G));
|
||||
}
|
||||
if (types.getWhite() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.W));
|
||||
}
|
||||
if (!onlyColors && types.getColorless() > 0) {
|
||||
netManas.add(Mana.ColorlessMana(1));
|
||||
}
|
||||
if (types.getAny() > 0) {
|
||||
netManas.add(Mana.AnyMana(1));
|
||||
}
|
||||
return netManas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mana produceMana(Game game, Ability source) {
|
||||
Mana mana = new Mana();
|
||||
|
|
@ -181,34 +208,6 @@ class AnyColorLandsProduceManaEffect extends ManaEffect {
|
|||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
List<Mana> netManas = new ArrayList<>();
|
||||
Mana types = getManaTypes(game, source);
|
||||
if (types.getBlack() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.B));
|
||||
}
|
||||
if (types.getRed() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.R));
|
||||
}
|
||||
if (types.getBlue() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.U));
|
||||
}
|
||||
if (types.getGreen() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.G));
|
||||
}
|
||||
if (types.getWhite() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.W));
|
||||
}
|
||||
if (types.getColorless() > 0) {
|
||||
netManas.add(Mana.ColorlessMana(1));
|
||||
}
|
||||
if (types.getAny() > 0) {
|
||||
netManas.add(Mana.AnyMana(1));
|
||||
}
|
||||
return netManas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnyColorLandsProduceManaEffect copy() {
|
||||
return new AnyColorLandsProduceManaEffect(this);
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
*/
|
||||
package mage.abilities.mana;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mage.Mana;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -23,8 +21,10 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CountAndromalius
|
||||
*/
|
||||
public class AnyColorPermanentTypesManaAbility extends ActivatedManaAbilityImpl {
|
||||
|
|
@ -80,6 +80,34 @@ class AnyColorPermanentTypesManaEffect extends ManaEffect {
|
|||
this.onlyColors = effect.onlyColors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
List<Mana> netManas = new ArrayList<>();
|
||||
Mana types = getManaTypes(game, source);
|
||||
if (types.getBlack() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.B));
|
||||
}
|
||||
if (types.getRed() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.R));
|
||||
}
|
||||
if (types.getBlue() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.U));
|
||||
}
|
||||
if (types.getGreen() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.G));
|
||||
}
|
||||
if (types.getWhite() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.W));
|
||||
}
|
||||
if (!onlyColors && types.getColorless() > 0) {
|
||||
netManas.add(Mana.ColorlessMana(1));
|
||||
}
|
||||
if (types.getAny() > 0) {
|
||||
netManas.add(Mana.AnyMana(1));
|
||||
}
|
||||
return netManas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mana produceMana(Game game, Ability source) {
|
||||
Mana mana = new Mana();
|
||||
|
|
@ -181,34 +209,6 @@ class AnyColorPermanentTypesManaEffect extends ManaEffect {
|
|||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
List<Mana> netManas = new ArrayList<>();
|
||||
Mana types = getManaTypes(game, source);
|
||||
if (types.getBlack() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.B));
|
||||
}
|
||||
if (types.getRed() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.R));
|
||||
}
|
||||
if (types.getBlue() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.U));
|
||||
}
|
||||
if (types.getGreen() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.G));
|
||||
}
|
||||
if (types.getWhite() > 0) {
|
||||
netManas.add(new Mana(ColoredManaSymbol.W));
|
||||
}
|
||||
if (types.getColorless() > 0) {
|
||||
netManas.add(Mana.ColorlessMana(1));
|
||||
}
|
||||
if (types.getAny() > 0) {
|
||||
netManas.add(Mana.AnyMana(1));
|
||||
}
|
||||
return netManas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnyColorPermanentTypesManaEffect copy() {
|
||||
return new AnyColorPermanentTypesManaEffect(this);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@ import mage.filter.FilterMana;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
|
|
@ -61,6 +63,36 @@ class CommanderIdentityManaEffect extends ManaEffect {
|
|||
return new CommanderIdentityManaEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID commanderId : game.getCommandersIds(controller)) {
|
||||
Card commander = game.getCard(commanderId);
|
||||
if (commander != null) {
|
||||
FilterMana commanderMana = commander.getColorIdentity();
|
||||
if (commanderMana.isBlack()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.B));
|
||||
}
|
||||
if (commanderMana.isBlue()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.U));
|
||||
}
|
||||
if (commanderMana.isGreen()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.G));
|
||||
}
|
||||
if (commanderMana.isRed()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.R));
|
||||
}
|
||||
if (commanderMana.isWhite()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.W));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return netMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mana produceMana(Game game, Ability source) {
|
||||
Mana mana = new Mana();
|
||||
|
|
@ -120,35 +152,4 @@ class CommanderIdentityManaEffect extends ManaEffect {
|
|||
}
|
||||
return mana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID commanderId : game.getCommandersIds(controller)) {
|
||||
Card commander = game.getCard(commanderId);
|
||||
if (commander != null) {
|
||||
FilterMana commanderMana = commander.getColorIdentity();
|
||||
if (commanderMana.isBlack()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.B));
|
||||
}
|
||||
if (commanderMana.isBlue()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.U));
|
||||
}
|
||||
if (commanderMana.isGreen()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.G));
|
||||
}
|
||||
if (commanderMana.isRed()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.R));
|
||||
}
|
||||
if (commanderMana.isWhite()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.W));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return netMana;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue