mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Primal Clay - Fixed choice replacement effect that blocked interface.
This commit is contained in:
parent
29dfe89fe5
commit
37ac205332
1 changed files with 45 additions and 31 deletions
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.fifthedition;
|
package mage.sets.fifthedition;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
|
@ -41,6 +42,7 @@ import mage.cards.CardImpl;
|
||||||
import mage.choices.ChoiceImpl;
|
import mage.choices.ChoiceImpl;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -57,9 +59,7 @@ public class PrimalClay extends CardImpl {
|
||||||
this.toughness = new MageInt(0);
|
this.toughness = new MageInt(0);
|
||||||
|
|
||||||
// As Primal Clay enters the battlefield, it becomes your choice of a 3/3 artifact creature, a 2/2 artifact creature with flying, or a 1/6 Wall artifact creature with defender in addition to its other types.
|
// As Primal Clay enters the battlefield, it becomes your choice of a 3/3 artifact creature, a 2/2 artifact creature with flying, or a 1/6 Wall artifact creature with defender in addition to its other types.
|
||||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new PrimalClayEffect(), "As {this} enters the battlefield, it becomes your choice of a 3/3 artifact creature, a 2/2 artifact creature with flying, or a 1/6 Wall artifact creature with defender in addition to its other types"));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new PrimalClayEffect(), "As {this} enters the battlefield, it becomes your choice of a 3/3 artifact creature, a 2/2 artifact creature with flying, or a 1/6 Wall artifact creature with defender in addition to its other types")));
|
||||||
ability.addChoice(new PrimalClayChoice());
|
|
||||||
this.addAbility(ability);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrimalClay(final PrimalClay card) {
|
public PrimalClay(final PrimalClay card) {
|
||||||
|
@ -73,35 +73,68 @@ public class PrimalClay extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PrimalClayEffect extends ContinuousEffectImpl {
|
class PrimalClayEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
|
private final static String choice1 = "a 3/3 artifact creature";
|
||||||
|
private final static String choice2 = "a 2/2 artifact creature with flying";
|
||||||
|
private final static String choice3 = "a 1/6 Wall artifact creature with defender";
|
||||||
|
|
||||||
|
String choice;
|
||||||
|
|
||||||
PrimalClayEffect() {
|
PrimalClayEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.BecomeCreature);
|
super(Duration.WhileOnBattlefield, Outcome.BecomeCreature);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrimalClayEffect(final PrimalClayEffect effect) {
|
PrimalClayEffect(final PrimalClayEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
this.choice = effect.choice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Ability source, Game game) {
|
||||||
|
super.init(source, game);
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
if (controller != null && permanent != null) {
|
||||||
|
ChoiceImpl primalClayChoice = new ChoiceImpl();
|
||||||
|
Set<String> choices = primalClayChoice.getChoices();
|
||||||
|
choices.add(choice1);
|
||||||
|
choices.add(choice2);
|
||||||
|
choices.add(choice3);
|
||||||
|
primalClayChoice.setMessage("Choose for " + permanent.getLogName() + " to be");
|
||||||
|
while (!primalClayChoice.isChosen()) {
|
||||||
|
if (!controller.isInGame()) {
|
||||||
|
discard();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
controller.choose(outcome, primalClayChoice, game);
|
||||||
|
}
|
||||||
|
this.choice = primalClayChoice.getChoice();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
discard();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
PrimalClayChoice choice = (PrimalClayChoice) source.getChoices().get(0);
|
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
|
discard();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case PTChangingEffects_7:
|
case PTChangingEffects_7:
|
||||||
if (sublayer.equals(SubLayer.SetPT_7b)) {
|
if (sublayer.equals(SubLayer.SetPT_7b)) {
|
||||||
switch (choice.getChoice()) {
|
switch (choice) {
|
||||||
case "a 3/3 artifact creature":
|
case choice1:
|
||||||
permanent.getPower().setValue(3);
|
permanent.getPower().setValue(3);
|
||||||
permanent.getToughness().setValue(3);
|
permanent.getToughness().setValue(3);
|
||||||
break;
|
break;
|
||||||
case "a 2/2 artifact creature with flying":
|
case choice2:
|
||||||
permanent.getPower().setValue(2);
|
permanent.getPower().setValue(2);
|
||||||
permanent.getToughness().setValue(2);
|
permanent.getToughness().setValue(2);
|
||||||
break;
|
break;
|
||||||
case "a 1/6 Wall artifact creature with defender":
|
case choice3:
|
||||||
permanent.getPower().setValue(1);
|
permanent.getPower().setValue(1);
|
||||||
permanent.getToughness().setValue(6);
|
permanent.getToughness().setValue(6);
|
||||||
break;
|
break;
|
||||||
|
@ -109,11 +142,11 @@ class PrimalClayEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AbilityAddingRemovingEffects_6:
|
case AbilityAddingRemovingEffects_6:
|
||||||
switch (choice.getChoice()) {
|
switch (choice) {
|
||||||
case "a 2/2 artifact creature with flying":
|
case choice2:
|
||||||
permanent.addAbility(FlyingAbility.getInstance(), source.getSourceId(), game);
|
permanent.addAbility(FlyingAbility.getInstance(), source.getSourceId(), game);
|
||||||
break;
|
break;
|
||||||
case "a 1/6 Wall artifact creature with defender":
|
case choice3:
|
||||||
permanent.addAbility(DefenderAbility.getInstance(), source.getSourceId(), game);
|
permanent.addAbility(DefenderAbility.getInstance(), source.getSourceId(), game);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -137,22 +170,3 @@ class PrimalClayEffect extends ContinuousEffectImpl {
|
||||||
return new PrimalClayEffect(this);
|
return new PrimalClayEffect(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PrimalClayChoice extends ChoiceImpl {
|
|
||||||
PrimalClayChoice() {
|
|
||||||
super(true);
|
|
||||||
this.setMessage("Choose for Primal Clay to be");
|
|
||||||
this.choices.add("a 3/3 artifact creature");
|
|
||||||
this.choices.add("a 2/2 artifact creature with flying");
|
|
||||||
this.choices.add("a 1/6 Wall artifact creature with defender");
|
|
||||||
}
|
|
||||||
|
|
||||||
PrimalClayChoice(final PrimalClayChoice choice) {
|
|
||||||
super(choice);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PrimalClayChoice copy() {
|
|
||||||
return new PrimalClayChoice(this);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue