mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Prevent returning ability that can't be played
This commit is contained in:
@@ -80,9 +80,12 @@ public abstract class Ability extends SpellAbility {
|
||||
}
|
||||
|
||||
public static final Ability PLAY_LAND_SURROGATE = new Ability(null, (Cost)null){
|
||||
@Override
|
||||
public boolean canPlay() {
|
||||
return true; //if this ability is added anywhere, it can be assummed that land can be played
|
||||
}
|
||||
@Override
|
||||
public void resolve() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new RuntimeException("This ability is intended to indicate \"land to play\" choice only");
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -105,9 +105,12 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
return null;
|
||||
}
|
||||
if (abilities.size() == 1 && !abilities.get(0).promptIfOnlyPossibleAbility()) {
|
||||
return abilities.get(0);
|
||||
if (abilities.get(0).canPlay()) {
|
||||
return abilities.get(0); //only return ability if it's playable, otherwise return null
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//show menu if mouse was trigger for ability
|
||||
final JPopupMenu menu = new JPopupMenu("Abilities");
|
||||
|
||||
@@ -120,7 +123,7 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
public void run() {
|
||||
CMessage.SINGLETON_INSTANCE.getInputControl().selectAbility(ab);
|
||||
}
|
||||
}, ab.getActivatingPlayer() == null || ab.canPlay()); //check getActivatingPlayer() to account for playing lands
|
||||
}, ab.canPlay());
|
||||
shortcut++;
|
||||
if (shortcut > KeyEvent.VK_9) {
|
||||
shortcut = 0; //stop adding shortcuts after 9
|
||||
|
||||
Reference in New Issue
Block a user