Ejemplo n.º 1
0
  public ArrayList<Minion> getDeckFromPlayer(String deckname, long playerid, boolean iswhite) {
    ArrayList<Minion> deck = new ArrayList<Minion>();
    Statement stmt;
    ArrayList<SmallCard> cards = new ArrayList<SmallCard>();
    try {
      stmt = connection.createStatement();
      String sql =
          "SELECT * FROM decks Where owner= " + playerid + " AND name = '" + deckname + "';";
      ResultSet rs = stmt.executeQuery(sql);
      String cs = "";
      if (rs.next()) {
        cs = rs.getString(6);
      }
      String inlist = "(";
      boolean added = false;
      for (String c : cs.split(",")) {
        if (added) inlist += ",";
        inlist += c;
        added = true;
      }
      inlist += ")";

      sql = "SELECT rowid,* FROM cards Where owner= " + playerid + " AND rowid IN " + inlist + ";";
      rs = stmt.executeQuery(sql);

      while (rs.next()) {
        SmallCard d = new SmallCard();
        // ( typeId int, owner int, tradeable int, level int)
        d.cardid = rs.getLong(1);
        d.typeid = rs.getInt(2);
        d.owner = rs.getLong(3);
        d.tradeable = rs.getInt(4);
        d.level = rs.getInt(5);
        cards.add(d);
      }
      stmt.close();

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    CardDB cdb = CardDB.getInstance();

    UColor colw = UColor.black;
    if (iswhite) colw = UColor.white;
    for (SmallCard sc : cards) {
      Minion m = new Minion(cdb.cardId2Card.get(sc.typeid), sc.cardid, colw);
      m.lvl = sc.level;
      deck.add(m);
    }

    return deck;
  }
Ejemplo n.º 2
0
  public void onCardPlay(Board b, UColor player, ArrayList<UPosition> targets, Minion playedCard) {

    Minion target = b.getMinionOnPosition(targets.get(0));
    target.buffMinionWithoutMessage(3, 0, 0, b);
    target.addnewEnchantments(
        "BUFF",
        "Focus",
        playedCard.card.cardDescription,
        playedCard.card,
        b,
        playedCard.position.color);

    return;
  }
Ejemplo n.º 3
0
 public void onCardPlay(Board b, UColor player, ArrayList<UPosition> targets, Minion playedCard) {
   Minion target = b.getMinionOnPosition(targets.get(0));
   target.addCardAsEnchantment(
       "ENCHANTMENT", "Morbid Curiosity", playedCard.card.cardDescription, playedCard, b);
   return;
 }