mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Some clean up with rule handling.
This commit is contained in:
parent
50e0a2c2a8
commit
bd20994f25
3 changed files with 20 additions and 17 deletions
|
@ -109,22 +109,24 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
|
|||
public String getRule() {
|
||||
String superRule = super.getRule(true);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String ruleLow = superRule.toLowerCase();
|
||||
if (optional && !ruleLow.startsWith("you ")) {
|
||||
if (this.getTargets().isEmpty()
|
||||
|| ruleLow.startsWith("exile")
|
||||
|| ruleLow.startsWith("destroy")
|
||||
|| ruleLow.startsWith("return")
|
||||
|| ruleLow.startsWith("tap")
|
||||
|| ruleLow.startsWith("untap")) {
|
||||
sb.append("you may ");
|
||||
} else {
|
||||
sb.append("you may have ");
|
||||
}
|
||||
if (!superRule.isEmpty()) {
|
||||
String ruleLow = superRule.toLowerCase();
|
||||
if (optional && !ruleLow.startsWith("you ")) {
|
||||
if (this.getTargets().isEmpty()
|
||||
|| ruleLow.startsWith("exile")
|
||||
|| ruleLow.startsWith("destroy")
|
||||
|| ruleLow.startsWith("return")
|
||||
|| ruleLow.startsWith("tap")
|
||||
|| ruleLow.startsWith("untap")) {
|
||||
sb.append("you may ");
|
||||
} else {
|
||||
sb.append("you may have ");
|
||||
}
|
||||
|
||||
}
|
||||
sb.append(superRule.substring(0, 1).toLowerCase());
|
||||
sb.append(superRule.substring(1));
|
||||
}
|
||||
sb.append(superRule.substring(0, 1).toLowerCase());
|
||||
sb.append(superRule.substring(1));
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
@ -28,13 +28,14 @@
|
|||
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* Is applied when the {@link Permanent} with this ability instance changes zones.
|
||||
|
@ -81,7 +82,7 @@ public class ZoneChangeTriggeredAbility<T extends ZoneChangeTriggeredAbility<T>>
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return rule + super.getRule();
|
||||
return new StringBuilder(rule).append(super.getRule()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -78,6 +78,6 @@ public class ConditionalActivatedAbility extends ActivatedAbilityImpl<Conditiona
|
|||
if (ruleText != null && !ruleText.isEmpty()) {
|
||||
return ruleText;
|
||||
}
|
||||
return new StringBuilder(super.getRule()).append(" Activate this ability only if ").append(condition.toString()).append(".").toString();
|
||||
return new StringBuilder(super.getRule()).append(" Activate this ability only ").append(condition.toString()).append(".").toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue