public Card[] pickCards(SelectCardOptions sco, Card[] allcards) {
        GameQuery p = new GameQuery(QueryType.GETCARD, QueryType.CARD)
        	.setInteger(sco.count)
        	.setBoolean(sco.exactly)
        	.setString(sco.header)
        	.setObject(sco);
        
        p = query(p);
        if (p == null)
        	return null;
        else if (p.i == 0)
        	return null;
		else if (p.o instanceof Card[] || p.o instanceof String[]) {
			String[] selected = new String[0];
			if (p.o instanceof Card[]) {
				ArrayList<String> a = new ArrayList<String>();
				for (Card c : (Card[]) p.o) 
					a.add(c.getName());
				selected = a.toArray(new String[0]);
			} else
				selected = (String[])p.o;
			
			ArrayList<Card> ret = new ArrayList<Card>();
			ArrayList<Card> all = new ArrayList<Card>(Arrays.asList(allcards));
			for (int i = 0; i < selected.length; i++) {
				for (int j = 0; j < all.size(); j++) {
					if (all.get(j).equals(selected[i])) {
						ret.add(all.get(j));
						all.remove(j);
						break;
					}
				}
			}
			return ret.toArray(new Card[0]);
		}
        
        return null;
    }