* Pine Walker - Fixed that the turned face up ability did also trigger for other creatures if Pine Walker was face down (fixes #581).

This commit is contained in:
LevelX2 2014-09-29 15:18:41 +02:00
parent 87b1b64d80
commit 6a9a7d11e8
5 changed files with 61 additions and 6 deletions

View file

@ -30,9 +30,11 @@ package mage.abilities.common;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.AbilityType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
@ -46,9 +48,10 @@ import mage.players.Player;
public class TurnFaceUpAbility extends ActivatedAbilityImpl {
public TurnFaceUpAbility(Costs costs) {
public TurnFaceUpAbility(Costs<Cost> costs) {
super(Zone.BATTLEFIELD, new TurnFaceUpEffect(), costs);
this.usesStack = false;
this.abilityType = AbilityType.SPECIAL_ACTION;
this.setRuleVisible(false); // will be made visible only to controller in CardView
}

View file

@ -54,7 +54,7 @@ public class TurnedFaceUpAllTriggeredAbility extends TriggeredAbilityImpl {
public TurnedFaceUpAllTriggeredAbility(Effect effect, FilterPermanent filter, boolean setTargetPointer) {
super(Zone.BATTLEFIELD, effect);
// has to be set so the ability triggers if card is turn faced up
// has to be set so the ability triggers if card itself is turn faced up
this.setWorksFaceDown(true);
this.filter = filter;
this.setTargetPointer = setTargetPointer;
@ -75,6 +75,18 @@ public class TurnedFaceUpAllTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (EventType.TURNEDFACEUP.equals(event.getType())) {
if (!event.getTargetId().equals(getSourceId())) {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getSourceId());
if (sourcePermanent != null) {
if (sourcePermanent.isFaceDown()) {
// if face down and it's not itself that is turned face up, it does not trigger
return false;
}
} else {
// Permanent is and was not on the battlefield
return false;
}
}
Permanent permanent = game.getPermanent(event.getTargetId());
if (filter.match(permanent, getSourceId(), getControllerId(), game)) {
if (setTargetPointer) {

View file

@ -26,9 +26,13 @@ public class TurnedFaceUpSourceTriggeredAbility extends TriggeredAbilityImpl {
public TurnedFaceUpSourceTriggeredAbility(Effect effect) {
this(effect, false);
}
public TurnedFaceUpSourceTriggeredAbility(Effect effect, boolean setTargetPointer) {
super(Zone.BATTLEFIELD, effect);
this(effect, setTargetPointer, false);
}
public TurnedFaceUpSourceTriggeredAbility(Effect effect, boolean setTargetPointer, boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
// has to be set so the ability triggers if card is turn faced up
this.setWorksFaceDown(true);
this.setTargetPointer = setTargetPointer;