adjust some text, cleanup some variable access

This commit is contained in:
xenohedron 2024-04-12 20:08:26 -04:00
parent 8271686cb4
commit 577a3708fc
9 changed files with 25 additions and 34 deletions

View file

@ -10,22 +10,22 @@ import mage.game.Game;
*/
public abstract class DelayedTriggeredAbility extends TriggeredAbilityImpl {
private Duration duration;
private final Duration duration;
protected boolean triggerOnlyOnce;
public DelayedTriggeredAbility(Effect effect) {
protected DelayedTriggeredAbility(Effect effect) {
this(effect, Duration.EndOfGame);
}
public DelayedTriggeredAbility(Effect effect, Duration duration) {
protected DelayedTriggeredAbility(Effect effect, Duration duration) {
this(effect, duration, true);
}
public DelayedTriggeredAbility(Effect effect, Duration duration, boolean triggerOnlyOnce) {
protected DelayedTriggeredAbility(Effect effect, Duration duration, boolean triggerOnlyOnce) {
this(effect, duration, triggerOnlyOnce, false);
}
public DelayedTriggeredAbility(Effect effect, Duration duration, boolean triggerOnlyOnce, boolean optional) {
protected DelayedTriggeredAbility(Effect effect, Duration duration, boolean triggerOnlyOnce, boolean optional) {
super(Zone.ALL, effect, optional);
this.duration = duration;
this.triggerOnlyOnce = triggerOnlyOnce;

View file

@ -23,8 +23,8 @@ import java.util.UUID;
*/
public abstract class TriggeredAbilityImpl extends AbilityImpl implements TriggeredAbility {
protected boolean optional;
protected boolean leavesTheBattlefieldTrigger;
private boolean optional;
private boolean leavesTheBattlefieldTrigger;
private boolean triggersOnceEachTurn = false;
private boolean doOnlyOnceEachTurn = false;
protected boolean replaceRuleText = false; // if true, replace "{this}" with "it" in effect text
@ -243,6 +243,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
return ruleLow.startsWith("attach")
|| ruleLow.startsWith("change")
|| ruleLow.startsWith("counter")
|| ruleLow.startsWith("create")
|| ruleLow.startsWith("destroy")
|| ruleLow.startsWith("distribute")
|| ruleLow.startsWith("sacrifice")
@ -367,9 +368,8 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
public TriggeredAbility setOptional() {
this.optional = true;
if (getEffects().stream().filter(
effect -> effect instanceof DoIfCostPaid && (this.optional && ((DoIfCostPaid) effect).isOptional()))
.findAny().isPresent()) {
if (getEffects().stream().anyMatch(
effect -> effect instanceof DoIfCostPaid && ((DoIfCostPaid) effect).isOptional())) {
throw new IllegalArgumentException(
"DoIfCostPaid effect must have only one optional settings, but it have two (trigger + DoIfCostPaid): "
+ this.getClass().getSimpleName());

View file

@ -48,12 +48,8 @@ public class AttacksWithCreaturesTriggeredAbility extends TriggeredAbilityImpl {
if (minAttackers == 1 && StaticFilters.FILTER_PERMANENT_CREATURES.equals(filter)) {
setTriggerPhrase("Whenever you attack, ");
} else {
StringBuilder sb = new StringBuilder("Whenever you attack with ");
sb.append(CardUtil.numberToText(minAttackers));
sb.append(" or more ");
sb.append(filter.getMessage());
sb.append(", ");
setTriggerPhrase(sb.toString());
setTriggerPhrase("Whenever you attack with " + CardUtil.numberToText(minAttackers)
+ " or more " + filter.getMessage() + ", ");
}
}