* Fixed Identity Thief copying creature with +1/+1 counter gets P/T boost from it, but not counter (fixes #2131).

This commit is contained in:
LevelX2 2016-08-05 21:15:07 +02:00
parent d1c25b0662
commit d0db2d51ed
33 changed files with 407 additions and 385 deletions

View file

@ -158,8 +158,8 @@ class MarathWillOfTheWildCreateTokenEffect extends OneShotEffect {
if (player != null) { if (player != null) {
int amount = new ManacostVariableValue().calculate(game, source, this); int amount = new ManacostVariableValue().calculate(game, source, this);
Token token = new MarathWillOfTheWildElementalToken(); Token token = new MarathWillOfTheWildElementalToken();
token.getPower().initValue(amount); token.getPower().modifyBaseValue(amount);
token.getToughness().initValue(amount); token.getToughness().modifyBaseValue(amount);
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true; return true;
} }

View file

@ -113,8 +113,8 @@ class WireflyToken extends Token {
WireflyToken() { WireflyToken() {
super("Wirefly", "2/2 colorless Insect artifact creature token named Wirefly"); super("Wirefly", "2/2 colorless Insect artifact creature token named Wirefly");
this.setOriginalExpansionSetCode("DST"); this.setOriginalExpansionSetCode("DST");
this.getPower().initValue(2); this.getPower().modifyBaseValue(2);
this.getToughness().initValue(2); this.getToughness().modifyBaseValue(2);
this.getSubtype().add("Insect"); this.getSubtype().add("Insect");
this.getCardType().add(CardType.ARTIFACT); this.getCardType().add(CardType.ARTIFACT);
this.getCardType().add(CardType.CREATURE); this.getCardType().add(CardType.CREATURE);

View file

@ -106,10 +106,7 @@ class IdentityThiefAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(this.getSourceId())) { return event.getSourceId().equals(this.getSourceId());
return true;
}
return false;
} }
@Override @Override
@ -141,7 +138,11 @@ class IdentityThiefEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && permanent != null && sourcePermanent != null) { if (controller != null && permanent != null && sourcePermanent != null) {
CopyEffect copyEffect = new CopyEffect(Duration.EndOfTurn, permanent, source.getSourceId()); Permanent permanentReset = permanent.copy();
permanentReset.getCounters().clear();
permanentReset.getPower().resetToBaseValue();
permanentReset.getToughness().resetToBaseValue();
CopyEffect copyEffect = new CopyEffect(Duration.EndOfTurn, permanentReset, source.getSourceId());
if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
// Copy exiled permanent // Copy exiled permanent
game.addEffect(copyEffect, source); game.addEffect(copyEffect, source);

View file

@ -33,14 +33,11 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -108,7 +105,9 @@ class TreeOfPerditionEffect extends OneShotEffect {
return false; return false;
} }
opponent.setLife(amount, game); opponent.setLife(amount, game);
game.addEffect(new SetPowerToughnessSourceEffect(Integer.MIN_VALUE, life, Duration.Custom, SubLayer.SetPT_7b), source); perm.getPower().modifyBaseValue(life);
perm.getToughness().modifyBaseValue(life);
// game.addEffect(new SetPowerToughnessSourceEffect(Integer.MIN_VALUE, life, Duration.Custom, SubLayer.SetPT_7b), source);
return true; return true;
} }
} }

View file

@ -82,8 +82,8 @@ class CamaridToken extends Token {
CamaridToken() { CamaridToken() {
super("Camarid", "1/1 blue Camarid creature tokens"); super("Camarid", "1/1 blue Camarid creature tokens");
this.setOriginalExpansionSetCode("FEM"); this.setOriginalExpansionSetCode("FEM");
this.getPower().initValue(1); this.getPower().modifyBaseValue(1);
this.getToughness().initValue(1); this.getToughness().modifyBaseValue(1);
this.color.setBlue(true); this.color.setBlue(true);
this.getSubtype().add("Camarid"); this.getSubtype().add("Camarid");
this.getCardType().add(CardType.CREATURE); this.getCardType().add(CardType.CREATURE);

View file

@ -33,7 +33,6 @@ 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.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.CardImpl; import mage.cards.CardImpl;
@ -43,7 +42,6 @@ import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.EntersTheBattlefieldEvent;
@ -152,7 +150,9 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source); game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source);
break; break;
} }
game.addEffect(new SetPowerToughnessSourceEffect(power, toughness, Duration.Custom, SubLayer.SetPT_7b), source); permanent.getPower().modifyBaseValue(power);
permanent.getToughness().modifyBaseValue(toughness);
// game.addEffect(new SetPowerToughnessSourceEffect(power, toughness, Duration.Custom, SubLayer.SetPT_7b), source);
} }
return false; return false;

View file

@ -1,117 +1,117 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.gatecrash; package mage.sets.gatecrash;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
import mage.players.Player; import mage.players.Player;
/** /**
* *
* @author LevelX2 * @author LevelX2
*/ */
public class MimingSlime extends CardImpl { public class MimingSlime extends CardImpl {
public MimingSlime(UUID ownerId) { public MimingSlime(UUID ownerId) {
super(ownerId, 126, "Miming Slime", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{G}"); super(ownerId, 126, "Miming Slime", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{G}");
this.expansionSetCode = "GTC"; this.expansionSetCode = "GTC";
// Put an X/X green Ooze creature token onto the battlefield, where X is the greatest power among creatures you control. // Put an X/X green Ooze creature token onto the battlefield, where X is the greatest power among creatures you control.
this.getSpellAbility().addEffect(new MimingSlimeEffect()); this.getSpellAbility().addEffect(new MimingSlimeEffect());
} }
public MimingSlime(final MimingSlime card) { public MimingSlime(final MimingSlime card) {
super(card); super(card);
} }
@Override @Override
public MimingSlime copy() { public MimingSlime copy() {
return new MimingSlime(this); return new MimingSlime(this);
} }
} }
class MimingSlimeEffect extends OneShotEffect { class MimingSlimeEffect extends OneShotEffect {
public MimingSlimeEffect() { public MimingSlimeEffect() {
super(Outcome.PutCreatureInPlay); super(Outcome.PutCreatureInPlay);
staticText = "Put an X/X green Ooze creature token onto the battlefield, where X is the greatest power among creatures you control"; staticText = "Put an X/X green Ooze creature token onto the battlefield, where X is the greatest power among creatures you control";
} }
public MimingSlimeEffect(final MimingSlimeEffect effect) { public MimingSlimeEffect(final MimingSlimeEffect effect) {
super(effect); super(effect);
} }
@Override @Override
public MimingSlimeEffect copy() { public MimingSlimeEffect copy() {
return new MimingSlimeEffect(this); return new MimingSlimeEffect(this);
} }
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null) { if (player != null) {
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game); List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game);
int amount = 0; int amount = 0;
for (Permanent creature : creatures) { for (Permanent creature : creatures) {
int power = creature.getPower().getValue(); int power = creature.getPower().getValue();
if (amount < power) { if (amount < power) {
amount = power; amount = power;
} }
} }
OozeToken oozeToken = new OozeToken(); OozeToken oozeToken = new OozeToken();
oozeToken.getPower().initValue(amount); oozeToken.getPower().modifyBaseValue(amount);
oozeToken.getToughness().initValue(amount); oozeToken.getToughness().modifyBaseValue(amount);
oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true; return true;
} }
return false; return false;
} }
} }
class OozeToken extends Token { class OozeToken extends Token {
public OozeToken() { public OozeToken() {
super("Ooze", "X/X green Ooze creature token"); super("Ooze", "X/X green Ooze creature token");
cardType.add(CardType.CREATURE); cardType.add(CardType.CREATURE);
subtype.add("Ooze"); subtype.add("Ooze");
color.setGreen(true); color.setGreen(true);
power = new MageInt(0); power = new MageInt(0);
toughness = new MageInt(0); toughness = new MageInt(0);
setOriginalExpansionSetCode("RTR"); setOriginalExpansionSetCode("RTR");
} }
} }

View file

@ -1,109 +1,109 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.gatecrash; package mage.sets.gatecrash;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.common.RemoveVariableCountersTargetCost; import mage.abilities.costs.common.RemoveVariableCountersTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
/** /**
* *
* @author LevelX2 * @author LevelX2
*/ */
public class OozeFlux extends CardImpl { public class OozeFlux extends CardImpl {
public OozeFlux(UUID ownerId) { public OozeFlux(UUID ownerId) {
super(ownerId, 128, "Ooze Flux", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}"); super(ownerId, 128, "Ooze Flux", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
this.expansionSetCode = "GTC"; this.expansionSetCode = "GTC";
// {1}{G}, Remove one or more +1/+1 counters from among creatures you control: Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way. // {1}{G}, Remove one or more +1/+1 counters from among creatures you control: Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new OozeFluxCreateTokenEffect(new OozeToken()),new ManaCostsImpl("{1}{G}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new OozeFluxCreateTokenEffect(new OozeToken()),new ManaCostsImpl("{1}{G}"));
ability.addCost(new RemoveVariableCountersTargetCost(new FilterControlledCreaturePermanent("creatures you control"), CounterType.P1P1, "one or more", 1)); ability.addCost(new RemoveVariableCountersTargetCost(new FilterControlledCreaturePermanent("creatures you control"), CounterType.P1P1, "one or more", 1));
this.addAbility(ability); this.addAbility(ability);
} }
public OozeFlux(final OozeFlux card) { public OozeFlux(final OozeFlux card) {
super(card); super(card);
} }
@Override @Override
public OozeFlux copy() { public OozeFlux copy() {
return new OozeFlux(this); return new OozeFlux(this);
} }
} }
class OozeFluxCreateTokenEffect extends OneShotEffect { class OozeFluxCreateTokenEffect extends OneShotEffect {
private final Token token; private final Token token;
public OozeFluxCreateTokenEffect(Token token) { public OozeFluxCreateTokenEffect(Token token) {
super(Outcome.PutCreatureInPlay); super(Outcome.PutCreatureInPlay);
this.token = token; this.token = token;
staticText = "Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way"; staticText = "Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way";
} }
public OozeFluxCreateTokenEffect(final OozeFluxCreateTokenEffect effect) { public OozeFluxCreateTokenEffect(final OozeFluxCreateTokenEffect effect) {
super(effect); super(effect);
this.token = effect.token.copy(); this.token = effect.token.copy();
} }
@Override @Override
public OozeFluxCreateTokenEffect copy() { public OozeFluxCreateTokenEffect copy() {
return new OozeFluxCreateTokenEffect(this); return new OozeFluxCreateTokenEffect(this);
} }
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int xValue = 0; int xValue = 0;
for (Cost cost : source.getCosts()) { for (Cost cost : source.getCosts()) {
if (cost instanceof RemoveVariableCountersTargetCost) { if (cost instanceof RemoveVariableCountersTargetCost) {
xValue = ((RemoveVariableCountersTargetCost) cost).getAmount(); xValue = ((RemoveVariableCountersTargetCost) cost).getAmount();
break; break;
} }
} }
Token tokenCopy = token.copy(); Token tokenCopy = token.copy();
tokenCopy.getAbilities().newId(); tokenCopy.getAbilities().newId();
tokenCopy.getPower().initValue(xValue); tokenCopy.getPower().modifyBaseValue(xValue);
tokenCopy.getToughness().initValue(xValue); tokenCopy.getToughness().modifyBaseValue(xValue);
tokenCopy.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); tokenCopy.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true; return true;
} }
} }

View file

@ -91,8 +91,8 @@ class SkeletonToken extends Token {
SkeletonToken() { SkeletonToken() {
super("Skeleton", "1/1 black Skeleton creature token onto the battlefield. It has \"{B}: Regenerate this creature.\""); super("Skeleton", "1/1 black Skeleton creature token onto the battlefield. It has \"{B}: Regenerate this creature.\"");
this.setOriginalExpansionSetCode("HML"); this.setOriginalExpansionSetCode("HML");
this.getPower().initValue(1); this.getPower().modifyBaseValue(1);
this.getToughness().initValue(1); this.getToughness().modifyBaseValue(1);
this.color.setBlack(true); this.color.setBlack(true);
this.getSubtype().add("Skeleton"); this.getSubtype().add("Skeleton");
this.getCardType().add(CardType.CREATURE); this.getCardType().add(CardType.CREATURE);

View file

@ -99,7 +99,11 @@ class EssenceOfTheWildEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourceObject != null) { if (sourceObject != null) {
game.addEffect(new CopyEffect(Duration.Custom, sourceObject, event.getTargetId()), source); Permanent permanentReset = sourceObject.copy();
permanentReset.getCounters().clear();
permanentReset.getPower().resetToBaseValue();
permanentReset.getToughness().resetToBaseValue();
game.addEffect(new CopyEffect(Duration.Custom, permanentReset, event.getTargetId()), source);
} }
return false; return false;
} }

View file

@ -73,14 +73,13 @@ public class PharikaGodOfAffliction extends CardImpl {
// As long as your devotion to black and green is less than seven, Pharika isn't a creature. // As long as your devotion to black and green is less than seven, Pharika isn't a creature.
Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ColoredManaSymbol.B, ColoredManaSymbol.G), 7); Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ColoredManaSymbol.B, ColoredManaSymbol.G), 7);
effect.setText("As long as your devotion to black and green is less than seven, Pharika isn't a creature"); effect.setText("As long as your devotion to black and green is less than seven, Pharika isn't a creature");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// {B}{G}: Exile target creature card from a graveyard. It's owner puts a 1/1 black and green Snake enchantment creature token with deathtouch onto the battlefield. // {B}{G}: Exile target creature card from a graveyard. It's owner puts a 1/1 black and green Snake enchantment creature token with deathtouch onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PharikaExileEffect(), new ManaCostsImpl("{B}{G}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PharikaExileEffect(), new ManaCostsImpl("{B}{G}"));
Target target = new TargetCardInGraveyard(new FilterCreatureCard("a creature card from a graveyard")); Target target = new TargetCardInGraveyard(new FilterCreatureCard("a creature card from a graveyard"));
ability.addTarget(target); ability.addTarget(target);
this.addAbility(ability); this.addAbility(ability);
} }
public PharikaGodOfAffliction(final PharikaGodOfAffliction card) { public PharikaGodOfAffliction(final PharikaGodOfAffliction card) {
@ -98,7 +97,7 @@ class PharikaExileEffect extends OneShotEffect {
public PharikaExileEffect() { public PharikaExileEffect() {
super(Outcome.PutCreatureInPlay); super(Outcome.PutCreatureInPlay);
staticText = "Exile target creature card from a graveyard. It's owner puts a 1/1 black and green Snake enchantment creature token with deathtouch onto the battlefield"; staticText = "Exile target creature card from a graveyard. It's owner puts a 1/1 black and green Snake enchantment creature token with deathtouch onto the battlefield";
} }
public PharikaExileEffect(final PharikaExileEffect effect) { public PharikaExileEffect(final PharikaExileEffect effect) {
super(effect); super(effect);
@ -116,8 +115,8 @@ class PharikaExileEffect extends OneShotEffect {
Player tokenController = game.getPlayer(targetCard.getOwnerId()); Player tokenController = game.getPlayer(targetCard.getOwnerId());
if (tokenController != null) { if (tokenController != null) {
return new PharikaSnakeToken().putOntoBattlefield(1, game, source.getSourceId(), tokenController.getId()); return new PharikaSnakeToken().putOntoBattlefield(1, game, source.getSourceId(), tokenController.getId());
} }
} }
} }
return false; return false;
} }
@ -132,15 +131,13 @@ class PharikaExileEffect extends OneShotEffect {
class PharikaSnakeToken extends Token { class PharikaSnakeToken extends Token {
public PharikaSnakeToken() { public PharikaSnakeToken() {
super("Snake", "1/1 black and green Snake enchantment creature token with deathtouch"); super("Snake", "1/1 black and green Snake enchantment creature token with deathtouch", 1, 1);
this.setOriginalExpansionSetCode("JOU"); this.setOriginalExpansionSetCode("JOU");
cardType.add(CardType.ENCHANTMENT); cardType.add(CardType.ENCHANTMENT);
cardType.add(CardType.CREATURE); cardType.add(CardType.CREATURE);
subtype.add("Snake"); subtype.add("Snake");
color.setBlack(true); color.setBlack(true);
color.setGreen(true); color.setGreen(true);
power.setValue(1);
toughness.setValue(1);
this.addAbility(DeathtouchAbility.getInstance()); this.addAbility(DeathtouchAbility.getInstance());
} }
} }

View file

@ -134,8 +134,8 @@ class NissaSageAnimistToken extends Token {
super("Ashaya, the Awoken World", "legendary 4/4 green Elemental creature token named Ashaya, the Awoken World"); super("Ashaya, the Awoken World", "legendary 4/4 green Elemental creature token named Ashaya, the Awoken World");
this.setOriginalExpansionSetCode("ORI"); this.setOriginalExpansionSetCode("ORI");
this.getSupertype().add("Legendary"); this.getSupertype().add("Legendary");
this.getPower().initValue(4); this.getPower().modifyBaseValue(4);
this.getToughness().initValue(4); this.getToughness().modifyBaseValue(4);
this.color.setGreen(true); this.color.setGreen(true);
this.getSubtype().add("Elemental"); this.getSubtype().add("Elemental");
this.getCardType().add(CardType.CREATURE); this.getCardType().add(CardType.CREATURE);

View file

@ -81,8 +81,8 @@ public class PhyrexianRebirth extends CardImpl {
count += permanent.destroy(source.getSourceId(), game, false) ? 1 : 0; count += permanent.destroy(source.getSourceId(), game, false) ? 1 : 0;
} }
HorrorToken horrorToken = new HorrorToken(); HorrorToken horrorToken = new HorrorToken();
horrorToken.getPower().initValue(count); horrorToken.getPower().modifyBaseValue(count);
horrorToken.getToughness().initValue(count); horrorToken.getToughness().modifyBaseValue(count);
horrorToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); horrorToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true; return true;
} }

View file

@ -74,8 +74,8 @@ class CatWarriorToken extends Token {
CatWarriorToken() { CatWarriorToken() {
super("Cat Warrior", "2/2 green Cat Warrior creature token with forestwalk"); super("Cat Warrior", "2/2 green Cat Warrior creature token with forestwalk");
this.setOriginalExpansionSetCode("PLC"); this.setOriginalExpansionSetCode("PLC");
this.getPower().initValue(2); this.getPower().modifyBaseValue(2);
this.getToughness().initValue(2); this.getToughness().modifyBaseValue(2);
this.color.setGreen(true); this.color.setGreen(true);
this.getSubtype().add("Cat"); this.getSubtype().add("Cat");
this.getSubtype().add("Warrior"); this.getSubtype().add("Warrior");

View file

@ -33,7 +33,6 @@ 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.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.CardImpl; import mage.cards.CardImpl;
@ -43,7 +42,6 @@ import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.EntersTheBattlefieldEvent;
@ -153,7 +151,9 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source); game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source);
break; break;
} }
game.addEffect(new SetPowerToughnessSourceEffect(power, toughness, Duration.Custom, SubLayer.SetPT_7b), source); permanent.getPower().modifyBaseValue(power);
permanent.getToughness().modifyBaseValue(toughness);
// game.addEffect(new SetPowerToughnessSourceEffect(power, toughness, Duration.Custom, SubLayer.SetPT_7b), source);
} }
return false; return false;

View file

@ -31,11 +31,8 @@ import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.continuous.SetPowerSourceEffect;
import mage.abilities.effects.common.continuous.SetToughnessSourceEffect;
import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -95,14 +92,14 @@ class MoltenSentryEffect extends OneShotEffect {
if (controller != null && permanent != null) { if (controller != null && permanent != null) {
if (controller.flipCoin(game)) { if (controller.flipCoin(game)) {
game.informPlayers("Heads: " + permanent.getLogName() + " enters the battlefield as a 5/2 creature with haste"); game.informPlayers("Heads: " + permanent.getLogName() + " enters the battlefield as a 5/2 creature with haste");
game.addEffect(new SetPowerSourceEffect(new StaticValue(5), Duration.WhileOnBattlefield), source); permanent.getPower().modifyBaseValue(5);
game.addEffect(new SetToughnessSourceEffect(new StaticValue(2), Duration.WhileOnBattlefield), source); permanent.getToughness().modifyBaseValue(2);
game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield), source); game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield), source);
return true; return true;
} else { } else {
game.informPlayers("Tails: " + permanent.getLogName() + " enters the battlefield as a 2/5 creature with defender"); game.informPlayers("Tails: " + permanent.getLogName() + " enters the battlefield as a 2/5 creature with defender");
game.addEffect(new SetPowerSourceEffect(new StaticValue(2), Duration.WhileOnBattlefield), source); permanent.getPower().modifyBaseValue(2);
game.addEffect(new SetToughnessSourceEffect(new StaticValue(5), Duration.WhileOnBattlefield), source); permanent.getToughness().modifyBaseValue(5);
game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.WhileOnBattlefield), source); game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.WhileOnBattlefield), source);
return true; return true;
} }

View file

@ -80,8 +80,8 @@ class SlimeMoldingEffect extends OneShotEffect {
int count = source.getManaCostsToPay().getX(); int count = source.getManaCostsToPay().getX();
OozeToken oozeToken = new OozeToken(); OozeToken oozeToken = new OozeToken();
oozeToken.getPower().initValue(count); oozeToken.getPower().modifyBaseValue(count);
oozeToken.getToughness().initValue(count); oozeToken.getToughness().modifyBaseValue(count);
oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true; return true;
} }

View file

@ -83,8 +83,8 @@ class DevastatingSummonsEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
ElementalToken token = new ElementalToken(); ElementalToken token = new ElementalToken();
token.getPower().initValue(new GetXValue().calculate(game, source, this)); token.getPower().modifyBaseValue(new GetXValue().calculate(game, source, this));
token.getToughness().initValue(new GetXValue().calculate(game, source, this)); token.getToughness().modifyBaseValue(new GetXValue().calculate(game, source, this));
token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId()); token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId());

View file

@ -80,8 +80,8 @@ class GelatinousGenesisEffect extends OneShotEffect {
int count = source.getManaCostsToPay().getX(); int count = source.getManaCostsToPay().getX();
OozeToken oozeToken = new OozeToken(); OozeToken oozeToken = new OozeToken();
oozeToken.getPower().initValue(count); oozeToken.getPower().modifyBaseValue(count);
oozeToken.getToughness().initValue(count); oozeToken.getToughness().modifyBaseValue(count);
oozeToken.putOntoBattlefield(count, game, source.getSourceId(), source.getControllerId()); oozeToken.putOntoBattlefield(count, game, source.getSourceId(), source.getControllerId());
return true; return true;
} }

View file

@ -72,15 +72,15 @@ class QuicksilverGargantuanApplyToPermanent extends ApplyToPermanent {
@Override @Override
public Boolean apply(Game game, Permanent permanent) { public Boolean apply(Game game, Permanent permanent) {
permanent.getPower().initValue(7); permanent.getPower().modifyBaseValue(7);
permanent.getToughness().initValue(7); permanent.getToughness().modifyBaseValue(7);
return true; return true;
} }
@Override @Override
public Boolean apply(Game game, MageObject mageObject) { public Boolean apply(Game game, MageObject mageObject) {
mageObject.getPower().initValue(7); mageObject.getPower().modifyBaseValue(7);
mageObject.getToughness().initValue(7); mageObject.getToughness().modifyBaseValue(7);
return true; return true;
} }

View file

@ -80,8 +80,8 @@ class WurmcallingEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int count = source.getManaCostsToPay().getX(); int count = source.getManaCostsToPay().getX();
WurmToken token = new WurmToken(); WurmToken token = new WurmToken();
token.getPower().initValue(count); token.getPower().modifyBaseValue(count);
token.getToughness().initValue(count); token.getToughness().modifyBaseValue(count);
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true; return true;
} }

View file

@ -129,8 +129,8 @@ class PhyrexianProcessorCreateTokenEffect extends OneShotEffect {
if(object != null && object instanceof Integer) { if(object != null && object instanceof Integer) {
int lifePaid = (int) object; int lifePaid = (int) object;
MinionToken token = new MinionToken(); MinionToken token = new MinionToken();
token.getPower().initValue(lifePaid); token.getPower().modifyBaseValue(lifePaid);
token.getToughness().initValue(lifePaid); token.getToughness().modifyBaseValue(lifePaid);
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true; return true;
} }

View file

@ -225,6 +225,8 @@ public class MorphTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void testPineWalkerWithUnboostEffect() { public void testPineWalkerWithUnboostEffect() {
// Morph {4}{G}
// Whenever Pine Walker or another creature you control is turned face up, untap that creature.
addCard(Zone.HAND, playerA, "Pine Walker"); addCard(Zone.HAND, playerA, "Pine Walker");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 8); addCard(Zone.BATTLEFIELD, playerA, "Forest", 8);
@ -641,24 +643,25 @@ public class MorphTest extends CardTestPlayerBase {
assertPowerToughness(playerA, "Pine Walker", 5, 5); assertPowerToughness(playerA, "Pine Walker", 5, 5);
assertTapped("Pine Walker", false); assertTapped("Pine Walker", false);
} }
/** /**
* Reflector Mage bouncing a creature that can be played as a morph should not prevent the card * Reflector Mage bouncing a creature that can be played as a morph should
* from being replayed as a morph. Morph creatures are nameless. * not prevent the card from being replayed as a morph. Morph creatures are
* * nameless.
* Reported bug: *
* Face-up morph creatures that are bounced by Reflector Mage should be able to be replayed as morphs * Reported bug: Face-up morph creatures that are bounced by Reflector Mage
* without the "until the next turn" restriction." * should be able to be replayed as morphs without the "until the next turn"
* restriction."
*/ */
@Test @Test
public void testReflectorMageBouncesFaceupCreatureReplayAsMorph() { public void testReflectorMageBouncesFaceupCreatureReplayAsMorph() {
// {1}{W}{U} When Reflector Mage enters the battlefield, return target creature an opponent controls to its owner's hand. // {1}{W}{U} When Reflector Mage enters the battlefield, return target creature an opponent controls to its owner's hand.
// That creature's owner can't cast spells with the same name as that creature until your next turn. // That creature's owner can't cast spells with the same name as that creature until your next turn.
addCard(Zone.HAND, playerA, "Reflector Mage"); // 2/3 addCard(Zone.HAND, playerA, "Reflector Mage"); // 2/3
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
addCard(Zone.BATTLEFIELD, playerA, "Island", 2); addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
//Tap: Add {G}, {U}, or {R} to your mana pool. //Tap: Add {G}, {U}, or {R} to your mana pool.
// Morph 2 (You may cast this card face down as a 2/2 creature for 3. Turn it face up any time for its morph cost.) // Morph 2 (You may cast this card face down as a 2/2 creature for 3. Turn it face up any time for its morph cost.)
// When Rattleclaw Mystic is turned face up, add {G}{U}{R} to your mana pool. // When Rattleclaw Mystic is turned face up, add {G}{U}{R} to your mana pool.
@ -666,36 +669,37 @@ public class MorphTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Forest"); addCard(Zone.BATTLEFIELD, playerB, "Forest");
addCard(Zone.BATTLEFIELD, playerB, "Island"); addCard(Zone.BATTLEFIELD, playerB, "Island");
addCard(Zone.BATTLEFIELD, playerB, "Mountain"); addCard(Zone.BATTLEFIELD, playerB, "Mountain");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage");
addTarget(playerA, "Rattleclaw Mystic"); addTarget(playerA, "Rattleclaw Mystic");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Rattleclaw Mystic"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Rattleclaw Mystic");
setChoice(playerB, "Yes"); // cast it face down as 2/2 creature setChoice(playerB, "Yes"); // cast it face down as 2/2 creature
setStopAt(2, PhaseStep.BEGIN_COMBAT); setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertPermanentCount(playerA, "Reflector Mage", 1); assertPermanentCount(playerA, "Reflector Mage", 1);
assertPermanentCount(playerB, "Rattleclaw Mystic", 0); assertPermanentCount(playerB, "Rattleclaw Mystic", 0);
assertHandCount(playerB, "Rattleclaw Mystic", 0); // should have been replayed assertHandCount(playerB, "Rattleclaw Mystic", 0); // should have been replayed
assertPermanentCount(playerB, "", 1); // Rattleclaw played as a morph assertPermanentCount(playerB, "", 1); // Rattleclaw played as a morph
} }
/** /**
* Reflector Mage bouncing a creature that can be played as a morph should not prevent the card * Reflector Mage bouncing a creature that can be played as a morph should
* from being replayed as a morph. Morph creatures are nameless. * not prevent the card from being replayed as a morph. Morph creatures are
* * nameless.
* Reported bug: *
* Face-up morph creatures that are bounced by Reflector Mage should be able to be replayed as morphs * Reported bug: Face-up morph creatures that are bounced by Reflector Mage
* without the "until the next turn" restriction." * should be able to be replayed as morphs without the "until the next turn"
* * restriction."
*
* Testing bouncing a face-down creature played next turn face-up. * Testing bouncing a face-down creature played next turn face-up.
*/ */
@Test @Test
public void testReflectorMageBouncesMorphCreatureReplayAsFaceup() { public void testReflectorMageBouncesMorphCreatureReplayAsFaceup() {
//Tap: Add {G}, {U}, or {R} to your mana pool. //Tap: Add {G}, {U}, or {R} to your mana pool.
// Morph 2 (You may cast this card face down as a 2/2 creature for 3. Turn it face up any time for its morph cost.) // Morph 2 (You may cast this card face down as a 2/2 creature for 3. Turn it face up any time for its morph cost.)
// When Rattleclaw Mystic is turned face up, add {G}{U}{R} to your mana pool. // When Rattleclaw Mystic is turned face up, add {G}{U}{R} to your mana pool.
@ -703,28 +707,28 @@ public class MorphTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Forest"); addCard(Zone.BATTLEFIELD, playerA, "Forest");
addCard(Zone.BATTLEFIELD, playerA, "Island"); addCard(Zone.BATTLEFIELD, playerA, "Island");
addCard(Zone.BATTLEFIELD, playerA, "Mountain"); addCard(Zone.BATTLEFIELD, playerA, "Mountain");
// {1}{W}{U} When Reflector Mage enters the battlefield, return target creature an opponent controls to its owner's hand. // {1}{W}{U} When Reflector Mage enters the battlefield, return target creature an opponent controls to its owner's hand.
// That creature's owner can't cast spells with the same name as that creature until your next turn. // That creature's owner can't cast spells with the same name as that creature until your next turn.
addCard(Zone.HAND, playerB, "Reflector Mage"); // 2/3 addCard(Zone.HAND, playerB, "Reflector Mage"); // 2/3
addCard(Zone.BATTLEFIELD, playerB, "Plains", 2); addCard(Zone.BATTLEFIELD, playerB, "Plains", 2);
addCard(Zone.BATTLEFIELD, playerB, "Island", 2); addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rattleclaw Mystic"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rattleclaw Mystic");
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Reflector Mage"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Reflector Mage");
addTarget(playerB, ""); addTarget(playerB, "");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Rattleclaw Mystic"); castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Rattleclaw Mystic");
setChoice(playerA, "No"); // cast it face down as 2/2 creature setChoice(playerA, "No"); // cast it face down as 2/2 creature
setStopAt(3, PhaseStep.BEGIN_COMBAT); setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertPermanentCount(playerB, "Reflector Mage", 1); assertPermanentCount(playerB, "Reflector Mage", 1);
assertPermanentCount(playerA, "Rattleclaw Mystic", 1); assertPermanentCount(playerA, "Rattleclaw Mystic", 1);
assertHandCount(playerA, "Rattleclaw Mystic", 0); // should have been replayed faceup assertHandCount(playerA, "Rattleclaw Mystic", 0); // should have been replayed faceup
} }
} }

View file

@ -381,7 +381,9 @@ public class TestPlayer implements Player {
@Override @Override
public boolean priority(Game game) { public boolean priority(Game game) {
int numberOfActions = actions.size(); int numberOfActions = actions.size();
for (PlayerAction action : actions) { List<PlayerAction> tempActions = new ArrayList<>();
tempActions.addAll(actions);
for (PlayerAction action : tempActions) {
if (action.getTurnNum() == game.getTurnNum() && action.getStep() == game.getStep().getType()) { if (action.getTurnNum() == game.getTurnNum() && action.getStep() == game.getStep().getType()) {
if (action.getAction().startsWith("activate:")) { if (action.getAction().startsWith("activate:")) {
@ -478,7 +480,7 @@ public class TestPlayer implements Player {
int turns = Integer.parseUnsignedInt(groups[1].substring(6)); int turns = Integer.parseUnsignedInt(groups[1].substring(6));
game.rollbackTurns(turns); game.rollbackTurns(turns);
actions.remove(action); actions.remove(action);
break; return true;
} }
} }
} }

View file

@ -24,8 +24,7 @@
* The views and conclusions contained in the software and documentation are those of the * The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage; package mage;
import java.io.Serializable; import java.io.Serializable;
@ -49,15 +48,28 @@ public class MageInt implements Serializable, Copyable<MageInt> {
}; };
protected int baseValue; protected int baseValue;
protected int baseValueModified;
protected int boostedValue;
protected String cardValue = ""; protected String cardValue = "";
public MageInt(int value) { public MageInt(int value) {
this.baseValue = value; this.baseValue = value;
this.baseValueModified = baseValue;
this.boostedValue = baseValue;
this.cardValue = Integer.toString(value); this.cardValue = Integer.toString(value);
} }
public MageInt(int baseValue, String cardValue) { public MageInt(int baseValue, String cardValue) {
this.baseValue = baseValue; this.baseValue = baseValue;
this.baseValueModified = baseValue;
this.boostedValue = baseValue;
this.cardValue = cardValue;
}
public MageInt(int baseValue, int baseValueModified, int boostedValue, String cardValue) {
this.baseValue = baseValue;
this.baseValueModified = baseValueModified;
this.boostedValue = boostedValue;
this.cardValue = cardValue; this.cardValue = cardValue;
} }
@ -66,24 +78,37 @@ public class MageInt implements Serializable, Copyable<MageInt> {
if (this == EmptyMageInt) { if (this == EmptyMageInt) {
return this; return this;
} }
return new MageInt(baseValue, cardValue); return new MageInt(baseValue, baseValueModified, boostedValue, cardValue);
} }
public int getValue() { public int getBaseValue() {
return baseValue; return baseValue;
} }
public void initValue(int value) { public int getBaseValueModified() {
this.baseValue = value; return baseValueModified;
}
public int getValue() {
return boostedValue;
}
public void modifyBaseValue(int value) {
this.baseValueModified = value;
this.boostedValue = value;
this.cardValue = Integer.toString(value); this.cardValue = Integer.toString(value);
} }
public void setValue(int value) { public void setValue(int value) {
this.baseValue = value; this.boostedValue = value;
} }
public void boostValue(int amount) { public void boostValue(int amount) {
this.baseValue += amount; this.boostedValue += amount;
}
public void resetToBaseValue() {
this.boostedValue = this.baseValueModified;
} }
@Override @Override

View file

@ -47,13 +47,12 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
/** /**
* This effect lets the card be a 2/2 face-down creature, with no text, * This effect lets the card be a 2/2 face-down creature, with no text, no name,
* no name, no subtypes, and no mana cost, if it's face down on the battlefield. * no subtypes, and no mana cost, if it's face down on the battlefield. And it
* And it adds the a TurnFaceUpAbility ability. * adds the a TurnFaceUpAbility ability.
* *
* @author LevelX2 * @author LevelX2
*/ */
public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implements SourceEffect { public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implements SourceEffect {
public enum FaceDownType { public enum FaceDownType {
@ -65,15 +64,15 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
protected int zoneChangeCounter; protected int zoneChangeCounter;
protected Ability turnFaceUpAbility = null; protected Ability turnFaceUpAbility = null;
protected MageObjectReference objectReference= null; protected MageObjectReference objectReference = null;
protected boolean foundPermanent; protected boolean foundPermanent;
protected FaceDownType faceDownType; protected FaceDownType faceDownType;
public BecomesFaceDownCreatureEffect(Duration duration, FaceDownType faceDownType){ public BecomesFaceDownCreatureEffect(Duration duration, FaceDownType faceDownType) {
this(null, null, duration, faceDownType); this(null, null, duration, faceDownType);
} }
public BecomesFaceDownCreatureEffect(Costs<Cost> turnFaceUpCosts, FaceDownType faceDownType){ public BecomesFaceDownCreatureEffect(Costs<Cost> turnFaceUpCosts, FaceDownType faceDownType) {
this(turnFaceUpCosts, null, faceDownType); this(turnFaceUpCosts, null, faceDownType);
} }
@ -97,7 +96,6 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
this.faceDownType = faceDownType; this.faceDownType = faceDownType;
} }
public BecomesFaceDownCreatureEffect(final BecomesFaceDownCreatureEffect effect) { public BecomesFaceDownCreatureEffect(final BecomesFaceDownCreatureEffect effect) {
super(effect); super(effect);
this.zoneChangeCounter = effect.zoneChangeCounter; this.zoneChangeCounter = effect.zoneChangeCounter;
@ -147,11 +145,11 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
} else { } else {
permanent = game.getPermanent(source.getSourceId()); permanent = game.getPermanent(source.getSourceId());
} }
if (permanent != null && permanent.isFaceDown(game)) { if (permanent != null && permanent.isFaceDown(game)) {
if (!foundPermanent) { if (!foundPermanent) {
foundPermanent = true; foundPermanent = true;
switch(faceDownType) { switch (faceDownType) {
case MANIFESTED: case MANIFESTED:
case MANUAL: // sets manifested image case MANUAL: // sets manifested image
permanent.setManifested(true); permanent.setManifested(true);
@ -184,11 +182,9 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
if (ability.getWorksFaceDown()) { if (ability.getWorksFaceDown()) {
ability.setRuleVisible(false); ability.setRuleVisible(false);
continue; continue;
} else { } else if (!ability.getRuleVisible() && !ability.getEffects().isEmpty()) {
if (!ability.getRuleVisible() && !ability.getEffects().isEmpty()) { if (ability.getEffects().get(0) instanceof BecomesFaceDownCreatureEffect) {
if (ability.getEffects().get(0) instanceof BecomesFaceDownCreatureEffect) { continue;
continue;
}
} }
} }
abilitiesToRemove.add(ability); abilitiesToRemove.add(ability);
@ -200,14 +196,12 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
break; break;
case PTChangingEffects_7: case PTChangingEffects_7:
if (sublayer == SubLayer.SetPT_7b) { if (sublayer == SubLayer.SetPT_7b) {
permanent.getPower().setValue(2); // permanent.getPower().setValue(2);
permanent.getToughness().setValue(2); // permanent.getToughness().setValue(2);
} }
} }
} else { } else if (duration.equals(Duration.Custom) && foundPermanent == true) {
if (duration.equals(Duration.Custom) && foundPermanent == true) { discard();
discard();
}
} }
return true; return true;
} }

View file

@ -115,7 +115,7 @@ public class BoostTargetEffect extends ContinuousEffectImpl {
if (staticText != null && !staticText.isEmpty()) { if (staticText != null && !staticText.isEmpty()) {
return staticText; return staticText;
} }
if (mode == null || mode.getTargets().size() == 0) { if (mode == null || mode.getTargets().isEmpty()) {
return "no target"; return "no target";
} }
Target target = mode.getTargets().get(0); Target target = mode.getTargets().get(0);

View file

@ -208,7 +208,6 @@ class FlashbackEffect extends OneShotEffect {
if (!game.isSimulation()) { if (!game.isSimulation()) {
game.informPlayers(controller.getLogName() + " flashbacks " + card.getLogName()); game.informPlayers(controller.getLogName() + " flashbacks " + card.getLogName());
} }
// spellAbility.setCostModificationActive(false); // prevents to apply cost modification twice for flashbacked spells
if (controller.cast(spellAbility, game, false)) { if (controller.cast(spellAbility, game, false)) {
ContinuousEffect effect = new FlashbackReplacementEffect(); ContinuousEffect effect = new FlashbackReplacementEffect();
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId()))); effect.setTargetPointer(new FixedTarget(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId())));

View file

@ -295,8 +295,8 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost
} }
public static void setPermanentToFaceDownCreature(MageObject mageObject) { public static void setPermanentToFaceDownCreature(MageObject mageObject) {
mageObject.getPower().initValue(2); mageObject.getPower().modifyBaseValue(2);
mageObject.getToughness().initValue(2); mageObject.getToughness().modifyBaseValue(2);
mageObject.getAbilities().clear(); mageObject.getAbilities().clear();
mageObject.getColor(null).setColor(new ObjectColor()); mageObject.getColor(null).setColor(new ObjectColor());
mageObject.setName(""); mageObject.setName("");

View file

@ -61,6 +61,8 @@ public class PermanentCard extends PermanentImpl {
} }
private void init(Card card, Game game) { private void init(Card card, Game game) {
power = card.getPower().copy();
toughness = card.getToughness().copy();
copyFromCard(card); copyFromCard(card);
// if temporary added abilities to the spell/card exist, you need to add it to the permanent derived from that card // if temporary added abilities to the spell/card exist, you need to add it to the permanent derived from that card
Abilities<Ability> otherAbilities = game.getState().getAllOtherAbilities(card.getId()); Abilities<Ability> otherAbilities = game.getState().getAllOtherAbilities(card.getId());
@ -94,6 +96,8 @@ public class PermanentCard extends PermanentImpl {
// when the permanent is reset, copy all original values from the card // when the permanent is reset, copy all original values from the card
// must copy card each reset so that the original values don't get modified // must copy card each reset so that the original values don't get modified
copyFromCard(card); copyFromCard(card);
power.resetToBaseValue();
toughness.resetToBaseValue();
super.reset(game); super.reset(game);
} }
@ -115,8 +119,6 @@ public class PermanentCard extends PermanentImpl {
this.cardType.addAll(card.getCardType()); this.cardType.addAll(card.getCardType());
this.color = card.getColor(null).copy(); this.color = card.getColor(null).copy();
this.manaCost = card.getManaCost().copy(); this.manaCost = card.getManaCost().copy();
this.power = card.getPower().copy();
this.toughness = card.getToughness().copy();
if (card instanceof PermanentCard) { if (card instanceof PermanentCard) {
this.maxLevelCounters = ((PermanentCard) card).maxLevelCounters; this.maxLevelCounters = ((PermanentCard) card).maxLevelCounters;
} }
@ -232,6 +234,8 @@ public class PermanentCard extends PermanentImpl {
@Override @Override
public boolean turnFaceUp(Game game, UUID playerId) { public boolean turnFaceUp(Game game, UUID playerId) {
if (super.turnFaceUp(game, playerId)) { if (super.turnFaceUp(game, playerId)) {
power.modifyBaseValue(power.getBaseValue());
toughness.modifyBaseValue(toughness.getBaseValue());
setManifested(false); setManifested(false);
setMorphed(false); setMorphed(false);
return true; return true;
@ -241,7 +245,7 @@ public class PermanentCard extends PermanentImpl {
@Override @Override
public void adjustTargets(Ability ability, Game game) { public void adjustTargets(Ability ability, Game game) {
if (this.isTransformed()) { if (this.isTransformed() && card.getSecondCardFace() != null) {
card.getSecondCardFace().adjustTargets(ability, game); card.getSecondCardFace().adjustTargets(ability, game);
} else { } else {
card.adjustTargets(ability, game); card.adjustTargets(ability, game);
@ -250,7 +254,7 @@ public class PermanentCard extends PermanentImpl {
@Override @Override
public void adjustCosts(Ability ability, Game game) { public void adjustCosts(Ability ability, Game game) {
if (this.isTransformed()) { if (this.isTransformed() && card.getSecondCardFace() != null) {
card.getSecondCardFace().adjustCosts(ability, game); card.getSecondCardFace().adjustCosts(ability, game);
} else { } else {
card.adjustCosts(ability, game); card.adjustCosts(ability, game);

View file

@ -82,8 +82,8 @@ public class PermanentToken extends PermanentImpl {
} }
this.cardType = token.getCardType(); this.cardType = token.getCardType();
this.color = token.getColor(game).copy(); this.color = token.getColor(game).copy();
this.power.initValue(token.getPower().getValue()); this.power.modifyBaseValue(token.getPower().getBaseValueModified());
this.toughness.initValue(token.getToughness().getValue()); this.toughness.modifyBaseValue(token.getToughness().getBaseValueModified());
this.supertype = token.getSupertype(); this.supertype = token.getSupertype();
this.subtype = token.getSubtype(); this.subtype = token.getSubtype();
} }

View file

@ -81,11 +81,11 @@ public class Token extends MageObjectImpl {
this.name = name; this.name = name;
this.description = description; this.description = description;
} }
public Token(String name, String description, int power, int toughness) { public Token(String name, String description, int power, int toughness) {
this(name, description); this(name, description);
this.power.setValue(power); this.power.modifyBaseValue(power);
this.toughness.setValue(toughness); this.toughness.modifyBaseValue(toughness);
} }
public Token(String name, String description, ObjectColor color, List<String> subtype, int power, int toughness, Abilities<Ability> abilities) { public Token(String name, String description, ObjectColor color, List<String> subtype, int power, int toughness, Abilities<Ability> abilities) {
@ -93,8 +93,8 @@ public class Token extends MageObjectImpl {
this.cardType.add(CardType.CREATURE); this.cardType.add(CardType.CREATURE);
this.color = color.copy(); this.color = color.copy();
this.subtype = subtype; this.subtype = subtype;
this.power.setValue(power); this.power.modifyBaseValue(power);
this.toughness.setValue(toughness); this.toughness.modifyBaseValue(toughness);
if (abilities != null) { if (abilities != null) {
this.abilities = abilities.copy(); this.abilities = abilities.copy();
} }
@ -217,11 +217,11 @@ public class Token extends MageObjectImpl {
} }
return false; return false;
} }
public void setPower(int power) { public void setPower(int power) {
this.power.setValue(power); this.power.setValue(power);
} }
public void setToughness(int toughness) { public void setToughness(int toughness) {
this.toughness.setValue(toughness); this.toughness.setValue(toughness);
} }
@ -264,17 +264,13 @@ public class Token extends MageObjectImpl {
if (availableImageSetCodes.size() > 0) { if (availableImageSetCodes.size() > 0) {
if (availableImageSetCodes.contains(code)) { if (availableImageSetCodes.contains(code)) {
setOriginalExpansionSetCode(code); setOriginalExpansionSetCode(code);
} else { } else // we should not set random set if appropriate set is already used
// we should not set random set if appropriate set is already used if (getOriginalExpansionSetCode() == null || getOriginalExpansionSetCode().isEmpty()
if (getOriginalExpansionSetCode() == null || getOriginalExpansionSetCode().isEmpty() || !availableImageSetCodes.contains(getOriginalExpansionSetCode())) {
|| !availableImageSetCodes.contains(getOriginalExpansionSetCode())) { setOriginalExpansionSetCode(availableImageSetCodes.get(new Random().nextInt(availableImageSetCodes.size())));
setOriginalExpansionSetCode(availableImageSetCodes.get(new Random().nextInt(availableImageSetCodes.size())));
}
}
} else {
if (getOriginalExpansionSetCode() == null || getOriginalExpansionSetCode().isEmpty()) {
setOriginalExpansionSetCode(code);
} }
} else if (getOriginalExpansionSetCode() == null || getOriginalExpansionSetCode().isEmpty()) {
setOriginalExpansionSetCode(code);
} }
} }

View file

@ -108,9 +108,9 @@ public class CopyTokenFunction implements Function<Token, Card> {
ability.setSourceId(target.getId()); ability.setSourceId(target.getId());
target.addAbility(ability); target.addAbility(ability);
} }
// Needed to do it this way because only the cardValue does not include the increased value from cards like "Intangible Virtue" will be copied.
target.getPower().initValue(Integer.parseInt(sourceObj.getPower().toString())); target.getPower().modifyBaseValue(sourceObj.getPower().getBaseValueModified());
target.getToughness().initValue(Integer.parseInt(sourceObj.getToughness().toString())); target.getToughness().modifyBaseValue(sourceObj.getToughness().getBaseValueModified());
return target; return target;
} }