mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
* Venser, the Sojourner - Fixed target of first ability to only allow to target permanents you own.
This commit is contained in:
parent
8b03a5b940
commit
11298a2d5f
1 changed files with 28 additions and 12 deletions
|
@ -29,6 +29,7 @@
|
||||||
package mage.sets.scarsofmirrodin;
|
package mage.sets.scarsofmirrodin;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObject;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
@ -48,17 +49,20 @@ import mage.abilities.effects.common.combat.UnblockableAllEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.TargetController;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.FilterSpell;
|
import mage.filter.FilterSpell;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.other.OwnerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.command.Emblem;
|
import mage.game.command.Emblem;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,17 +70,24 @@ import mage.target.targetpointer.FixedTarget;
|
||||||
*/
|
*/
|
||||||
public class VenserTheSojourner extends CardImpl {
|
public class VenserTheSojourner extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterPermanent filter = new FilterCreaturePermanent("permanent you own");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(new OwnerPredicate(TargetController.YOU));
|
||||||
|
}
|
||||||
|
|
||||||
public VenserTheSojourner(UUID ownerId) {
|
public VenserTheSojourner(UUID ownerId) {
|
||||||
super(ownerId, 135, "Venser, the Sojourner", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{3}{W}{U}");
|
super(ownerId, 135, "Venser, the Sojourner", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{3}{W}{U}");
|
||||||
this.expansionSetCode = "SOM";
|
this.expansionSetCode = "SOM";
|
||||||
this.subtype.add("Venser");
|
this.subtype.add("Venser");
|
||||||
this.color.setWhite(true);
|
this.color.setWhite(true);
|
||||||
this.color.setBlue(true);
|
this.color.setBlue(true);
|
||||||
|
|
||||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
|
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
|
||||||
|
|
||||||
// +2: Exile target permanent you own. Return it to the battlefield under your control at the beginning of the next end step.
|
// +2: Exile target permanent you own. Return it to the battlefield under your control at the beginning of the next end step.
|
||||||
LoyaltyAbility ability1 = new LoyaltyAbility(new VenserTheSojournerEffect(), 2);
|
LoyaltyAbility ability1 = new LoyaltyAbility(new VenserTheSojournerEffect(), 2);
|
||||||
Target target = new TargetControlledPermanent();
|
Target target = new TargetPermanent(filter);
|
||||||
ability1.addTarget(target);
|
ability1.addTarget(target);
|
||||||
this.addAbility(ability1);
|
this.addAbility(ability1);
|
||||||
|
|
||||||
|
@ -114,18 +125,23 @@ class VenserTheSojournerEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
if (getTargetPointer().getFirst(game, source) != null) {
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (controller != null && sourceObject != null) {
|
||||||
if (permanent.moveToExile(source.getSourceId(), "Venser, the Sojourner", source.getSourceId(), game)) {
|
if (getTargetPointer().getFirst(game, source) != null) {
|
||||||
//create delayed triggered ability
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
|
if (permanent != null) {
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getLogName(), source.getSourceId(), game, Zone.BATTLEFIELD)) {
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
//create delayed triggered ability
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
|
||||||
return true;
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue