static public ArrayList<Ability_Mana> sortForNeeded(ManaCost cost, ArrayList<Ability_Mana> manaAbilities, Player player) {

        ArrayList<String> colors;

        ArrayList<Ability_Mana> res = new ArrayList<Ability_Mana>();

        ManaCost onlyColored = new ManaCost(cost.toString());

        onlyColored.removeColorlessMana();

        for (Ability_Mana am : manaAbilities) {
            colors = getProduceableColors(am, player);
            for (int j = 0; j < colors.size(); j++) {
                if (onlyColored.isNeeded(colors.get(j))) {
                    res.add(am);
                    break;
                }
            }
        }

        for (Ability_Mana am : manaAbilities) {

            if (res.contains(am)) break;

            colors = getProduceableColors(am, player);
            for (int j = 0; j < colors.size(); j++) {
                if (cost.isNeeded(colors.get(j))) {
                    res.add(am);
                    break;
                }
            }
        }

        return res;
    }