mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00:13 +00:00
fixed implementation of Jaded Response (fixes #6414)
This commit is contained in:
parent
8e3f029df6
commit
79f49c9997
1 changed files with 13 additions and 16 deletions
|
@ -1,22 +1,19 @@
|
||||||
|
|
||||||
package mage.cards.j;
|
package mage.cards.j;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.ObjectColor;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.CounterTargetEffect;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.game.stack.StackObject;
|
import mage.game.stack.StackObject;
|
||||||
|
import mage.target.TargetSpell;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public final class JadedResponse extends CardImpl {
|
public final class JadedResponse extends CardImpl {
|
||||||
|
@ -26,9 +23,10 @@ public final class JadedResponse extends CardImpl {
|
||||||
|
|
||||||
// Counter target spell if it shares a color with a creature you control.
|
// Counter target spell if it shares a color with a creature you control.
|
||||||
this.getSpellAbility().addEffect(new JadedResponseEffect());
|
this.getSpellAbility().addEffect(new JadedResponseEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetSpell());
|
||||||
}
|
}
|
||||||
|
|
||||||
public JadedResponse(final JadedResponse card) {
|
private JadedResponse(final JadedResponse card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +43,7 @@ class JadedResponseEffect extends OneShotEffect {
|
||||||
this.staticText = "Counter target spell if it shares a color with a creature you control";
|
this.staticText = "Counter target spell if it shares a color with a creature you control";
|
||||||
}
|
}
|
||||||
|
|
||||||
JadedResponseEffect(final JadedResponseEffect effect) {
|
private JadedResponseEffect(final JadedResponseEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,13 +58,12 @@ class JadedResponseEffect extends OneShotEffect {
|
||||||
if (stackObject == null) {
|
if (stackObject == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ObjectColor creatureColors = new ObjectColor();
|
boolean matches = game.getBattlefield()
|
||||||
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_CREATURES, source.getControllerId(), game)) {
|
.getAllActivePermanents(
|
||||||
creatureColors = creatureColors.union(creature.getColor(game));
|
StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game
|
||||||
if (!creatureColors.intersection(stackObject.getColor(game)).isColorless()) {
|
).stream()
|
||||||
return new CounterTargetEffect().apply(game, source);
|
.map(permanent -> permanent.getColor(game))
|
||||||
}
|
.anyMatch(stackObject.getColor(game)::shares);
|
||||||
}
|
return matches && game.getStack().counter(stackObject.getId(), source.getSourceId(), game);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue