From 40ff146764331ac3e3dc4606ab675cf936ff9375 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 14 May 2018 11:39:27 -0400 Subject: [PATCH] fixed Death's Shadow getting bigger from negative life totals (no longer how the rules work) --- Mage.Sets/src/mage/cards/d/DeathsShadow.java | 4 ++-- .../common/SignInversionDynamicValue.java | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/DeathsShadow.java b/Mage.Sets/src/mage/cards/d/DeathsShadow.java index 6bae1cb589..71c65af311 100644 --- a/Mage.Sets/src/mage/cards/d/DeathsShadow.java +++ b/Mage.Sets/src/mage/cards/d/DeathsShadow.java @@ -47,14 +47,14 @@ import mage.constants.Zone; public class DeathsShadow extends CardImpl { 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.power = new MageInt(13); this.toughness = new MageInt(13); // 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))); } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java index 6f630c4861..db00aa1ccb 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java @@ -8,18 +8,30 @@ import mage.game.Game; public class SignInversionDynamicValue implements DynamicValue { private final DynamicValue value; + private final boolean canBePositive; public SignInversionDynamicValue(DynamicValue value) { + this(value, true); + } + + public SignInversionDynamicValue(DynamicValue value, boolean canBePositive) { this.value = value.copy(); + this.canBePositive = canBePositive; } SignInversionDynamicValue(final SignInversionDynamicValue dynamicValue) { this.value = dynamicValue.value.copy(); + this.canBePositive = dynamicValue.canBePositive; } @Override 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