Improved ability outcome processing;

This commit is contained in:
Oleg Agafonov 2020-01-29 07:33:33 +04:00
parent ab10ee10c9
commit 89394ffe0a
20 changed files with 227 additions and 100 deletions

View file

@ -1,9 +1,5 @@
package mage.game.stack;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.ObjectColor;
@ -34,6 +30,11 @@ import mage.util.GameLog;
import mage.util.SubTypeList;
import mage.watchers.Watcher;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -578,7 +579,7 @@ public class StackAbility extends StackObjImpl implements Ability {
game.getStack().push(newStackAbility);
if (chooseNewTargets && !newAbility.getTargets().isEmpty()) {
Player controller = game.getPlayer(newControllerId);
Outcome outcome = newAbility.getEffects().isEmpty() ? Outcome.Detriment : newAbility.getEffects().get(0).getOutcome();
Outcome outcome = newAbility.getEffects().getOutcome(newAbility);
if (controller.chooseUse(outcome, "Choose new targets?", source, game)) {
newAbility.getTargets().clearChosen();
newAbility.getTargets().chooseTargets(outcome, newControllerId, newAbility, false, game, false);
@ -648,7 +649,16 @@ public class StackAbility extends StackObjImpl implements Ability {
@Override
public Ability addHint(Hint hint) {
// only abilities supports addhint
return null;
throw new IllegalArgumentException("Stack ability is not supports hint adding");
}
@Override
public Ability addCustomOutcome(Outcome customOutcome) {
throw new IllegalArgumentException("Stack ability is not supports custom outcome adding");
}
@Override
public Outcome getCustomOutcome() {
return this.ability.getCustomOutcome();
}
}