mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
fixed Death's Shadow getting bigger from negative life totals (no longer how the rules work)
This commit is contained in:
parent
9a66f1713b
commit
40ff146764
2 changed files with 15 additions and 3 deletions
|
@ -54,7 +54,7 @@ public class DeathsShadow extends CardImpl {
|
|||
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)));
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue