mirror of
https://github.com/correl/mage.git
synced 2025-04-06 09:13:45 -09:00
Fixes net mana calculation for AddManaOfTwoDifferentColorsEffect (#8949)
This commit is contained in:
commit
b605d8e66b
1 changed files with 27 additions and 2 deletions
|
@ -4,6 +4,7 @@ package mage.abilities.effects.mana;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.choices.ManaChoice;
|
import mage.choices.ManaChoice;
|
||||||
|
import mage.constants.ManaType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
@ -12,6 +13,32 @@ import java.util.List;
|
||||||
|
|
||||||
public class AddManaOfTwoDifferentColorsEffect extends ManaEffect {
|
public class AddManaOfTwoDifferentColorsEffect extends ManaEffect {
|
||||||
|
|
||||||
|
// Performing this calculation here since it never changes and should not be recalcualted each time.
|
||||||
|
private static final List<ManaType> colorsToCycle = new ArrayList<>();
|
||||||
|
private static final List<Mana> netMana = new ArrayList<>();
|
||||||
|
static {
|
||||||
|
// Add the colored mana in order to cycle through them
|
||||||
|
colorsToCycle.add(ManaType.WHITE);
|
||||||
|
colorsToCycle.add(ManaType.BLUE);
|
||||||
|
colorsToCycle.add(ManaType.BLACK);
|
||||||
|
colorsToCycle.add(ManaType.RED);
|
||||||
|
colorsToCycle.add(ManaType.GREEN);
|
||||||
|
|
||||||
|
// Create the possible combinations of two mana
|
||||||
|
for (ManaType manaType1 : colorsToCycle) {
|
||||||
|
for (ManaType manaType2 : colorsToCycle) {
|
||||||
|
// Mana types must be different
|
||||||
|
if (manaType1 == manaType2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Mana manaCombo = new Mana(manaType1);
|
||||||
|
manaCombo.increase(manaType2);
|
||||||
|
netMana.add(manaCombo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public AddManaOfTwoDifferentColorsEffect() {
|
public AddManaOfTwoDifferentColorsEffect() {
|
||||||
super();
|
super();
|
||||||
staticText = "Add two mana of different colors.";
|
staticText = "Add two mana of different colors.";
|
||||||
|
@ -23,8 +50,6 @@ public class AddManaOfTwoDifferentColorsEffect extends ManaEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Mana> getNetMana(Game game, Ability source) {
|
public List<Mana> getNetMana(Game game, Ability source) {
|
||||||
List<Mana> netMana = new ArrayList<>();
|
|
||||||
netMana.add(Mana.AnyMana(2));
|
|
||||||
return netMana;
|
return netMana;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue