Implemented Run Away Together

This commit is contained in:
Evan Kranzler 2019-09-04 08:38:27 -04:00
parent 6ab89127c9
commit dd3bedb5c0
2 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,71 @@
package mage.cards.r;
import mage.abilities.Ability;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RunAwayTogether extends CardImpl {
public RunAwayTogether(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Choose two target creatures controlled by different players. Return those creatures to their owners' hands.
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect(true));
this.getSpellAbility().addTarget(new RunAwayTogetherTarget());
}
private RunAwayTogether(final RunAwayTogether card) {
super(card);
}
@Override
public RunAwayTogether copy() {
return new RunAwayTogether(this);
}
}
class RunAwayTogetherTarget extends TargetCreaturePermanent {
RunAwayTogetherTarget() {
super(2, 2, StaticFilters.FILTER_PERMANENT_CREATURE, false);
}
private RunAwayTogetherTarget(final RunAwayTogetherTarget target) {
super(target);
}
@Override
public RunAwayTogetherTarget copy() {
return new RunAwayTogetherTarget(this);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (!super.canTarget(controllerId, id, source, game)) {
return false;
}
Permanent creature = game.getPermanent(id);
if (creature == null) {
return false;
}
return !this.getTargets()
.stream()
.map(game::getPermanent)
.anyMatch(permanent -> permanent != null
&& !creature.getId().equals(permanent.getId())
&& !creature.isControlledBy(permanent.getControllerId())
);
}
}
// give carly rae jepsen a sword

View file

@ -33,6 +33,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Gilded Goose", 160, Rarity.RARE, mage.cards.g.GildedGoose.class));
cards.add(new SetCardInfo("Golden Egg", 220, Rarity.COMMON, mage.cards.g.GoldenEgg.class));
cards.add(new SetCardInfo("Maraleaf Pixie", 196, Rarity.UNCOMMON, mage.cards.m.MaraleafPixie.class));
cards.add(new SetCardInfo("Run Away Together", 62, Rarity.COMMON, mage.cards.r.RunAwayTogether.class));
cards.add(new SetCardInfo("Tome Raider", 68, Rarity.COMMON, mage.cards.t.TomeRaider.class));
cards.add(new SetCardInfo("Wishful Merfolk", 73, Rarity.COMMON, mage.cards.w.WishfulMerfolk.class));
cards.add(new SetCardInfo("Witching Well", 74, Rarity.COMMON, mage.cards.w.WitchingWell.class));