mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
GUI: added card hints in choose replacement effect dialog
This commit is contained in:
parent
67ff2da060
commit
7b2e9b390c
7 changed files with 50 additions and 26 deletions
|
|
@ -16,10 +16,9 @@ import mage.abilities.mana.ManaAbility;
|
|||
import mage.cards.*;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceHintType;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.*;
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_RESET_ALL;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterAttackingCreature;
|
||||
import mage.filter.common.FilterBlockingCreature;
|
||||
|
|
@ -57,6 +56,9 @@ import java.util.*;
|
|||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_RESET_ALL;
|
||||
|
||||
/**
|
||||
* Human: server side logic to exchange game data between server app and another player's app
|
||||
*
|
||||
|
|
@ -485,12 +487,12 @@ public class HumanPlayer extends PlayerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int chooseReplacementEffect(Map<String, String> rEffects, Game game) {
|
||||
public int chooseReplacementEffect(Map<String, String> effectsMap, Map<String, MageObject> objectsMap, Game game) {
|
||||
if (gameInCheckPlayableState(game, true)) { // ignore warning logs until double call for TAPPED_FOR_MANA will be fix
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rEffects.size() <= 1) {
|
||||
if (effectsMap.size() <= 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -505,8 +507,8 @@ public class HumanPlayer extends PlayerImpl {
|
|||
for (String autoText : autoSelectReplacementEffects) {
|
||||
int count = 0;
|
||||
// find effect with same saved text
|
||||
for (String effectKey : rEffects.keySet()) {
|
||||
String currentText = prepareReplacementText(rEffects.get(effectKey), useSameSettings);
|
||||
for (String effectKey : effectsMap.keySet()) {
|
||||
String currentText = prepareReplacementText(effectsMap.get(effectKey), useSameSettings);
|
||||
if (currentText.equals(autoText)) {
|
||||
return count;
|
||||
}
|
||||
|
|
@ -517,7 +519,17 @@ public class HumanPlayer extends PlayerImpl {
|
|||
|
||||
replacementEffectChoice.clearChoice();
|
||||
replacementEffectChoice.getChoices().clear();
|
||||
replacementEffectChoice.setKeyChoices(rEffects);
|
||||
replacementEffectChoice.getKeyChoices().clear();
|
||||
effectsMap.forEach((key, value) -> {
|
||||
MageObject object = objectsMap.getOrDefault(key, null);
|
||||
replacementEffectChoice.withItem(
|
||||
key,
|
||||
value,
|
||||
null,
|
||||
object != null ? ChoiceHintType.GAME_OBJECT : null,
|
||||
object != null ? object.getId().toString() : null
|
||||
);
|
||||
});
|
||||
|
||||
// if same choices then select first
|
||||
int differentChoices = 0;
|
||||
|
|
@ -557,7 +569,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
|
||||
if (replacementEffectChoice.getChoiceKey() != null) {
|
||||
int index = 0;
|
||||
for (String key : rEffects.keySet()) {
|
||||
for (String key : effectsMap.keySet()) {
|
||||
if (replacementEffectChoice.getChoiceKey().equals(key)) {
|
||||
return index;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue