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

@ -11,6 +11,7 @@ import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SpellAbilityType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -44,11 +45,8 @@ public final class BeckCall extends SplitCard {
class BeckTriggeredAbility extends DelayedTriggeredAbility {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
public BeckTriggeredAbility() {
super(new DrawCardSourceControllerEffect(1), Duration.EndOfTurn, false);
optional = true;
BeckTriggeredAbility() {
super(new DrawCardSourceControllerEffect(1), Duration.EndOfTurn, false, true);
}
private BeckTriggeredAbility(final BeckTriggeredAbility ability) {
@ -64,7 +62,7 @@ class BeckTriggeredAbility extends DelayedTriggeredAbility {
public boolean checkTrigger(GameEvent event, Game game) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
return filter.match(permanent, getControllerId(), this, game);
return StaticFilters.FILTER_PERMANENT_CREATURE.match(permanent, getControllerId(), this, game);
}
@Override

View file

@ -39,9 +39,8 @@ public final class BredForTheHunt extends CardImpl {
class BredForTheHuntTriggeredAbility extends TriggeredAbilityImpl {
public BredForTheHuntTriggeredAbility() {
super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1));
this.optional = true;
BredForTheHuntTriggeredAbility() {
super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), true);
}
private BredForTheHuntTriggeredAbility(final BredForTheHuntTriggeredAbility ability) {

View file

@ -82,7 +82,7 @@ class OwenGradyRaptorTrainerEffect extends OneShotEffect {
} else if (i == choices.size()-1){
separator = "";
}
sb.append(choicesArray[i]).append(separator);
sb.append(choicesArray[i].toLowerCase()).append(separator);
}
return sb.toString();
}

View file

@ -53,9 +53,8 @@ class RiteOfHarmonyTriggeredAbility extends DelayedTriggeredAbility {
filter.add(Predicates.or(CardType.CREATURE.getPredicate(), CardType.ENCHANTMENT.getPredicate()));
}
public RiteOfHarmonyTriggeredAbility() {
RiteOfHarmonyTriggeredAbility() {
super(new DrawCardSourceControllerEffect(1), Duration.EndOfTurn, false);
optional = false;
}
private RiteOfHarmonyTriggeredAbility(final RiteOfHarmonyTriggeredAbility ability) {
@ -83,4 +82,4 @@ class RiteOfHarmonyTriggeredAbility extends DelayedTriggeredAbility {
public String getRule() {
return "Whenever a creature or enchantment enters the battlefield under your control this turn, draw a card.";
}
}
}

View file

@ -53,7 +53,7 @@ public class ShaunFatherOfSynths extends CardImpl {
Effect effect = new CreateTokenCopyTargetEffect(
null, null,
false, 1, true, true)
.setPermanentModifier((token) -> {
.setPermanentModifier(token -> {
token.removeSuperType(SuperType.LEGENDARY);
token.addCardType(CardType.CREATURE);
token.addCardType(CardType.ARTIFACT);
@ -78,4 +78,4 @@ public class ShaunFatherOfSynths extends CardImpl {
return new ShaunFatherOfSynths(this);
}
}
}

View file

@ -58,9 +58,8 @@ class VerdantSuccessionTriggeredAbility extends TriggeredAbilityImpl {
filter.add(TokenPredicate.FALSE);
}
public VerdantSuccessionTriggeredAbility() {
super(Zone.BATTLEFIELD, new VerdantSuccessionEffect());
this.optional = true;
VerdantSuccessionTriggeredAbility() {
super(Zone.BATTLEFIELD, new VerdantSuccessionEffect(), true);
}
private VerdantSuccessionTriggeredAbility(final VerdantSuccessionTriggeredAbility ability) {

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() + ", ");
}
}