Merge origin/master

This commit is contained in:
LevelX2 2018-05-11 00:52:28 +02:00
commit fe32fc7cc3
15 changed files with 110 additions and 131 deletions

View file

@ -45,6 +45,7 @@ import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -69,9 +70,12 @@ public class AmbushCommander extends CardImpl {
this.toughness = new MageInt(2);
// Forests you control are 1/1 green Elf creatures that are still lands.
ContinuousEffect effect = new BecomesCreatureAllEffect(new AmbushCommanderToken(), "lands", filter2, Duration.WhileOnBattlefield);
ContinuousEffect effect = new BecomesCreatureAllEffect(
new CreatureToken(1, 1, "1/1 green Elf creature").withColor("G").withSubType(SubType.ELF),
"lands", filter2, Duration.WhileOnBattlefield, true);
effect.getDependencyTypes().add(DependencyType.BecomeForest);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// {1}{G}, Sacrifice an Elf: Target creature gets +3/+3 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(3, 3, Duration.EndOfTurn),
new ManaCostsImpl("{1}{G}"));
@ -89,23 +93,3 @@ public class AmbushCommander extends CardImpl {
return new AmbushCommander(this);
}
}
class AmbushCommanderToken extends TokenImpl {
public AmbushCommanderToken() {
super("Elf", "1/1 green Elf creatures");
subtype.add(SubType.ELF);
cardType.add(CardType.CREATURE);
power = new MageInt(1);
toughness = new MageInt(1);
color.setGreen(true);
}
public AmbushCommanderToken(final AmbushCommanderToken token) {
super(token);
}
public AmbushCommanderToken copy() {
return new AmbushCommanderToken(this);
}
}

View file

@ -48,6 +48,7 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.common.TargetControlledCreaturePermanent;
/**
@ -64,16 +65,25 @@ public class Dragonshift extends CardImpl {
public Dragonshift(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}{R}");
// Until end of turn, target creature you control becomes a blue and red Dragon with base power and toughness 4/4, loses all abilities, and gains flying.
Effect effect = new BecomesCreatureTargetEffect(new DragonToken(), true, false, Duration.EndOfTurn);
Effect effect = new BecomesCreatureTargetEffect(
new CreatureToken(4, 4, "blue and red Dragon with base power and toughness 4/4")
.withSubType(SubType.DRAGON)
.withColor("UR")
.withAbility(FlyingAbility.getInstance()),
true, false, Duration.EndOfTurn);
effect.setText("Until end of turn, target creature you control becomes a blue and red Dragon with base power and toughness 4/4, loses all abilities, and gains flying.");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
// Overload {3}{U}{U}{R}{R}
Ability ability = new OverloadAbility(this, new LoseAllAbilitiesAllEffect(new FilterControlledCreaturePermanent(""), Duration.EndOfTurn), new ManaCostsImpl("{3}{U}{U}{R}{R}"));
ability.addEffect(new BecomesCreatureAllEffect(new DragonToken(), null, filter, Duration.EndOfTurn));
ability.addEffect(new BecomesCreatureAllEffect(
new CreatureToken(4, 4, "blue and red Dragon with base power and toughness 4/4 and with flying")
.withColor("UR")
.withSubType(SubType.DRAGON)
.withAbility(FlyingAbility.getInstance()),
null, filter, Duration.EndOfTurn, true));
this.addAbility(ability);
}
@ -85,26 +95,4 @@ public class Dragonshift extends CardImpl {
public Dragonshift copy() {
return new Dragonshift(this);
}
private class DragonToken extends TokenImpl {
public DragonToken() {
super("Dragon", "blue and red Dragon with base power and toughness 4/4 and with flying");
cardType.add(CardType.CREATURE);
color.setBlue(true);
color.setRed(true);
subtype.add(SubType.DRAGON);
power = new MageInt(4);
toughness = new MageInt(4);
this.addAbility(FlyingAbility.getInstance());
}
public DragonToken(final DragonToken token) {
super(token);
}
public DragonToken copy() {
return new DragonToken(this);
}
}
}
}

View file

@ -105,7 +105,7 @@ class JolraelEmpressOfBeastsEffect extends OneShotEffect {
if (targetPlayer != null) {
FilterPermanent filter = new FilterLandPermanent();
filter.add(new ControllerIdPredicate(targetPlayer.getId()));
game.addEffect(new BecomesCreatureAllEffect(new CreatureToken(3, 3), "lands", filter, Duration.EndOfTurn), source);
game.addEffect(new BecomesCreatureAllEffect(new CreatureToken(3, 3), "lands", filter, Duration.EndOfTurn, false), source);
return true;
}
return false;

View file

@ -38,6 +38,7 @@ import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
@ -50,7 +51,9 @@ public class KormusBell extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// All Swamps are 1/1 black creatures that are still lands.
ContinuousEffect effect = new BecomesCreatureAllEffect(new KormusBellToken(), "lands", new FilterPermanent(SubType.SWAMP, "Swamps"), Duration.WhileOnBattlefield);
ContinuousEffect effect = new BecomesCreatureAllEffect(
new CreatureToken(1, 1, "1/1 black creature").withColor("B"),
"lands", new FilterPermanent(SubType.SWAMP, "Swamps"), Duration.WhileOnBattlefield, true);
effect.setDependedToType(DependencyType.BecomeSwamp);
effect.addDependedToType(DependencyType.BecomeIsland);
effect.addDependedToType(DependencyType.BecomeMountain);
@ -66,21 +69,3 @@ public class KormusBell extends CardImpl {
return new KormusBell(this);
}
}
class KormusBellToken extends TokenImpl {
public KormusBellToken() {
super("", "1/1 black creatures");
cardType.add(CardType.CREATURE);
power = new MageInt(1);
toughness = new MageInt(1);
color.setBlack(true); // black creatures
}
public KormusBellToken(final KormusBellToken token) {
super(token);
}
public KormusBellToken copy() {
return new KormusBellToken(this);
}
}

View file

@ -61,8 +61,9 @@ public class LifeDeath extends SplitCard {
// Life
// All lands you control become 1/1 creatures until end of turn. They're still lands.
getLeftHalfCard().getSpellAbility().addEffect(new BecomesCreatureAllEffect(new CreatureToken(1, 1), "lands",
new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn));
getLeftHalfCard().getSpellAbility().addEffect(new BecomesCreatureAllEffect(
new CreatureToken(1, 1),
"lands", new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn, false));
// Death
// Return target creature card from your graveyard to the battlefield. You lose life equal to its converted mana cost.

View file

@ -58,7 +58,9 @@ public class LivingLands extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
// All Forests are 1/1 creatures that are still lands.
ContinuousEffect effect = new BecomesCreatureAllEffect(new CreatureToken(1, 1), "lands", filter, Duration.WhileOnBattlefield);
ContinuousEffect effect = new BecomesCreatureAllEffect(
new CreatureToken(1, 1),
"lands", filter, Duration.WhileOnBattlefield, false);
effect.getDependencyTypes().add(DependencyType.BecomeForest);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}

View file

@ -53,7 +53,9 @@ public class LivingPlane extends CardImpl {
this.addSuperType(SuperType.WORLD);
// All lands are 1/1 creatures that are still lands.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new CreatureToken(1, 1), "lands", StaticFilters.FILTER_LANDS, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(
new CreatureToken(1, 1),
"lands", StaticFilters.FILTER_LANDS, Duration.WhileOnBattlefield, false)));
}
public LivingPlane(final LivingPlane card) {

View file

@ -53,7 +53,9 @@ public class NaturalAffinity extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{G}");
// All lands become 2/2 creatures until end of turn. They're still lands.
this.getSpellAbility().addEffect(new BecomesCreatureAllEffect(new CreatureToken(2, 2), "lands", StaticFilters.FILTER_LANDS, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new BecomesCreatureAllEffect(
new CreatureToken(2, 2),
"lands", StaticFilters.FILTER_LANDS, Duration.EndOfTurn, false));
}
public NaturalAffinity(final NaturalAffinity card) {

View file

@ -47,6 +47,7 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
@ -68,9 +69,11 @@ public class NaturalEmergence extends CardImpl {
Effect effect = new ReturnToHandChosenControlledPermanentEffect(filter);
effect.setText("return a red or green enchantment you control to its owner's hand");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect, false));
// Lands you control are 2/2 creatures with first strike. They're still lands.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new NaturalEmergenceToken(),
"lands", new FilterControlledLandPermanent("lands you control"), Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(
new CreatureToken(2, 2, "2/2 creatures with first strike").withAbility(FirstStrikeAbility.getInstance()),
"lands", new FilterControlledLandPermanent("lands you control"), Duration.WhileOnBattlefield, false)));
}
public NaturalEmergence(final NaturalEmergence card) {
@ -81,22 +84,4 @@ public class NaturalEmergence extends CardImpl {
public NaturalEmergence copy() {
return new NaturalEmergence(this);
}
}
class NaturalEmergenceToken extends TokenImpl {
public NaturalEmergenceToken() {
super("Land", "2/2 creatures with first strike");
cardType.add(CardType.CREATURE);
power = new MageInt(2);
toughness = new MageInt(2);
this.addAbility(FirstStrikeAbility.getInstance());
}
public NaturalEmergenceToken(final NaturalEmergenceToken token) {
super(token);
}
public NaturalEmergenceToken copy() {
return new NaturalEmergenceToken(this);
}
}
}

View file

@ -52,8 +52,9 @@ public class NaturesRevolt extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}{G}");
// All lands are 2/2 creatures that are still lands.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new CreatureToken(2, 2),
"lands", new FilterLandPermanent(), Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(
new CreatureToken(2, 2),
"lands", new FilterLandPermanent(), Duration.WhileOnBattlefield, false)));
}
public NaturesRevolt(final NaturesRevolt card) {

View file

@ -58,7 +58,9 @@ public class RudeAwakening extends CardImpl {
this.getSpellAbility().addEffect(new UntapAllLandsControllerEffect());
// or until end of turn, lands you control become 2/2 creatures that are still lands.
Mode mode = new Mode();
mode.getEffects().add(new BecomesCreatureAllEffect(new CreatureToken(2, 2), "lands", new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn));
mode.getEffects().add(new BecomesCreatureAllEffect(
new CreatureToken(2, 2),
"lands", new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn, false));
this.getSpellAbility().getModes().addMode(mode);
// Entwine {2}{G}

View file

@ -40,6 +40,7 @@ import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.common.FilterControlledLandPermanent;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
@ -52,10 +53,15 @@ public class SylvanAwakening extends CardImpl {
// Until your next turn, all lands you control become 2/2 Elemental creatures with reach, indestructible, and haste. They're still lands.
this.getSpellAbility().addEffect(new BecomesCreatureAllEffect(
new SylvanAwakeningToken(),
new CreatureToken(2, 2, "2/2 Elemental creatures with reach, indestructible, and haste")
.withSubType(SubType.ELEMENTAL)
.withAbility(ReachAbility.getInstance())
.withAbility(IndestructibleAbility.getInstance())
.withAbility(HasteAbility.getInstance()),
"lands",
new FilterControlledLandPermanent("all lands you control"),
Duration.UntilYourNextTurn)
Duration.UntilYourNextTurn,
false)
);
}
@ -68,26 +74,3 @@ public class SylvanAwakening extends CardImpl {
return new SylvanAwakening(this);
}
}
class SylvanAwakeningToken extends TokenImpl {
public SylvanAwakeningToken() {
super("", "2/2 Elemental creatures with reach, indestructible, and haste");
cardType.add(CardType.CREATURE);
this.subtype.add(SubType.ELEMENTAL);
power = new MageInt(2);
toughness = new MageInt(2);
this.addAbility(ReachAbility.getInstance());
this.addAbility(IndestructibleAbility.getInstance());
this.addAbility(HasteAbility.getInstance());
}
public SylvanAwakeningToken(final SylvanAwakeningToken token) {
super(token);
}
public SylvanAwakeningToken copy() {
return new SylvanAwakeningToken(this);
}
}

View file

@ -68,7 +68,9 @@ public class TheloniteDruid extends CardImpl {
this.toughness = new MageInt(1);
// {1}{G}, {tap}, Sacrifice a creature: Forests you control become 2/3 creatures until end of turn. They're still lands.
ContinuousEffect effect = new BecomesCreatureAllEffect(new CreatureToken(2, 3), "Forests", filter, Duration.EndOfTurn);
ContinuousEffect effect = new BecomesCreatureAllEffect(
new CreatureToken(2, 3),
"Forests", filter, Duration.EndOfTurn, false);
effect.getDependencyTypes().add(DependencyType.BecomeForest);
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
effect,

View file

@ -52,21 +52,24 @@ import java.util.Set;
public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
protected Token token;
protected String type;
protected String theyAreStillType;
private final FilterPermanent filter;
private boolean loseColor = true;
public BecomesCreatureAllEffect(Token token, String type, FilterPermanent filter, Duration duration) {
public BecomesCreatureAllEffect(Token token, String theyAreStillType, FilterPermanent filter, Duration duration, boolean loseColor) {
super(duration, Outcome.BecomeCreature);
this.token = token;
this.type = type;
this.theyAreStillType = theyAreStillType;
this.filter = filter;
this.loseColor = loseColor;
}
public BecomesCreatureAllEffect(final BecomesCreatureAllEffect effect) {
super(effect);
token = effect.token.copy();
type = effect.type;
this.token = effect.token.copy();
this.theyAreStillType = effect.theyAreStillType;
this.filter = effect.filter.copy();
this.loseColor = effect.loseColor;
}
@Override
@ -94,6 +97,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
} else {
affectedPermanents = new HashSet<>(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game));
}
for(Permanent permanent : affectedPermanents) {
if (permanent != null) {
switch (layer) {
@ -106,7 +110,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
}
}
}
if (type == null) {
if (theyAreStillType == null) {
permanent.getSubtype(game).clear();
}
if (!token.getSubtype(game).isEmpty()) {
@ -114,13 +118,22 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
}
}
break;
case ColorChangingEffects_5:
if (sublayer == SubLayer.NA) {
if (this.loseColor) {
permanent.getColor(game).setBlack(false);
permanent.getColor(game).setGreen(false);
permanent.getColor(game).setBlue(false);
permanent.getColor(game).setWhite(false);
permanent.getColor(game).setRed(false);
}
if (token.getColor(game).hasColor()) {
permanent.getColor(game).setColor(token.getColor(game));
permanent.getColor(game).addColor(token.getColor(game));
}
}
break;
case AbilityAddingRemovingEffects_6:
if (sublayer == SubLayer.NA) {
if (!token.getAbilities().isEmpty()) {
@ -130,6 +143,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
}
}
break;
case PTChangingEffects_7:
if (sublayer == SubLayer.SetPT_7b) {
int power = token.getPower().getValue();
@ -139,6 +153,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
permanent.getToughness().setValue(toughness);
}
}
break;
}
}
}
@ -168,8 +183,8 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
sb.append(" become ");
}
sb.append(token.getDescription());
if (type != null && !type.isEmpty()) {
sb.append(". They're still ").append(type);
if (theyAreStillType != null && !theyAreStillType.isEmpty()) {
sb.append(". They're still ").append(theyAreStillType);
}
return sb.toString();
}

View file

@ -1,6 +1,8 @@
package mage.game.permanent.token.custom;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.permanent.token.TokenImpl;
@ -39,6 +41,31 @@ public class CreatureToken extends TokenImpl {
}
}
public CreatureToken withAbility(Ability ability) {
this.addAbility(ability);
return this;
}
public CreatureToken withColor(String extraColors) {
ObjectColor extraColorsList = new ObjectColor(extraColors);
this.getColor(null).addColor(extraColorsList);
return this;
}
public CreatureToken withType(CardType extraType) {
if (!this.cardType.contains(extraType)) {
this.cardType.add(extraType);
}
return this;
}
public CreatureToken withSubType(SubType extraSubType) {
if (!this.subtype.contains(extraSubType)) {
this.subtype.add(extraSubType);
}
return this;
}
public CreatureToken(final CreatureToken token) {
super(token);
}