- Little fixes

This commit is contained in:
Jeff 2013-07-13 11:36:38 -05:00
parent 281d88c972
commit 951b944555
3 changed files with 15 additions and 7 deletions

View file

@ -46,13 +46,11 @@ import mage.constants.Layer;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.SubLayer; import mage.constants.SubLayer;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -63,7 +61,7 @@ import mage.target.targetpointer.FixedTarget;
*/ */
public class KarrthusTyrantOfJund extends CardImpl<KarrthusTyrantOfJund> { public class KarrthusTyrantOfJund extends CardImpl<KarrthusTyrantOfJund> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other Dragons you control"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Dragon creatures you control");
static { static {
filter.add(new AnotherPredicate()); filter.add(new AnotherPredicate());

View file

@ -76,7 +76,7 @@ public class PardicDragon extends CardImpl<PardicDragon> {
this.addAbility(new SuspendAbility(2, new ManaCostsImpl("{R}{R}"), this, true)); 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. // 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( this.addAbility(new ConditionalTriggeredAbility(
new OpponentCastsSpellTriggeredAbility(Zone.EXILED, new PardicDragonEffect(), new FilterCard(), false), new OpponentCastsSpellTriggeredAbility(Zone.EXILED, new PardicDragonEffect(), new FilterCard(), false, true),
SuspendedCondition.getInstance(), SuspendedCondition.getInstance(),
"Whenever an opponent casts a spell, if {this} is suspended, that player may put a time counter on Pardic Dragon." "Whenever an opponent casts a spell, if {this} is suspended, that player may put a time counter on Pardic Dragon."
)); ));

View file

@ -41,8 +41,10 @@ import mage.target.targetpointer.FixedTarget;
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class OpponentCastsSpellTriggeredAbility extends TriggeredAbilityImpl<OpponentCastsSpellTriggeredAbility> { public class OpponentCastsSpellTriggeredAbility extends TriggeredAbilityImpl<OpponentCastsSpellTriggeredAbility> {
private static final FilterCard spellCard = new FilterCard("a spell"); private static final FilterCard spellCard = new FilterCard("a spell");
protected FilterCard filter; protected FilterCard filter;
protected boolean setTargetPointerPlayer;
public OpponentCastsSpellTriggeredAbility(Effect effect, boolean optional) { public OpponentCastsSpellTriggeredAbility(Effect effect, boolean optional) {
this(effect, spellCard, optional); this(effect, spellCard, optional);
@ -57,19 +59,28 @@ public class OpponentCastsSpellTriggeredAbility extends TriggeredAbilityImpl<Opp
this.filter = filter; this.filter = filter;
} }
public OpponentCastsSpellTriggeredAbility(Zone zone, Effect effect, FilterCard filter, boolean optional, boolean setTargetPointerPlayer) {
super(zone, effect, optional);
this.filter = filter;
this.setTargetPointerPlayer = setTargetPointerPlayer;
}
public OpponentCastsSpellTriggeredAbility(final OpponentCastsSpellTriggeredAbility ability) { public OpponentCastsSpellTriggeredAbility(final OpponentCastsSpellTriggeredAbility ability) {
super(ability); super(ability);
filter = ability.filter; filter = ability.filter;
this.setTargetPointerPlayer = ability.setTargetPointerPlayer;
} }
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST && game.getOpponents(controllerId).contains(event.getPlayerId())) { if (event.getType() == GameEvent.EventType.SPELL_CAST && game.getOpponents(controllerId).contains(event.getPlayerId())) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && filter.match(spell, game)) { if (spell != null && filter.match(spell, game) && !setTargetPointerPlayer) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId())); this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
return true; return true;
} else {
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
return true;
} }
} }
return false; return false;
@ -84,5 +95,4 @@ public class OpponentCastsSpellTriggeredAbility extends TriggeredAbilityImpl<Opp
public OpponentCastsSpellTriggeredAbility copy() { public OpponentCastsSpellTriggeredAbility copy() {
return new OpponentCastsSpellTriggeredAbility(this); return new OpponentCastsSpellTriggeredAbility(this);
} }
} }