fixed Death's Shadow getting bigger from negative life totals (no longer how the rules work)

This commit is contained in:
Evan Kranzler 2018-05-14 11:39:27 -04:00
parent 9a66f1713b
commit 40ff146764
2 changed files with 15 additions and 3 deletions

View file

@ -47,14 +47,14 @@ import mage.constants.Zone;
public class DeathsShadow extends CardImpl { public class DeathsShadow extends CardImpl {
public DeathsShadow(UUID ownerId, CardSetInfo setInfo) { public DeathsShadow(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}");
this.subtype.add(SubType.AVATAR); this.subtype.add(SubType.AVATAR);
this.power = new MageInt(13); this.power = new MageInt(13);
this.toughness = new MageInt(13); this.toughness = new MageInt(13);
// Death's Shadow gets -X/-X, where X is your life total. // Death's Shadow gets -X/-X, where X is your life total.
SignInversionDynamicValue x = new SignInversionDynamicValue(new ControllerLifeCount()); SignInversionDynamicValue x = new SignInversionDynamicValue(new ControllerLifeCount(), false);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(x, x, Duration.WhileOnBattlefield))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(x, x, Duration.WhileOnBattlefield)));
} }

View file

@ -8,18 +8,30 @@ import mage.game.Game;
public class SignInversionDynamicValue implements DynamicValue { public class SignInversionDynamicValue implements DynamicValue {
private final DynamicValue value; private final DynamicValue value;
private final boolean canBePositive;
public SignInversionDynamicValue(DynamicValue value) { public SignInversionDynamicValue(DynamicValue value) {
this(value, true);
}
public SignInversionDynamicValue(DynamicValue value, boolean canBePositive) {
this.value = value.copy(); this.value = value.copy();
this.canBePositive = canBePositive;
} }
SignInversionDynamicValue(final SignInversionDynamicValue dynamicValue) { SignInversionDynamicValue(final SignInversionDynamicValue dynamicValue) {
this.value = dynamicValue.value.copy(); this.value = dynamicValue.value.copy();
this.canBePositive = dynamicValue.canBePositive;
} }
@Override @Override
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
return -1 * value.calculate(game, sourceAbility, effect); int amount = value.calculate(game, sourceAbility, effect);
if (amount >= 0 || canBePositive) {
return -1 * amount;
} else {
return 0;
}
} }
@Override @Override