Пример #1
0
        public void UpdateNURBS()
        {
            Vector3[] positions = new Vector3[P.Count];
            float[]   weights   = new float[P.Count];
            float[]   knots     = new float[P.Count];
            for (int i = 0; i < P.Count; ++i)
            {
                P[i].Parameters[0] = 1.0f;
                positions[i]       = P[i].Position;
                weights[i]         = P[i].Parameters[0];
                knots[i]           = (float)(i) / (float)(P.Count - 1);
            }
            nurbs = new WildMagic.NURBSCurve(
                P.Count,
                positions,
                weights,
                2,
#if true
                false,
                true
#else
                true,   // loop
                false   // open  (knots)
#endif
                );
        }
Пример #2
0
        public WildMagic OfficialManualRoll(int manualRoll)
        {
            // Check if roll is Odd, and add 1 in that case. This is to align with our 1-50 table.
            if (manualRoll % 2 != 0)
            {
                manualRoll++;
            }
            int Roll = manualRoll / 2;

            return(CurrentResult = TableFactory.GetResult(Roll));
        }
Пример #3
0
        public string Generate(string[] commands)
        {
            ITable table;

            if (Array.Exists(commands, element => element.ToLower() == "-chaos"))
            {
                table = new ChaosMagic();
            }
            else if (Array.Exists(commands, element => element.ToLower() == "-eldritch"))
            {
                table = new EldritchMagic();
            }
            else if (Array.Exists(commands, element => element.ToLower() == "-izzet"))
            {
                table = new IzzetMagic();
            }
            else
            {
                table = new WildMagic();
            }

            var randomValue = _rng.Next(table.Max);

            Regex re = new Regex(@"\d+");

            foreach (string element in commands)
            {
                if (re.IsMatch(element))
                {
                    randomValue = Int32.Parse(element);
                    break;
                }
            }

            if (randomValue > table.Max)
            {
                return($"Provided value is out of range. Selected table has {table.Max} rows.");
            }

            var output = $"[{randomValue}]: {table.Fetch(randomValue)}";

            if (Array.Exists(commands, element => element.ToLower() == "-duration"))
            {
                var durationTable  = new SurgeDuration();
                var randomDuration = _rng.Next(durationTable.Max);
                var duration       = durationTable.Fetch(randomDuration);
                duration = char.ToLower(duration[0]) + duration.Substring(1);
                output  += $" The condition will last until {duration}";
            }

            return(">>> " + output);
        }
Пример #4
0
        private static void LoadCustomNodes(XmlNodeList nodes)
        {
            if (nodes == null)
            {
                return;
            }

            foreach (XmlNode node in nodes)
            {
                WildMagic wildMagic = new WildMagic(GetXmlAttributeAsInt(node, "WildMagicID"), GetXmlAttributeAsString(node, "WildMagicEffect"));
                _customWildMagicTable.Add(wildMagic);
            }
        }
Пример #5
0
 public WildMagic CustomManualRoll(int manualRoll)
 {
     return(CurrentResult = TableFactory.GetCustomResult(manualRoll));
 }
Пример #6
0
        public WildMagic CustomRoll()
        {
            int roll = RandomNumberGenerator.NumberBetween(1, SetNumberRange());

            return(CurrentResult = TableFactory.GetCustomResult(roll));
        }
Пример #7
0
        public WildMagic OfficialRoll()
        {
            int roll = RandomNumberGenerator.NumberBetween(1, 50);

            return(CurrentResult = TableFactory.GetResult(roll));
        }