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;
}