mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
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:
parent
c2360036f3
commit
d7ad639439
4 changed files with 42 additions and 1 deletions
|
|
@ -74,7 +74,11 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
|
|||
|
||||
for (T ability:this) {
|
||||
if (!(ability instanceof SpellAbility || ability instanceof PlayLandAbility)) {
|
||||
rules.add(ability.getRule());
|
||||
if (ability.getRuleAtTheTop()) {
|
||||
rules.add(0, ability.getRule());
|
||||
} else {
|
||||
rules.add(ability.getRule());
|
||||
}
|
||||
}
|
||||
if (ability instanceof SpellAbility) {
|
||||
String kickerRule = getKickerRule(ability);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue