new SetBasePowerToughnessPlusOneSourceEffect

This commit is contained in:
xenohedron 2023-08-26 00:51:20 -04:00
parent 5d0c1c96c8
commit c84fbfd00e
7 changed files with 59 additions and 62 deletions

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;
import mage.MageObject;
@ -13,8 +12,6 @@ import mage.constants.SubLayer;
import mage.game.Game;
/**
* RENAME
*
* @author BetaSteward_at_googlemail.com, North, Alex-Vasile, xenohedron
*/
public class SetBasePowerToughnessSourceEffect extends ContinuousEffectImpl {
@ -72,15 +69,11 @@ public class SetBasePowerToughnessSourceEffect extends ContinuousEffectImpl {
discard();
return false;
}
if (this.power != null) {
int power = this.power.calculate(game, source, this);
mageObject.getPower().setModifiedBaseValue(power);
mageObject.getPower().setModifiedBaseValue(this.power.calculate(game, source, this));
}
if (this.toughness != null) {
int toughness = this.toughness.calculate(game, source, this);
mageObject.getToughness().setModifiedBaseValue(toughness);
mageObject.getToughness().setModifiedBaseValue(this.toughness.calculate(game, source, this));
}
return true;
}

View file

@ -2,12 +2,12 @@ package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.AdditiveDynamicValue;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
import mage.constants.*;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessPlusOneSourceEffect;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
/**
* @author ciaccona007
@ -15,7 +15,6 @@ import mage.constants.*;
public final class ConsumingBlobOozeToken extends TokenImpl {
private static final DynamicValue powerValue = CardTypesInGraveyardCount.YOU;
private static final DynamicValue toughnessValue = new AdditiveDynamicValue(powerValue, StaticValue.get(1));
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.\"");
@ -27,11 +26,7 @@ public final class ConsumingBlobOozeToken extends TokenImpl {
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.addAbility(new SimpleStaticAbility(
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")
));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessPlusOneSourceEffect(powerValue)));
}
private ConsumingBlobOozeToken(final ConsumingBlobOozeToken token) {