public void RenderMeeple(Meeple m, bool BlankOld = true) { if (!Enabled) { return; } if (BlankOld) { MarkCard(m.X, m.Y, .3, Brushes.White, false); } MarkCard(m.X, m.Y, .2, new SolidBrush(m.Player.Color), false); if (BlankOld) { Refresh(); } }
public void ChooseCard(ListBox LB, int index) { if (Sim.CurrentPlayer != index) { lblInstruction.Text = "Not your cards! use other box!"; return; } Card ChosenCard; try { ChosenCard = (Card)LB.SelectedItem; } catch { return; } if (ChosenCard == null) { return; } if (Sim.Board.Players[Sim.CurrentPlayer].Hand.Count(o => o.Type == CardType.PlaceMeeple) > 0) { if (ChosenCard.Type != CardType.PlaceMeeple) { lblInstruction.Text = "You Must choose PlaceMeeple at the start!"; return; } } SelectedCard = ChosenCard; StealthX = -1; StealthY = -1; if (ChosenCard.Type == CardType.PlaceMeeple) { lblInstruction.Text = "Card selected: " + ChosenCard.ToString() + ", now pick a destination!"; SelectedMeeple = Sim.Board.Meeples.First(o => o.X < 0 && o.Player.ID == Sim.CurrentPlayer); } else { lblInstruction.Text = "Card selected: " + ChosenCard.ToString() + ", now pick a meeple!"; } }
private void RenderBox_MouseDown(object sender, MouseEventArgs e) { int TileX = (int)Math.Floor(e.X / Sim.Vis.CWid); int TileY = (int)Math.Floor(e.Y / Sim.Vis.CHit); if (e.Button == MouseButtons.Right) { StealthX = TileX; StealthY = TileY; lblInstruction.Text = "OK! Now Click destination again"; } if (e.Button == MouseButtons.Left) { if (SelectedMeeple == null) { SelectedMeeple = Sim.Board.GetMeepleAt(TileX, TileY); if (SelectedMeeple == null) { return; } if (SelectedMeeple.Player.ID != Sim.CurrentPlayer) { SelectedMeeple = null; lblInstruction.Text = "Thats not yours!"; return; } StealthX = -1; StealthY = -1; lblInstruction.Text = "OK! Now pick a destination!"; if (SelectedCard != null) { var Moves = SelectedCard.PossibleMoves(TileX, TileY, Sim.Board, Sim.CurrentPlayer); foreach (var m in Moves) { Sim.Vis.MarkCard(m.ToX, m.ToY, .1, null, false); } Sim.Vis.Refresh(); } } else { if (SelectedCard == null) { lblInstruction.Text = "No card selected!"; return; } if (SelectedCard.Type == CardType.Stealth && StealthY < 0) { lblInstruction.Text = "Right click a tile to Stealth over! Then Click destination again"; return; } var PossibleMoves = Sim.AllPossibleMoves(Sim.Board.Players[Sim.CurrentPlayer], Sim.Board); var MoveType = SelectedCard; var Score = Sim.Board.Tiles[TileX, TileY].ScoreValue; if (SelectedCard.Type == CardType.Shadow) { MoveType = Sim.Board.ShadowLastPlayedCard; } if (SelectedCard.Type == CardType.Stealth) { Score += Sim.Board.Tiles[StealthX, StealthY].ScoreValue; } var ProposedMove = new PossibleMove() { FromX = SelectedMeeple.X, FromY = SelectedMeeple.Y, ToX = TileX, ToY = TileY, Card = MoveType, Destination = Sim.Board.Tiles[TileX, TileY], isShadow = SelectedCard.Type == CardType.Shadow, FirstX = StealthX, FirstY = StealthY, ScoreValue = Score }; if (PossibleMoves.Contains(ProposedMove)) { Sim.Board.PlayMove(ProposedMove, Sim.Board.Players[Sim.CurrentPlayer]); Sim.WaitForPlayer = false; } else { lblInstruction.Text = "Invalid move!"; return; } } } }