Added locking stage of dynamic value in BoostControlledEffect

This commit is contained in:
magenoxx 2011-09-22 17:17:43 +04:00
parent 9a8f6e839d
commit fe45c8adee

View file

@ -50,6 +50,8 @@ public class BoostControlledEffect extends ContinuousEffectImpl<BoostControlledE
private DynamicValue toughness; private DynamicValue toughness;
protected boolean excludeSource; protected boolean excludeSource;
protected FilterCreaturePermanent filter; protected FilterCreaturePermanent filter;
// if true, all dynamic values should be calculated once
protected boolean isLockedIn = false;
public BoostControlledEffect(int power, int toughness, Duration duration) { public BoostControlledEffect(int power, int toughness, Duration duration) {
this(power, toughness, duration, FilterCreaturePermanent.getDefault(), false); this(power, toughness, duration, FilterCreaturePermanent.getDefault(), false);
@ -86,6 +88,7 @@ public class BoostControlledEffect extends ContinuousEffectImpl<BoostControlledE
this.toughness = effect.toughness; this.toughness = effect.toughness;
this.filter = effect.filter.copy(); this.filter = effect.filter.copy();
this.excludeSource = effect.excludeSource; this.excludeSource = effect.excludeSource;
this.isLockedIn = effect.isLockedIn;
} }
@Override @Override
@ -103,6 +106,10 @@ public class BoostControlledEffect extends ContinuousEffectImpl<BoostControlledE
} }
} }
} }
if (this.isLockedIn) {
power = new StaticValue(power.calculate(game, source));
toughness = new StaticValue(toughness.calculate(game, source));
}
} }
@Override @Override
@ -148,4 +155,8 @@ public class BoostControlledEffect extends ContinuousEffectImpl<BoostControlledE
staticText = rule; staticText = rule;
} }
public void setLockedIn(boolean isLockedIn) {
this.isLockedIn =isLockedIn;
}
} }