mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
revert changes to dynamic value calculations (will investigate more thoroughly later)
This commit is contained in:
parent
473eca6bfc
commit
8e3f4d89c9
2 changed files with 18 additions and 8 deletions
|
@ -3,6 +3,7 @@ package mage.abilities.dynamicvalue.common;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
@ -29,12 +30,17 @@ public class SourcePermanentPowerCount implements DynamicValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
Permanent sourcePermanent = sourceAbility.getSourcePermanentOrLKI(game);
|
Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId());
|
||||||
if (sourcePermanent == null) {
|
if (sourcePermanent == null
|
||||||
return 0;
|
|| (sourceAbility.getSourceObjectZoneChangeCounter() > 0
|
||||||
|
&& sourcePermanent.getZoneChangeCounter(game) > sourceAbility.getSourceObjectZoneChangeCounter())) {
|
||||||
|
sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD);
|
||||||
}
|
}
|
||||||
int power = sourcePermanent.getPower().getValue();
|
if (sourcePermanent != null
|
||||||
return allowNegativeValues ? power : Integer.max(power, 0);
|
&& (allowNegativeValues || sourcePermanent.getPower().getValue() >= 0)) {
|
||||||
|
return sourcePermanent.getPower().getValue();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,6 +3,7 @@ package mage.abilities.dynamicvalue.common;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
@ -29,11 +30,14 @@ public class SourcePermanentToughnessValue implements DynamicValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
Permanent sourcePermanent = sourceAbility.getSourcePermanentOrLKI(game);
|
Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId());
|
||||||
if (sourcePermanent == null) {
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue