Added a method to set the rule of an ability to the top of the rules shown in the tooltip.

This commit is contained in:
LevelX2 2012-11-29 07:43:15 +01:00
parent c2360036f3
commit d7ad639439
4 changed files with 42 additions and 1 deletions

View file

@ -74,8 +74,12 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
for (T ability:this) {
if (!(ability instanceof SpellAbility || ability instanceof PlayLandAbility)) {
if (ability.getRuleAtTheTop()) {
rules.add(0, ability.getRule());
} else {
rules.add(ability.getRule());
}
}
if (ability instanceof SpellAbility) {
String kickerRule = getKickerRule(ability);
if (!kickerRule.isEmpty()) {

View file

@ -365,4 +365,18 @@ public interface Ability extends Controllable, Serializable {
*/
public boolean isInUseableZone(Game game, MageObject source, boolean checkLKI);
/**
* Returns true if this ability has to be shown on top of the card.
*
* @return
*/
public boolean getRuleAtTheTop();
/**
* Sets the value for the ruleAtTheTop attribute
*
* @param ruleAtTheTop
*/
public void setRuleAtTheTop(boolean ruleAtTheTop);
}

View file

@ -75,6 +75,7 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
protected Zone zone;
protected String name;
protected boolean usesStack = true;
protected boolean ruleAtTheTop = false;
@Override
public abstract T copy();
@ -108,6 +109,7 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
this.alternativeCosts.add((AlternativeCost)cost.copy());
}
this.modes = ability.modes.copy();
this.ruleAtTheTop = ability.ruleAtTheTop;
}
@Override
@ -507,4 +509,15 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
public String toString() {
return getRule();
}
@Override
public boolean getRuleAtTheTop() {
return ruleAtTheTop;
}
@Override
public void setRuleAtTheTop(boolean ruleAtTheTop) {
this.ruleAtTheTop = ruleAtTheTop;
}
}

View file

@ -362,4 +362,14 @@ public class StackAbility implements StackObject, Ability {
public boolean isCopy() {
return false;
}
@Override
public boolean getRuleAtTheTop() {
return this.ability.getRuleAtTheTop();
}
@Override
public void setRuleAtTheTop(boolean ruleAtTheTop) {
this.ability.setRuleAtTheTop(ruleAtTheTop);
}
}