mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
Fixed a bug of SpellCastOpponentTriggeredAbility and changed FilterCard to FilterSpell.
This commit is contained in:
parent
eff2572ee5
commit
ff1b2ceb72
6 changed files with 25 additions and 21 deletions
|
@ -107,8 +107,9 @@ class ReciprocateTarget<T extends TargetCreaturePermanent<T>> extends TargetPerm
|
|||
@Override
|
||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
int remainingTargets = this.minNumberOfTargets - targets.size();
|
||||
if (remainingTargets == 0)
|
||||
return true;
|
||||
if (remainingTargets == 0) {
|
||||
return true;
|
||||
}
|
||||
int count = 0;
|
||||
MageObject targetSource = game.getObject(sourceId);
|
||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId);
|
||||
|
@ -116,8 +117,9 @@ class ReciprocateTarget<T extends TargetCreaturePermanent<T>> extends TargetPerm
|
|||
if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game)
|
||||
&& watcher != null && watcher.damageSources.contains(permanent.getId())) {
|
||||
count++;
|
||||
if (count >= remainingTargets)
|
||||
return true;
|
||||
if (count >= remainingTargets) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -126,8 +126,9 @@ class GiltspireAvengerTarget<T extends TargetCreaturePermanent<T>> extends Targe
|
|||
@Override
|
||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
int remainingTargets = this.minNumberOfTargets - targets.size();
|
||||
if (remainingTargets == 0)
|
||||
return true;
|
||||
if (remainingTargets == 0) {
|
||||
return true;
|
||||
}
|
||||
int count = 0;
|
||||
MageObject targetSource = game.getObject(sourceId);
|
||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId);
|
||||
|
@ -135,8 +136,9 @@ class GiltspireAvengerTarget<T extends TargetCreaturePermanent<T>> extends Targe
|
|||
if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game)
|
||||
&& watcher != null && watcher.damageSources.contains(permanent.getId())) {
|
||||
count++;
|
||||
if (count >= remainingTargets)
|
||||
return true;
|
||||
if (count >= remainingTargets) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -36,7 +36,7 @@ import mage.abilities.common.SpellCastOpponentTriggeredAbility;
|
|||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
||||
|
@ -46,7 +46,7 @@ import mage.filter.predicate.mageobject.ColorPredicate;
|
|||
*/
|
||||
public class MoldAdder extends CardImpl<MoldAdder> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("blue or black spell");
|
||||
private static final FilterSpell filter = new FilterSpell("blue or black spell");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
|
|
|
@ -39,7 +39,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
@ -52,7 +52,7 @@ import mage.players.Player;
|
|||
*/
|
||||
public class Mindsparker extends CardImpl<Mindsparker> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("white or blue instant or sorcery spell");
|
||||
private static final FilterSpell filter = new FilterSpell("white or blue instant or sorcery spell");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
|
|
|
@ -49,7 +49,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class PardicDragon extends CardImpl<PardicDragon> {
|
|||
this.addAbility(new SuspendAbility(2, new ManaCostsImpl("{R}{R}"), this, true));
|
||||
// Whenever an opponent casts a spell, if Pardic Dragon is suspended, that player may put a time counter on Pardic Dragon.
|
||||
this.addAbility(new ConditionalTriggeredAbility(
|
||||
new SpellCastOpponentTriggeredAbility(Zone.EXILED, new PardicDragonEffect(), new FilterCard(), false, true),
|
||||
new SpellCastOpponentTriggeredAbility(Zone.EXILED, new PardicDragonEffect(), new FilterSpell(), false, true),
|
||||
SuspendedCondition.getInstance(),
|
||||
"Whenever an opponent casts a spell, if {this} is suspended, that player may put a time counter on Pardic Dragon."
|
||||
));
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.abilities.common;
|
|||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
|
@ -42,23 +42,23 @@ import mage.target.targetpointer.FixedTarget;
|
|||
*/
|
||||
public class SpellCastOpponentTriggeredAbility extends TriggeredAbilityImpl<SpellCastOpponentTriggeredAbility> {
|
||||
|
||||
private static final FilterCard spellCard = new FilterCard("a spell");
|
||||
protected FilterCard filter;
|
||||
private static final FilterSpell spellCard = new FilterSpell("a spell");
|
||||
protected FilterSpell filter;
|
||||
protected boolean setTargetPointerPlayer;
|
||||
|
||||
public SpellCastOpponentTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, spellCard, optional);
|
||||
}
|
||||
|
||||
public SpellCastOpponentTriggeredAbility(Effect effect, FilterCard filter, boolean optional) {
|
||||
public SpellCastOpponentTriggeredAbility(Effect effect, FilterSpell filter, boolean optional) {
|
||||
this(Zone.BATTLEFIELD, effect, filter, optional);
|
||||
}
|
||||
|
||||
public SpellCastOpponentTriggeredAbility(Zone zone, Effect effect, FilterCard filter, boolean optional) {
|
||||
public SpellCastOpponentTriggeredAbility(Zone zone, Effect effect, FilterSpell filter, boolean optional) {
|
||||
this(zone, effect, filter, optional, false);
|
||||
}
|
||||
|
||||
public SpellCastOpponentTriggeredAbility(Zone zone, Effect effect, FilterCard filter, boolean optional, boolean setTargetPointerPlayer) {
|
||||
public SpellCastOpponentTriggeredAbility(Zone zone, Effect effect, FilterSpell filter, boolean optional, boolean setTargetPointerPlayer) {
|
||||
super(zone, effect, optional);
|
||||
this.filter = filter;
|
||||
this.setTargetPointerPlayer = setTargetPointerPlayer;
|
||||
|
@ -79,8 +79,8 @@ public class SpellCastOpponentTriggeredAbility extends TriggeredAbilityImpl<Spel
|
|||
for (Effect effect: this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue