mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
[NEO] Implemented The Shattered States Era / Nameless Conqueror
This commit is contained in:
parent
6eda309765
commit
68edee6d32
6 changed files with 180 additions and 26 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.Pronoun;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
|
@ -18,12 +19,9 @@ import mage.players.Player;
|
|||
*/
|
||||
public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
|
||||
|
||||
protected Effect additionalEffect;
|
||||
protected boolean returnUnderYourControl;
|
||||
|
||||
public ExileAndReturnTransformedSourceEffect() {
|
||||
this(Pronoun.IT);
|
||||
}
|
||||
protected final Pronoun pronoun;
|
||||
protected final Effect additionalEffect;
|
||||
protected final boolean returnUnderYourControl;
|
||||
|
||||
public ExileAndReturnTransformedSourceEffect(Pronoun pronoun) {
|
||||
this(pronoun, null);
|
||||
|
|
@ -40,15 +38,14 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
|
|||
*/
|
||||
public ExileAndReturnTransformedSourceEffect(Pronoun pronoun, Effect additionalEffect, boolean returnUnderYourControl) {
|
||||
super(Outcome.Benefit);
|
||||
this.pronoun = pronoun;
|
||||
this.additionalEffect = additionalEffect;
|
||||
this.returnUnderYourControl = returnUnderYourControl;
|
||||
this.staticText = "exile {this}, then return " + pronoun.getObjective()
|
||||
+ " to the battlefield transformed under " + pronoun.getPossessive()
|
||||
+ " " + (this.returnUnderYourControl ? "your" : "owner's") + " control";
|
||||
}
|
||||
|
||||
public ExileAndReturnTransformedSourceEffect(final ExileAndReturnTransformedSourceEffect effect) {
|
||||
protected ExileAndReturnTransformedSourceEffect(final ExileAndReturnTransformedSourceEffect effect) {
|
||||
super(effect);
|
||||
this.pronoun = effect.pronoun;
|
||||
this.additionalEffect = effect.additionalEffect;
|
||||
this.returnUnderYourControl = effect.returnUnderYourControl;
|
||||
}
|
||||
|
|
@ -61,24 +58,38 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
// Creature has to be on the battlefield to get exiled and be able to return transformed
|
||||
Permanent sourceObject = game.getPermanent(source.getSourceId());
|
||||
Permanent sourceObject = source.getSourcePermanentIfItStillExists(game);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (sourceObject != null && controller != null && sourceObject.getZoneChangeCounter(game) == source.getSourceObjectZoneChangeCounter()) {
|
||||
if (controller.moveCards(sourceObject, Zone.EXILED, source, game)) {
|
||||
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
|
||||
Card cardFromExile = game.getCard(source.getSourceId());
|
||||
if (cardFromExile != null) {
|
||||
controller.moveCards(cardFromExile, Zone.BATTLEFIELD, source, game, false, false, !this.returnUnderYourControl, null);
|
||||
if (additionalEffect != null) {
|
||||
if (additionalEffect instanceof ContinuousEffect) {
|
||||
game.addEffect((ContinuousEffect) additionalEffect, source);
|
||||
} else {
|
||||
additionalEffect.apply(game, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sourceObject == null || controller == null) {
|
||||
return true;
|
||||
}
|
||||
if (!controller.moveCards(sourceObject, Zone.EXILED, source, game)) {
|
||||
return true;
|
||||
}
|
||||
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
|
||||
Card cardFromExile = game.getCard(source.getSourceId());
|
||||
if (cardFromExile == null) {
|
||||
return true;
|
||||
}
|
||||
controller.moveCards(cardFromExile, Zone.BATTLEFIELD, source, game, false, false, !this.returnUnderYourControl, null);
|
||||
if (additionalEffect == null) {
|
||||
return true;
|
||||
}
|
||||
if (additionalEffect instanceof ContinuousEffect) {
|
||||
game.addEffect((ContinuousEffect) additionalEffect, source);
|
||||
} else {
|
||||
additionalEffect.apply(game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "exile {this}, then return " + pronoun.getObjective()
|
||||
+ " to the battlefield transformed under " + pronoun.getPossessive()
|
||||
+ ' ' + (this.returnUnderYourControl ? "your" : "owner's") + " control";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Pronoun;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class ExileSagaAndReturnTransformedEffect extends ExileAndReturnTransformedSourceEffect {
|
||||
|
||||
public ExileSagaAndReturnTransformedEffect() {
|
||||
super(Pronoun.IT, null, true);
|
||||
staticText = "exile this Saga, then return it to the battlefield transformed under your control";
|
||||
}
|
||||
|
||||
private ExileSagaAndReturnTransformedEffect(final ExileSagaAndReturnTransformedEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExileSagaAndReturnTransformedEffect copy() {
|
||||
return new ExileSagaAndReturnTransformedEffect(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue