Updated other boost effect for AI outcome

This commit is contained in:
magenoxx 2012-06-29 16:57:25 +04:00
parent 511df3605f
commit 5d397bfbee
5 changed files with 39 additions and 19 deletions

View file

@ -32,6 +32,10 @@ import mage.Constants.*;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.TriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DomainValue;
import mage.abilities.dynamicvalue.common.SignInversionDynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.game.Game;
import java.util.*;
@ -157,4 +161,18 @@ public abstract class ContinuousEffectImpl<T extends ContinuousEffectImpl<T>> ex
this.staticText = text;
}
protected static boolean isCanKill(DynamicValue toughness) {
if (toughness instanceof StaticValue) {
return toughness.calculate(null, null) < 0;
}
if (toughness instanceof SignInversionDynamicValue) {
// count this class as used for "-{something_positive}"
return true;
}
if (toughness instanceof DomainValue) {
return ((DomainValue)toughness).getAmount() < 0;
}
return false;
}
}