mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
Updated other boost effect for AI outcome
This commit is contained in:
parent
511df3605f
commit
5d397bfbee
5 changed files with 39 additions and 19 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ import mage.Constants.Outcome;
|
|||
import mage.Constants.SubLayer;
|
||||
import mage.abilities.Ability;
|
||||
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.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
@ -68,7 +70,7 @@ public class BoostAllEffect extends ContinuousEffectImpl<BoostAllEffect> {
|
|||
}
|
||||
|
||||
public BoostAllEffect(DynamicValue power, DynamicValue toughness, Duration duration, FilterCreaturePermanent filter, boolean excludeSource) {
|
||||
super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
||||
super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, isCanKill(toughness) ? Outcome.UnboostCreature : Outcome.BoostCreature);
|
||||
this.power = power;
|
||||
this.toughness = toughness;
|
||||
this.filter = filter;
|
||||
|
|
|
@ -34,6 +34,8 @@ import mage.Constants.Outcome;
|
|||
import mage.Constants.SubLayer;
|
||||
import mage.abilities.Ability;
|
||||
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.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.game.Game;
|
||||
|
@ -61,7 +63,7 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl<BoostEnchantedEff
|
|||
}
|
||||
|
||||
public BoostEnchantedEffect(DynamicValue power, DynamicValue toughness, Duration duration) {
|
||||
super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
||||
super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, isCanKill(toughness) ? Outcome.UnboostCreature : Outcome.BoostCreature);
|
||||
this.power = power;
|
||||
this.toughness = toughness;
|
||||
setText();
|
||||
|
@ -78,6 +80,20 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl<BoostEnchantedEff
|
|||
return new BoostEnchantedEffect(this);
|
||||
}
|
||||
|
||||
private 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
|
|
|
@ -20,7 +20,7 @@ public class BoostOpponentsEffect extends ContinuousEffectImpl<BoostOpponentsEff
|
|||
}
|
||||
|
||||
public BoostOpponentsEffect(int power, int toughness, Constants.Duration duration, FilterCreaturePermanent filter) {
|
||||
super(duration, Constants.Layer.PTChangingEffects_7, Constants.SubLayer.ModifyPT_7c, Constants.Outcome.BoostCreature);
|
||||
super(duration, Constants.Layer.PTChangingEffects_7, Constants.SubLayer.ModifyPT_7c, toughness < 0 ? Constants.Outcome.UnboostCreature : Constants.Outcome.BoostCreature);
|
||||
this.power = power;
|
||||
this.toughness = toughness;
|
||||
this.filter = filter;
|
||||
|
|
|
@ -34,8 +34,6 @@ import mage.Constants.SubLayer;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
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.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.game.Game;
|
||||
|
@ -79,20 +77,6 @@ public class BoostTargetEffect extends ContinuousEffectImpl<BoostTargetEffect> {
|
|||
this.lockedIn = effect.lockedIn;
|
||||
}
|
||||
|
||||
private 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoostTargetEffect copy() {
|
||||
return new BoostTargetEffect(this);
|
||||
|
|
Loading…
Reference in a new issue