public boolean isButtonEnabled(int skill, Player player) { if (player == null) return false; if (player.hasSkill(skill)) return false; if (player.getSkillPoints() < getSkillXpCost(skill, player)) return false; if (!hasRequiredSkills(skill, player)) return false; return true; }
private boolean hasRequiredSkills(int skill, Player player) { String prereqs = skillPrereqs[skill]; for (int i = 0; i < prereqs.length(); i++) { int prereqIndex = prereqs.charAt(i) - 65; if (!player.hasSkill(prereqIndex)) return false; } return true; }
public boolean isButtonSelected(int skill, Player player) { return (player != null && player.hasSkill(skill)); }