mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Improved Doubling Chant.
This commit is contained in:
parent
3a88168bdd
commit
a2ae384960
1 changed files with 19 additions and 10 deletions
|
@ -89,21 +89,30 @@ class DoublingChantEffect extends OneShotEffect<DoublingChantEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
List<Card> chosenCards = new ArrayList<Card>();
|
||||
List<String> namesFiltered = new ArrayList<String>();
|
||||
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(FilterCreaturePermanent.getDefault(), source.getControllerId());
|
||||
for (Permanent creature : creatures) {
|
||||
final String creatureName = creature.getName();
|
||||
if (!namesFiltered.contains(creatureName)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Search for ").append(creature.getName()).append(" in your library?");
|
||||
sb.append("Search for ").append(creatureName).append(" in your library?");
|
||||
|
||||
if (player.chooseUse(Outcome.PutCreatureInPlay, sb.toString(), game)) {
|
||||
FilterCreatureCard filter = new FilterCreatureCard(creature.getName());
|
||||
filter.getName().add(creature.getName());
|
||||
FilterCreatureCard filter = new FilterCreatureCard(creatureName);
|
||||
filter.getName().add(creatureName);
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
|
||||
if (player.searchLibrary(target, game)) {
|
||||
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
chosenCards.add(card);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
namesFiltered.add(creatureName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue