* Conqueror's Galleon - fixed that it returns under owner control instead your;

This commit is contained in:
Oleg Agafonov 2020-01-16 08:54:59 +04:00
parent ec2ea7f070
commit 5d52f0ace3
2 changed files with 17 additions and 8 deletions

View file

@ -1,8 +1,7 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Gender;
import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
@ -14,8 +13,9 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class ConquerorsGalleon extends CardImpl { public final class ConquerorsGalleon extends CardImpl {
@ -34,7 +34,7 @@ public final class ConquerorsGalleon extends CardImpl {
this.addAbility(new TransformAbility()); this.addAbility(new TransformAbility());
this.addAbility(new AttacksTriggeredAbility( this.addAbility(new AttacksTriggeredAbility(
new CreateDelayedTriggeredAbilityEffect( new CreateDelayedTriggeredAbilityEffect(
new AtTheEndOfCombatDelayedTriggeredAbility(new ExileAndReturnTransformedSourceEffect())), new AtTheEndOfCombatDelayedTriggeredAbility(new ExileAndReturnTransformedSourceEffect(Gender.NEUTRAL, null, true))),
false, false,
"When {this} attacks, exile it at the end of combat, then return it to the battlefield transformed under your control.")); "When {this} attacks, exile it at the end of combat, then return it to the battlefield transformed under your control."));

View file

@ -24,6 +24,7 @@ import mage.players.Player;
public class ExileAndReturnTransformedSourceEffect extends OneShotEffect { public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
protected Effect additionalEffect; protected Effect additionalEffect;
protected boolean returnUnderYourControl;
public ExileAndReturnTransformedSourceEffect() { public ExileAndReturnTransformedSourceEffect() {
this(Gender.NEUTRAL); this(Gender.NEUTRAL);
@ -33,20 +34,28 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
this(gender, null); this(gender, null);
} }
public ExileAndReturnTransformedSourceEffect(Gender gender, Effect additionalEffect) {
this(gender, additionalEffect, false);
}
/** /**
* @param gender * @param gender
* @param additionalEffect that effect is applies as source is exiled * @param additionalEffect that effect is applies as source is exiled
* @param returnUnderYourControl return under your or owner control
*/ */
public ExileAndReturnTransformedSourceEffect(Gender gender, Effect additionalEffect) { public ExileAndReturnTransformedSourceEffect(Gender gender, Effect additionalEffect, boolean returnUnderYourControl) {
super(Outcome.Benefit); super(Outcome.Benefit);
this.additionalEffect = additionalEffect; this.additionalEffect = additionalEffect;
this.returnUnderYourControl = returnUnderYourControl;
this.staticText = "exile {this}, then return " + gender.getPersonalPronoun() this.staticText = "exile {this}, then return " + gender.getPersonalPronoun()
+ " to the battlefield transformed under " + gender.getPossesivePronoun() + " owner's control"; + " to the battlefield transformed under " + gender.getPossesivePronoun()
+ " " + (this.returnUnderYourControl ? "your" : "owner's") + " control";
} }
public ExileAndReturnTransformedSourceEffect(final ExileAndReturnTransformedSourceEffect effect) { public ExileAndReturnTransformedSourceEffect(final ExileAndReturnTransformedSourceEffect effect) {
super(effect); super(effect);
this.additionalEffect = effect.additionalEffect; this.additionalEffect = effect.additionalEffect;
this.returnUnderYourControl = effect.returnUnderYourControl;
} }
@Override @Override
@ -64,7 +73,7 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE); game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
Card cardFromExile = game.getCard(source.getSourceId()); Card cardFromExile = game.getCard(source.getSourceId());
if (cardFromExile != null) { if (cardFromExile != null) {
controller.moveCards(cardFromExile, Zone.BATTLEFIELD, source, game, false, false, true, null); controller.moveCards(cardFromExile, Zone.BATTLEFIELD, source, game, false, false, !this.returnUnderYourControl, null);
if (additionalEffect != null) { if (additionalEffect != null) {
if (additionalEffect instanceof ContinuousEffect) { if (additionalEffect instanceof ContinuousEffect) {
game.addEffect((ContinuousEffect) additionalEffect, source); game.addEffect((ContinuousEffect) additionalEffect, source);