mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Added an effect and used it in 4 cards
This commit is contained in:
parent
32131157d1
commit
d5252fd24b
5 changed files with 76 additions and 219 deletions
|
@ -36,6 +36,7 @@ import mage.abilities.costs.mana.GenericManaCost;
|
|||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesChosenNonWallCreatureTypeTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesSubtypeTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.repository.CardRepository;
|
||||
|
@ -63,7 +64,7 @@ public class UnnaturalSelection extends CardImpl {
|
|||
this.expansionSetCode = "APC";
|
||||
|
||||
// {1}: Choose a creature type other than Wall. Target creature becomes that type until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UnnaturalSelectionEffect(), new GenericManaCost(1));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesChosenNonWallCreatureTypeTargetEffect(), new GenericManaCost(1));
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -76,54 +77,4 @@ public class UnnaturalSelection extends CardImpl {
|
|||
public UnnaturalSelection copy() {
|
||||
return new UnnaturalSelection(this);
|
||||
}
|
||||
}
|
||||
|
||||
class UnnaturalSelectionEffect extends OneShotEffect {
|
||||
|
||||
public UnnaturalSelectionEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
staticText = "choose a creature type other than wall, target creature's type becomes that type until end of turn";
|
||||
}
|
||||
|
||||
public UnnaturalSelectionEffect(final UnnaturalSelectionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
String chosenType = "";
|
||||
if (player != null && permanent != null) {
|
||||
Choice typeChoice = new ChoiceImpl(true);
|
||||
typeChoice.setMessage("Choose creature type other than Wall");
|
||||
Set<String> types = CardRepository.instance.getCreatureTypes();
|
||||
types.remove("Wall");
|
||||
typeChoice.setChoices(types);
|
||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
if (!player.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
chosenType = typeChoice.getChoice();
|
||||
if (chosenType != null && !chosenType.isEmpty()) {
|
||||
// ADD TYPE TO TARGET
|
||||
ContinuousEffect effect = new BecomesSubtypeTargetEffect(Duration.EndOfTurn, chosenType);
|
||||
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect copy() {
|
||||
return new UnnaturalSelectionEffect(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -37,6 +37,7 @@ import mage.abilities.costs.common.TapSourceCost;
|
|||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesChosenNonWallCreatureTypeTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesSubtypeTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.repository.CardRepository;
|
||||
|
@ -68,7 +69,7 @@ public class Imagecrafter extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// {tap}: Choose a creature type other than Wall. Target creature becomes that type until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ImagecrafterEffect(), new TapSourceCost());
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesChosenNonWallCreatureTypeTargetEffect(), new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -82,52 +83,4 @@ public class Imagecrafter extends CardImpl {
|
|||
return new Imagecrafter(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ImagecrafterEffect extends OneShotEffect {
|
||||
|
||||
public ImagecrafterEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
staticText = "choose a creature type other than wall, target creature's type becomes that type until end of turn";
|
||||
}
|
||||
|
||||
public ImagecrafterEffect(final ImagecrafterEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
String chosenType = "";
|
||||
if (player != null && permanent != null) {
|
||||
Choice typeChoice = new ChoiceImpl(true);
|
||||
typeChoice.setMessage("Choose creature type other than Wall");
|
||||
Set<String> types = CardRepository.instance.getCreatureTypes();
|
||||
types.remove("Wall");
|
||||
typeChoice.setChoices(types);
|
||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
if (!player.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
chosenType = typeChoice.getChoice();
|
||||
if (chosenType != null && !chosenType.isEmpty()) {
|
||||
// ADD TYPE TO TARGET
|
||||
ContinuousEffect effect = new BecomesSubtypeTargetEffect(Duration.EndOfTurn, chosenType);
|
||||
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect copy() {
|
||||
return new ImagecrafterEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -37,6 +37,7 @@ import mage.abilities.costs.mana.ManaCostsImpl;
|
|||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesChosenNonWallCreatureTypeTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesSubtypeTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.repository.CardRepository;
|
||||
|
@ -68,7 +69,7 @@ public class MistformMutant extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// {1}{U}: Choose a creature type other than Wall. Target creature becomes that type until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MistformMutantEffect(), new ManaCostsImpl<>("{1}{U}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesChosenNonWallCreatureTypeTargetEffect(), new ManaCostsImpl<>("{1}{U}"));
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -81,54 +82,4 @@ public class MistformMutant extends CardImpl {
|
|||
public MistformMutant copy() {
|
||||
return new MistformMutant(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MistformMutantEffect extends OneShotEffect {
|
||||
|
||||
public MistformMutantEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
staticText = "choose a creature type other than wall, target creature's type becomes that type until end of turn";
|
||||
}
|
||||
|
||||
public MistformMutantEffect(final MistformMutantEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
String chosenType = "";
|
||||
if (player != null && permanent != null) {
|
||||
Choice typeChoice = new ChoiceImpl(true);
|
||||
typeChoice.setMessage("Choose creature type other than Wall");
|
||||
Set<String> types = CardRepository.instance.getCreatureTypes();
|
||||
types.remove("Wall");
|
||||
typeChoice.setChoices(types);
|
||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
if (!player.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
chosenType = typeChoice.getChoice();
|
||||
if (chosenType != null && !chosenType.isEmpty()) {
|
||||
// ADD TYPE TO TARGET
|
||||
ContinuousEffect effect = new BecomesSubtypeTargetEffect(Duration.EndOfTurn, chosenType);
|
||||
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect copy() {
|
||||
return new MistformMutantEffect(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -27,27 +27,13 @@
|
|||
*/
|
||||
package mage.sets.onslaught;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesSubtypeTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesChosenNonWallCreatureTypeTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -61,7 +47,7 @@ public class Standardize extends CardImpl {
|
|||
|
||||
// Choose a creature type other than Wall. Each creature becomes that type until end of turn.
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addEffect(new StandardizeEffect());
|
||||
this.getSpellAbility().addEffect(new BecomesChosenNonWallCreatureTypeTargetEffect());
|
||||
}
|
||||
|
||||
public Standardize(final Standardize card) {
|
||||
|
@ -72,54 +58,4 @@ public class Standardize extends CardImpl {
|
|||
public Standardize copy() {
|
||||
return new Standardize(this);
|
||||
}
|
||||
}
|
||||
|
||||
class StandardizeEffect extends OneShotEffect {
|
||||
|
||||
public StandardizeEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
staticText = "choose a creature type other than wall, target creature's type becomes that type until end of turn";
|
||||
}
|
||||
|
||||
public StandardizeEffect(final StandardizeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
String chosenType = "";
|
||||
if (player != null && permanent != null) {
|
||||
Choice typeChoice = new ChoiceImpl(true);
|
||||
typeChoice.setMessage("Choose creature type other than Wall");
|
||||
Set<String> types = CardRepository.instance.getCreatureTypes();
|
||||
types.remove("Wall");
|
||||
typeChoice.setChoices(types);
|
||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
if (!player.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
chosenType = typeChoice.getChoice();
|
||||
if (chosenType != null && !chosenType.isEmpty()) {
|
||||
// ADD TYPE TO TARGET
|
||||
ContinuousEffect effect = new BecomesSubtypeTargetEffect(Duration.EndOfTurn, chosenType);
|
||||
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect copy() {
|
||||
return new StandardizeEffect(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
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;
|
||||
|
||||
public class BecomesChosenNonWallCreatureTypeTargetEffect extends OneShotEffect {
|
||||
|
||||
public BecomesChosenNonWallCreatureTypeTargetEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
staticText = "choose a creature type other than wall, target creature's type becomes that type until end of turn";
|
||||
|
||||
}
|
||||
|
||||
public BecomesChosenNonWallCreatureTypeTargetEffect(final BecomesChosenNonWallCreatureTypeTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
String chosenType = "";
|
||||
if (player != null && permanent != null) {
|
||||
Choice typeChoice = new ChoiceImpl(true);
|
||||
typeChoice.setMessage("Choose creature type other than Wall");
|
||||
Set<String> types = CardRepository.instance.getCreatureTypes();
|
||||
types.remove("Wall");
|
||||
typeChoice.setChoices(types);
|
||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
if (!player.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
chosenType = typeChoice.getChoice();
|
||||
if (chosenType != null && !chosenType.isEmpty()) {
|
||||
// ADD TYPE TO TARGET
|
||||
ContinuousEffect effect = new BecomesSubtypeTargetEffect(Duration.EndOfTurn, chosenType);
|
||||
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect copy() {
|
||||
return new BecomesChosenNonWallCreatureTypeTargetEffect(this);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue