mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
parent
b4a58a339d
commit
35f4a898f9
8 changed files with 24 additions and 7 deletions
|
|
@ -24,7 +24,6 @@ import mage.cards.repository.CardCriteria;
|
||||||
import mage.cards.repository.CardInfo;
|
import mage.cards.repository.CardInfo;
|
||||||
import mage.cards.repository.CardRepository;
|
import mage.cards.repository.CardRepository;
|
||||||
import mage.choices.Choice;
|
import mage.choices.Choice;
|
||||||
import mage.choices.ChoiceColor;
|
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
|
|
@ -1956,7 +1955,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
// choose the correct color to pay a spell
|
// choose the correct color to pay a spell
|
||||||
if (outcome == Outcome.PutManaInPool && choice instanceof ChoiceColor && currentUnpaidMana != null) {
|
if (outcome == Outcome.PutManaInPool && choice.isManaColorChoice() && currentUnpaidMana != null) {
|
||||||
if (currentUnpaidMana.containsColor(ColoredManaSymbol.W) && choice.getChoices().contains("White")) {
|
if (currentUnpaidMana.containsColor(ColoredManaSymbol.W) && choice.getChoices().contains("White")) {
|
||||||
choice.setChoice("White");
|
choice.setChoice("White");
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import mage.abilities.mana.ManaAbility;
|
||||||
import mage.cards.*;
|
import mage.cards.*;
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
import mage.choices.Choice;
|
import mage.choices.Choice;
|
||||||
import mage.choices.ChoiceColor;
|
|
||||||
import mage.choices.ChoiceImpl;
|
import mage.choices.ChoiceImpl;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
|
|
@ -583,7 +582,7 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to autopay for mana
|
// Try to autopay for mana
|
||||||
if (Outcome.PutManaInPool == outcome && choice instanceof ChoiceColor && currentlyUnpaidMana != null) {
|
if (Outcome.PutManaInPool == outcome && choice.isManaColorChoice() && currentlyUnpaidMana != null) {
|
||||||
// Check check if the spell being paid for cares about the color of mana being paid
|
// Check check if the spell being paid for cares about the color of mana being paid
|
||||||
// See: https://github.com/magefree/mage/issues/9070
|
// See: https://github.com/magefree/mage/issues/9070
|
||||||
boolean caresAboutManaColor = false;
|
boolean caresAboutManaColor = false;
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ class KatildaDawnhartPrimeManaEffect extends ManaEffect {
|
||||||
if (controller == null || permanent == null) {
|
if (controller == null || permanent == null) {
|
||||||
return new Mana();
|
return new Mana();
|
||||||
}
|
}
|
||||||
Choice choice = new ChoiceImpl();
|
Choice choice = new ChoiceImpl().setManaColorChoice(true);
|
||||||
choice.setMessage("Pick a mana color");
|
choice.setMessage("Pick a mana color");
|
||||||
ObjectColor color = permanent.getColor(game);
|
ObjectColor color = permanent.getColor(game);
|
||||||
if (color.isWhite()) {
|
if (color.isWhite()) {
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ class TazriStalwartSurvivorManaEffect extends ManaEffect {
|
||||||
if (controller == null || permanent == null) {
|
if (controller == null || permanent == null) {
|
||||||
return new Mana();
|
return new Mana();
|
||||||
}
|
}
|
||||||
Choice choice = new ChoiceImpl();
|
Choice choice = new ChoiceImpl().setManaColorChoice(true);
|
||||||
choice.setMessage("Pick a mana color");
|
choice.setMessage("Pick a mana color");
|
||||||
ObjectColor color = permanent.getColor(game);
|
ObjectColor color = permanent.getColor(game);
|
||||||
if (color.isWhite()) {
|
if (color.isWhite()) {
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ class CommanderIdentityManaEffect extends ManaEffect {
|
||||||
}
|
}
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
Choice choice = new ChoiceImpl();
|
Choice choice = new ChoiceImpl().setManaColorChoice(true);
|
||||||
choice.setMessage("Pick a mana color");
|
choice.setMessage("Pick a mana color");
|
||||||
for (UUID commanderId : game.getCommandersIds(controller, CommanderCardType.COMMANDER_OR_OATHBREAKER, false)) {
|
for (UUID commanderId : game.getCommandersIds(controller, CommanderCardType.COMMANDER_OR_OATHBREAKER, false)) {
|
||||||
Card commander = game.getCard(commanderId);
|
Card commander = game.getCard(commanderId);
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,10 @@ public interface Choice extends Serializable, Copyable<Choice> {
|
||||||
|
|
||||||
ChoiceHintType getHintType();
|
ChoiceHintType getHintType();
|
||||||
|
|
||||||
|
boolean isManaColorChoice();
|
||||||
|
|
||||||
|
Choice setManaColorChoice(boolean manaColorChoice);
|
||||||
|
|
||||||
// string choice
|
// string choice
|
||||||
void setChoices(Set<String> choices);
|
void setChoices(Set<String> choices);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ public class ChoiceColor extends ChoiceImpl {
|
||||||
|
|
||||||
this.setMessage(chooseMessage);
|
this.setMessage(chooseMessage);
|
||||||
this.setSubMessage(chooseSubMessage);
|
this.setSubMessage(chooseSubMessage);
|
||||||
|
this.manaColorChoice = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ChoiceColor(final ChoiceColor choice) {
|
protected ChoiceColor(final ChoiceColor choice) {
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ public class ChoiceImpl implements Choice {
|
||||||
protected String specialText = "";
|
protected String specialText = "";
|
||||||
protected String specialHint = "";
|
protected String specialHint = "";
|
||||||
|
|
||||||
|
protected boolean manaColorChoice = false; // set true to allow automatic choosing with Outcome.PutManaInPool
|
||||||
|
|
||||||
public ChoiceImpl() {
|
public ChoiceImpl() {
|
||||||
this(false);
|
this(false);
|
||||||
}
|
}
|
||||||
|
|
@ -65,6 +67,7 @@ public class ChoiceImpl implements Choice {
|
||||||
this.specialCanBeEmpty = choice.specialCanBeEmpty;
|
this.specialCanBeEmpty = choice.specialCanBeEmpty;
|
||||||
this.specialText = choice.specialText;
|
this.specialText = choice.specialText;
|
||||||
this.specialHint = choice.specialHint;
|
this.specialHint = choice.specialHint;
|
||||||
|
this.manaColorChoice = choice.manaColorChoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -328,6 +331,17 @@ public class ChoiceImpl implements Choice {
|
||||||
return this.hintType;
|
return this.hintType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isManaColorChoice() {
|
||||||
|
return manaColorChoice;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ChoiceImpl setManaColorChoice(boolean manaColorChoice) {
|
||||||
|
this.manaColorChoice = manaColorChoice;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private void protectFromEmptyChoices() {
|
private void protectFromEmptyChoices() {
|
||||||
// if there are no choices then required must be disabled to allow user to close a dialog
|
// if there are no choices then required must be disabled to allow user to close a dialog
|
||||||
// example: database error on too low memory, see Brain Pry and 500 Mb server
|
// example: database error on too low memory, see Brain Pry and 500 Mb server
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue