mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +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,6 +109,7 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
String superRule = super.getRule(true);
|
String superRule = super.getRule(true);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
if (!superRule.isEmpty()) {
|
||||||
String ruleLow = superRule.toLowerCase();
|
String ruleLow = superRule.toLowerCase();
|
||||||
if (optional && !ruleLow.startsWith("you ")) {
|
if (optional && !ruleLow.startsWith("you ")) {
|
||||||
if (this.getTargets().isEmpty()
|
if (this.getTargets().isEmpty()
|
||||||
|
@ -125,6 +126,7 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
|
||||||
}
|
}
|
||||||
sb.append(superRule.substring(0, 1).toLowerCase());
|
sb.append(superRule.substring(0, 1).toLowerCase());
|
||||||
sb.append(superRule.substring(1));
|
sb.append(superRule.substring(1));
|
||||||
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,14 @@
|
||||||
|
|
||||||
package mage.abilities.common;
|
package mage.abilities.common;
|
||||||
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is applied when the {@link Permanent} with this ability instance changes zones.
|
* Is applied when the {@link Permanent} with this ability instance changes zones.
|
||||||
|
@ -81,7 +82,7 @@ public class ZoneChangeTriggeredAbility<T extends ZoneChangeTriggeredAbility<T>>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return rule + super.getRule();
|
return new StringBuilder(rule).append(super.getRule()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -78,6 +78,6 @@ public class ConditionalActivatedAbility extends ActivatedAbilityImpl<Conditiona
|
||||||
if (ruleText != null && !ruleText.isEmpty()) {
|
if (ruleText != null && !ruleText.isEmpty()) {
|
||||||
return ruleText;
|
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