Merge pull request #11031 from xenohedron/cleanup-7a-7b

More SetBasePowerToughnessSourceEffect cleanup
This commit is contained in:
xenohedron 2023-08-31 00:29:59 -04:00 committed by GitHub
commit d6c690601d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 657 additions and 256 deletions

View file

@ -83,8 +83,7 @@ class AmplifireEffect extends OneShotEffect {
SetBasePowerToughnessSourceEffect setBasePowerToughnessSourceEffect = new SetBasePowerToughnessSourceEffect( SetBasePowerToughnessSourceEffect setBasePowerToughnessSourceEffect = new SetBasePowerToughnessSourceEffect(
2*lastCard.getPower().getValue(), 2*lastCard.getPower().getValue(),
2*lastCard.getToughness().getValue(), 2*lastCard.getToughness().getValue(),
Duration.UntilYourNextTurn, Duration.UntilYourNextTurn
SubLayer.SetPT_7b
); );
game.addEffect(setBasePowerToughnessSourceEffect, source); game.addEffect(setBasePowerToughnessSourceEffect, source);
} }

View file

@ -124,7 +124,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl {
toughness = 5; toughness = 5;
break; break;
} }
game.addEffect(new SetBasePowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield, SubLayer.CharacteristicDefining_7a), source); game.addEffect(new SetBasePowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield), source);
return false; return false;
} }

View file

@ -4,9 +4,8 @@ import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetBasePowerSourceEffect;
import mage.abilities.keyword.BoastAbility; import mage.abilities.keyword.BoastAbility;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -88,7 +87,7 @@ class ArniBrokenbrowEffect extends OneShotEffect {
if (controller.chooseUse(outcome, "Change base power of " + mageObject.getLogName() + " to " if (controller.chooseUse(outcome, "Change base power of " + mageObject.getLogName() + " to "
+ power + " until end of turn?", source, game + power + " until end of turn?", source, game
)) { )) {
game.addEffect(new SetBasePowerToughnessSourceEffect(StaticValue.get(power), null, Duration.EndOfTurn, SubLayer.SetPT_7b), source); game.addEffect(new SetBasePowerSourceEffect(power, Duration.EndOfTurn), source);
return true; return true;
} }
return false; return false;

View file

@ -39,8 +39,7 @@ public final class AscendantSpirit extends CardImpl {
ability.addEffect(new SetBasePowerToughnessSourceEffect( ability.addEffect(new SetBasePowerToughnessSourceEffect(
2, 2,
3, 3,
Duration.WhileOnBattlefield, Duration.Custom
SubLayer.SetPT_7b
).setText("with base power and toughness 2/3")); ).setText("with base power and toughness 2/3"));
this.addAbility(ability); this.addAbility(ability);
@ -93,7 +92,7 @@ class AscendantSpiritWarriorEffect extends OneShotEffect {
Duration.Custom, SubType.SPIRIT, SubType.WARRIOR, SubType.ANGEL Duration.Custom, SubType.SPIRIT, SubType.WARRIOR, SubType.ANGEL
), source); ), source);
game.addEffect(new SetBasePowerToughnessSourceEffect( game.addEffect(new SetBasePowerToughnessSourceEffect(
4, 4, Duration.Custom, SubLayer.SetPT_7b 4, 4, Duration.Custom
), source); ), source);
return true; return true;
} }

View file

@ -12,7 +12,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubLayer;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.FilterSpell; import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
@ -41,7 +40,7 @@ public final class BattlegateMimic extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Whenever you cast a spell that's both red and white, Battlegate Mimic has base power and toughness 4/2 and gains first strike until end of turn. // Whenever you cast a spell that's both red and white, Battlegate Mimic has base power and toughness 4/2 and gains first strike until end of turn.
SetBasePowerToughnessSourceEffect baseToughnessSourceEffect = new SetBasePowerToughnessSourceEffect(4, 2, Duration.EndOfTurn, SubLayer.SetPT_7b); SetBasePowerToughnessSourceEffect baseToughnessSourceEffect = new SetBasePowerToughnessSourceEffect(4, 2, Duration.EndOfTurn);
Ability ability = SpellCastControllerTriggeredAbility.createWithRule(baseToughnessSourceEffect, filter, false, rule); Ability ability = SpellCastControllerTriggeredAbility.createWithRule(baseToughnessSourceEffect, filter, false, rule);
ability.addEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, false, true)); ability.addEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, false, true));
this.addAbility(ability); this.addAbility(ability);

View file

@ -33,9 +33,7 @@ public final class BramblefortFink extends CardImpl {
// {8}: Bramblefort Fink has base power and toughness 10/10 until end of turn. Activate this ability only if you control an Oko planeswalker. // {8}: Bramblefort Fink has base power and toughness 10/10 until end of turn. Activate this ability only if you control an Oko planeswalker.
this.addAbility(new ActivateIfConditionActivatedAbility( this.addAbility(new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD, Zone.BATTLEFIELD,
new SetBasePowerToughnessSourceEffect( new SetBasePowerToughnessSourceEffect(10, 10, Duration.EndOfTurn),
10, 10, Duration.EndOfTurn, SubLayer.SetPT_7b
).setText("{this} has base power and toughness 10/10 until end of turn"),
new GenericManaCost(8), new GenericManaCost(8),
condition)); condition));
} }

View file

@ -8,7 +8,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubLayer;
import mage.constants.SubType; import mage.constants.SubType;
import java.util.UUID; import java.util.UUID;
@ -28,7 +27,7 @@ public final class BrokersInitiate extends CardImpl {
// {4}{G/U}: Brokers Initiate has base power and toughness 5/5 until end of turn. // {4}{G/U}: Brokers Initiate has base power and toughness 5/5 until end of turn.
this.addAbility(new SimpleActivatedAbility( this.addAbility(new SimpleActivatedAbility(
new SetBasePowerToughnessSourceEffect(5, 5, Duration.EndOfTurn, SubLayer.SetPT_7b), new SetBasePowerToughnessSourceEffect(5, 5, Duration.EndOfTurn),
new ManaCostsImpl<>("{4}{G/U}") new ManaCostsImpl<>("{4}{G/U}")
)); ));
} }

View file

@ -34,7 +34,7 @@ public final class ChimericMass extends CardImpl {
new CreatureToken(0, 0, "Construct artifact creature with \"This creature's power and toughness are each equal to the number of charge counters on it.\"") new CreatureToken(0, 0, "Construct artifact creature with \"This creature's power and toughness are each equal to the number of charge counters on it.\"")
.withType(CardType.ARTIFACT) .withType(CardType.ARTIFACT)
.withSubType(SubType.CONSTRUCT) .withSubType(SubType.CONSTRUCT)
.withAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetBasePowerToughnessSourceEffect(count, count, Duration.WhileOnBattlefield, SubLayer.SetPT_7b))), .withAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetBasePowerToughnessSourceEffect(count, Duration.WhileOnBattlefield))),
CardType.ARTIFACT, Duration.EndOfTurn).withDurationRuleAtStart(true), new GenericManaCost(1))); CardType.ARTIFACT, Duration.EndOfTurn).withDurationRuleAtStart(true), new GenericManaCost(1)));
} }

View file

@ -3,15 +3,16 @@ package mage.cards.c;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility; import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.AdditiveDynamicValue;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount; import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetBasePowerToughnessPlusOneSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.permanent.token.ConsumingBlobOozeToken; import mage.game.permanent.token.ConsumingBlobOozeToken;
import java.util.UUID; import java.util.UUID;
@ -22,7 +23,6 @@ import java.util.UUID;
public final class ConsumingBlob extends CardImpl { public final class ConsumingBlob extends CardImpl {
private static final DynamicValue powerValue = CardTypesInGraveyardCount.YOU; private static final DynamicValue powerValue = CardTypesInGraveyardCount.YOU;
private static final DynamicValue toughnessValue = new AdditiveDynamicValue(powerValue, StaticValue.get(1));
public ConsumingBlob(UUID ownerId, CardSetInfo setInfo) { public ConsumingBlob(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
@ -32,11 +32,7 @@ public final class ConsumingBlob extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Consuming Blob's power is equal to the number of card types among cards in your graveyard and its toughness is equal to that number plus 1. // Consuming Blob's power is equal to the number of card types among cards in your graveyard and its toughness is equal to that number plus 1.
this.addAbility(new SimpleStaticAbility( this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessPlusOneSourceEffect(powerValue)));
Zone.ALL,
new SetBasePowerToughnessSourceEffect(powerValue, toughnessValue, Duration.EndOfGame, SubLayer.CharacteristicDefining_7a)
.setText("{this}'s power is equal to the number of creature cards in all graveyards and its toughness is equal to that number plus 1")
));
// At the beginning of your end step, create a green Ooze creature token with "This creature's power is equal to the number of card types among cards in your graveyard and its toughness is equal to that number plus 1". // At the beginning of your end step, create a green Ooze creature token with "This creature's power is equal to the number of card types among cards in your graveyard and its toughness is equal to that number plus 1".
this.addAbility(new BeginningOfEndStepTriggeredAbility( this.addAbility(new BeginningOfEndStepTriggeredAbility(

View file

@ -8,9 +8,8 @@ import mage.abilities.condition.common.FormidableCondition;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetBasePowerSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
@ -41,8 +40,7 @@ public final class CraterElemental extends CardImpl {
// <i>Formidable</i> &mdash; {2}{R}: Crater Elemental has base power 8 until end of turn. Activate this ability only if creatures you control have total power 8 or greater. // <i>Formidable</i> &mdash; {2}{R}: Crater Elemental has base power 8 until end of turn. Activate this ability only if creatures you control have total power 8 or greater.
ability = new ActivateIfConditionActivatedAbility( ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD, Zone.BATTLEFIELD,
new SetBasePowerToughnessSourceEffect(StaticValue.get(8), null, Duration.EndOfTurn, SubLayer.SetPT_7b) new SetBasePowerSourceEffect(8, Duration.EndOfTurn),
.setText("{this} has base power 8 until end of turn"),
new ManaCostsImpl<>("{2}{R}"), new ManaCostsImpl<>("{2}{R}"),
FormidableCondition.instance FormidableCondition.instance
); );

View file

@ -103,7 +103,7 @@ enum DonalHeraldOfWingsApplier implements StackObjectCopyApplier {
copiedSpell.addSubType(SubType.SPIRIT); copiedSpell.addSubType(SubType.SPIRIT);
copiedSpell.getPower().setModifiedBaseValue(1); copiedSpell.getPower().setModifiedBaseValue(1);
copiedSpell.getToughness().setModifiedBaseValue(1); copiedSpell.getToughness().setModifiedBaseValue(1);
Ability ability = new SimpleStaticAbility(new SetBasePowerToughnessSourceEffect(1,1, Duration.Custom, SubLayer.SetPT_7b)); Ability ability = new SimpleStaticAbility(new SetBasePowerToughnessSourceEffect(1,1, Duration.Custom));
ability.setRuleVisible(false); ability.setRuleVisible(false);
copiedSpell.getAbilities().add(ability); copiedSpell.getAbilities().add(ability);
} }

View file

@ -117,7 +117,7 @@ class DracoplasmEffect extends ReplacementEffectImpl {
toughness = CardUtil.overflowInc(toughness, targetCreature.getToughness().getValue()); toughness = CardUtil.overflowInc(toughness, targetCreature.getToughness().getValue());
} }
} }
ContinuousEffect effect = new SetBasePowerToughnessSourceEffect(power, toughness, Duration.Custom, SubLayer.SetPT_7b); ContinuousEffect effect = new SetBasePowerToughnessSourceEffect(power, toughness, Duration.Custom);
game.addEffect(effect, source); game.addEffect(effect, source);
return false; return false;
} }

View file

@ -78,7 +78,7 @@ class DruidClassToken extends TokenImpl {
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
this.addAbility(new SimpleStaticAbility(new SetBasePowerToughnessSourceEffect( this.addAbility(new SimpleStaticAbility(new SetBasePowerToughnessSourceEffect(
LandsYouControlCount.instance, LandsYouControlCount.instance, Duration.EndOfGame, SubLayer.SetPT_7b LandsYouControlCount.instance, Duration.EndOfGame
).setText("this creature's power and toughness are each equal to the number of lands you control"))); ).setText("this creature's power and toughness are each equal to the number of lands you control")));
} }

View file

@ -65,7 +65,7 @@ class ElvishImpersonatorsEffect extends OneShotEffect {
List<Integer> results = controller.rollDice(outcome, source, game, 6, 2, 0); List<Integer> results = controller.rollDice(outcome, source, game, 6, 2, 0);
int firstRoll = results.get(0); int firstRoll = results.get(0);
int secondRoll = results.get(1); int secondRoll = results.get(1);
game.addEffect(new SetBasePowerToughnessSourceEffect(firstRoll, secondRoll, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source); game.addEffect(new SetBasePowerToughnessSourceEffect(firstRoll, secondRoll, Duration.Custom), source);
return true; return true;
} }
} }

View file

@ -1,4 +1,3 @@
package mage.cards.e; package mage.cards.e;
import mage.MageInt; import mage.MageInt;
@ -42,9 +41,7 @@ public final class EntropicSpecter extends CardImpl {
// Entropic Specter's power and toughness are each equal to the number of cards in the chosen player's hand. // Entropic Specter's power and toughness are each equal to the number of cards in the chosen player's hand.
this.addAbility(new SimpleStaticAbility(Zone.ALL, this.addAbility(new SimpleStaticAbility(Zone.ALL,
// back to the graveyard or if the chosen player left the game it's again a 0/0 // back to the graveyard or if the chosen player left the game it's again a 0/0
new SetBasePowerToughnessSourceEffect(CardsInTargetPlayerHandCount.instance, CardsInTargetPlayerHandCount.instance, new SetBasePowerToughnessSourceEffect(CardsInTargetPlayerHandCount.instance, Duration.WhileOnBattlefield)));
Duration.WhileOnBattlefield, SubLayer.SetPT_7b)
.setText("{this}'s power and toughness are each equal to the number of cards in the chosen player's hand")));
// Whenever Entropic Specter deals damage to a player, that player discards a card. // Whenever Entropic Specter deals damage to a player, that player discards a card.
this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new DiscardTargetEffect(1, false), false, true)); this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new DiscardTargetEffect(1, false), false, true));

View file

@ -34,7 +34,7 @@ public final class EvolvedSleeper extends CardImpl {
Duration.Custom, SubType.HUMAN, SubType.CLERIC Duration.Custom, SubType.HUMAN, SubType.CLERIC
).setText("{this} becomes a Human Cleric"), new ManaCostsImpl<>("{B}")); ).setText("{this} becomes a Human Cleric"), new ManaCostsImpl<>("{B}"));
ability.addEffect(new SetBasePowerToughnessSourceEffect( ability.addEffect(new SetBasePowerToughnessSourceEffect(
2, 2, Duration.Custom, SubLayer.SetPT_7b 2, 2, Duration.Custom
).setText("with base power and toughness 2/2")); ).setText("with base power and toughness 2/2"));
this.addAbility(ability); this.addAbility(ability);
@ -87,7 +87,7 @@ class EvolvedSleeperClericEffect extends OneShotEffect {
Duration.Custom, SubType.PHYREXIAN, SubType.HUMAN, SubType.CLERIC Duration.Custom, SubType.PHYREXIAN, SubType.HUMAN, SubType.CLERIC
), source); ), source);
game.addEffect(new SetBasePowerToughnessSourceEffect( game.addEffect(new SetBasePowerToughnessSourceEffect(
3, 3, Duration.Custom, SubLayer.SetPT_7b 3, 3, Duration.Custom
), source); ), source);
return true; return true;
} }

View file

@ -1,28 +1,22 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetBasePowerSourceEffect;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.abilities.keyword.LifelinkAbility; import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
* *
* @author TheElk801 * @author TheElk801
@ -88,7 +82,7 @@ class EvraHalcyonWitnessEffect extends OneShotEffect {
// For example, say Evra is enchanted with Dub (which makes it 6/6) and your life total is 7. // For example, say Evra is enchanted with Dub (which makes it 6/6) and your life total is 7.
// After the exchange, Evra would be a 9/6 creature (its power became 7, which was then modified by Dub) and your life total would be 6. // After the exchange, Evra would be a 9/6 creature (its power became 7, which was then modified by Dub) and your life total would be 6.
// (2018-04-27) // (2018-04-27)
game.addEffect(new SetBasePowerToughnessSourceEffect(StaticValue.get(life), null, Duration.Custom, SubLayer.SetPT_7b), source); game.addEffect(new SetBasePowerSourceEffect(life, Duration.Custom), source);
return true; return true;
} }
} }

View file

@ -35,7 +35,7 @@ public final class FigureOfDestiny extends CardImpl {
Duration.Custom, SubType.KITHKIN, SubType.SPIRIT Duration.Custom, SubType.KITHKIN, SubType.SPIRIT
).setText("{this} becomes a Kithkin Spirit"), new ManaCostsImpl<>("{R/W}")); ).setText("{this} becomes a Kithkin Spirit"), new ManaCostsImpl<>("{R/W}"));
ability.addEffect(new SetBasePowerToughnessSourceEffect( ability.addEffect(new SetBasePowerToughnessSourceEffect(
2, 2, Duration.Custom, SubLayer.SetPT_7b 2, 2, Duration.Custom
).setText("with base power and toughness 2/2")); ).setText("with base power and toughness 2/2"));
this.addAbility(ability); this.addAbility(ability);
@ -86,7 +86,7 @@ class FigureOfDestinySpiritEffect extends OneShotEffect {
Duration.Custom, SubType.KITHKIN, SubType.SPIRIT, SubType.WARRIOR Duration.Custom, SubType.KITHKIN, SubType.SPIRIT, SubType.WARRIOR
), source); ), source);
game.addEffect(new SetBasePowerToughnessSourceEffect( game.addEffect(new SetBasePowerToughnessSourceEffect(
4, 4, Duration.Custom, SubLayer.SetPT_7b 4, 4, Duration.Custom
), source); ), source);
return true; return true;
} }
@ -119,7 +119,7 @@ class FigureOfDestinyWarriorEffect extends OneShotEffect {
Duration.Custom, SubType.KITHKIN, SubType.SPIRIT, SubType.WARRIOR, SubType.AVATAR Duration.Custom, SubType.KITHKIN, SubType.SPIRIT, SubType.WARRIOR, SubType.AVATAR
), source); ), source);
game.addEffect(new SetBasePowerToughnessSourceEffect( game.addEffect(new SetBasePowerToughnessSourceEffect(
8, 8, Duration.Custom, SubLayer.SetPT_7b 8, 8, Duration.Custom
), source); ), source);
game.addEffect(new GainAbilitySourceEffect( game.addEffect(new GainAbilitySourceEffect(
FlyingAbility.getInstance(), Duration.Custom FlyingAbility.getInstance(), Duration.Custom

View file

@ -44,7 +44,7 @@ public final class FrodoSauronsBane extends CardImpl {
this.addAbility(new SimpleActivatedAbility( this.addAbility(new SimpleActivatedAbility(
new ConditionalOneShotEffect(new AddContinuousEffectToGame( new ConditionalOneShotEffect(new AddContinuousEffectToGame(
new AddCardSubTypeSourceEffect(Duration.Custom, SubType.HALFLING, SubType.SCOUT), new AddCardSubTypeSourceEffect(Duration.Custom, SubType.HALFLING, SubType.SCOUT),
new SetBasePowerToughnessSourceEffect(2, 3, Duration.Custom, SubLayer.SetPT_7b), new SetBasePowerToughnessSourceEffect(2, 3, Duration.Custom),
new GainAbilitySourceEffect(LifelinkAbility.getInstance(), Duration.Custom) new GainAbilitySourceEffect(LifelinkAbility.getInstance(), Duration.Custom)
), condition1, "if {this} is a Citizen, it becomes a Halfling Scout with base power and toughness 2/3 and lifelink"), ), condition1, "if {this} is a Citizen, it becomes a Halfling Scout with base power and toughness 2/3 and lifelink"),
new ManaCostsImpl<>("{W/B}{W/B}") new ManaCostsImpl<>("{W/B}{W/B}")

View file

@ -71,7 +71,7 @@ class GigantiformAbility extends StaticAbility {
super(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.AURA)); super(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.AURA));
Ability ability = new SimpleStaticAbility( Ability ability = new SimpleStaticAbility(
Zone.BATTLEFIELD, Zone.BATTLEFIELD,
new SetBasePowerToughnessSourceEffect(8, 8, Duration.WhileOnBattlefield, SubLayer.SetPT_7b) new SetBasePowerToughnessSourceEffect(8, 8, Duration.WhileOnBattlefield)
); );
this.addEffect(new GainAbilityAttachedEffect(ability, AttachmentType.AURA)); this.addEffect(new GainAbilityAttachedEffect(ability, AttachmentType.AURA));
} }

View file

@ -1,4 +1,3 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
@ -8,7 +7,6 @@ import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CopyPermanentEffect; import mage.abilities.effects.common.CopyPermanentEffect;
@ -18,7 +16,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubLayer;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
@ -56,8 +53,7 @@ class GigantoplasmCopyApplier extends CopyApplier {
@Override @Override
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) { public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
DynamicValue variableMana = ManacostVariableValue.REGULAR; Effect effect = new SetBasePowerToughnessSourceEffect(ManacostVariableValue.REGULAR, Duration.Custom);
Effect effect = new SetBasePowerToughnessSourceEffect(variableMana, variableMana, Duration.WhileOnBattlefield, SubLayer.SetPT_7b);
effect.setText("This creature has base power and toughness X/X"); effect.setText("This creature has base power and toughness X/X");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{X}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{X}"));
blueprint.getAbilities().add(ability); blueprint.getAbilities().add(ability);

View file

@ -81,8 +81,8 @@ class HalfdaneUpkeepEffect extends OneShotEffect {
ContinuousEffect effect = new SetBasePowerToughnessSourceEffect( ContinuousEffect effect = new SetBasePowerToughnessSourceEffect(
permanent.getPower().getValue(), permanent.getPower().getValue(),
permanent.getToughness().getValue(), permanent.getToughness().getValue(),
Duration.UntilYourNextUpkeepStep, Duration.UntilYourNextUpkeepStep
SubLayer.SetPT_7b); );
game.addEffect(effect, source); game.addEffect(effect, source);
return true; return true;
} }

View file

@ -1,30 +1,26 @@
package mage.cards.l; package mage.cards.l;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.AdditiveDynamicValue;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardsInAllGraveyardsCount; import mage.abilities.dynamicvalue.common.CardsInAllGraveyardsCount;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.common.continuous.SetBasePowerToughnessPlusOneSourceEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubLayer;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import java.util.UUID;
/** /**
* *
* @author Plopman * @author Plopman
*/ */
public final class Lhurgoyf extends CardImpl { public final class Lhurgoyf extends CardImpl {
private static final DynamicValue powerValue = new CardsInAllGraveyardsCount(StaticFilters.FILTER_CARD_CREATURE); private static final DynamicValue powerValue = new CardsInAllGraveyardsCount(StaticFilters.FILTER_CARD_CREATURES);
private static final DynamicValue toughnessValue = new AdditiveDynamicValue(powerValue, StaticValue.get(1));
public Lhurgoyf(UUID ownerId, CardSetInfo setInfo) { public Lhurgoyf(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}");
@ -34,11 +30,7 @@ public final class Lhurgoyf extends CardImpl {
this.toughness = new MageInt(0); this.toughness = new MageInt(0);
// Lhurgoyf's power is equal to the number of creature cards in all graveyards and its toughness is equal to that number plus 1. // Lhurgoyf's power is equal to the number of creature cards in all graveyards and its toughness is equal to that number plus 1.
this.addAbility(new SimpleStaticAbility( this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessPlusOneSourceEffect(powerValue)));
Zone.ALL,
new SetBasePowerToughnessSourceEffect(powerValue, toughnessValue, Duration.EndOfGame, SubLayer.CharacteristicDefining_7a)
.setText("{this}'s power is equal to the number of creature cards in all graveyards and its toughness is equal to that number plus 1")
));
} }
private Lhurgoyf(final Lhurgoyf card) { private Lhurgoyf(final Lhurgoyf card) {

View file

@ -44,7 +44,7 @@ public final class MarshFlitter extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new GoblinRogueToken(), 2), false)); this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new GoblinRogueToken(), 2), false));
// Sacrifice a Goblin: Marsh Flitter has base power and toughness 3/3 until end of turn. // Sacrifice a Goblin: Marsh Flitter has base power and toughness 3/3 until end of turn.
Effect effect = new SetBasePowerToughnessSourceEffect(3, 3, Duration.EndOfTurn, SubLayer.SetPT_7b); Effect effect = new SetBasePowerToughnessSourceEffect(3, 3, Duration.EndOfTurn);
effect.setText("{this} has base power and toughness 3/3 until end of turn"); effect.setText("{this} has base power and toughness 3/3 until end of turn");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new SacrificeTargetCost(new TargetControlledPermanent(filter))); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new SacrificeTargetCost(new TargetControlledPermanent(filter)));
this.addAbility(ability); this.addAbility(ability);

View file

@ -79,7 +79,7 @@ class MasterOfWindsEffect extends OneShotEffect {
null, "4/1", "1/4", source, game null, "4/1", "1/4", source, game
) ? 4 : 1; ) ? 4 : 1;
game.addEffect(new SetBasePowerToughnessSourceEffect( game.addEffect(new SetBasePowerToughnessSourceEffect(
power, 5 - power, Duration.EndOfTurn, SubLayer.SetPT_7b power, 5 - power, Duration.EndOfTurn
), source); ), source);
return true; return true;
} }

View file

@ -35,7 +35,7 @@ public final class MinionOfTheWastes extends CardImpl {
// Trample // Trample
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// As Minion of the Wastes enters the battlefield, pay any amount of life. The amount you pay can't be more than the total number of white nontoken permanents your opponents control plus the total number of white cards in their graveyards. // As Minion of the Wastes enters the battlefield, pay any amount of life.
this.addAbility(new AsEntersBattlefieldAbility(new MinionOfTheWastesEffect())); this.addAbility(new AsEntersBattlefieldAbility(new MinionOfTheWastesEffect()));
// Minion of the Wastes's power and toughness are each equal to the life paid as it entered the battlefield. // Minion of the Wastes's power and toughness are each equal to the life paid as it entered the battlefield.
@ -84,7 +84,7 @@ class MinionOfTheWastesEffect extends OneShotEffect {
game.informPlayers((sourceCard != null ? sourceCard.getLogName() : "") + ": " + controller.getLogName() + game.informPlayers((sourceCard != null ? sourceCard.getLogName() : "") + ": " + controller.getLogName() +
" pays " + payAmount + " life"); " pays " + payAmount + " life");
game.addEffect(new SetBasePowerToughnessSourceEffect( game.addEffect(new SetBasePowerToughnessSourceEffect(
payAmount, payAmount, Duration.Custom, SubLayer.CharacteristicDefining_7a payAmount, payAmount, Duration.Custom
), source); ), source);
permanent.addInfo("life paid", CardUtil.addToolTipMarkTags("Life paid: " + payAmount), game); permanent.addInfo("life paid", CardUtil.addToolTipMarkTags("Life paid: " + payAmount), game);
return true; return true;

View file

@ -79,7 +79,7 @@ class MoltenSentryEffect extends OneShotEffect {
toughness = 5; toughness = 5;
gainedAbility = DefenderAbility.getInstance(); gainedAbility = DefenderAbility.getInstance();
} }
game.addEffect(new SetBasePowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield, SubLayer.CharacteristicDefining_7a), source); game.addEffect(new SetBasePowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield), source);
game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield), source); game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield), source);
return true; return true;
} }

View file

@ -40,7 +40,8 @@ public final class MythRealized extends CardImpl {
// {W}: Until end of turn, Myth Realized becomes a Monk Avatar creature in addition to its other types and gains "This creature's power and toughness are each equal to the number of lore counters on it." // {W}: Until end of turn, Myth Realized becomes a Monk Avatar creature in addition to its other types and gains "This creature's power and toughness are each equal to the number of lore counters on it."
Effect effect = new BecomesCreatureSourceEffect(new MythRealizedToken(), CardType.ENCHANTMENT, Duration.EndOfTurn).withDurationRuleAtStart(true); Effect effect = new BecomesCreatureSourceEffect(new MythRealizedToken(), CardType.ENCHANTMENT, Duration.EndOfTurn).withDurationRuleAtStart(true);
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{W}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{W}"));
ability.addEffect(new SetBasePowerToughnessSourceEffect(loreCounterCount, loreCounterCount, Duration.EndOfTurn, SubLayer.SetPT_7b).setText("and gains \"This creature's power and toughness are each equal to the number of lore counters on it.\"")); ability.addEffect(new SetBasePowerToughnessSourceEffect(loreCounterCount, Duration.EndOfTurn)
.setText("and gains \"This creature's power and toughness are each equal to the number of lore counters on it.\""));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -108,7 +108,7 @@ class NamelessRaceEffect extends OneShotEffect {
game.informPlayers((sourceCard != null ? sourceCard.getLogName() : "") + ": " + controller.getLogName() + game.informPlayers((sourceCard != null ? sourceCard.getLogName() : "") + ": " + controller.getLogName() +
" pays " + payAmount + " life"); " pays " + payAmount + " life");
game.addEffect(new SetBasePowerToughnessSourceEffect( game.addEffect(new SetBasePowerToughnessSourceEffect(
payAmount, payAmount, Duration.Custom, SubLayer.CharacteristicDefining_7a payAmount, payAmount, Duration.Custom
), source); ), source);
permanent.addInfo("life paid", CardUtil.addToolTipMarkTags("Life paid: " + payAmount), game); permanent.addInfo("life paid", CardUtil.addToolTipMarkTags("Life paid: " + payAmount), game);
return true; return true;

View file

@ -12,7 +12,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubLayer;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.FilterSpell; import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
@ -44,7 +43,7 @@ public final class NightskyMimic extends CardImpl {
// Whenever you cast a spell that's both white and black, Nightsky Mimic has base power and toughness 4/4 until end of turn and gains flying until end of turn. // Whenever you cast a spell that's both white and black, Nightsky Mimic has base power and toughness 4/4 until end of turn and gains flying until end of turn.
Ability ability = SpellCastControllerTriggeredAbility.createWithRule( Ability ability = SpellCastControllerTriggeredAbility.createWithRule(
new SetBasePowerToughnessSourceEffect(4, 4, Duration.EndOfTurn, SubLayer.SetPT_7b), new SetBasePowerToughnessSourceEffect(4, 4, Duration.EndOfTurn),
filter, false, rule filter, false, rule
); );
ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn, false, true)); ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn, false, true));

View file

@ -114,7 +114,7 @@ public final class PrimalClay extends CardImpl {
game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source); game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source);
break; break;
} }
game.addEffect(new SetBasePowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield, SubLayer.CharacteristicDefining_7a), source); game.addEffect(new SetBasePowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield), source);
return false; return false;
} }

View file

@ -113,7 +113,7 @@ public final class PrimalPlasma extends CardImpl {
game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source); game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source);
break; break;
} }
game.addEffect(new SetBasePowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield, SubLayer.CharacteristicDefining_7a), source); game.addEffect(new SetBasePowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield), source);
} }
return false; return false;

View file

@ -1,25 +1,23 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetBasePowerSourceEffect;
import mage.constants.SubType;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubLayer; import mage.constants.SubType;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
* *
* @author TheElk801 * @author TheElk801
@ -71,7 +69,7 @@ class RiptideManglerEffect extends OneShotEffect {
if (permanent == null) { if (permanent == null) {
return false; return false;
} }
game.addEffect(new SetBasePowerToughnessSourceEffect(StaticValue.get(permanent.getPower().getValue()), null, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source); game.addEffect(new SetBasePowerSourceEffect(permanent.getPower().getValue(), Duration.Custom), source);
return true; return true;
} }
} }

View file

@ -7,7 +7,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubLayer;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
@ -27,7 +26,7 @@ public final class RisenRiptide extends CardImpl {
// Whenever you cast a kicked spell, Risen Riptide has base power and toughness 5/5 until end of turn. // Whenever you cast a kicked spell, Risen Riptide has base power and toughness 5/5 until end of turn.
this.addAbility(new SpellCastControllerTriggeredAbility( this.addAbility(new SpellCastControllerTriggeredAbility(
new SetBasePowerToughnessSourceEffect(5, 5, Duration.EndOfTurn, SubLayer.SetPT_7b) new SetBasePowerToughnessSourceEffect(5, 5, Duration.EndOfTurn)
.setText("{this} has base power and toughness 5/5 until end of turn"), .setText("{this} has base power and toughness 5/5 until end of turn"),
StaticFilters.FILTER_SPELL_KICKED_A, StaticFilters.FILTER_SPELL_KICKED_A,
false) false)

View file

@ -12,7 +12,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubLayer;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.FilterSpell; import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
@ -44,7 +43,7 @@ public final class RiverfallMimic extends CardImpl {
// Whenever you cast a spell that's both blue and red, Riverfall Mimic has base power and toughness 3/3 until end of turn and can't be blocked this turn. // Whenever you cast a spell that's both blue and red, Riverfall Mimic has base power and toughness 3/3 until end of turn and can't be blocked this turn.
Ability ability = SpellCastControllerTriggeredAbility.createWithRule( Ability ability = SpellCastControllerTriggeredAbility.createWithRule(
new SetBasePowerToughnessSourceEffect(3, 3, Duration.EndOfTurn, SubLayer.SetPT_7b), new SetBasePowerToughnessSourceEffect(3, 3, Duration.EndOfTurn),
filter, false, rule filter, false, rule
); );
ability.addEffect(new GainAbilitySourceEffect(new CantBeBlockedSourceAbility(), Duration.EndOfTurn, false, true)); ability.addEffect(new GainAbilitySourceEffect(new CantBeBlockedSourceAbility(), Duration.EndOfTurn, false, true));

View file

@ -4,9 +4,8 @@ import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetBaseToughnessSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
@ -77,7 +76,7 @@ class SentinelEffect extends OneShotEffect {
Permanent targetPermanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); Permanent targetPermanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (controller != null && targetPermanent != null) { if (controller != null && targetPermanent != null) {
int newToughness = CardUtil.overflowInc(targetPermanent.getPower().getValue(), 1); int newToughness = CardUtil.overflowInc(targetPermanent.getPower().getValue(), 1);
game.addEffect(new SetBasePowerToughnessSourceEffect(null, StaticValue.get(newToughness), Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source); game.addEffect(new SetBaseToughnessSourceEffect(newToughness, Duration.Custom), source);
return true; return true;
} }
return false; return false;

View file

@ -14,7 +14,6 @@ import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -74,7 +73,7 @@ class ShapeStealerEffect extends OneShotEffect {
return false; return false;
} }
ContinuousEffect effect = new SetBasePowerToughnessSourceEffect(permanent.getPower().getValue(), permanent.getToughness().getValue(), Duration.EndOfTurn, SubLayer.SetPT_7b); ContinuousEffect effect = new SetBasePowerToughnessSourceEffect(permanent.getPower().getValue(), permanent.getToughness().getValue(), Duration.EndOfTurn);
game.addEffect(effect, source); game.addEffect(effect, source);
return true; return true;
} }

View file

@ -12,7 +12,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubLayer;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.FilterSpell; import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
@ -44,7 +43,7 @@ public final class ShorecrasherMimic extends CardImpl {
// Whenever you cast a spell that's both green and blue, Shorecrasher Mimic has base power and toughness 5/3 until end of turn and gains trample until end of turn. // Whenever you cast a spell that's both green and blue, Shorecrasher Mimic has base power and toughness 5/3 until end of turn and gains trample until end of turn.
Ability ability = SpellCastControllerTriggeredAbility.createWithRule( Ability ability = SpellCastControllerTriggeredAbility.createWithRule(
new SetBasePowerToughnessSourceEffect(5, 3, Duration.EndOfTurn, SubLayer.SetPT_7b), new SetBasePowerToughnessSourceEffect(5, 3, Duration.EndOfTurn),
filter, false, rule filter, false, rule
); );
ability.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, false, true)); ability.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, false, true));

View file

@ -54,7 +54,7 @@ public final class SurgeEngine extends CardImpl {
new ManaCostsImpl<>("{2}{U}"), SurgeEngineCondition.instance new ManaCostsImpl<>("{2}{U}"), SurgeEngineCondition.instance
); );
ability.addEffect(new SetBasePowerToughnessSourceEffect( ability.addEffect(new SetBasePowerToughnessSourceEffect(
5, 4, Duration.Custom, SubLayer.SetPT_7b 5, 4, Duration.Custom
).setText("and has base power and toughness 5/4")); ).setText("and has base power and toughness 5/4"));
this.addAbility(ability); this.addAbility(ability);

View file

@ -8,7 +8,7 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -27,13 +27,10 @@ import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
/** /**
* @author nantuko * @author nantuko, xenohedron
*/ */
public final class SuturedGhoul extends CardImpl { public final class SuturedGhoul extends CardImpl {
private static final String staticText = "exile any number of creature cards from your graveyard";
private static final String staticText2 = "Sutured Ghoul's power is equal to the total power of the exiled cards and its toughness is equal to their total toughness";
public SuturedGhoul(UUID ownerId, CardSetInfo setInfo) { public SuturedGhoul(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}{B}");
this.subtype.add(SubType.ZOMBIE); this.subtype.add(SubType.ZOMBIE);
@ -44,12 +41,12 @@ public final class SuturedGhoul extends CardImpl {
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// As Sutured Ghoul enters the battlefield, exile any number of creature cards from your graveyard. // As Sutured Ghoul enters the battlefield, exile any number of creature cards from your graveyard.
this.addAbility(new AsEntersBattlefieldAbility(new SuturedGhoulEffect(), staticText)); this.addAbility(new AsEntersBattlefieldAbility(new SuturedGhoulEffect()));
// Sutured Ghoul's power is equal to the total power of the exiled cards and its toughness is equal to their total toughness. // Sutured Ghoul's power is equal to the total power of the exiled cards and its toughness is equal to their total toughness.
BoostSourceEffect effect = new BoostSourceEffect(SuturedGhoulPowerCount.instance, SuturedGhoulToughnessCount.instance, Duration.WhileOnBattlefield); this.addAbility(new SimpleStaticAbility(new SetBasePowerToughnessSourceEffect(
effect.setText(staticText2); SuturedGhoulPowerCount.instance, SuturedGhoulToughnessCount.instance, Duration.WhileOnBattlefield,
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); "{this}'s power is equal to the total power of the exiled cards and its toughness is equal to their total toughness")));
} }
private SuturedGhoul(final SuturedGhoul card) { private SuturedGhoul(final SuturedGhoul card) {
@ -64,12 +61,12 @@ public final class SuturedGhoul extends CardImpl {
class SuturedGhoulEffect extends OneShotEffect { class SuturedGhoulEffect extends OneShotEffect {
public SuturedGhoulEffect() { SuturedGhoulEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = "exile any number of creature cards from your graveyard"; staticText = "exile any number of creature cards from your graveyard";
} }
public SuturedGhoulEffect(SuturedGhoulEffect effect) { private SuturedGhoulEffect(final SuturedGhoulEffect effect) {
super(effect); super(effect);
} }

View file

@ -55,7 +55,7 @@ class SvogthosToken extends TokenImpl {
power = new MageInt(0); power = new MageInt(0);
toughness = new MageInt(0); toughness = new MageInt(0);
CardsInControllerGraveyardCount count = new CardsInControllerGraveyardCount(new FilterCreatureCard("creature cards")); CardsInControllerGraveyardCount count = new CardsInControllerGraveyardCount(new FilterCreatureCard("creature cards"));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessSourceEffect(count, count, Duration.WhileOnBattlefield, SubLayer.SetPT_7b))); this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessSourceEffect(count, Duration.WhileOnBattlefield)));
} }
public SvogthosToken(final SvogthosToken token) { public SvogthosToken(final SvogthosToken token) {
super(token); super(token);

View file

@ -78,7 +78,7 @@ class SwornDefenderEffect extends OneShotEffect {
if (controller != null && targetPermanent != null) { if (controller != null && targetPermanent != null) {
int newPower = CardUtil.overflowDec(targetPermanent.getToughness().getValue(), 1); int newPower = CardUtil.overflowDec(targetPermanent.getToughness().getValue(), 1);
int newToughness = CardUtil.overflowInc(targetPermanent.getPower().getValue(), 1); int newToughness = CardUtil.overflowInc(targetPermanent.getPower().getValue(), 1);
game.addEffect(new SetBasePowerToughnessSourceEffect(newPower, newToughness, Duration.EndOfTurn, SubLayer.SetPT_7b), source); game.addEffect(new SetBasePowerToughnessSourceEffect(newPower, newToughness, Duration.EndOfTurn), source);
return true; return true;
} }
return false; return false;

View file

@ -2,14 +2,14 @@ package mage.cards.t;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.AdditiveDynamicValue;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount; import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.common.continuous.SetBasePowerToughnessPlusOneSourceEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import java.util.UUID; import java.util.UUID;
@ -19,7 +19,6 @@ import java.util.UUID;
public final class Tarmogoyf extends CardImpl { public final class Tarmogoyf extends CardImpl {
private static final DynamicValue powerValue = CardTypesInGraveyardCount.ALL; private static final DynamicValue powerValue = CardTypesInGraveyardCount.ALL;
private static final DynamicValue toughnessValue = new AdditiveDynamicValue(powerValue, StaticValue.get(1));
public Tarmogoyf(UUID ownerId, CardSetInfo setInfo) { public Tarmogoyf(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
@ -29,11 +28,7 @@ public final class Tarmogoyf extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Tarmogoyf's power is equal to the number of card types among cards in all graveyards and its toughness is equal to that number plus 1. // Tarmogoyf's power is equal to the number of card types among cards in all graveyards and its toughness is equal to that number plus 1.
this.addAbility(new SimpleStaticAbility( this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessPlusOneSourceEffect(powerValue)));
Zone.ALL,
new SetBasePowerToughnessSourceEffect(powerValue, toughnessValue, Duration.EndOfGame, SubLayer.CharacteristicDefining_7a)
.setText("{this}'s power is equal to the number of card types among cards in all graveyards and its toughness is equal to that number plus 1")
));
} }
private Tarmogoyf(final Tarmogoyf card) { private Tarmogoyf(final Tarmogoyf card) {

View file

@ -27,7 +27,7 @@ public final class TestamentOfFaith extends CardImpl {
// {X}: Testament of Faith becomes an X/X Wall creature with defender in addition to its other types until end of turn. // {X}: Testament of Faith becomes an X/X Wall creature with defender in addition to its other types until end of turn.
Ability ability = new SimpleActivatedAbility(new SetBasePowerToughnessSourceEffect( Ability ability = new SimpleActivatedAbility(new SetBasePowerToughnessSourceEffect(
ManacostVariableValue.REGULAR, ManacostVariableValue.REGULAR, Duration.EndOfTurn, SubLayer.SetPT_7b ManacostVariableValue.REGULAR, Duration.EndOfTurn
).setText("{this} becomes an X/X"), new VariableManaCost(VariableCostType.NORMAL)); ).setText("{this} becomes an X/X"), new VariableManaCost(VariableCostType.NORMAL));
ability.addEffect(new TestamentOfFaithEffect()); ability.addEffect(new TestamentOfFaithEffect());
ability.addEffect(new GainAbilitySourceEffect( ability.addEffect(new GainAbilitySourceEffect(

View file

@ -17,7 +17,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ComparisonType; import mage.constants.ComparisonType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubLayer;
/** /**
* *
@ -38,7 +37,7 @@ public final class TimberPaladin extends CardImpl {
// As long as Timber Paladin is enchanted by exactly one Aura, it has base power and toughness 3/3. // As long as Timber Paladin is enchanted by exactly one Aura, it has base power and toughness 3/3.
Ability ability1 = new SimpleStaticAbility(new ConditionalContinuousEffect( Ability ability1 = new SimpleStaticAbility(new ConditionalContinuousEffect(
new SetBasePowerToughnessSourceEffect(3, 3, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), new SetBasePowerToughnessSourceEffect(3, 3, Duration.WhileOnBattlefield),
exactlyOne, exactlyOne,
"As long as {this} is enchanted by exactly one Aura, it has base power and toughness 3/3." "As long as {this} is enchanted by exactly one Aura, it has base power and toughness 3/3."
)); ));
@ -47,7 +46,7 @@ public final class TimberPaladin extends CardImpl {
// As long as Timber Paladin is enchanted by exactly two Auras, it has base power and toughness 5/5 and vigilance. // As long as Timber Paladin is enchanted by exactly two Auras, it has base power and toughness 5/5 and vigilance.
Ability ability2 = new SimpleStaticAbility(new ConditionalContinuousEffect( Ability ability2 = new SimpleStaticAbility(new ConditionalContinuousEffect(
new SetBasePowerToughnessSourceEffect(5, 5, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), new SetBasePowerToughnessSourceEffect(5, 5, Duration.WhileOnBattlefield),
exactlyTwo, exactlyTwo,
"As long as {this} is enchanted by exactly two Auras, it has base power and toughness 5/5" "As long as {this} is enchanted by exactly two Auras, it has base power and toughness 5/5"
)); ));
@ -57,7 +56,7 @@ public final class TimberPaladin extends CardImpl {
// As long as Timber Paladin is enchanted by three or more Auras, it has base power and toughness 10/10, vigilance, and trample. // As long as Timber Paladin is enchanted by three or more Auras, it has base power and toughness 10/10, vigilance, and trample.
Ability ability3 = new SimpleStaticAbility(new ConditionalContinuousEffect( Ability ability3 = new SimpleStaticAbility(new ConditionalContinuousEffect(
new SetBasePowerToughnessSourceEffect(10, 10, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), new SetBasePowerToughnessSourceEffect(10, 10, Duration.WhileOnBattlefield),
threeOrMore, threeOrMore,
"As long as {this} is enchanted by three or more Auras, it has base power and toughness 10/10" "As long as {this} is enchanted by three or more Auras, it has base power and toughness 10/10"
)); ));

View file

@ -1,16 +1,11 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; 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.dynamicvalue.common.StaticValue;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessTargetEffect; import mage.abilities.effects.common.continuous.SetBaseToughnessSourceEffect;
import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -19,7 +14,8 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
@ -88,9 +84,7 @@ class TreeOfPerditionEffect extends OneShotEffect {
// For example, say Tree of Perdition is equipped with Cultists Staff (which makes it 2/15) and the players life total is 7. // For example, say Tree of Perdition is equipped with Cultists Staff (which makes it 2/15) and the players life total is 7.
// After the exchange, Tree of Perdition would be a 2/9 creature (its toughness became 7, which was then modified by Cultists Staff) and the players life total would be 15. // After the exchange, Tree of Perdition would be a 2/9 creature (its toughness became 7, which was then modified by Cultists Staff) and the players life total would be 15.
// (2016-07-13) // (2016-07-13)
ContinuousEffect powerToughnessEffect = new SetBasePowerToughnessTargetEffect(null, StaticValue.get(life), Duration.Custom); game.addEffect(new SetBaseToughnessSourceEffect(life, Duration.Custom), source);
powerToughnessEffect.setTargetPointer(new FixedTarget(perm.getId()));
game.addEffect(powerToughnessEffect, source);
return true; return true;
} }

View file

@ -1,13 +1,11 @@
package mage.cards.t; package mage.cards.t;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; 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.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetBaseToughnessSourceEffect;
import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -65,7 +63,6 @@ class TreeOfRedemptionEffect extends OneShotEffect {
return false; return false;
} }
int amount = perm.getToughness().getValue(); int amount = perm.getToughness().getValue();
int life = player.getLife(); int life = player.getLife();
if (life == amount) { if (life == amount) {
@ -78,7 +75,7 @@ class TreeOfRedemptionEffect extends OneShotEffect {
return false; return false;
} }
player.setLife(amount, game, source); player.setLife(amount, game, source);
game.addEffect(new SetBasePowerToughnessSourceEffect(null, StaticValue.get(life), Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source); game.addEffect(new SetBaseToughnessSourceEffect(life, Duration.Custom), source);
return true; return true;
} }

View file

@ -86,7 +86,7 @@ class TrenchGorgerEffect extends OneShotEffect {
} }
} }
controller.shuffleLibrary(source, game); controller.shuffleLibrary(source, game);
game.addEffect(new SetBasePowerToughnessSourceEffect(count, count, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source); game.addEffect(new SetBasePowerToughnessSourceEffect(count, count, Duration.WhileOnBattlefield), source);
return true; return true;
} }
} }

View file

@ -3,17 +3,18 @@ package mage.cards.u;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.IntPlusDynamicValue;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.MultipliedValue; import mage.abilities.dynamicvalue.MultipliedValue;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.dynamicvalue.common.MultikickerCount; import mage.abilities.dynamicvalue.common.MultikickerCount;
import mage.abilities.effects.common.MillCardsControllerEffect; import mage.abilities.effects.common.MillCardsControllerEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetBasePowerToughnessPlusOneSourceEffect;
import mage.abilities.keyword.KickerAbility; import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -23,8 +24,7 @@ import java.util.UUID;
*/ */
public final class UrborgLhurgoyf extends CardImpl { public final class UrborgLhurgoyf extends CardImpl {
private static final DynamicValue powerValue = new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURE); private static final DynamicValue powerValue = new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURES);
private static final DynamicValue toughnessValue = new IntPlusDynamicValue(1, powerValue);
private static final DynamicValue millValue = new MultipliedValue(MultikickerCount.instance, 3); private static final DynamicValue millValue = new MultipliedValue(MultikickerCount.instance, 3);
public UrborgLhurgoyf(UUID ownerId, CardSetInfo setInfo) { public UrborgLhurgoyf(UUID ownerId, CardSetInfo setInfo) {
@ -43,11 +43,7 @@ public final class UrborgLhurgoyf extends CardImpl {
this.addAbility(new AsEntersBattlefieldAbility(new MillCardsControllerEffect(millValue))); this.addAbility(new AsEntersBattlefieldAbility(new MillCardsControllerEffect(millValue)));
// Urborg Lhurgoyf's power is equal to the number of creature cards in your graveyard and its toughness is equal to that number plus 1. // Urborg Lhurgoyf's power is equal to the number of creature cards in your graveyard and its toughness is equal to that number plus 1.
this.addAbility(new SimpleStaticAbility( this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessPlusOneSourceEffect(powerValue)));
Zone.ALL,
new SetBasePowerToughnessSourceEffect(powerValue, toughnessValue, Duration.EndOfGame, SubLayer.CharacteristicDefining_7a)
.setText("{this}'s power is equal to the number of creature cards in your graveyard and its toughness is equal to that number plus 1")
));
} }
private UrborgLhurgoyf(final UrborgLhurgoyf card) { private UrborgLhurgoyf(final UrborgLhurgoyf card) {

View file

@ -4,9 +4,8 @@ import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetBaseToughnessSourceEffect;
import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -65,7 +64,7 @@ class WallOfTombstonesEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int newToughness = CardUtil.overflowInc(1, new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURE).calculate(game, source, this)); int newToughness = CardUtil.overflowInc(1, new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURE).calculate(game, source, this));
game.addEffect(new SetBasePowerToughnessSourceEffect(null, StaticValue.get(newToughness), Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source); game.addEffect(new SetBaseToughnessSourceEffect(newToughness, Duration.Custom), source);
return true; return true;
} }
} }

View file

@ -43,7 +43,7 @@ public final class WardenOfTheFirstTree extends CardImpl {
Duration.Custom, SubType.HUMAN, SubType.WARRIOR Duration.Custom, SubType.HUMAN, SubType.WARRIOR
).setText("{this} becomes a Human Warrior"), new ManaCostsImpl<>("{1}{W/B}")); ).setText("{this} becomes a Human Warrior"), new ManaCostsImpl<>("{1}{W/B}"));
ability.addEffect(new SetBasePowerToughnessSourceEffect( ability.addEffect(new SetBasePowerToughnessSourceEffect(
3, 3, Duration.Custom, SubLayer.SetPT_7b 3, 3, Duration.Custom
).setText("with base power and toughness 3/3")); ).setText("with base power and toughness 3/3"));
this.addAbility(ability); this.addAbility(ability);

View file

@ -16,7 +16,6 @@ import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TappedPredicate;
@ -95,7 +94,7 @@ class WoodElementalEffect extends OneShotEffect {
targetPermanent.sacrifice(source, game); targetPermanent.sacrifice(source, game);
} }
} }
game.addEffect(new SetBasePowerToughnessSourceEffect(sacrificedForests, sacrificedForests, Duration.Custom, SubLayer.SetPT_7b), source); game.addEffect(new SetBasePowerToughnessSourceEffect(sacrificedForests, sacrificedForests, Duration.Custom), source);
return true; return true;
} }
} }

View file

@ -12,7 +12,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubLayer;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.FilterSpell; import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
@ -44,7 +43,7 @@ public final class WoodlurkerMimic extends CardImpl {
// Whenever you cast a spell that's both black and green, Woodlurker Mimic has base power and toughness 4/5 until end of turn and gains wither until end of turn. // Whenever you cast a spell that's both black and green, Woodlurker Mimic has base power and toughness 4/5 until end of turn and gains wither until end of turn.
Ability ability = SpellCastControllerTriggeredAbility.createWithRule( Ability ability = SpellCastControllerTriggeredAbility.createWithRule(
new SetBasePowerToughnessSourceEffect(4, 5, Duration.EndOfTurn, SubLayer.SetPT_7b), new SetBasePowerToughnessSourceEffect(4, 5, Duration.EndOfTurn),
filter, false, rule filter, false, rule
); );
ability.addEffect(new GainAbilitySourceEffect(WitherAbility.getInstance(), Duration.EndOfTurn, false, true)); ability.addEffect(new GainAbilitySourceEffect(WitherAbility.getInstance(), Duration.EndOfTurn, false, true));

View file

@ -0,0 +1,161 @@
package org.mage.test.cards.continuous;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* Check that effects setting base power/toughness work properly, including CDA and 7b with duration
*
* @author xenohedron
*/
public class SetBasePTSourceTest extends CardTestPlayerBase {
@Test
public void testCDAsetPT() {
String rootless = "Rootless Yew"; // 3GG 5/4
// When Rootless Yew dies, search your library for a creature card with power or toughness 6 or greater,
// reveal it, put it into your hand, then shuffle.
String enigma = "Enigma Drake"; // 1UR */4
// Enigma Drake's power is equal to the number of instant and sorcery cards in your graveyard.
String kami = "Traproot Kami"; // G 0/*
// Traproot Kamis toughness is equal to the number of Forests on the battlefield.
setStrictChooseMode(true);
addCard(Zone.LIBRARY, playerA, enigma);
addCard(Zone.GRAVEYARD, playerA, "Shock", 6);
addCard(Zone.BATTLEFIELD, playerA, rootless);
addCard(Zone.BATTLEFIELD, playerA, "Tarmogoyf");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Zone.BATTLEFIELD, playerA, kami);
addCard(Zone.BATTLEFIELD, playerA, "Visara the Dreadful");
// Activate Visara to trigger dies ability and search. CDA must apply in all zones.
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Destroy target", rootless);
addTarget(playerA, enigma); // power 6 due to 6 instants in graveyard
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertHandCount(playerA, enigma, 1);
assertGraveyardCount(playerA, rootless, 1);
assertPowerToughness(playerA, kami, 0, 3); // 3 forests
assertPowerToughness(playerA, "Tarmogoyf", 2, 3); // Instant and creature
}
@Test
public void testLayer7b() {
String mimic = "Battlegate Mimic"; // {1}{R/W} 2/1
// Whenever you cast a spell thats both red and white, Battlegate Mimic has base power and toughness 4/2
// until end of turn and gains first strike until end of turn.
String figure = "Figure of Destiny"; // {R/W} 1/1
// {R/W}: Figure of Destiny becomes a Kithkin Spirit with base power and toughness 2/2.
// {R/W}{R/W}{R/W}: If Figure of Destiny is a Spirit, it becomes a Kithkin Spirit Warrior with base power and toughness 4/4.
// {R/W}{R/W}{R/W}{R/W}{R/W}{R/W}: If Figure of Destiny is a Warrior, it becomes a Kithkin Spirit Warrior Avatar
// with base power and toughness 8/8, flying, and first strike.
String cloudshift = "Cloudshift"; // {W} Instant
// Exile target creature you control, then return that card to the battlefield under your control.
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 10);
addCard(Zone.BATTLEFIELD, playerA, mimic);
addCard(Zone.HAND, playerA, figure);
addCard(Zone.HAND, playerA, cloudshift, 2);
addCard(Zone.HAND, playerA, "Double Cleave"); // {1}{R/W} Instant
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, figure);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, mimic, 4, 2);
assertPowerToughness(playerA, figure,1, 1);
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{R/W}: ");
waitStackResolved(1, PhaseStep.POSTCOMBAT_MAIN);
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{R/W}{R/W}{R/W}: ");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPowerToughness(playerA, mimic, 4, 2);
assertPowerToughness(playerA, figure,4, 4);
setStopAt(2, PhaseStep.UPKEEP);
execute();
assertPowerToughness(playerA, mimic, 2, 1);
assertPowerToughness(playerA, figure,4, 4);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Double Cleave", mimic);
waitStackResolved(2, PhaseStep.PRECOMBAT_MAIN);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, cloudshift, figure);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, mimic, 4, 2);
assertPowerToughness(playerA, figure, 1, 1);
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerA, cloudshift, mimic);
waitStackResolved(2, PhaseStep.POSTCOMBAT_MAIN);
activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerA, "{R/W}: ");
setStopAt(2, PhaseStep.END_TURN);
execute();
assertPowerToughness(playerA, mimic, 2, 1);
assertPowerToughness(playerA, figure, 2, 2);
}
@Test
public void testSvogthos() {
String svogthos = "Svogthos, the Restless Tomb"; // Land
// {3}{B}{G}: Until end of turn, Svogthos, the Restless Tomb becomes a black and green Plant Zombie creature with
// "This creatures power and toughness are each equal to the number of creature cards in your graveyard." Its still a land.
setStrictChooseMode(true);
addCard(Zone.GRAVEYARD, playerA, "Walking Corpse", 5);
addCard(Zone.BATTLEFIELD, playerA, svogthos);
addCard(Zone.BATTLEFIELD, playerA, "Bayou", 5);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{3}{B}{G}: ");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, svogthos, 5, 5);
}
@Test
public void testSuturedGhoul() {
String ghoul = "Sutured Ghoul"; // 4BBB */* Trample
// As Sutured Ghoul enters the battlefield, exile any number of creature cards from your graveyard.
// Sutured Ghoul's power is equal to the total power of the exiled cards and its toughness is equal to their total toughness.
String tymaret = "Tymaret, Chosen from Death"; // BB 2/*
// Tymaret's toughness is equal to your devotion to black.
String corpse = "Walking Corpse"; // 1B 2/2
String bogstomper = "Bogstomper"; // 4BB 6/5
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, corpse);
addCard(Zone.GRAVEYARD, playerA, tymaret, 1);
addCard(Zone.GRAVEYARD, playerA, bogstomper, 1);
addCard(Zone.HAND, playerA, ghoul);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 7);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, ghoul);
addTarget(playerA, tymaret + "^" + bogstomper);
// Total devotion is 3 + 1 so Tymaret has toughness 4 in all zones
// Therefore Sutured Ghoul exiling Tymaret and Bogstomper should have power 2+6 and toughness 4+5
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertExileCount(playerA, tymaret, 1);
assertExileCount(playerA, bogstomper, 1);
assertPowerToughness(playerA, ghoul, 8, 9);
}
}

View file

@ -0,0 +1,287 @@
package org.mage.test.cards.replacement.entersBattlefield;
import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility;
import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author xenohedron
*/
public class PrimalClayTest extends CardTestPlayerBase {
private static final String clay = "Primal Clay";
// As Primal Clay enters the battlefield, it becomes your choice of a 3/3 artifact creature, a 2/2 artifact creature
// with flying, or a 1/6 Wall artifact creature with defender in addition to its other types.
private static final String plasma = "Primal Plasma";
// As Primal Plasma enters the battlefield, it becomes your choice of a 3/3 creature, a 2/2 creature with flying,
// or a 1/6 creature with defender.
private static final String sentry = "Molten Sentry";
// As Molten Sentry enters the battlefield, flip a coin. If the coin comes up heads, Molten Sentry enters the battlefield
// as a 5/2 creature with haste. If it comes up tails, Molten Sentry enters the battlefield as a 2/5 creature with defender.
private static final String aquamorph = "Aquamorph Entity";
// As Aquamorph Entity enters the battlefield or is turned face up, it becomes your choice of 5/1 or 1/5.
private static final String tunnel = "Tunnel";
// Destroy target Wall. It can't be regenerated.
private static final String clone = "Clone";
// You may have Clone enter the battlefield as a copy of any creature on the battlefield.
private static final String cryptoplasm = "Cryptoplasm";
// At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature, except it has this ability.
private static final String cloudshift = "Cloudshift";
// Exile target creature you control, then return that card to the battlefield under your control.
@Test
public void testClayPTSet() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 3/3 artifact creature");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, clay, 3, 3);
}
@Test
public void testClayAbilityGained() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 2/2 artifact creature with flying");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, clay, 2, 2);
assertAbility(playerA, clay, FlyingAbility.getInstance(), true);
}
@Test
@Ignore("current workaround implementation doesn't account for this")
public void testClaySubtypeGained() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 1/6 Wall artifact creature with defender");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, clay, 1, 6);
assertAbility(playerA, clay, DefenderAbility.getInstance(), true);
assertSubtype(clay, SubType.WALL);
}
@Test
public void testClayCopyPTOnBattlefield() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.HAND, playerA, cryptoplasm);
addCard(Zone.BATTLEFIELD, playerA, "Island", 7);
addCard(Zone.BATTLEFIELD, playerB, "Plains", 3);
addCard(Zone.HAND, playerB, "The Battle of Bywater", 1);
// Destroy all creatures with power 3 or greater. Then create a Food token for each creature you control.
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 3/3 artifact creature");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, cryptoplasm);
// cryptoplasm trigger at next upkeep
setChoice(playerA, true); // whether to copy
addTarget(playerA, clay); // what to copy
castSpell(4, PhaseStep.PRECOMBAT_MAIN, playerB, "The Battle of Bywater");
// since cryptoplasm now a 3/3, both are destroyed
setStrictChooseMode(true);
setStopAt(4, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertGraveyardCount(playerA, clay, 1);
assertGraveyardCount(playerA, cryptoplasm, 1);
}
@Ignore("Chosen characteristics of Primal Clay should be copiable values")
@Test
public void testClayCopySubtypeOnBattlefield() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.HAND, playerA, cryptoplasm);
addCard(Zone.BATTLEFIELD, playerA, "Island", 7);
addCard(Zone.HAND, playerB, tunnel, 2);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 1/6 Wall artifact creature with defender");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, cryptoplasm);
// cryptoplasm trigger at next upkeep
setChoice(playerA, true); // whether to copy
addTarget(playerA, clay); // what to copy
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerB, tunnel, clay);
waitStackResolved(3, PhaseStep.PRECOMBAT_MAIN);
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerB, tunnel, clay);
setStrictChooseMode(true);
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, clay, 1);
assertGraveyardCount(playerA, cryptoplasm, 1);
}
@Test
public void testPlasmaClone() {
addCard(Zone.HAND, playerA, plasma);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
addCard(Zone.HAND, playerB, clone);
addCard(Zone.BATTLEFIELD, playerB, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, plasma);
setChoice(playerA, "a 1/6 creature with defender");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, clone);
setChoice(playerB, true); // whether to copy
setChoice(playerB, plasma); // what to copy
setChoice(playerB, "a 2/2 creature with flying"); // new choice as ETB
setStrictChooseMode(true);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, plasma, 1, 6);
assertPowerToughness(playerB, plasma, 2, 2);
assertAbility(playerB, plasma, FlyingAbility.getInstance(), true);
//assertAbility(playerB, plasma, DefenderAbility.getInstance(), true); TODO: this is a copiable value
}
@Test
public void testMoltenSentryClone() {
addCard(Zone.HAND, playerA, sentry);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
addCard(Zone.HAND, playerB, clone);
addCard(Zone.BATTLEFIELD, playerB, "Island", 4);
setFlipCoinResult(playerA, true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, sentry);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, clone);
setChoice(playerB, true); // whether to copy
setFlipCoinResult(playerB, false);
setChoice(playerB, sentry); // what to copy
setStrictChooseMode(true);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, sentry, 5, 2);
assertAbility(playerA, sentry, HasteAbility.getInstance(), true);
assertPowerToughness(playerB, sentry, 2, 5);
assertAbility(playerB, sentry, DefenderAbility.getInstance(), true);
}
@Test
public void testAquamorphEntityETB() {
addCard(Zone.HAND, playerA, aquamorph);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, aquamorph);
setChoice(playerA, false); // not using morph
setChoice(playerA, "a 5/1 creature");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, aquamorph, 5, 1);
}
@Test
public void testAquamorphEntityUnmorph() {
addCard(Zone.HAND, playerA, aquamorph);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 6);
addCard(Zone.HAND, playerA, "Island");
addCard(Zone.HAND, playerA, "Savage Swipe", 1);
// Target creature you control gets +2/+2 until end of turn if its power is 2. Then it fights target creature you dont control.
addCard(Zone.BATTLEFIELD, playerB, "Siege Mastodon", 1); // 3/5 creature for fighting
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, aquamorph);
setChoice(playerA, true); // cast facedown as 2/2
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Savage Swipe");
addTarget(playerA, ""); // morph
addTarget(playerA, "Siege Mastodon");
// 2/2 becomes 4/4, fights 3/5, neither dies
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Island");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{U}: Turn"); // unmorph
setChoice(playerA, "a 1/5 creature");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, aquamorph, 1 + 2, 5 + 2);
assertDamageReceived(playerA, aquamorph, 3);
assertDamageReceived(playerB, "Siege Mastodon", 4);
}
@Test
public void testClayFlicker() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.HAND, playerA, cloudshift);
addCard(Zone.BATTLEFIELD, playerA, "Waterkin Shaman");
// 2/1; Whenever a creature with flying enters the battlefield under your control, Waterkin Shaman gets +1/+1 until end of turn.
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 2/2 artifact creature with flying");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, cloudshift, clay);
setChoice(playerA, "a 3/3 artifact creature");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, clay, 3, 3);
assertPowerToughness(playerA, "Waterkin Shaman", 2 + 1, 1 + 1);
assertAbility(playerA, clay, FlyingAbility.getInstance(), false);
}
@Test
public void testClayFlickerWall() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.HAND, playerA, cloudshift);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 1/6 artifact creature with defender");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, cloudshift, clay);
setChoice(playerA, "a 3/3 artifact creature");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, clay, 3, 3);
assertNotSubtype(clay, SubType.WALL);
}
}

View file

@ -1,36 +1,34 @@
package mage.abilities.effects.common.continuous; package mage.abilities.effects.common.continuous;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.dynamicvalue.common.StaticValue;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer; import mage.constants.SubLayer;
import mage.game.Game;
/** /**
* @author LevelX2 * @author xenohedron
*/ */
public class SetBasePowerSourceEffect extends ContinuousEffectImpl { public class SetBasePowerSourceEffect extends SetBasePowerToughnessSourceEffect {
private final DynamicValue amount;
/** /**
* @param amount Power to set as a characteristic-defining ability * @param amount Power to set as a characteristic-defining ability
*/ */
public SetBasePowerSourceEffect(DynamicValue amount) { public SetBasePowerSourceEffect(DynamicValue amount) {
super(Duration.EndOfGame, Layer.PTChangingEffects_7, SubLayer.CharacteristicDefining_7a, Outcome.BoostCreature); super(amount, null, Duration.EndOfGame, SubLayer.CharacteristicDefining_7a);
setCharacterDefining(true);
this.amount = amount;
staticText = "{this}'s power is equal to the number of " + amount.getMessage(); staticText = "{this}'s power is equal to the number of " + amount.getMessage();
} }
/**
* @param amount Power to set in layer 7b
* @param duration Duration for the effect
*/
public SetBasePowerSourceEffect(int amount, Duration duration) {
super(StaticValue.get(amount), null, duration, SubLayer.SetPT_7b);
staticText = "{this} has base power " + amount + ' ' + duration.toString();
}
protected SetBasePowerSourceEffect(final SetBasePowerSourceEffect effect) { protected SetBasePowerSourceEffect(final SetBasePowerSourceEffect effect) {
super(effect); super(effect);
this.amount = effect.amount;
} }
@Override @Override
@ -38,15 +36,4 @@ public class SetBasePowerSourceEffect extends ContinuousEffectImpl {
return new SetBasePowerSourceEffect(this); return new SetBasePowerSourceEffect(this);
} }
@Override
public boolean apply(Game game, Ability source) {
MageObject mageObject = game.getObject(source);
if (mageObject == null) {
return false;
}
int value = amount.calculate(game, source, this);
mageObject.getPower().setModifiedBaseValue(value);
return true;
}
} }

View file

@ -0,0 +1,30 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.IntPlusDynamicValue;
import mage.constants.Duration;
import mage.constants.SubLayer;
/**
* @author xenohedron
*/
public class SetBasePowerToughnessPlusOneSourceEffect extends SetBasePowerToughnessSourceEffect {
/**
* @param amount Power to set as a characteristic-defining ability; toughness is that value plus 1
*/
public SetBasePowerToughnessPlusOneSourceEffect(DynamicValue amount) {
super(amount, new IntPlusDynamicValue(1, amount), Duration.EndOfGame, SubLayer.CharacteristicDefining_7a);
this.staticText = "{this}'s power is equal to the number of " + amount.getMessage() + " and its toughness is equal to that number plus 1";
}
protected SetBasePowerToughnessPlusOneSourceEffect(final SetBasePowerToughnessPlusOneSourceEffect effect) {
super(effect);
}
@Override
public SetBasePowerToughnessPlusOneSourceEffect copy() {
return new SetBasePowerToughnessPlusOneSourceEffect(this);
}
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.continuous; package mage.abilities.effects.common.continuous;
import mage.MageObject; import mage.MageObject;
@ -13,8 +12,6 @@ import mage.constants.SubLayer;
import mage.game.Game; import mage.game.Game;
/** /**
* RENAME
*
* @author BetaSteward_at_googlemail.com, North, Alex-Vasile, xenohedron * @author BetaSteward_at_googlemail.com, North, Alex-Vasile, xenohedron
*/ */
public class SetBasePowerToughnessSourceEffect extends ContinuousEffectImpl { public class SetBasePowerToughnessSourceEffect extends ContinuousEffectImpl {
@ -23,11 +20,11 @@ public class SetBasePowerToughnessSourceEffect extends ContinuousEffectImpl {
private final DynamicValue toughness; private final DynamicValue toughness;
/** /**
* Note: Need to set text manually if calling this constructor directly. * This constructor is called by the other more specific constructors which set text for appropriate usages.
* <p> * @param power can be null, if only toughness is to be modified
* It is possible to have power or toughness to null, in which case only the other is modified. * @param toughness can be null, if only power is to be modified
*/ */
public SetBasePowerToughnessSourceEffect(DynamicValue power, DynamicValue toughness, Duration duration, SubLayer subLayer) { protected SetBasePowerToughnessSourceEffect(DynamicValue power, DynamicValue toughness, Duration duration, SubLayer subLayer) {
super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature); super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature);
setCharacterDefining(subLayer == SubLayer.CharacteristicDefining_7a); setCharacterDefining(subLayer == SubLayer.CharacteristicDefining_7a);
this.power = power; this.power = power;
@ -42,8 +39,37 @@ public class SetBasePowerToughnessSourceEffect extends ContinuousEffectImpl {
this.staticText = "{this}'s power and toughness are each equal to the number of " + amount.getMessage(); this.staticText = "{this}'s power and toughness are each equal to the number of " + amount.getMessage();
} }
public SetBasePowerToughnessSourceEffect(int power, int toughness, Duration duration, SubLayer subLayer) { /**
this(StaticValue.get(power), StaticValue.get(toughness), duration, subLayer); * @param amount Power and toughness to set in layer 7b
* @param duration Duration for the effect
*/
public SetBasePowerToughnessSourceEffect(DynamicValue amount, Duration duration) {
this(amount, amount, duration, SubLayer.SetPT_7b);
if (duration.toString().isEmpty()) {
staticText = "{this}'s power and toughness are each equal to the number of " + amount.getMessage();
} else {
staticText = "{this} has base power and toughness each equal to the number of " + amount.getMessage() + " " + duration;
}
}
/**
* @param power set in layer 7b
* @param toughness set in layer 7b
* @param duration Duration for the effect
* @param text Text to set as staticText
*/
public SetBasePowerToughnessSourceEffect(DynamicValue power, DynamicValue toughness, Duration duration, String text) {
this(power, toughness, duration, SubLayer.SetPT_7b);
this.staticText = text;
}
/**
* @param power set in layer 7b
* @param toughness set in layer 7b
* @param duration Duration for the effect
*/
public SetBasePowerToughnessSourceEffect(int power, int toughness, Duration duration) {
this(StaticValue.get(power), StaticValue.get(toughness), duration, SubLayer.SetPT_7b);
this.staticText = "{this} has base power and toughness " + power + '/' + toughness + ' ' + duration.toString(); this.staticText = "{this} has base power and toughness " + power + '/' + toughness + ' ' + duration.toString();
} }
@ -62,25 +88,22 @@ public class SetBasePowerToughnessSourceEffect extends ContinuousEffectImpl {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
MageObject mageObject = game.getPermanentEntering(source.getSourceId()); MageObject mageObject = game.getPermanentEntering(source.getSourceId());
if (mageObject == null) { if (mageObject == null) {
if (duration == Duration.Custom || isTemporary()) { if (this.characterDefining || this.duration == Duration.WhileOnBattlefield) {
mageObject = game.getPermanent(source.getSourceId()); // Duration is a workaround for Primal Clay and similar which are incorrectly implemented
} else {
mageObject = game.getObject(source); mageObject = game.getObject(source);
} else {
mageObject = source.getSourcePermanentIfItStillExists(game);
} }
} }
if (mageObject == null || (power == null && toughness == null)) { if (mageObject == null) {
discard(); discard();
return false; return false;
} }
if (this.power != null) { if (this.power != null) {
int power = this.power.calculate(game, source, this); mageObject.getPower().setModifiedBaseValue(this.power.calculate(game, source, this));
mageObject.getPower().setModifiedBaseValue(power);
} }
if (this.toughness != null) { if (this.toughness != null) {
int toughness = this.toughness.calculate(game, source, this); mageObject.getToughness().setModifiedBaseValue(this.toughness.calculate(game, source, this));
mageObject.getToughness().setModifiedBaseValue(toughness);
} }
return true; return true;
} }

View file

@ -1,38 +1,34 @@
package mage.abilities.effects.common.continuous; package mage.abilities.effects.common.continuous;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.dynamicvalue.common.StaticValue;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer; import mage.constants.SubLayer;
import mage.game.Game;
/** /**
* RENAME * @author xenohedron
*
* @author Backfir3, noxx
*/ */
public class SetBaseToughnessSourceEffect extends ContinuousEffectImpl { public class SetBaseToughnessSourceEffect extends SetBasePowerToughnessSourceEffect {
private final DynamicValue amount;
/** /**
* @param amount Toughness to set as a characteristic-defining ability * @param amount Toughness to set as a characteristic-defining ability
*/ */
public SetBaseToughnessSourceEffect(DynamicValue amount) { public SetBaseToughnessSourceEffect(DynamicValue amount) {
super(Duration.EndOfGame, Layer.PTChangingEffects_7, SubLayer.CharacteristicDefining_7a, Outcome.BoostCreature); super(null, amount, Duration.EndOfGame, SubLayer.CharacteristicDefining_7a);
setCharacterDefining(true);
this.amount = amount;
staticText = "{this}'s toughness is equal to the number of " + amount.getMessage(); staticText = "{this}'s toughness is equal to the number of " + amount.getMessage();
} }
/**
* @param amount Toughness to set in layer 7b
* @param duration Duration for the effect
*/
public SetBaseToughnessSourceEffect(int amount, Duration duration) {
super(null, StaticValue.get(amount), duration, SubLayer.SetPT_7b);
staticText = "{this} has base toughness " + amount + ' ' + duration.toString();
}
protected SetBaseToughnessSourceEffect(final SetBaseToughnessSourceEffect effect) { protected SetBaseToughnessSourceEffect(final SetBaseToughnessSourceEffect effect) {
super(effect); super(effect);
this.amount = effect.amount;
} }
@Override @Override
@ -40,15 +36,4 @@ public class SetBaseToughnessSourceEffect extends ContinuousEffectImpl {
return new SetBaseToughnessSourceEffect(this); return new SetBaseToughnessSourceEffect(this);
} }
@Override
public boolean apply(Game game, Ability source) {
MageObject mageObject = game.getObject(source);
if (mageObject != null) {
int value = amount.calculate(game, source, this);
mageObject.getToughness().setModifiedBaseValue(value);
return true;
}
return false;
}
} }

View file

@ -11,7 +11,6 @@ import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubLayer;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
@ -55,7 +54,7 @@ public class LevelerCardBuilder {
staticAbility.setRuleVisible(false); staticAbility.setRuleVisible(false);
constructed.add(staticAbility); constructed.add(staticAbility);
} }
ContinuousEffect effect = new SetBasePowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield, SubLayer.SetPT_7b); ContinuousEffect effect = new SetBasePowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield);
ConditionalContinuousEffect ptEffect = new ConditionalContinuousEffect(effect, condition, rule); ConditionalContinuousEffect ptEffect = new ConditionalContinuousEffect(effect, condition, rule);
constructed.add(new SimpleStaticAbility(Zone.BATTLEFIELD, ptEffect)); constructed.add(new SimpleStaticAbility(Zone.BATTLEFIELD, ptEffect));

View file

@ -2,12 +2,12 @@ package mage.game.permanent.token;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.AdditiveDynamicValue;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount; import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.common.continuous.SetBasePowerToughnessPlusOneSourceEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.constants.CardType;
import mage.constants.*; import mage.constants.SubType;
import mage.constants.Zone;
/** /**
* @author ciaccona007 * @author ciaccona007
@ -15,7 +15,6 @@ import mage.constants.*;
public final class ConsumingBlobOozeToken extends TokenImpl { public final class ConsumingBlobOozeToken extends TokenImpl {
private static final DynamicValue powerValue = CardTypesInGraveyardCount.YOU; private static final DynamicValue powerValue = CardTypesInGraveyardCount.YOU;
private static final DynamicValue toughnessValue = new AdditiveDynamicValue(powerValue, StaticValue.get(1));
public ConsumingBlobOozeToken() { public ConsumingBlobOozeToken() {
super("Ooze Token", "green Ooze creature token with \"This creature's power is equal to the number of card types among cards in your graveyard and its toughness is equal to that number plus 1.\""); super("Ooze Token", "green Ooze creature token with \"This creature's power is equal to the number of card types among cards in your graveyard and its toughness is equal to that number plus 1.\"");
@ -27,11 +26,7 @@ public final class ConsumingBlobOozeToken extends TokenImpl {
toughness = new MageInt(1); toughness = new MageInt(1);
// This creature's power is equal to the number of card types among cards in your graveyard and its toughness is equal to that number plus 1. // This creature's power is equal to the number of card types among cards in your graveyard and its toughness is equal to that number plus 1.
this.addAbility(new SimpleStaticAbility( this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessPlusOneSourceEffect(powerValue)));
Zone.ALL,
new SetBasePowerToughnessSourceEffect(powerValue, toughnessValue, Duration.EndOfGame, SubLayer.CharacteristicDefining_7a)
.setText("{this}'s power is equal to the number of creature cards in all graveyards and its toughness is equal to that number plus 1")
));
} }
private ConsumingBlobOozeToken(final ConsumingBlobOozeToken token) { private ConsumingBlobOozeToken(final ConsumingBlobOozeToken token) {