mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
add mana-generation helpers to ChoiceColor
This commit is contained in:
parent
ec87dd4c94
commit
0125f88611
12 changed files with 55 additions and 144 deletions
|
|
@ -107,17 +107,7 @@ class CoalitionRelicEffect extends OneShotEffect {
|
|||
}
|
||||
player.choose(outcome, choice, game);
|
||||
}
|
||||
if (choice.getColor().isBlack()) {
|
||||
mana.increaseBlack();
|
||||
} else if (choice.getColor().isBlue()) {
|
||||
mana.increaseBlue();
|
||||
} else if (choice.getColor().isRed()) {
|
||||
mana.increaseRed();
|
||||
} else if (choice.getColor().isGreen()) {
|
||||
mana.increaseGreen();
|
||||
} else if (choice.getColor().isWhite()) {
|
||||
mana.increaseWhite();
|
||||
}
|
||||
choice.increaseMana(mana);
|
||||
choice.clearChoice();
|
||||
}
|
||||
player.getManaPool().addMana(mana, game, source);
|
||||
|
|
|
|||
|
|
@ -140,17 +140,7 @@ class DawnsReflectionManaEffect extends ManaEffect {
|
|||
while (controller.canRespond() && !controller.choose(Outcome.Benefit, choiceColor, game)) {
|
||||
}
|
||||
|
||||
if (choiceColor.getColor().isBlack()) {
|
||||
mana.increaseBlack();
|
||||
} else if (choiceColor.getColor().isBlue()) {
|
||||
mana.increaseBlue();
|
||||
} else if (choiceColor.getColor().isRed()) {
|
||||
mana.increaseRed();
|
||||
} else if (choiceColor.getColor().isGreen()) {
|
||||
mana.increaseGreen();
|
||||
} else if (choiceColor.getColor().isWhite()) {
|
||||
mana.increaseWhite();
|
||||
}
|
||||
choiceColor.increaseMana(mana);
|
||||
}
|
||||
|
||||
controller.getManaPool().addMana(mana, game, source);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ package mage.cards.f;
|
|||
import java.util.UUID;
|
||||
import mage.ConditionalMana;
|
||||
import mage.Mana;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.ExileTargetCost;
|
||||
|
|
@ -116,22 +115,11 @@ class FoodChainManaEffect extends ManaEffect {
|
|||
}
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
controller.choose(Outcome.PutManaInPool, choice, game);
|
||||
ObjectColor chosenColor = choice.getColor();
|
||||
if (chosenColor == null) {
|
||||
if (choice.getColor() == null) {
|
||||
return false;
|
||||
}
|
||||
Mana mana = null;
|
||||
if (chosenColor.isBlack()) {
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.BlackMana(manaCostExiled + 1), source, game).build();
|
||||
} else if (chosenColor.isBlue()) {
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.BlueMana(manaCostExiled + 1), source, game).build();
|
||||
} else if (chosenColor.isRed()) {
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.RedMana(manaCostExiled + 1), source, game).build();
|
||||
} else if (chosenColor.isGreen()) {
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.GreenMana(manaCostExiled + 1), source, game).build();
|
||||
} else if (chosenColor.isWhite()) {
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.WhiteMana(manaCostExiled + 1), source, game).build();
|
||||
}
|
||||
Mana chosen = choice.getMana(manaCostExiled + 1);
|
||||
Mana mana = new FoodChainManaBuilder().setMana(chosen, source, game).build();
|
||||
if (mana != null) {
|
||||
checkToFirePossibleEvents(mana, game, source);
|
||||
controller.getManaPool().addMana(mana, game, source);
|
||||
|
|
|
|||
|
|
@ -135,11 +135,11 @@ class MarketFestivalManaEffect extends ManaEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if(controller != null && sourceObject != null){
|
||||
int x = 2;
|
||||
if (controller != null && sourceObject != null) {
|
||||
int x = 2;
|
||||
|
||||
Mana mana = new Mana();
|
||||
for(int i = 0; i < x; i++){
|
||||
for (int i = 0; i < x; i++) {
|
||||
ChoiceColor choiceColor = new ChoiceColor();
|
||||
if (i == 0) {
|
||||
choiceColor.setMessage("First mana color for " + sourceObject.getLogName());
|
||||
|
|
@ -152,22 +152,11 @@ class MarketFestivalManaEffect extends ManaEffect {
|
|||
}
|
||||
}
|
||||
|
||||
if (choiceColor.getColor().isBlack()) {
|
||||
mana.increaseBlack();
|
||||
} else if (choiceColor.getColor().isBlue()) {
|
||||
mana.increaseBlue();
|
||||
} else if (choiceColor.getColor().isRed()) {
|
||||
mana.increaseRed();
|
||||
} else if (choiceColor.getColor().isGreen()) {
|
||||
mana.increaseGreen();
|
||||
} else if (choiceColor.getColor().isWhite()) {
|
||||
mana.increaseWhite();
|
||||
}
|
||||
choiceColor.increaseMana(mana);
|
||||
}
|
||||
checkToFirePossibleEvents(mana, game, source);
|
||||
controller.getManaPool().addMana(mana, game, source);
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,17 +134,7 @@ class PlasmCaptureManaEffect extends ManaEffect {
|
|||
}
|
||||
}
|
||||
|
||||
if (choiceColor.getColor().isBlack()) {
|
||||
mana.increaseBlack();
|
||||
} else if (choiceColor.getColor().isBlue()) {
|
||||
mana.increaseBlue();
|
||||
} else if (choiceColor.getColor().isRed()) {
|
||||
mana.increaseRed();
|
||||
} else if (choiceColor.getColor().isGreen()) {
|
||||
mana.increaseGreen();
|
||||
} else if (choiceColor.getColor().isWhite()) {
|
||||
mana.increaseWhite();
|
||||
}
|
||||
choiceColor.increaseMana(mana);
|
||||
}
|
||||
|
||||
player.getManaPool().addMana(mana, game, source);
|
||||
|
|
|
|||
|
|
@ -156,24 +156,13 @@ class VedalkenEngineerEffect extends ManaEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Mana mana = new Mana();
|
||||
ChoiceColor choiceColor = new ChoiceColor(true);
|
||||
while (!controller.choose(Outcome.Benefit, choiceColor, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (choiceColor.getColor().isBlack()) {
|
||||
mana.setBlack(amount);
|
||||
} else if (choiceColor.getColor().isBlue()) {
|
||||
mana.setBlue(amount);
|
||||
} else if (choiceColor.getColor().isRed()) {
|
||||
mana.setRed(amount);
|
||||
} else if (choiceColor.getColor().isGreen()) {
|
||||
mana.setGreen(amount);
|
||||
} else if (choiceColor.getColor().isWhite()) {
|
||||
mana.setWhite(amount);
|
||||
}
|
||||
Mana mana = choiceColor.getMana(amount);
|
||||
Mana condMana = manaBuilder.setMana(mana, source, game).build();
|
||||
checkToFirePossibleEvents(condMana, game, source);
|
||||
controller.getManaPool().addMana(condMana, game, source);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue