public void StartRandom( ) { switch (RandomType) { case 1: // 3D6 int Dice1 = DiceMath.Dice6(); int Dice2 = DiceMath.Dice6(); int Dice3 = DiceMath.Dice6(); NumberVal = Dice1 + Dice2 + Dice3; NumberVal *= 5; break; case 2: // 2D6 + 6 int Dice4 = DiceMath.Dice6(); int Dice5 = DiceMath.Dice6(); NumberVal = Dice4 + Dice5 + 6; NumberVal *= 5; break; default: break; } ViewText.text = NumberVal.ToString(); }
public void DisPlayDice3Result() { OutPutResult.text = RandomTimes + "D3 Result : "; int DicesResult = 0; for (int i = 0; i < RandomTimes; i++) { int Dice = DiceMath.Dice3(); DicesResult += Dice; OutPutResult.text += Dice + " "; } OutPutResult.text += " = " + DicesResult; }
public int DiceRewardResult(int ExtraDice, ref string Reason) { List <int> Dices = new List <int>(); Reason = ""; for (int i = 0; i < 2 + ExtraDice; i++) { Dices.Add(DiceMath.Dice10()); Reason += Dices[i] + " "; } if (Dices.Count > 2 && Dices.Where(x => x == 0).ToList().Count >= 2) { Dices.RemoveAll(x => x == 0); Dices.Add(0); } Dices.Sort(); return(DiceMath.Dice100Counting(Dices[0], Dices[1])); }
public int DicePunishmentResult(int ExtraDice, ref string Reason) { List <int> Dices = new List <int>(); Reason = ""; for (int i = 0; i < 2 + ExtraDice; i++) { Dices.Add(DiceMath.Dice10()); Reason += Dices[i] + " "; } Dices.Sort(); if (!(Dices.Count >= 2 && Dices.Where(x => x == 0).ToList().Count >= 2)) { Dices.Reverse(); } return(DiceMath.Dice100Counting(Dices[0], Dices[1])); }
public void DisPlayDicePunishmentResult() { RandomManager.instance.OutPutResult.text = "Result : "; List <int> Dices = new List <int>(); for (int i = 0; i < 2 + ExtraDiceTime; i++) { Dices.Add(DiceMath.Dice10()); RandomManager.instance.OutPutResult.text += Dices[i] + " "; } Dices.Sort(); if (!(Dices.Count >= 2 && Dices.Where(x => x == 0).ToList().Count >= 2)) { Dices.Reverse(); } RandomManager.instance.OutPutResult.text += " Worst Result : "; RandomManager.instance.OutPutResult.text += Dices[0] + " " + Dices[1] + " "; RandomManager.instance.OutPutResult.text += " = " + DiceMath.Dice100Counting(Dices[0], Dices[1]); }
public void OutputResult_6th() { int OurSideVal = int.Parse(OurSideInputField.text); int OpposSideVal = int.Parse(OpposSideInputField.text); int PassVal = (((OurSideVal - OpposSideVal) * 5) + 50); if (PassVal >= 100) { ResultText.text = "100% Pass, No need to roll dice"; return; } else if (PassVal <= 0) { ResultText.text = "100% fail pass, No need to roll dice"; return; } int randomDice = DiceMath.Dice100(); ResultText.text = "Request Below " + PassVal + "% , Dice Result : = " + randomDice + "% :" + (randomDice <= PassVal ? "Passed !" : "Not Passed !"); }
public void DisPlayDiceRewardResult() { RandomManager.instance.OutPutResult.text = "Result : "; List <int> Dices = new List <int>(); for (int i = 0; i < 2 + ExtraDiceTime; i++) { Dices.Add(DiceMath.Dice10()); RandomManager.instance.OutPutResult.text += Dices[i] + " "; } if (Dices.Count > 2 && Dices.Where(x => x == 0).ToList().Count >= 2) { Dices.RemoveAll(x => x == 0); Dices.Add(0); } Dices.Sort(); RandomManager.instance.OutPutResult.text += " Best Result : "; RandomManager.instance.OutPutResult.text += Dices[0] + " " + Dices[1] + " "; RandomManager.instance.OutPutResult.text += " = " + DiceMath.Dice100Counting(Dices[0], Dices[1]); }
public void OutputResult() { string MEReason = ""; string THEIRReason = ""; int OurSideVal = int.Parse(OurSideInputField.text); int OpposSideVal = int.Parse(OpposSideInputField.text); int OurRandomResult = 0; int METype = GetDiceType(MEtoggles); int THEIRType = GetDiceType(THEIRtoggles); if (METype == 0) { OurRandomResult = DiceMath.Dice100(); } else if (METype == 1) { int ExtraDice = int.Parse(MEinputField.text == "" ? "0" : MEinputField.text); OurRandomResult = DiceRewardResult(ExtraDice, ref MEReason); } else { int ExtraDice = int.Parse(MEinputField.text == "" ? "0" : MEinputField.text); OurRandomResult = DicePunishmentResult(ExtraDice, ref MEReason); } int OpposRandomResult = 0; if (THEIRType == 0) { OpposRandomResult = DiceMath.Dice100(); } else if (THEIRType == 1) { int ExtraDice = int.Parse(THEIRinputField.text == "" ? "0" : THEIRinputField.text); OpposRandomResult = DiceRewardResult(ExtraDice, ref THEIRReason); } else { int ExtraDice = int.Parse(THEIRinputField.text == "" ? "0" : THEIRinputField.text); OpposRandomResult = DicePunishmentResult(ExtraDice, ref THEIRReason); } DiceMath.DiceLevelEnum OurJudge = DiceMath.JudgeDice(OurSideVal, OurRandomResult); DiceMath.DiceLevelEnum OpposJudge = DiceMath.JudgeDice(OpposSideVal, OpposRandomResult); if (OurJudge < OpposJudge) { ResultText.text = "Dice Result : = " + MEReason + OurJudge + " " + OurRandomResult + " VS " + THEIRReason + OpposJudge + " " + OpposRandomResult + "" + ", Passed !"; return; } else if (OurJudge > OpposJudge) { ResultText.text = "Dice Result : = " + MEReason + OurJudge + " " + OurRandomResult + " VS " + THEIRReason + OpposJudge + " " + OpposRandomResult + ", Not Passed !"; return; } else { if (OurSideVal > OpposSideVal) { ResultText.text = "Dice Result : = Same DiceLevel, " + MEReason + ": " + OurRandomResult + " VS " + THEIRReason + ": " + OpposRandomResult + ", Passed !"; return; } else if (OurSideVal < OpposSideVal) { ResultText.text = "Dice Result : = Same DiceLevel, " + MEReason + ": " + OurRandomResult + " VS " + THEIRReason + ": " + OpposRandomResult + ", Not Passed !"; return; } else { OutputResult(); } } }