forked from External/mage
- Fixed #5777.
This commit is contained in:
parent
735d2a16a2
commit
ef48d23c4a
1 changed files with 15 additions and 13 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -13,7 +12,7 @@ import mage.constants.TargetController;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.filter.predicate.other.OwnerPredicate;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -28,23 +27,24 @@ import mage.players.Player;
|
|||
*/
|
||||
public final class BridgeFromBelow extends CardImpl {
|
||||
|
||||
|
||||
private static final FilterCreaturePermanent filter1 = new FilterCreaturePermanent("Whenever a nontoken creature is put into your graveyard from the battlefield");
|
||||
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("When a creature is put into an opponent's graveyard from the battlefield");
|
||||
|
||||
static{
|
||||
filter1.add(new ControllerPredicate(TargetController.YOU));
|
||||
|
||||
static {
|
||||
filter1.add(new OwnerPredicate(TargetController.YOU));
|
||||
filter1.add(Predicates.not(TokenPredicate.instance));
|
||||
filter2.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
filter2.add(new OwnerPredicate(TargetController.OPPONENT));
|
||||
}
|
||||
|
||||
|
||||
public BridgeFromBelow(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{B}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}{B}{B}");
|
||||
|
||||
// Whenever a nontoken creature is put into your graveyard from the battlefield, if Bridge from Below is in your graveyard, create a 2/2 black Zombie creature token.
|
||||
this.addAbility(new BridgeFromBelowAbility(new CreateTokenEffect(new ZombieToken()), filter1));
|
||||
|
||||
// When a creature is put into an opponent's graveyard from the battlefield, if Bridge from Below is in your graveyard, exile Bridge from Below.
|
||||
this.addAbility(new BridgeFromBelowAbility(new ExileSourceEffect(), filter2));
|
||||
|
||||
}
|
||||
|
||||
public BridgeFromBelow(final BridgeFromBelow card) {
|
||||
|
|
@ -86,7 +86,8 @@ class BridgeFromBelowAbility extends TriggeredAbilityImpl {
|
|||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.isDiesEvent()) {
|
||||
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
||||
if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) {
|
||||
if (permanent != null
|
||||
&& filter.match(permanent, sourceId, controllerId, game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -96,11 +97,12 @@ class BridgeFromBelowAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
Player controller = game.getPlayer(this.getControllerId());
|
||||
return controller != null && controller.getGraveyard().contains(this.getSourceId());
|
||||
return controller != null
|
||||
&& controller.getGraveyard().contains(this.getSourceId());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return filter.getMessage() +", if {this} is in your graveyard, " + super.getRule();
|
||||
return filter.getMessage() + ", if {this} is in your graveyard, " + super.getRule();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue