[CLB] Implement Minthara, Merciless Soul (#9972)

This commit is contained in:
Grath 2023-02-12 14:24:23 -05:00 committed by GitHub
parent 6a4ead88e2
commit 7172027cde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 165 additions and 9 deletions

View file

@ -9,7 +9,9 @@ import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -26,7 +28,7 @@ public class BoostAllEffect extends ContinuousEffectImpl {
protected DynamicValue power;
protected DynamicValue toughness;
protected boolean excludeSource;
protected FilterCreaturePermanent filter;
protected FilterPermanent filter;
public BoostAllEffect(int power, int toughness, Duration duration) {
this(power, toughness, duration, false);
@ -62,6 +64,28 @@ public class BoostAllEffect extends ContinuousEffectImpl {
}
}
public BoostAllEffect(int power, int toughness, Duration duration, FilterControlledCreaturePermanent filter, boolean excludeSource) {
this(StaticValue.get(power), StaticValue.get(toughness), duration, filter, excludeSource);
}
public BoostAllEffect(DynamicValue power, DynamicValue toughness, Duration duration, FilterControlledCreaturePermanent filter, boolean excludeSource) {
this(power, toughness, duration, filter, excludeSource, null);
}
public BoostAllEffect(DynamicValue power, DynamicValue toughness, Duration duration, FilterControlledCreaturePermanent filter, boolean excludeSource, String rule) {
super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, CardUtil.getBoostOutcome(power, toughness));
this.power = power;
this.toughness = toughness;
this.filter = filter;
this.excludeSource = excludeSource;
if (rule == null || rule.isEmpty()) {
setText();
} else {
this.staticText = rule;
}
}
public BoostAllEffect(final BoostAllEffect effect) {
super(effect);
this.power = effect.power;

View file

@ -3,6 +3,7 @@ package mage.abilities.keyword;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.common.CounterUnlessPaysEffect;
import mage.constants.Zone;
import mage.game.Game;
@ -18,7 +19,10 @@ import mage.util.CardUtil;
public class WardAbility extends TriggeredAbilityImpl {
private final Cost cost;
private final DynamicValue genericMana;
private final boolean showAbilityHint;
private final String whereXIs;
public WardAbility(Cost cost) {
this(cost, true);
@ -27,13 +31,34 @@ public class WardAbility extends TriggeredAbilityImpl {
public WardAbility(Cost cost, boolean showAbilityHint) {
super(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(cost), false);
this.cost = cost;
this.genericMana = null;
this.showAbilityHint = showAbilityHint;
this.whereXIs = null;
}
public WardAbility(DynamicValue genericMana) {
this(genericMana, null);
}
public WardAbility(DynamicValue genericMana, String whereXIs) {
super(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(genericMana), false);
this.genericMana = genericMana;
this.whereXIs = whereXIs;
this.cost = null;
this.showAbilityHint = false;
}
private WardAbility(final WardAbility ability) {
super(ability);
this.cost = ability.cost.copy();
if (ability.cost != null) {
this.cost = ability.cost.copy();
this.genericMana = null;
} else {
this.genericMana = ability.genericMana.copy();
this.cost = null;
}
this.showAbilityHint = ability.showAbilityHint;
this.whereXIs = ability.whereXIs;
}
@Override
@ -75,21 +100,36 @@ public class WardAbility extends TriggeredAbilityImpl {
@Override
public String getRule() {
StringBuilder sb = new StringBuilder("ward");
if (cost instanceof ManaCost) {
sb.append(' ').append(cost.getText());
if (cost != null) {
if (cost instanceof ManaCost) {
sb.append(' ').append(cost.getText());
} else {
sb.append("—").append(CardUtil.getTextWithFirstCharUpperCase(cost.getText())).append('.');
}
} else {
sb.append("—").append(CardUtil.getTextWithFirstCharUpperCase(cost.getText())).append('.');
sb.append(" {X}");
if (whereXIs != null) {
sb.append(", where X is ").append(whereXIs).append('.');
}
}
if (showAbilityHint) {
sb.append(" <i>(Whenever this creature becomes the target of a spell or ability an opponent controls, " +
"counter it unless that player ");
if (cost instanceof ManaCost) {
sb.append("pays ").append(cost.getText());
if (cost != null) {
if (cost instanceof ManaCost) {
sb.append("pays ").append(cost.getText());
} else {
sb.append(cost.getText().replace("pay ", "pays "));
}
sb.append(".)</i>");
} else {
sb.append(cost.getText().replace("pay ", "pays "));
sb.append("pays {X}");
if (whereXIs != null) {
sb.append(whereXIs);
}
sb.append(".)</i>");
}
sb.append(".)</i>");
}
return sb.toString();