forked from External/mage
new TargetPlayerGainControlSourceEffect
rework Drooling Ogre and others to use it
This commit is contained in:
parent
94ca1626c7
commit
d6e7ff6dad
16 changed files with 139 additions and 549 deletions
|
|
@ -1,15 +1,13 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.DiesAttachedTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
|
|
@ -17,10 +15,10 @@ import mage.abilities.keyword.VigilanceAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
|
|
@ -46,7 +44,7 @@ public final class AvariceAmulet extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// Whenever equipped creature dies, target opponent gains control of Avarice Amulet.
|
||||
ability = new DiesAttachedTriggeredAbility(new AvariceAmuletChangeControlEffect(), "equipped creature", false);
|
||||
ability = new DiesAttachedTriggeredAbility(new TargetPlayerGainControlSourceEffect(), "equipped creature", false);
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
@ -63,30 +61,3 @@ public final class AvariceAmulet extends CardImpl {
|
|||
return new AvariceAmulet(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AvariceAmuletChangeControlEffect extends ContinuousEffectImpl {
|
||||
|
||||
AvariceAmuletChangeControlEffect() {
|
||||
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
staticText = "target opponent gains control of {this}";
|
||||
}
|
||||
|
||||
private AvariceAmuletChangeControlEffect(final AvariceAmuletChangeControlEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AvariceAmuletChangeControlEffect copy() {
|
||||
return new AvariceAmuletChangeControlEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
return permanent.changeControllerId(source.getFirstTarget(), game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.ControlsPermanentsComparedToOpponentsCondition;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
|
@ -62,7 +62,7 @@ class ChaosLordTriggeredAbility extends BeginningOfUpkeepTriggeredAbility {
|
|||
|
||||
ChaosLordTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD,
|
||||
new GainControlSourceEffect(),
|
||||
new TargetPlayerGainControlSourceEffect(),
|
||||
TargetController.YOU,
|
||||
false);
|
||||
}
|
||||
|
|
@ -96,39 +96,11 @@ class ChaosLordTriggeredAbility extends BeginningOfUpkeepTriggeredAbility {
|
|||
|
||||
}
|
||||
|
||||
class GainControlSourceEffect extends ContinuousEffectImpl {
|
||||
|
||||
GainControlSourceEffect() {
|
||||
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
staticText = "target opponent gains control of {this}";
|
||||
}
|
||||
|
||||
private GainControlSourceEffect(final GainControlSourceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GainControlSourceEffect copy() {
|
||||
return new GainControlSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent != null) {
|
||||
return permanent.changeControllerId(source.getFirstTarget(), game, source);
|
||||
} else {
|
||||
discard();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class ChaosLordEffect extends AsThoughEffectImpl {
|
||||
|
||||
ChaosLordEffect() {
|
||||
super(AsThoughEffectType.ATTACK_AS_HASTE, Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "Chaos Lord can attack as though it had haste unless it entered the battlefield this turn";
|
||||
staticText = "{this} can attack as though it had haste unless it entered the battlefield this turn";
|
||||
}
|
||||
|
||||
private ChaosLordEffect(final ChaosLordEffect effect) {
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.DrawCardTargetEffect;
|
||||
import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect;
|
||||
import mage.abilities.effects.common.UntapSourceEffect;
|
||||
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
|
||||
import mage.abilities.mana.SimpleManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -59,7 +59,7 @@ class CovetedJewelTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public CovetedJewelTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DrawCardTargetEffect(3), false);
|
||||
this.addEffect(new CovetedJewelControlEffect());
|
||||
this.addEffect(new TargetPlayerGainControlSourceEffect());
|
||||
this.addEffect(new UntapSourceEffect());
|
||||
}
|
||||
|
||||
|
|
@ -103,31 +103,3 @@ class CovetedJewelTriggeredAbility extends TriggeredAbilityImpl {
|
|||
+ "and gains control of {this}. Untap it.";
|
||||
}
|
||||
}
|
||||
|
||||
class CovetedJewelControlEffect extends ContinuousEffectImpl {
|
||||
|
||||
CovetedJewelControlEffect() {
|
||||
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
}
|
||||
|
||||
private CovetedJewelControlEffect(final CovetedJewelControlEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CovetedJewelControlEffect copy() {
|
||||
return new CovetedJewelControlEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
Player newControllingPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (permanent == null || newControllingPlayer == null || !newControllingPlayer.canRespond()) {
|
||||
this.discard();
|
||||
return false;
|
||||
}
|
||||
permanent.changeControllerId(getTargetPointer().getFirst(game, source), game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,14 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SourceDealsDamageToThisTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -30,7 +23,7 @@ public final class CragSaurian extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Whenever a source deals damage to Crag Saurian, that source's controller gains control of Crag Saurian.
|
||||
this.addAbility(new SourceDealsDamageToThisTriggeredAbility(new CragSaurianEffect()));
|
||||
this.addAbility(new SourceDealsDamageToThisTriggeredAbility(new TargetPlayerGainControlSourceEffect("that source's controller")));
|
||||
}
|
||||
|
||||
private CragSaurian(final CragSaurian card) {
|
||||
|
|
@ -42,33 +35,3 @@ public final class CragSaurian extends CardImpl {
|
|||
return new CragSaurian(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CragSaurianEffect extends OneShotEffect {
|
||||
|
||||
CragSaurianEffect() {
|
||||
super(Outcome.GainControl);
|
||||
this.staticText = "that source's controller gains control of {this}";
|
||||
}
|
||||
|
||||
private CragSaurianEffect(final CragSaurianEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player newController = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (newController != null && controller != null && !controller.equals(newController)) {
|
||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId());
|
||||
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CragSaurianEffect copy() {
|
||||
return new CragSaurianEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,19 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.abilities.common.SpellCastAllTriggeredAbility;
|
||||
import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.filter.StaticFilters;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author wetterlicht
|
||||
* @author xenohedron
|
||||
*/
|
||||
public final class DroolingOgre extends CardImpl {
|
||||
|
||||
|
|
@ -33,7 +24,8 @@ public final class DroolingOgre extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Whenever a player casts an artifact spell, that player gains control of Drooling Ogre.
|
||||
this.addAbility(new DroolingOgreTriggeredAbility());
|
||||
this.addAbility(new SpellCastAllTriggeredAbility(new TargetPlayerGainControlSourceEffect(),
|
||||
StaticFilters.FILTER_SPELL_AN_ARTIFACT, false, SetTargetPointer.PLAYER));
|
||||
}
|
||||
|
||||
private DroolingOgre(final DroolingOgre card) {
|
||||
|
|
@ -45,72 +37,4 @@ public final class DroolingOgre extends CardImpl {
|
|||
return new DroolingOgre(this);
|
||||
}
|
||||
|
||||
private static class DroolingOgreEffect extends OneShotEffect {
|
||||
|
||||
DroolingOgreEffect() {
|
||||
super(Outcome.GainControl);
|
||||
this.staticText = "that player gains control of {this}";
|
||||
}
|
||||
|
||||
private DroolingOgreEffect(final DroolingOgreEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player newController = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (newController != null
|
||||
&& controller != null
|
||||
&& !controller.equals(newController)) {
|
||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId());
|
||||
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DroolingOgreEffect copy() {
|
||||
return new DroolingOgreEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DroolingOgreTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public DroolingOgreTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DroolingOgreEffect(), false);
|
||||
}
|
||||
|
||||
private DroolingOgreTriggeredAbility(final DroolingOgreTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DroolingOgreTriggeredAbility copy() {
|
||||
return new DroolingOgreTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.SPELL_CAST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && spell.isArtifact(game)) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a player casts an artifact spell, that player gains control of {this}.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.AttacksOrBlocksTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
|
|
@ -20,6 +17,8 @@ import mage.target.Target;
|
|||
import mage.target.common.TargetOpponent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
|
|
@ -67,60 +66,22 @@ class FickleEfreetChangeControlEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null) {
|
||||
if (!controller.flipCoin(source, game, true)) {
|
||||
if (sourcePermanent != null) {
|
||||
Target target = new TargetOpponent(true);
|
||||
if (target.canChoose(controller.getId(), source, game)) {
|
||||
while (!target.isChosen() && target.canChoose(controller.getId(), source, game) && controller.canRespond()) {
|
||||
controller.chooseTarget(outcome, target, source, game);
|
||||
}
|
||||
}
|
||||
Player chosenOpponent = game.getPlayer(target.getFirstTarget());
|
||||
if (chosenOpponent != null) {
|
||||
ContinuousEffect effect = new FickleEfreetGainControlEffect(Duration.Custom, target.getFirstTarget());
|
||||
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId(), game));
|
||||
game.addEffect(effect, source);
|
||||
game.informPlayers(chosenOpponent.getLogName() + " has gained control of " + sourcePermanent.getLogName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (controller == null || sourcePermanent == null) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.flipCoin(source, game, true)) {
|
||||
Target target = new TargetOpponent(true);
|
||||
controller.chooseTarget(outcome, target, source, game);
|
||||
Player chosenOpponent = game.getPlayer(target.getFirstTarget());
|
||||
if (chosenOpponent != null) {
|
||||
game.addEffect(new GainControlTargetEffect(
|
||||
Duration.Custom, true, chosenOpponent.getId()
|
||||
).setTargetPointer(new FixedTarget(sourcePermanent, game)), source);
|
||||
game.informPlayers(chosenOpponent.getLogName() + " has gained control of " + sourcePermanent.getLogName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class FickleEfreetGainControlEffect extends ContinuousEffectImpl {
|
||||
|
||||
UUID controller;
|
||||
|
||||
public FickleEfreetGainControlEffect(Duration duration, UUID controller) {
|
||||
super(duration, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
this.controller = controller;
|
||||
this.staticText = "That player gains control of {this}";
|
||||
}
|
||||
|
||||
private FickleEfreetGainControlEffect(final FickleEfreetGainControlEffect effect) {
|
||||
super(effect);
|
||||
this.controller = effect.controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FickleEfreetGainControlEffect copy() {
|
||||
return new FickleEfreetGainControlEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (targetPointer != null) {
|
||||
permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
}
|
||||
if (permanent != null) {
|
||||
return permanent.changeControllerId(controller, game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,22 +5,20 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.abilities.condition.common.MyTurnCondition;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect;
|
||||
import mage.abilities.hint.common.MyTurnHint;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author jeffwadsworth
|
||||
* @author xenohedron
|
||||
*/
|
||||
public final class HumbleDefector extends CardImpl {
|
||||
|
||||
|
|
@ -32,7 +30,9 @@ public final class HumbleDefector extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// {T}: Draw two cards. Target opponent gains control of Humble Defector. Activate this ability only during your turn.
|
||||
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new HumbleDefectorEffect(), new TapSourceCost(), MyTurnCondition.instance);
|
||||
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD,
|
||||
new DrawCardSourceControllerEffect(2), new TapSourceCost(), MyTurnCondition.instance);
|
||||
ability.addEffect(new TargetPlayerGainControlSourceEffect());
|
||||
ability.addTarget(new TargetOpponent());
|
||||
ability.addHint(MyTurnHint.instance);
|
||||
this.addAbility(ability);
|
||||
|
|
@ -48,66 +48,3 @@ public final class HumbleDefector extends CardImpl {
|
|||
return new HumbleDefector(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HumbleDefectorEffect extends OneShotEffect {
|
||||
|
||||
HumbleDefectorEffect() {
|
||||
super(Outcome.Discard);
|
||||
this.staticText = "Draw two cards. Target opponent gains control of {this}.";
|
||||
}
|
||||
|
||||
private HumbleDefectorEffect(final HumbleDefectorEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HumbleDefectorEffect copy() {
|
||||
return new HumbleDefectorEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.drawCards(2, source, game);
|
||||
}
|
||||
Permanent humbleDefector = source.getSourcePermanentIfItStillExists(game);
|
||||
Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (targetOpponent != null && humbleDefector != null) {
|
||||
ContinuousEffect effect = new HumbleDefectorControlSourceEffect();
|
||||
game.addEffect(effect, source);
|
||||
game.informPlayers(humbleDefector.getName() + " is now controlled by " + targetOpponent.getLogName());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class HumbleDefectorControlSourceEffect extends ContinuousEffectImpl {
|
||||
|
||||
HumbleDefectorControlSourceEffect() {
|
||||
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
}
|
||||
|
||||
private HumbleDefectorControlSourceEffect(final HumbleDefectorControlSourceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HumbleDefectorControlSourceEffect copy() {
|
||||
return new HumbleDefectorControlSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player targetOpponent = game.getPlayer(source.getFirstTarget());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && targetOpponent != null) {
|
||||
permanent.changeControllerId(targetOpponent.getId(), game, source);
|
||||
} else {
|
||||
// no valid target exists, effect can be discarded
|
||||
discard();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import mage.abilities.common.OnEventTriggeredAbility;
|
|||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamageControllerEffect;
|
||||
import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -34,7 +34,7 @@ public final class JinxedChoker extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
// At the beginning of your end step, target opponent gains control of Jinxed Choker and puts a charge counter on it.
|
||||
Ability endStepAbility = new BeginningOfYourEndStepTriggeredAbility(new JinxedChokerChangeControllerEffect(), false);
|
||||
Ability endStepAbility = new BeginningOfYourEndStepTriggeredAbility(new TargetPlayerGainControlSourceEffect(), false);
|
||||
endStepAbility.addEffect(new JinxedChokerAddCounterEffect());
|
||||
endStepAbility.addTarget(new TargetOpponent());
|
||||
this.addAbility(endStepAbility);
|
||||
|
|
@ -58,35 +58,6 @@ public final class JinxedChoker extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class JinxedChokerChangeControllerEffect extends ContinuousEffectImpl {
|
||||
|
||||
JinxedChokerChangeControllerEffect() {
|
||||
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
staticText = "target opponent gains control of {this}";
|
||||
}
|
||||
|
||||
private JinxedChokerChangeControllerEffect(final JinxedChokerChangeControllerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JinxedChokerChangeControllerEffect copy() {
|
||||
return new JinxedChokerChangeControllerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent != null) {
|
||||
return permanent.changeControllerId(source.getFirstTarget(), game, source);
|
||||
} else {
|
||||
discard();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JinxedChokerAddCounterEffect extends OneShotEffect {
|
||||
|
||||
JinxedChokerAddCounterEffect() {
|
||||
|
|
|
|||
|
|
@ -1,23 +1,21 @@
|
|||
|
||||
package mage.cards.j;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.OnEventTriggeredAbility;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.DamageControllerEffect;
|
||||
import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -28,10 +26,10 @@ public final class JinxedIdol extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
// At the beginning of your upkeep, Jinxed Idol deals 2 damage to you.
|
||||
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new DamageControllerEffect(2)));
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DamageControllerEffect(2), TargetController.YOU, false));
|
||||
|
||||
// Sacrifice a creature: Target opponent gains control of Jinxed Idol.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new JinxedIdolEffect(),
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TargetPlayerGainControlSourceEffect(),
|
||||
new SacrificeTargetCost(StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT));
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
|
@ -47,32 +45,3 @@ public final class JinxedIdol extends CardImpl {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class JinxedIdolEffect extends ContinuousEffectImpl {
|
||||
|
||||
JinxedIdolEffect() {
|
||||
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
staticText = "Target opponent gains control of {this}";
|
||||
}
|
||||
|
||||
private JinxedIdolEffect(final JinxedIdolEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JinxedIdolEffect copy() {
|
||||
return new JinxedIdolEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent != null) {
|
||||
return permanent.changeControllerId(source.getFirstTarget(), game, source);
|
||||
} else {
|
||||
discard();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,22 @@
|
|||
|
||||
package mage.cards.j;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.DamageControllerEffect;
|
||||
import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
|
|
@ -44,7 +36,7 @@ public final class JinxedRing extends CardImpl {
|
|||
this.addAbility(new PutIntoGraveFromBattlefieldAllTriggeredAbility(new DamageControllerEffect(1), false, filter, false, true));
|
||||
|
||||
// Sacrifice a creature: Target opponent gains control of Jinxed Ring.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new JinxedRingEffect(),
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TargetPlayerGainControlSourceEffect(),
|
||||
new SacrificeTargetCost(StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT));
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
|
@ -59,32 +51,3 @@ public final class JinxedRing extends CardImpl {
|
|||
return new JinxedRing(this);
|
||||
}
|
||||
}
|
||||
|
||||
class JinxedRingEffect extends ContinuousEffectImpl {
|
||||
|
||||
JinxedRingEffect() {
|
||||
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
staticText = "Target opponent gains control of {this}";
|
||||
}
|
||||
|
||||
private JinxedRingEffect(final JinxedRingEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JinxedRingEffect copy() {
|
||||
return new JinxedRingEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent != null) {
|
||||
return permanent.changeControllerId(source.getFirstTarget(), game, source);
|
||||
} else {
|
||||
discard();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
|
@ -95,7 +94,7 @@ class LoxodonPeacekeeperEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
if (tiedPlayers.size() > 0) {
|
||||
if (!tiedPlayers.isEmpty()) {
|
||||
UUID newControllerId = null;
|
||||
if (tiedPlayers.size() > 1) {
|
||||
FilterPlayer filter = new FilterPlayer("a player tied for lowest life total");
|
||||
|
|
|
|||
|
|
@ -1,30 +1,23 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
|
@ -50,7 +43,7 @@ public final class MeasureOfWickedness extends CardImpl {
|
|||
|
||||
// Whenever another card is put into your graveyard from anywhere, target opponent gains control of Measure of Wickedness.
|
||||
ability = new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
new MeasureOfWickednessControlSourceEffect(), false, filter, TargetController.YOU);
|
||||
new TargetPlayerGainControlSourceEffect(), false, filter, TargetController.YOU);
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
@ -65,33 +58,3 @@ public final class MeasureOfWickedness extends CardImpl {
|
|||
return new MeasureOfWickedness(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MeasureOfWickednessControlSourceEffect extends ContinuousEffectImpl {
|
||||
|
||||
MeasureOfWickednessControlSourceEffect() {
|
||||
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
staticText = "target opponent gains control of {this}";
|
||||
}
|
||||
|
||||
private MeasureOfWickednessControlSourceEffect(final MeasureOfWickednessControlSourceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MeasureOfWickednessControlSourceEffect copy() {
|
||||
return new MeasureOfWickednessControlSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player targetOpponent = game.getPlayer(source.getFirstTarget());
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent != null && targetOpponent != null) {
|
||||
permanent.changeControllerId(targetOpponent.getId(), game, source);
|
||||
} else {
|
||||
// no valid target exists, effect can be discarded
|
||||
discard();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package mage.cards.r;
|
|||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
|
|
@ -100,7 +99,7 @@ class RiskyMoveGetControlEffect extends OneShotEffect {
|
|||
|
||||
class RiskyMoveTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public RiskyMoveTriggeredAbility() {
|
||||
RiskyMoveTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new RiskyMoveFlipCoinEffect(), false);
|
||||
setTriggerPhrase("When you gain control of {this} from another player, ");
|
||||
}
|
||||
|
|
@ -180,9 +179,9 @@ class RiskyMoveFlipCoinEffect extends OneShotEffect {
|
|||
|
||||
class RiskyMoveCreatureGainControlEffect extends ContinuousEffectImpl {
|
||||
|
||||
private UUID controller;
|
||||
private final UUID controller;
|
||||
|
||||
public RiskyMoveCreatureGainControlEffect(Duration duration, UUID controller) {
|
||||
RiskyMoveCreatureGainControlEffect(Duration duration, UUID controller) {
|
||||
super(duration, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
this.controller = controller;
|
||||
this.staticText = "If you lose the flip, that opponent gains control of that creature";
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class ShurikenEffect extends OneShotEffect {
|
|||
Permanent equipment = (Permanent) object;
|
||||
targetedPermanent.damage(2, equipment.getId(), source, game);
|
||||
Permanent attached = source.getSourcePermanentOrLKI(game);
|
||||
if (attached != null && attached.hasSubtype(SubType.NINJA, game)) {
|
||||
if (attached == null || attached.hasSubtype(SubType.NINJA, game)) {
|
||||
return true;
|
||||
}
|
||||
game.addEffect(new GainControlTargetEffect(
|
||||
|
|
|
|||
|
|
@ -1,28 +1,22 @@
|
|||
|
||||
package mage.cards.w;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect;
|
||||
import mage.abilities.effects.mana.BasicManaEffect;
|
||||
import mage.abilities.keyword.SwampwalkAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
|
|
@ -40,7 +34,7 @@ public final class WitchEngine extends CardImpl {
|
|||
|
||||
// {T}: Add {B}{B}{B}{B}. Target opponent gains control of Witch Engine. (Activate this ability only any time you could cast an instant.)
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BasicManaEffect(Mana.BlackMana(4)), new TapSourceCost());
|
||||
ability.addEffect(new WitchEngineEffect());
|
||||
ability.addEffect(new TargetPlayerGainControlSourceEffect());
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
@ -54,32 +48,3 @@ public final class WitchEngine extends CardImpl {
|
|||
return new WitchEngine(this);
|
||||
}
|
||||
}
|
||||
|
||||
class WitchEngineEffect extends ContinuousEffectImpl {
|
||||
|
||||
WitchEngineEffect() {
|
||||
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
staticText = "target opponent gains control of {this}";
|
||||
}
|
||||
|
||||
private WitchEngineEffect(final WitchEngineEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WitchEngineEffect copy() {
|
||||
return new WitchEngineEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent != null) {
|
||||
return permanent.changeControllerId(source.getFirstTarget(), game, source);
|
||||
} else {
|
||||
discard();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
* @author xenohedron
|
||||
*/
|
||||
public class TargetPlayerGainControlSourceEffect extends OneShotEffect {
|
||||
|
||||
private final String playerDescription;
|
||||
|
||||
public TargetPlayerGainControlSourceEffect() {
|
||||
this("");
|
||||
}
|
||||
|
||||
public TargetPlayerGainControlSourceEffect(String playerDescription) {
|
||||
super(Outcome.Benefit);
|
||||
this.playerDescription = playerDescription;
|
||||
}
|
||||
|
||||
protected TargetPlayerGainControlSourceEffect(final TargetPlayerGainControlSourceEffect effect) {
|
||||
super(effect);
|
||||
this.playerDescription = effect.playerDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (player == null || permanent == null) {
|
||||
return false;
|
||||
}
|
||||
game.addEffect(new GainControlTargetEffect(
|
||||
Duration.Custom, true, player.getId()
|
||||
).setTargetPointer(new FixedTarget(permanent, game)), source);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetPlayerGainControlSourceEffect copy() {
|
||||
return new TargetPlayerGainControlSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return (playerDescription.isEmpty() ? getTargetPointer().describeTargets(mode.getTargets(), "that player") : playerDescription) +
|
||||
" gains control of {this}";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue