This commit is contained in:
Evan Kranzler 2017-08-22 21:44:14 -04:00
parent 12cedf945d
commit c61651da69
2 changed files with 12 additions and 4 deletions

View file

@ -32,7 +32,6 @@ import mage.abilities.Ability;
import mage.abilities.common.AttacksAttachedTriggeredAbility;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.keyword.EnchantAbility;
@ -53,10 +52,9 @@ import mage.target.common.TargetCreaturePermanent;
public class ThunderousMight extends CardImpl {
public ThunderousMight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
@ -65,8 +63,9 @@ public class ThunderousMight extends CardImpl {
this.addAbility(ability);
// Whenever enchanted creature attacks, it gets +X/+0 until end of turn, where X is your devotion to red.
Effect effect = new BoostEnchantedEffect(new DevotionCount(ColoredManaSymbol.R), new StaticValue(0), Duration.EndOfTurn);
BoostEnchantedEffect effect = new BoostEnchantedEffect(new DevotionCount(ColoredManaSymbol.R), new StaticValue(0), Duration.EndOfTurn);
effect.setText("it gets +X/+0 until end of turn, where X is your devotion to red");
effect.setLockedIn(true);
this.addAbility(new AttacksAttachedTriggeredAbility(effect, AttachmentType.AURA, false));
}

View file

@ -47,6 +47,7 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl {
private DynamicValue power;
private DynamicValue toughness;
private boolean lockedIn = false;
public BoostEnchantedEffect(int power, int toughness) {
this(power, toughness, Duration.WhileOnBattlefield);
@ -81,6 +82,10 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl {
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (lockedIn) {
power = new StaticValue(power.calculate(game, source, this));
toughness = new StaticValue(toughness.calculate(game, source, this));
}
if (affectedObjectsSet) {
// Added boosts of activated or triggered abilities exist independent from the source they are created by
// so a continuous effect for the permanent itself with the attachment is created
@ -113,6 +118,10 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl {
return true;
}
public void setLockedIn(boolean lockedIn) {
this.lockedIn = lockedIn;
}
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append("Enchanted creature gets ");