[LTC] Implement Summons of Saruman (#10720)

* [LTC] Implement Summons of Saruman

* fix constructor for Assault on Osgiliath

* fix verify failure

* refactoring a couple more Amass X
This commit is contained in:
Susucre 2023-08-01 15:51:06 +02:00 committed by GitHub
parent 1c5829f16b
commit 241226cd83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 160 additions and 101 deletions

View file

@ -1,7 +1,6 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
@ -28,7 +27,7 @@ public class MillCardsControllerEffect extends OneShotEffect {
setText();
}
public MillCardsControllerEffect(final MillCardsControllerEffect effect) {
private MillCardsControllerEffect(final MillCardsControllerEffect effect) {
super(effect);
this.numberCards = effect.numberCards;
}

View file

@ -1,6 +1,8 @@
package mage.abilities.effects.keyword;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect;
import mage.constants.Duration;
@ -33,22 +35,34 @@ public class AmassEffect extends OneShotEffect {
filter.add(SubType.ARMY.getPredicate());
}
private final int amount;
private final DynamicValue amount;
private final SubType subType;
public AmassEffect(int amount, SubType subType) {
this(StaticValue.get(amount), subType);
}
public AmassEffect(DynamicValue amount, SubType subType) {
this(amount, subType, true);
}
public AmassEffect(DynamicValue amount, SubType subType, boolean withReminder) {
super(Outcome.BoostCreature);
this.amount = amount;
this.amount = amount.copy();
this.subType = subType;
staticText = "amass " + subType + "s " + amount + ". <i>(Put " + CardUtil.numberToText(amount) +
" +1/+1 counter" + (amount > 1 ? "s " : " ") + "on an Army you control. It's also " +
subType.getIndefiniteArticle() + ' ' + subType + ". If you don't control an Army, " +
"create a 0/0 black " + subType + " Army creature token first.)</i>";
staticText = "amass " + subType + "s " + amount + ".";
if (withReminder) {
staticText += " <i>(Put " + CardUtil.numberToText(amount.toString(), "a")
+ " +1/+1 counter" + (amount.toString().equals("1") ? " " : "s ") + "on an Army you control. It's also "
+ subType.getIndefiniteArticle() + ' ' + subType + ". If you don't control an Army, "
+ "create a 0/0 black " + subType + " Army creature token first.)</i>";
}
}
private AmassEffect(final AmassEffect effect) {
super(effect);
this.amount = effect.amount;
this.amount = effect.amount.copy();
this.subType = effect.subType;
}
@ -59,7 +73,7 @@ public class AmassEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
return doAmass(amount, subType, game, source) != null;
return doAmass(amount.calculate(game, source, this), subType, game, source) != null;
}
private static Token makeToken(SubType subType) {