Ejemplo n.º 1
0
        public void TestGetTotalFutureRngPositions()
        {
            StealFutureRng future = new StealFutureRng();

            Assert.AreEqual(0, future.GetTotalFutureRngPositions());
            future.AddNextRngInstance(GetStealFutureRngInstance());
            Assert.AreEqual(1, future.GetTotalFutureRngPositions());
            future.AddNextRngInstance(GetStealFutureRngInstance());
            Assert.AreEqual(2, future.GetTotalFutureRngPositions());
        }
Ejemplo n.º 2
0
        public void TestGetRngInstanceAt_ArgumentOutOfBounds()
        {
            StealFutureRng future = new StealFutureRng();

            future.AddNextRngInstance(GetStealFutureRngInstance());
            future.AddNextRngInstance(GetStealFutureRngInstance());
            Assert.ThrowsException <ArgumentOutOfRangeException>(
                delegate
            {
                future.GetRngInstanceAt(2);
            }
                );
        }
Ejemplo n.º 3
0
        public void TestGetRngInstanceAt()
        {
            StealFutureRng future = new StealFutureRng();

            future.AddNextRngInstance(GetStealFutureRngInstance());
            future.AddNextRngInstance(GetStealFutureRngInstance());
            StealFutureRngInstance instance = GetStealFutureRngInstance();

            instance.Lv99RedChocobo = true;
            instance.NormalReward   = StealType.Rare;

            future.AddNextRngInstance(instance);
            StealFutureRngInstance copy = future.GetRngInstanceAt(2);

            Assert.AreEqual(instance.Lv99RedChocobo, copy.Lv99RedChocobo);
            Assert.AreEqual(instance.NormalReward, copy.NormalReward);
        }
Ejemplo n.º 4
0
        protected override void CalculateRngHelper()
        {
            int rarePosition      = -1;
            int rarePositionCuffs = -1;

            bool rareSteal      = false;
            bool rareStealCuffs = false;

            _futureRng = new StealFutureRng();

            // Use these variables to check for first punch combo
            ComboFound    = false;
            ComboPosition = -1;

            uint firstRngVal  = DisplayRng.genrand();
            uint secondRngVal = DisplayRng.genrand();
            uint thirdRngVal  = DisplayRng.genrand();

            // We want to preserve the character index, since this loop is just for display:
            int indexStatic = Group.GetIndex();

            Group.ResetIndex();

            int start = GetLoopStartIndex();
            int end   = start + HealVals.Count + FutureRngPositionsToCalculate;

            for (int index = start; index < end; index++)
            {
                // Index starting at 0
                LoopIndex = index - start;

                // Get the heal value once
                int currentHeal = Group.GetHealValue(firstRngVal);
                int nextHeal    = Group.PeekHealValue(secondRngVal);

                // Set the next expected heal value
                if (index == start + HealVals.Count - 1 || index == 1)
                {
                    NextHealValue = nextHeal;
                }

                // Advance the RNG before starting the loop in case we want to skip an entry
                uint firstRngValTemp  = firstRngVal;
                uint secondRngValTemp = secondRngVal;
                uint thirdRngValTemp  = thirdRngVal;
                firstRngVal  = secondRngVal;
                secondRngVal = thirdRngVal;
                thirdRngVal  = DisplayRng.genrand();

                // Skip the entry if it's too long ago
                if (LoopIndex < HealVals.Count - HistoryToDisplay)
                {
                    continue;
                }

                // Start actually collating data
                StealFutureRngInstance newRngInstance =
                    new StealFutureRngInstance();

                // check if we are calculating past RNG
                if (index < start + HealVals.Count)
                {
                    newRngInstance.IsPastRng = true;
                }

                // Set useful information
                newRngInstance.Index          = index;
                newRngInstance.CurrentHeal    = currentHeal;
                newRngInstance.RandToPercent  = Utils.RandToPercent(firstRngValTemp);
                newRngInstance.Lv99RedChocobo = firstRngValTemp < 0x1000000;

                // Handle stealing
                newRngInstance.NormalReward = Steal.CheckSteal2(
                    firstRngValTemp, secondRngValTemp, thirdRngValTemp);
                newRngInstance.CuffsReward = Steal.CheckStealCuffs2(
                    firstRngValTemp, secondRngValTemp, thirdRngValTemp);

                // Stealing directions
                CalculateStealDirections(firstRngValTemp, false,
                                         ref rareSteal, ref rarePosition);
                CalculateStealDirections(firstRngValTemp, true,
                                         ref rareStealCuffs, ref rarePositionCuffs);

                // Check for combo during string of punches
                CheckForCombo(firstRngValTemp);

                _futureRng.AddNextRngInstance(newRngInstance);
            }

            WriteStealDirectionsInfo(rarePosition, rarePositionCuffs);

            AttacksBeforeNextCombo = ComboPosition;

            Group.SetIndex(indexStatic);
        }