mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 05:09:16 -08:00
Changed ability handling of modal spells to be able to select the same mode multiple times with different targets.
This commit is contained in:
parent
b18cae5100
commit
4711e0cf99
40 changed files with 488 additions and 421 deletions
|
|
@ -64,7 +64,16 @@ import mage.constants.ManaType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.PlayerAction;
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_ID_NO;
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_ID_YES;
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_TEXT_NO;
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_TEXT_YES;
|
||||
import static mage.constants.PlayerAction.RESET_AUTO_SELECT_REPLACEMENT_EFFECTS;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_ABILITY_FIRST;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_ABILITY_LAST;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_NAME_FIRST;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_NAME_LAST;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_RESET_ALL;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -1284,20 +1293,24 @@ public class HumanPlayer extends PlayerImpl {
|
|||
if (modes.size() > 1) {
|
||||
MageObject obj = game.getObject(source.getSourceId());
|
||||
Map<UUID, String> modeMap = new LinkedHashMap<>();
|
||||
AvailableModes:
|
||||
for (Mode mode : modes.getAvailableModes(source, game)) {
|
||||
if ((!modes.getSelectedModes().contains(mode.getId()) || modes.isEachModeMoreThanOnce())// show only modes not already selected if more than once is not allowed
|
||||
&& mode.getTargets().canChoose(source.getSourceId(), source.getControllerId(), game)) { // and needed targets have to be available
|
||||
int timesSelected = 0;
|
||||
for (Mode selectedMode : modes.getSelectedModes()) {
|
||||
if (mode.getId().equals(selectedMode.getId())) {
|
||||
if (modes.isEachModeMoreThanOnce()) {
|
||||
timesSelected++;
|
||||
} else {
|
||||
continue AvailableModes;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mode.getTargets().canChoose(source.getSourceId(), source.getControllerId(), game)) { // and needed targets have to be available
|
||||
String modeText = mode.getEffects().getText(mode);
|
||||
if (obj != null) {
|
||||
modeText = modeText.replace("{source}", obj.getName()).replace("{this}", obj.getName());
|
||||
}
|
||||
if (modes.isEachModeMoreThanOnce()) {
|
||||
int timesSelected = 0;
|
||||
for (UUID selectedModeId : modes.getSelectedModes()) {
|
||||
if (mode.getId().equals(selectedModeId)) {
|
||||
timesSelected++;
|
||||
}
|
||||
}
|
||||
if (timesSelected > 0) {
|
||||
modeText = "(selected " + timesSelected + "x) " + modeText;
|
||||
}
|
||||
|
|
@ -1327,6 +1340,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return modes.getMode();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue