diff --git a/Mage.Sets/src/mage/cards/b/BramblefortFink.java b/Mage.Sets/src/mage/cards/b/BramblefortFink.java index c7f7eca5764..dfb393b5f22 100644 --- a/Mage.Sets/src/mage/cards/b/BramblefortFink.java +++ b/Mage.Sets/src/mage/cards/b/BramblefortFink.java @@ -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. this.addAbility(new ActivateIfConditionActivatedAbility( Zone.BATTLEFIELD, - new SetBasePowerToughnessSourceEffect( - 10, 10, Duration.EndOfTurn - ).setText("{this} has base power and toughness 10/10 until end of turn"), + new SetBasePowerToughnessSourceEffect(10, 10, Duration.EndOfTurn), new GenericManaCost(8), condition)); } diff --git a/Mage.Sets/src/mage/cards/c/ChimericMass.java b/Mage.Sets/src/mage/cards/c/ChimericMass.java index 9774cf47941..76aabe80a40 100644 --- a/Mage.Sets/src/mage/cards/c/ChimericMass.java +++ b/Mage.Sets/src/mage/cards/c/ChimericMass.java @@ -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.\"") .withType(CardType.ARTIFACT) .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))); } diff --git a/Mage.Sets/src/mage/cards/d/DruidClass.java b/Mage.Sets/src/mage/cards/d/DruidClass.java index 04c24492394..48a54994abf 100644 --- a/Mage.Sets/src/mage/cards/d/DruidClass.java +++ b/Mage.Sets/src/mage/cards/d/DruidClass.java @@ -78,7 +78,7 @@ class DruidClassToken extends TokenImpl { this.addAbility(HasteAbility.getInstance()); 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"))); } diff --git a/Mage.Sets/src/mage/cards/e/EntropicSpecter.java b/Mage.Sets/src/mage/cards/e/EntropicSpecter.java index 8814a842773..747ea0ef1c6 100644 --- a/Mage.Sets/src/mage/cards/e/EntropicSpecter.java +++ b/Mage.Sets/src/mage/cards/e/EntropicSpecter.java @@ -1,4 +1,3 @@ - package mage.cards.e; 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. this.addAbility(new SimpleStaticAbility(Zone.ALL, // back to the graveyard or if the chosen player left the game it's again a 0/0 - new SetBasePowerToughnessSourceEffect(CardsInTargetPlayerHandCount.instance, CardsInTargetPlayerHandCount.instance, - 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"))); + new SetBasePowerToughnessSourceEffect(CardsInTargetPlayerHandCount.instance, Duration.WhileOnBattlefield))); // Whenever Entropic Specter deals damage to a player, that player discards a card. this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new DiscardTargetEffect(1, false), false, true)); diff --git a/Mage.Sets/src/mage/cards/g/Gigantoplasm.java b/Mage.Sets/src/mage/cards/g/Gigantoplasm.java index 485f95d4f93..c7e57502f06 100644 --- a/Mage.Sets/src/mage/cards/g/Gigantoplasm.java +++ b/Mage.Sets/src/mage/cards/g/Gigantoplasm.java @@ -1,4 +1,3 @@ - package mage.cards.g; import java.util.UUID; @@ -8,7 +7,6 @@ import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.Effect; import mage.abilities.effects.common.CopyPermanentEffect; @@ -18,7 +16,6 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Duration; -import mage.constants.SubLayer; import mage.constants.Zone; import mage.filter.StaticFilters; import mage.game.Game; @@ -56,8 +53,7 @@ class GigantoplasmCopyApplier extends CopyApplier { @Override public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) { - DynamicValue variableMana = ManacostVariableValue.REGULAR; - Effect effect = new SetBasePowerToughnessSourceEffect(variableMana, variableMana, Duration.WhileOnBattlefield, SubLayer.SetPT_7b); + Effect effect = new SetBasePowerToughnessSourceEffect(ManacostVariableValue.REGULAR, Duration.WhileOnBattlefield); effect.setText("This creature has base power and toughness X/X"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{X}")); blueprint.getAbilities().add(ability); diff --git a/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java b/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java index 1f621495cb3..159d5b78b4d 100644 --- a/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java +++ b/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java @@ -35,7 +35,7 @@ public final class MinionOfTheWastes extends CardImpl { // Trample 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())); // Minion of the Wastes's power and toughness are each equal to the life paid as it entered the battlefield. diff --git a/Mage.Sets/src/mage/cards/m/MythRealized.java b/Mage.Sets/src/mage/cards/m/MythRealized.java index c87dd76f304..430e3df8fa4 100644 --- a/Mage.Sets/src/mage/cards/m/MythRealized.java +++ b/Mage.Sets/src/mage/cards/m/MythRealized.java @@ -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." Effect effect = new BecomesCreatureSourceEffect(new MythRealizedToken(), CardType.ENCHANTMENT, Duration.EndOfTurn).withDurationRuleAtStart(true); 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); } diff --git a/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java b/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java index 59d9ca960d2..7d369e51159 100644 --- a/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java +++ b/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java @@ -55,7 +55,7 @@ class SvogthosToken extends TokenImpl { power = new MageInt(0); toughness = new MageInt(0); 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) { super(token); diff --git a/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java b/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java index 38010f817b0..e51181c82e0 100644 --- a/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java +++ b/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java @@ -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. 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)); ability.addEffect(new TestamentOfFaithEffect()); ability.addEffect(new GainAbilitySourceEffect( diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetBasePowerToughnessSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetBasePowerToughnessSourceEffect.java index b11a81cddde..72eed3ff1a8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetBasePowerToughnessSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetBasePowerToughnessSourceEffect.java @@ -20,11 +20,11 @@ public class SetBasePowerToughnessSourceEffect extends ContinuousEffectImpl { private final DynamicValue toughness; /** - * Note: Need to set text manually if calling this constructor directly. - *

- * It is possible to have power or toughness to null, in which case only the other is modified. + * This constructor is called by the other more specific constructors which set text for appropriate usages. + * @param power can be null, if only toughness is to be 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); setCharacterDefining(subLayer == SubLayer.CharacteristicDefining_7a); this.power = power; @@ -39,6 +39,19 @@ public class SetBasePowerToughnessSourceEffect extends ContinuousEffectImpl { this.staticText = "{this}'s power and toughness are each equal to the number of " + amount.getMessage(); } + /** + * @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; + } + } + 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();