- Allowing Charms to have subAbilities be chosen more than once (AI support needs improving to actually filter through all the permutations)

This commit is contained in:
Sol
2015-11-10 03:10:53 +00:00
parent 27a80bbae9
commit 022041a2f6
6 changed files with 19 additions and 14 deletions

View File

@@ -52,9 +52,9 @@ public class CharmEffect extends SpellAbilityEffect {
// so nothing to do in this resolve
}
@Override
protected String getStackDescription(SpellAbility sa) {
// TODO Build StackDescription based on Chosen SubAbilities
return "";
}
@@ -79,7 +79,7 @@ public class CharmEffect extends SpellAbilityEffect {
source.setChosenPlayer(chooser);
}
List<AbilitySub> chosen = chooser.getController().chooseModeForAbility(sa, min, num);
List<AbilitySub> chosen = chooser.getController().chooseModeForAbility(sa, min, num, sa.hasParam(("CanRepeatModes")));
chainAbilities(sa, chosen);
}
@@ -98,12 +98,15 @@ public class CharmEffect extends SpellAbilityEffect {
});
for (AbilitySub sub : chosen) {
saDeepest.setSubAbility(sub);
sub.setActivatingPlayer(saDeepest.getActivatingPlayer());
sub.setParent(saDeepest);
// Clone the chosen, just in case the some subAb gets chosen multiple times
AbilitySub clone = (AbilitySub)sub.getCopy();
saDeepest.setSubAbility(clone);
clone.setActivatingPlayer(saDeepest.getActivatingPlayer());
clone.setParent(saDeepest);
// to chain the next one (but make sure it goes all the way at the end of the SA chain)
saDeepest = sub;
saDeepest = clone;
while (saDeepest.getSubAbility() != null) {
saDeepest = saDeepest.getSubAbility();
}

View File

@@ -184,7 +184,7 @@ public abstract class PlayerController {
public abstract boolean chooseFlipResult(SpellAbility sa, Player flipper, boolean[] results, boolean call);
public abstract Card chooseProtectionShield(GameEntity entityBeingDamaged, List<String> options, Map<String, Card> choiceMap);
public abstract List<AbilitySub> chooseModeForAbility(SpellAbility sa, int min, int num);
public abstract List<AbilitySub> chooseModeForAbility(SpellAbility sa, int min, int num, boolean allowRepeat);
public abstract byte chooseColor(String message, SpellAbility sa, ColorSet colors);
public abstract byte chooseColorAllowColorless(String message, Card c, ColorSet colors);