22 double num4 = num2 * (num3 + 1.0) / 2.0;
23 double num5 = Math.Sqrt(num2 * (num3 * num3 - 1.0) / 12.0);
24 double d = (double)(
rnd(1000000) + 1) / 1000001.0;
25 double num6 = (double)(
rnd(1000000) + 1) / 1000001.0;
26 double num7 = Math.Sqrt(-2.0 * Math.Log(d)) * Math.Cos(Math.PI * 2.0 * num6);
27 double num8 = Math.Floor(num4 + num5 * num7 + 0.5);
29 if (num8 < (
double)
num)
33 if (num8 > (
double)num9)
37 long num10 = (long)num8;
42 if (
bonus < 0 && num10 <
long.MinValue -
bonus)
52 for (
int i = 0; i <
num; i++)
68 a = 1 + Mathf.Abs(num3 / 100) + ((Mathf.Abs(num3 % 100) >
rnd(100)) ? 1 : 0);
70 for (
int i = 0; i < Mathf.Min(a, 20); i++)
73 if (i == 0 || (flag && num4 > num2) || (!flag && num4 < num2))
86 public static int rnd(
int a)
91 public Dice(
int _num = 0,
int _sides = 0,
int _bonus = 0,
Card _card =
null)
102 string[] array = raw.Split(
',');
103 if (array.Length != 0)
105 string[] array2 = array[0].Split(
'd');
106 dice.num =
int.Parse(array2[0]);
107 dice.sides =
int.Parse(array2[1]);
109 if (array.Length > 1)
111 dice.bonus =
int.Parse(array[1]);
133 string key = ele.
source.alias;
136 key = ele.
source.alias.Split(
'_')[0] +
"_";
144 int ele2 = ((!ele.
source.aliasParent.IsEmpty()) ? c.
Evalue(ele.
source.aliasParent) : 0);
147 return new Dice(Mathf.Max(1, row.
num.Calc(power, ele2)), Mathf.Max(1, row.
sides.Calc(power, ele2)), row.
bonus.Calc(power, ele2), c);
164 int ele = power / 10;
167 Element orCreateElement = c.elements.GetOrCreateElement(act.source.id);
168 power2 = orCreateElement.
GetPower(c);
169 ele = ((!orCreateElement.
source.aliasParent.IsEmpty()) ? c.Evalue(orCreateElement.
source.aliasParent) : 0);
173 return new Dice(Mathf.Max(1, value.num.Calc(power2, ele)), Mathf.Max(1, value.sides.Calc(power2, ele)), value.bonus.Calc(power2, ele), c);
static long Roll_Precise(int num, int sides, int bonus=0)
static long RollMax(int num, int sides, int bonus=0)
static long Roll(int num, int sides, int bonus=0, Card card=null)
static Dice Parse(string raw)
override string ToString()
static Dice Create(Element ele, Card c)
static Dice Create(string id, int power, Card c=null, Act act=null)
static long Roll_Normal(long num, long sides, int bonus=0)
Dice(int _num=0, int _sides=0, int _bonus=0, Card _card=null)
static SourceManager sources
virtual int GetPower(Card c)
static int Range(int min, int max)