* Primal Clay, Primal Plasma - Fixed enters the battlefield type choose handling.

This commit is contained in:
LevelX2 2015-08-02 09:21:48 +02:00
parent d60b651704
commit 6faeb19079
2 changed files with 31 additions and 44 deletions

View file

@ -29,13 +29,13 @@ package mage.sets.fifthedition;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
@ -48,9 +48,6 @@ import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentCard;
import mage.game.permanent.PermanentToken;
import mage.game.permanent.token.Token;
import mage.players.Player; import mage.players.Player;
/** /**
@ -122,49 +119,38 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
Permanent permanent = game.getPermanent(source.getSourceId()); Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) { if (permanent != null) {
Choice choice = new ChoiceImpl(true); Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose what the creature becomes to"); choice.setMessage("Choose what " + permanent.getIdName() + " becomes to");
choice.getChoices().add(choice33); choice.getChoices().add(choice33);
choice.getChoices().add(choice22); choice.getChoices().add(choice22);
choice.getChoices().add(choice16); choice.getChoices().add(choice16);
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
while(!choice.isChosen()) { while (!choice.isChosen()) {
controller.choose(Outcome.Neutral, choice, game); controller.choose(Outcome.Neutral, choice, game);
if (!controller.isInGame()) { if (!controller.isInGame()) {
return false; return false;
} }
} }
} }
MageObject mageObject; int power = 0;
if (permanent instanceof PermanentCard) { int toughness = 0;
mageObject = ((PermanentCard) permanent).getCard();
} else {
mageObject = ((PermanentToken) permanent).getToken();
}
switch (choice.getChoice()) { switch (choice.getChoice()) {
case choice33: case choice33:
mageObject.getPower().setValue(3); power = 3;
mageObject.getToughness().setValue(3); toughness = 3;
break; break;
case choice22: case choice22:
mageObject.getPower().setValue(2); power = 2;
mageObject.getToughness().setValue(2); toughness = 2;
if (mageObject instanceof Card) { game.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.Custom), source);
game.getState().addOtherAbility((Card)mageObject, FlyingAbility.getInstance());
} else {
((Token)mageObject).addAbility(FlyingAbility.getInstance());
}
break; break;
case choice16: case choice16:
mageObject.getPower().setValue(1); power = 1;
mageObject.getToughness().setValue(6); toughness = 6;
if (mageObject instanceof Card) { game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source);
game.getState().addOtherAbility((Card)mageObject, DefenderAbility.getInstance());
} else {
((Token)mageObject).addAbility(DefenderAbility.getInstance());
}
break; break;
} }
game.addEffect(new SetPowerToughnessSourceEffect(power, toughness, Duration.Custom), source);
} }
return false; return false;

View file

@ -29,13 +29,13 @@ package mage.sets.planechase2012;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
@ -48,9 +48,6 @@ import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentCard;
import mage.game.permanent.PermanentToken;
import mage.game.permanent.token.Token;
import mage.players.Player; import mage.players.Player;
/** /**
@ -123,35 +120,39 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
Permanent permanent = game.getPermanent(source.getSourceId()); Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) { if (permanent != null) {
Choice choice = new ChoiceImpl(true); Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose what the creature becomes to"); choice.setMessage("Choose what " + permanent.getIdName() + " becomes to");
choice.getChoices().add(choice33); choice.getChoices().add(choice33);
choice.getChoices().add(choice22); choice.getChoices().add(choice22);
choice.getChoices().add(choice16); choice.getChoices().add(choice16);
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
while(!choice.isChosen()) { while (!choice.isChosen()) {
controller.choose(Outcome.Neutral, choice, game); controller.choose(Outcome.Neutral, choice, game);
if (!controller.isInGame()) { if (!controller.isInGame()) {
return false; return false;
} }
} }
} }
int power = 0;
int toughness = 0;
switch (choice.getChoice()) { switch (choice.getChoice()) {
case choice33: case choice33:
permanent.getPower().setValue(3); power = 3;
permanent.getToughness().setValue(3); toughness = 3;
break; break;
case choice22: case choice22:
permanent.getPower().setValue(2); power = 2;
permanent.getToughness().setValue(2); toughness = 2;
permanent.addAbility(FlyingAbility.getInstance(), source.getId(), game); game.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.Custom), source);
break; break;
case choice16: case choice16:
permanent.getPower().setValue(1); power = 1;
permanent.getToughness().setValue(6); toughness = 6;
permanent.addAbility(DefenderAbility.getInstance(), source.getId(), game); game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source);
break; break;
} }
game.addEffect(new SetPowerToughnessSourceEffect(power, toughness, Duration.Custom), source);
} }
return false; return false;