public void TrashExcludeTrump(ITrash trash) { cards.Where(c => !c.Action.IsTrump) .ForEach(c => { trash.TrashCard(c); }); cards.RemoveAll(c => !c.Action.IsTrump); }
// ボードを作成する public void MakeBoard(bool isPlayer1) { CurrentPhase = Phase.Start; Player1 = new Player(true, rule); Player2 = new Player(false, rule); cardSet = new CardSet.Factory(this).CreateClassic(); deck = new Deck(); trash = new Trash(); deck.AppendCards(cardSet.EnumerateNormalCards().Shuffle(randGen)); deck.AppendTrumps(cardSet.EnumerateTrumps().Shuffle(randGen)); MyPlayer = isPlayer1 ? Player1 : Player2; currentIndex = -1; }
public void OnTurnEnd(ITrash trash) { // 現時点のペナルティカードを全てゴミ箱へ movePenarty.Concat(actionPenarty) .Where(c => c != null) .Distinct() .Where(c => !c.Action.IsTrump) // 切り札は捨てない .ForEach(c => { trash.TrashCard(c); }); // ペナルティをクリア for (int i = 0; i < movePenarty.Length; ++i) { movePenarty[i] = null; actionPenarty[i] = null; } // actionにプロットされているペナルティを反映 for (int i = 0; i < actionPlot.Length; ++i) { if (actionPlot[i] == null) { continue; } if (actionPlot[i].Action.PenartyMove) { movePenarty[i] = actionPlot[i]; } if (actionPlot[i].Action.PenartyAction) { actionPenarty[i] = actionPlot[i]; } } // プロットをクリア for (int i = 0; i < movePlot.Length; ++i) { movePlot[i] = null; actionPlot[i] = null; } }
/// <summary> /// Unregister trash. /// </summary> public static void RemoveTrash(ITrash trash) { Instance(true)?.trash.Remove(trash); }
/// <summary> /// Register trash. /// </summary> public static void AddTrash(ITrash trash) { Instance()?.trash.Add(trash); }