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

@ -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());