/// <summary> /// Rool dices /// </summary> /// <param name="launcher">the player who rool dices</param> public void RoolDices(Player launcher) { // Define the launcher if ((this.CurrentLauncher.Id != launcher.Id)) { this.CurrentLauncher = launcher; this.NumberOfRool = 0; this.PlayerCanBeRaise = true; } if (!PlayerCanBeRaise) { EventNotifyMessage("Vous ne pouvez pas relancer les dés !"); } else if (NumberOfRool >= Config.NB_MAX_LAUNCH_DICES - 1) { this.PlayerCanBeRaise = false; launcher.InJail = true; EventNotifyMessage("Vous avez réalisé trop de lancé double. Vous allez en prison."); EventMovePlayerToCell(CurrentLauncher, BoardHandler.Instance.Board.GetCell(Config.JAIL_POSITION), false); } else { this.NumberOfRool++; FirstDice.Rool(); SecondDice.Rool(); if (IsDouble()) { if ((this.CurrentLauncher.InJail)) { CurrentLauncher.NbTurnInJail = 0; this.CurrentLauncher.InJail = false; this.PlayerCanBeRaise = true; EventNotifyAlertMessage("Vous êtes libéré de prison !", AlertDialog.TypeOfAlert.INFO); EventMovePlayer(CurrentLauncher, GetValue(), true); } else { this.PlayerCanBeRaise = true; EventMovePlayer(CurrentLauncher, GetValue(), true); } } else { if (this.CurrentLauncher.InJail) { CurrentLauncher.NbTurnInJail += 1; this.PlayerCanBeRaise = false; EventNotifyAlertMessage("Vous êtes toujours en prison !", AlertDialog.TypeOfAlert.INFO); } else { this.PlayerCanBeRaise = false; EventMovePlayer(CurrentLauncher, GetValue(), true); } } } }
public void RollDices() { FirstDice.RollDice(random); SecondDice.RollDice(random); if (FirstDice.Value == SecondDice.Value) { IsDouble = true; } else { IsDouble = false; } }