hasOptions use same method as getArtificialOptions to generate options

master
melvin 2012-09-25 13:16:41 +08:00
parent be5252da9d
commit b41c3dd87a
1 changed files with 15 additions and 7 deletions

View File

@ -40,8 +40,14 @@ public class MagicPayManaCostChoice extends MagicChoice {
@Override
boolean hasOptions(final MagicGame game,final MagicPlayer player,final MagicSource source,final boolean hints) {
final MagicPayManaCostResultBuilder builder=new MagicPayManaCostResultBuilder(game,player,cost.getBuilderCost());
return builder.hasResults();
final Collection<Object> options = genOptions(game, player);
return !options.isEmpty();
}
private Collection<Object> genOptions(final MagicGame game, final MagicPlayer player) {
return game.getFastChoices() ?
buildDelayedPayManaCostResults(game,player) :
new MagicPayManaCostResultBuilder(game,player,cost.getBuilderCost()).getResults();
}
private Collection<Object> buildDelayedPayManaCostResults(final MagicGame game,final MagicPlayer player) {
@ -68,12 +74,14 @@ public class MagicPayManaCostChoice extends MagicChoice {
final MagicPlayer player,
final MagicSource source) {
final Collection<Object> options =
game.getFastChoices() ?
buildDelayedPayManaCostResults(game,player) :
new MagicPayManaCostResultBuilder(game,player,cost.getBuilderCost()).getResults();
final Collection<Object> options = genOptions(game, player);
assert options.size() > 0 : "No options to pay mana cost";
assert !options.isEmpty() :
"No options to pay mana cost\n" +
"fastChoices = " + game.getFastChoices() + "\n" +
"source = " + source + "\n" +
"player = " + player + "\n" +
"event = " + event + "\n";
return options;
}