mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -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,8 +74,12 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
|
||||||
|
|
||||||
for (T ability:this) {
|
for (T ability:this) {
|
||||||
if (!(ability instanceof SpellAbility || ability instanceof PlayLandAbility)) {
|
if (!(ability instanceof SpellAbility || ability instanceof PlayLandAbility)) {
|
||||||
|
if (ability.getRuleAtTheTop()) {
|
||||||
|
rules.add(0, ability.getRule());
|
||||||
|
} else {
|
||||||
rules.add(ability.getRule());
|
rules.add(ability.getRule());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (ability instanceof SpellAbility) {
|
if (ability instanceof SpellAbility) {
|
||||||
String kickerRule = getKickerRule(ability);
|
String kickerRule = getKickerRule(ability);
|
||||||
if (!kickerRule.isEmpty()) {
|
if (!kickerRule.isEmpty()) {
|
||||||
|
|
|
||||||
|
|
@ -365,4 +365,18 @@ public interface Ability extends Controllable, Serializable {
|
||||||
*/
|
*/
|
||||||
public boolean isInUseableZone(Game game, MageObject source, boolean checkLKI);
|
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 Zone zone;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected boolean usesStack = true;
|
protected boolean usesStack = true;
|
||||||
|
protected boolean ruleAtTheTop = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract T copy();
|
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.alternativeCosts.add((AlternativeCost)cost.copy());
|
||||||
}
|
}
|
||||||
this.modes = ability.modes.copy();
|
this.modes = ability.modes.copy();
|
||||||
|
this.ruleAtTheTop = ability.ruleAtTheTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -507,4 +509,15 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getRule();
|
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() {
|
public boolean isCopy() {
|
||||||
return false;
|
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