public void setAllCardPositions(Player watcher) { allRowLines.Clear(); int cardAllignOffset = 4; for (int i = 0; i < _context.players.Count; ++i) { Player p = _context.players[i]; int playerCardAllignLeft = Utils.fieldStartHorizontal + i * Utils.fieldPerPlayerHorizontal; int currentLine = Utils.fieldStartVerticalOffset; List <int> rowLines = new List <int>(); for (int row = 0; row < 3; ++row) { rowLines.Add(currentLine + 1); currentLine += 2; foreach (Card u in Select.Cards(_context.cards, Filter.anyCardHostByPlayerIn(Place.battlefield, p))) { if (u as Unit != null && (u as Unit).row == row) { u._show.setPosition(new Point(playerCardAllignLeft + cardAllignOffset + 2, currentLine++)); } } } allRowLines.Add(rowLines); // rest == non-battlefield List <int> linesForPlaces = new List <int>(); List <int> cardsInPlaces = new List <int>(); foreach (Place place in Utils.allPlaces) { if (place != Place.battlefield) { // skip 1 line each separation linesForPlaces.Add(currentLine + 1); currentLine += 2; int cardsInPlace = 0; bool lastWasInvisible = false; foreach (Card c in Select.Cards(_context.cards, Filter.anyCardHostByPlayerIn(place, p))) { if (lastWasInvisible && !c.isVisibleTo(watcher)) { currentLine--; } c._show.setPosition(new Point(playerCardAllignLeft + cardAllignOffset, currentLine)); currentLine++; cardsInPlace++; lastWasInvisible = !c.isVisibleTo(watcher); } cardsInPlaces.Add(cardsInPlace); //if (cardsInPlace == 0 && place != Place.deck) // linesForPlaces[linesForPlaces.Count - 1] = -1; } } // indexes changes to ignore battlefield for (int j = 0; j < linesForPlaces.Count; ++j) { clearLine(i, linesForPlaces[j] - 1, linesForPlaces[j]); Console.SetCursorPosition(playerCardAllignLeft, linesForPlaces[j] + Utils.fieldStartVerticalOffset); swapColor(_lightPlayerColors[i], ConsoleColor.White); if (linesForPlaces[j] < 0) { continue; } if (cardsInPlaces[j] > 0) { Console.Write(String.Format("{0}'s {1}:{2}", p, Utils.allPlaces[j + 1], String.Format(" <{0}>", cardsInPlaces[j]))); } popColor(); } } updateAllRowWeatherAndValues(); }
public static double meanTopdeckValue(Card asker) { return(meanPlayValue(Select.Cards(asker.context.cards, Filter.anyCardInBaseHostDeck(asker)))); }