revert changes to dynamic value calculations (will investigate more thoroughly later)

This commit is contained in:
Evan Kranzler 2021-03-31 08:55:49 -04:00
parent 473eca6bfc
commit 8e3f4d89c9
2 changed files with 18 additions and 8 deletions

View file

@ -3,6 +3,7 @@ package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -29,12 +30,17 @@ public class SourcePermanentPowerCount implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent sourcePermanent = sourceAbility.getSourcePermanentOrLKI(game);
if (sourcePermanent == null) {
return 0;
Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId());
if (sourcePermanent == null
|| (sourceAbility.getSourceObjectZoneChangeCounter() > 0
&& sourcePermanent.getZoneChangeCounter(game) > sourceAbility.getSourceObjectZoneChangeCounter())) {
sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD);
}
int power = sourcePermanent.getPower().getValue();
return allowNegativeValues ? power : Integer.max(power, 0);
if (sourcePermanent != null
&& (allowNegativeValues || sourcePermanent.getPower().getValue() >= 0)) {
return sourcePermanent.getPower().getValue();
}
return 0;
}
@Override

View file

@ -3,6 +3,7 @@ package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -29,11 +30,14 @@ public class SourcePermanentToughnessValue implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent sourcePermanent = sourceAbility.getSourcePermanentOrLKI(game);
Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId());
if (sourcePermanent == null) {
return 0;
sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD);
}
return sourcePermanent.getToughness().getValue();
if (sourcePermanent != null) {
return sourcePermanent.getToughness().getValue();
}
return 0;
}
@Override