mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Add DontUntapAsLongAsSourceTappedEffect and connectSource parameter to TapTargetEffect. Use them for existing cards. Implement card: Thalakos Dreamsower
This commit is contained in:
parent
6d90539b7b
commit
82f2d73fb9
6 changed files with 189 additions and 310 deletions
|
@ -29,21 +29,16 @@ package mage.sets.journeyintonyx;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
|
||||||
import mage.abilities.common.SkipUntapOptionalAbility;
|
import mage.abilities.common.SkipUntapOptionalAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.RestrictionEffect;
|
import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
|
||||||
import mage.abilities.effects.common.TapTargetEffect;
|
import mage.abilities.effects.common.TapTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,12 +55,11 @@ public class DesertersQuarters extends CardImpl {
|
||||||
this.addAbility(new SkipUntapOptionalAbility());
|
this.addAbility(new SkipUntapOptionalAbility());
|
||||||
|
|
||||||
// {6}, T: Tap target creature. It doesn't untap during its controller's untap step for as long as Deserter's Quarters remains tapped.
|
// {6}, T: Tap target creature. It doesn't untap during its controller's untap step for as long as Deserter's Quarters remains tapped.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DesertersQuartersTapTargetEffect(), new GenericManaCost(6));
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(true), new GenericManaCost(6));
|
||||||
ability.addCost(new TapSourceCost());
|
ability.addCost(new TapSourceCost());
|
||||||
ability.addTarget(new TargetCreaturePermanent());
|
ability.addTarget(new TargetCreaturePermanent());
|
||||||
|
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DesertersQuartersRestrictionEffect()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DesertersQuarters(final DesertersQuarters card) {
|
public DesertersQuarters(final DesertersQuarters card) {
|
||||||
|
@ -77,79 +71,3 @@ public class DesertersQuarters extends CardImpl {
|
||||||
return new DesertersQuarters(this);
|
return new DesertersQuarters(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DesertersQuartersTapTargetEffect extends TapTargetEffect {
|
|
||||||
|
|
||||||
public DesertersQuartersTapTargetEffect() {
|
|
||||||
super();
|
|
||||||
staticText = "Tap target creature. It doesn't untap during its controller's untap step for as long as {this} remains tapped";
|
|
||||||
}
|
|
||||||
|
|
||||||
public DesertersQuartersTapTargetEffect(final DesertersQuartersTapTargetEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (sourcePermanent != null) {
|
|
||||||
sourcePermanent.clearConnectedCards("DesertersQuarters");
|
|
||||||
}
|
|
||||||
for (UUID target : targetPointer.getTargets(game, source)) {
|
|
||||||
Permanent permanent = game.getPermanent(target);
|
|
||||||
if (sourcePermanent != null) {
|
|
||||||
sourcePermanent.addConnectedCard("DesertersQuarters", permanent.getId());
|
|
||||||
}
|
|
||||||
if (permanent != null) {
|
|
||||||
permanent.tap(game);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DesertersQuartersTapTargetEffect copy() {
|
|
||||||
return new DesertersQuartersTapTargetEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText(Mode mode) {
|
|
||||||
return staticText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class DesertersQuartersRestrictionEffect extends RestrictionEffect {
|
|
||||||
|
|
||||||
public DesertersQuartersRestrictionEffect() {
|
|
||||||
super(Duration.WhileOnBattlefield);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DesertersQuartersRestrictionEffect(final DesertersQuartersRestrictionEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
|
||||||
Permanent rustTick = game.getPermanent(source.getSourceId());
|
|
||||||
if (rustTick != null && rustTick.isTapped()) {
|
|
||||||
if (rustTick.getConnectedCards("DesertersQuarters").size() > 0) {
|
|
||||||
UUID target = rustTick.getConnectedCards("DesertersQuarters").get(0);
|
|
||||||
if (target != null && target.equals(permanent.getId())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canBeUntapped(Permanent permanent, Ability source, Game game) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DesertersQuartersRestrictionEffect copy() {
|
|
||||||
return new DesertersQuartersRestrictionEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -29,27 +29,19 @@ package mage.sets.mirage;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
|
||||||
import mage.abilities.common.SkipUntapOptionalAbility;
|
import mage.abilities.common.SkipUntapOptionalAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
|
||||||
import mage.abilities.effects.RestrictionEffect;
|
import mage.abilities.effects.common.TapTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.events.GameEvent;
|
|
||||||
import mage.game.events.GameEvent.EventType;
|
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,12 +67,11 @@ public class AmberPrison extends CardImpl {
|
||||||
this.addAbility(new SkipUntapOptionalAbility());
|
this.addAbility(new SkipUntapOptionalAbility());
|
||||||
|
|
||||||
// {4}, {tap}: Tap target artifact, creature, or land. That permanent doesn't untap during its controller's untap step for as long as Amber Prison remains tapped.
|
// {4}, {tap}: Tap target artifact, creature, or land. That permanent doesn't untap during its controller's untap step for as long as Amber Prison remains tapped.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AmberPrisonTapTargetEffect(), new GenericManaCost(4));
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(true), new GenericManaCost(4));
|
||||||
ability.addCost(new TapSourceCost());
|
ability.addCost(new TapSourceCost());
|
||||||
ability.addTarget(new TargetPermanent(filter));
|
ability.addTarget(new TargetPermanent(filter));
|
||||||
|
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
this.addAbility(new AmberPrisonUntapTriggeredAbility());
|
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AmberPrisonRestrictionEffect()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmberPrison(final AmberPrison card) {
|
public AmberPrison(final AmberPrison card) {
|
||||||
|
@ -92,124 +83,3 @@ public class AmberPrison extends CardImpl {
|
||||||
return new AmberPrison(this);
|
return new AmberPrison(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AmberPrisonTapTargetEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public AmberPrisonTapTargetEffect() {
|
|
||||||
super(Outcome.Tap);
|
|
||||||
this.staticText = "Tap target artifact, creature, or land. That permanent doesn't untap during its controller's untap step for as long as {source} remains tapped.";
|
|
||||||
}
|
|
||||||
|
|
||||||
public AmberPrisonTapTargetEffect(final AmberPrisonTapTargetEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AmberPrisonTapTargetEffect copy() {
|
|
||||||
return new AmberPrisonTapTargetEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
|
||||||
for (UUID target : targetPointer.getTargets(game, source)) {
|
|
||||||
Permanent permanent = game.getPermanent(target);
|
|
||||||
if (permanent != null) {
|
|
||||||
if (sourcePermanent != null) {
|
|
||||||
sourcePermanent.addConnectedCard("AmberPrison", permanent.getId());
|
|
||||||
}
|
|
||||||
permanent.tap(game);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class AmberPrisonRestrictionEffect extends RestrictionEffect {
|
|
||||||
|
|
||||||
public AmberPrisonRestrictionEffect() {
|
|
||||||
super(Duration.WhileOnBattlefield);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AmberPrisonRestrictionEffect(final AmberPrisonRestrictionEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AmberPrisonRestrictionEffect copy() {
|
|
||||||
return new AmberPrisonRestrictionEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (sourcePermanent != null && sourcePermanent.isTapped()) {
|
|
||||||
if (sourcePermanent.getConnectedCards("AmberPrison") != null) {
|
|
||||||
return sourcePermanent.getConnectedCards("AmberPrison").contains(permanent.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canBeUntapped(Permanent permanent, Ability source, Game game) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class AmberPrisonUntapTriggeredAbility extends TriggeredAbilityImpl {
|
|
||||||
|
|
||||||
public AmberPrisonUntapTriggeredAbility() {
|
|
||||||
super(Zone.BATTLEFIELD, new AmberPrisonReleaseOnUntapEffect(), false);
|
|
||||||
this.usesStack = false;
|
|
||||||
this.ruleVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AmberPrisonUntapTriggeredAbility(final AmberPrisonUntapTriggeredAbility ability) {
|
|
||||||
super(ability);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AmberPrisonUntapTriggeredAbility copy() {
|
|
||||||
return new AmberPrisonUntapTriggeredAbility(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
|
||||||
return event.getType() == EventType.UNTAP;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
|
||||||
return event.getTargetId().equals(this.getSourceId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AmberPrisonReleaseOnUntapEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public AmberPrisonReleaseOnUntapEffect() {
|
|
||||||
super(Outcome.Detriment);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AmberPrisonReleaseOnUntapEffect(final AmberPrisonReleaseOnUntapEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AmberPrisonReleaseOnUntapEffect copy() {
|
|
||||||
return new AmberPrisonReleaseOnUntapEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (sourcePermanent != null) {
|
|
||||||
sourcePermanent.clearConnectedCards("AmberPrison");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -30,22 +30,17 @@ package mage.sets.scarsofmirrodin;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
|
||||||
import mage.abilities.common.SkipUntapOptionalAbility;
|
import mage.abilities.common.SkipUntapOptionalAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.RestrictionEffect;
|
|
||||||
import mage.abilities.effects.common.TapTargetEffect;
|
import mage.abilities.effects.common.TapTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.target.common.TargetArtifactPermanent;
|
import mage.target.common.TargetArtifactPermanent;
|
||||||
|
import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
|
@ -64,12 +59,11 @@ public class RustTick extends CardImpl {
|
||||||
this.addAbility(new SkipUntapOptionalAbility());
|
this.addAbility(new SkipUntapOptionalAbility());
|
||||||
|
|
||||||
// {1}, {tap}: Tap target artifact. It doesn't untap during its controller's untap step for as long as Rust Tick remains tapped.
|
// {1}, {tap}: Tap target artifact. It doesn't untap during its controller's untap step for as long as Rust Tick remains tapped.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RustTickTapTargetEffect(), new GenericManaCost(1));
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(true), new GenericManaCost(1));
|
||||||
ability.addCost(new TapSourceCost());
|
ability.addCost(new TapSourceCost());
|
||||||
ability.addTarget(new TargetArtifactPermanent());
|
ability.addTarget(new TargetArtifactPermanent());
|
||||||
|
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RustTickRestrictionEffect()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RustTick(final RustTick card) {
|
public RustTick(final RustTick card) {
|
||||||
|
@ -81,79 +75,3 @@ public class RustTick extends CardImpl {
|
||||||
return new RustTick(this);
|
return new RustTick(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class RustTickTapTargetEffect extends TapTargetEffect {
|
|
||||||
|
|
||||||
public RustTickTapTargetEffect() {
|
|
||||||
super();
|
|
||||||
staticText = "Tap target artifact. It doesn't untap during its controller's untap step for as long as Rust Tick remains tapped";
|
|
||||||
}
|
|
||||||
|
|
||||||
public RustTickTapTargetEffect(final RustTickTapTargetEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent rustTick = game.getPermanent(source.getSourceId());
|
|
||||||
if (rustTick != null) {
|
|
||||||
rustTick.clearConnectedCards("RustTick");
|
|
||||||
}
|
|
||||||
for (UUID target : targetPointer.getTargets(game, source)) {
|
|
||||||
Permanent permanent = game.getPermanent(target);
|
|
||||||
if (permanent != null) {
|
|
||||||
rustTick.addConnectedCard("RustTick", permanent.getId());
|
|
||||||
permanent.tap(game);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RustTickTapTargetEffect copy() {
|
|
||||||
return new RustTickTapTargetEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText(Mode mode) {
|
|
||||||
return staticText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class RustTickRestrictionEffect extends RestrictionEffect {
|
|
||||||
|
|
||||||
public RustTickRestrictionEffect() {
|
|
||||||
super(Duration.WhileOnBattlefield);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RustTickRestrictionEffect(final RustTickRestrictionEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
|
||||||
Permanent rustTick = game.getPermanent(source.getSourceId());
|
|
||||||
if (rustTick != null && rustTick.isTapped()) {
|
|
||||||
if (rustTick.getConnectedCards("RustTick").size() > 0) {
|
|
||||||
UUID target = rustTick.getConnectedCards("RustTick").get(0);
|
|
||||||
if (target != null && target.equals(permanent.getId())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canBeUntapped(Permanent permanent, Ability source, Game game) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RustTickRestrictionEffect copy() {
|
|
||||||
return new RustTickRestrictionEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
76
Mage.Sets/src/mage/sets/tempest/ThalakosDreamsower.java
Normal file
76
Mage.Sets/src/mage/sets/tempest/ThalakosDreamsower.java
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package mage.sets.tempest;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
|
||||||
|
import mage.abilities.common.SkipUntapOptionalAbility;
|
||||||
|
import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
|
||||||
|
import mage.abilities.effects.common.TapTargetEffect;
|
||||||
|
import mage.abilities.keyword.ShadowAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LoneFox
|
||||||
|
*/
|
||||||
|
public class ThalakosDreamsower extends CardImpl {
|
||||||
|
|
||||||
|
public ThalakosDreamsower(UUID ownerId) {
|
||||||
|
super(ownerId, 92, "Thalakos Dreamsower", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{U}");
|
||||||
|
this.expansionSetCode = "TMP";
|
||||||
|
this.subtype.add("Thalakos");
|
||||||
|
this.subtype.add("Wizard");
|
||||||
|
this.power = new MageInt(1);
|
||||||
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
|
// Shadow
|
||||||
|
this.addAbility(ShadowAbility.getInstance());
|
||||||
|
// You may choose not to untap Thalakos Dreamsower during your untap step.
|
||||||
|
this.addAbility(new SkipUntapOptionalAbility());
|
||||||
|
// Whenever Thalakos Dreamsower deals damage to an opponent, tap target creature. That creature doesn't untap during its controller's untap step for as long as Thalakos Dreamsower remains tapped.
|
||||||
|
Ability ability = new DealsDamageToOpponentTriggeredAbility(new TapTargetEffect(true), false);
|
||||||
|
ability.addTarget(new TargetCreaturePermanent());
|
||||||
|
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
|
||||||
|
this.addAbility(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ThalakosDreamsower(final ThalakosDreamsower card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThalakosDreamsower copy() {
|
||||||
|
return new ThalakosDreamsower(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.RestrictionEffect;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LoneFox
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DontUntapAsLongAsSourceTappedEffect extends RestrictionEffect {
|
||||||
|
|
||||||
|
public DontUntapAsLongAsSourceTappedEffect() {
|
||||||
|
super(Duration.WhileOnBattlefield);
|
||||||
|
staticText = "It doesn't untap during its controller's untap step for as long as {source} remains tapped.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public DontUntapAsLongAsSourceTappedEffect(final DontUntapAsLongAsSourceTappedEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
|
if(sourcePermanent != null && sourcePermanent.isTapped()) {
|
||||||
|
String name = sourcePermanent.getName();
|
||||||
|
if(sourcePermanent.getConnectedCards(name).size() > 0) {
|
||||||
|
UUID target = sourcePermanent.getConnectedCards(name).get(0);
|
||||||
|
if(target != null && target.equals(permanent.getId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBeUntapped(Permanent permanent, Ability source, Game game) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DontUntapAsLongAsSourceTappedEffect copy() {
|
||||||
|
return new DontUntapAsLongAsSourceTappedEffect(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,15 +28,14 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import mage.constants.Outcome;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.constants.Outcome;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,17 +43,31 @@ import mage.util.CardUtil;
|
||||||
*/
|
*/
|
||||||
public class TapTargetEffect extends OneShotEffect {
|
public class TapTargetEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
private final boolean connectSource;
|
||||||
|
|
||||||
public TapTargetEffect() {
|
public TapTargetEffect() {
|
||||||
super(Outcome.Tap);
|
this(null, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TapTargetEffect(boolean connectSource) {
|
||||||
|
this(null, connectSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TapTargetEffect(String text) {
|
public TapTargetEffect(String text) {
|
||||||
this();
|
this(text, false);
|
||||||
this.staticText = text;
|
}
|
||||||
|
|
||||||
|
public TapTargetEffect(String text, boolean connectSource) {
|
||||||
|
super(Outcome.Tap);
|
||||||
|
this.connectSource = connectSource;
|
||||||
|
if(text != null) {
|
||||||
|
this.staticText = text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TapTargetEffect(final TapTargetEffect effect) {
|
public TapTargetEffect(final TapTargetEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
this.connectSource = effect.connectSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,6 +81,12 @@ public class TapTargetEffect extends OneShotEffect {
|
||||||
Permanent permanent = game.getPermanent(target);
|
Permanent permanent = game.getPermanent(target);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.tap(game);
|
permanent.tap(game);
|
||||||
|
if(connectSource) {
|
||||||
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
|
if(sourcePermanent != null) {
|
||||||
|
sourcePermanent.addConnectedCard(sourcePermanent.getName(), permanent.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue