forked from External/mage
Bugfix: Kindred Dominance type choice now works correctly.
This commit is contained in:
parent
95492e29e8
commit
305403feeb
1 changed files with 8 additions and 9 deletions
|
|
@ -35,6 +35,8 @@ import mage.abilities.effects.common.ChooseCreatureTypeEffect;
|
|||
import mage.abilities.effects.common.DestroyAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceCreatureType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -55,7 +57,6 @@ public class KindredDominance extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{B}{B}");
|
||||
|
||||
// Choose a creature type. Destroy all creatures that are not the chosen type.
|
||||
this.getSpellAbility().addEffect(new ChooseCreatureTypeEffect(Outcome.DestroyPermanent));
|
||||
this.getSpellAbility().addEffect(new KindredDominanceEffect());
|
||||
}
|
||||
|
||||
|
|
@ -88,14 +89,12 @@ class KindredDominanceEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (controller != null & mageObject != null) {
|
||||
SubType subType = ChooseCreatureTypeEffect.getChoosenCreatureType(source.getSourceId(), game);
|
||||
if (subType != null) {
|
||||
FilterPermanent filter = new FilterCreaturePermanent("creatures");
|
||||
filter.add(Predicates.not(new SubtypePredicate(subType)));
|
||||
return new DestroyAllEffect(filter).apply(game, source);
|
||||
}
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
if (controller != null && controller.choose(outcome, typeChoice, game)) {
|
||||
game.informPlayers(controller.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("All creatures not of the chosen type");
|
||||
filter.add(Predicates.not(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice()))));
|
||||
return new DestroyAllEffect(filter).apply(game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue