/// <summary>
        /// Randomizes the values on the given weapon
        /// </summary>
        /// <param name="weapon">The weapon to randomize</param>
        /// <param name="nameRandomizer">The name randomizer</param>
        private static void RandomizeWeapon(WeaponItem weapon, WeaponAndArmorNameRandomizer nameRandomizer)
        {
            if (weapon.Type == WeaponType.Slingshot)
            {
                //TODO: assign the name here after we deal with the slingshot name hardcoding issue
                // Doing this to advance the RNG - don't actually assign the name
                nameRandomizer.GenerateRandomWeaponName(weapon.Type, (WeaponIndexes)weapon.Id);
                return;
            }

            RandomizeWeaponType(weapon);
            RandomizeWeaponDamage(weapon);
            RandomizeWeaponCrits(weapon);
            RandomizeWeaponKnockback(weapon);
            RandomizeWeaponSpeed(weapon);
            RandomizeWeaponAOE(weapon);
            RandomizeWeaponPrecision(weapon);
            RandomizeWeaponDefense(weapon);
            RandomizeWeaponDropInfo(weapon);
            SetWeaponDescription(weapon);

            string weaponName = nameRandomizer.GenerateRandomWeaponName(weapon.Type);

            if ((Globals.Config.Weapons.Randomize && Globals.Config.Weapons.RandomizeGalaxySwordName) || weapon.Name != "Galaxy Sword")
            {
                weapon.OverrideName = weaponName;
            }
        }
        /// <summary>
        /// Randomizes boots - currently only changes defense and immunity
        /// </summary>
        /// <returns />
        public static Dictionary <int, string> Randomize()
        {
            Boots.Clear();
            WeaponAndArmorNameRandomizer nameRandomizer = new WeaponAndArmorNameRandomizer();

            Dictionary <int, string> bootReplacements = new Dictionary <int, string>();
            List <BootItem>          bootsToUse       = new List <BootItem>();

            foreach (BootItem originalBoot in BootData.AllBoots)
            {
                int statPool = Globals.RNGGetIntWithinPercentage(originalBoot.Defense + originalBoot.Immunity, 30);
                int defense  = Range.GetRandomValue(0, statPool);
                int immunity = statPool - defense;

                BootItem newBootItem = new BootItem(
                    originalBoot.Id,
                    nameRandomizer.GenerateRandomBootName(),
                    originalBoot.NotActuallyPrice,
                    defense,
                    immunity,
                    originalBoot.ColorSheetIndex
                    );

                bootsToUse.Add(newBootItem);
                Boots.Add(newBootItem.Id, newBootItem);
            }

            foreach (BootItem bootToAdd in bootsToUse)
            {
                bootReplacements.Add(bootToAdd.Id, bootToAdd.ToString());
            }

            WriteToSpoilerLog(bootsToUse);
            return(bootReplacements);
        }
Esempio n. 3
0
        /// <summary>
        /// Randomizes boots - currently only changes defense and immunity
        /// </summary>
        /// <returns />
        public static Dictionary <int, string> Randomize()
        {
            Boots.Clear();
            WeaponAndArmorNameRandomizer nameRandomizer = new WeaponAndArmorNameRandomizer();
            List <string> descriptions = NameAndDescriptionRandomizer.GenerateBootDescriptions(BootData.AllBoots.Count);

            Dictionary <int, string> bootReplacements = new Dictionary <int, string>();
            List <BootItem>          bootsToUse       = new List <BootItem>();

            for (int i = 0; i < BootData.AllBoots.Count; i++)
            {
                BootItem originalBoot = BootData.AllBoots[i];
                int      statPool     = Globals.RNGGetIntWithinPercentage(originalBoot.Defense + originalBoot.Immunity, 30);
                int      defense      = Range.GetRandomValue(0, statPool);
                int      immunity     = statPool - defense;

                if ((defense + immunity) == 0)
                {
                    if (Globals.RNGGetNextBoolean())
                    {
                        defense = 1;
                    }

                    else
                    {
                        immunity = 1;
                    }
                }

                BootItem newBootItem = new BootItem(
                    originalBoot.Id,
                    nameRandomizer.GenerateRandomBootName(),
                    descriptions[i],
                    originalBoot.NotActuallyPrice,
                    defense,
                    immunity,
                    originalBoot.ColorSheetIndex
                    );

                bootsToUse.Add(newBootItem);
                Boots.Add(newBootItem.Id, newBootItem);
            }

            foreach (BootItem bootToAdd in bootsToUse)
            {
                bootReplacements.Add(bootToAdd.Id, bootToAdd.ToString());
            }

            WriteToSpoilerLog(bootsToUse);
            return(bootReplacements);
        }
        /// <summary>
        /// Returns the object use to modify the weapons
        /// </summary>
        /// <returns />
        public static Dictionary <int, string> Randomize()
        {
            Weapons.Clear();
            WeaponAndArmorNameRandomizer nameRandomizer = new WeaponAndArmorNameRandomizer();

            Dictionary <int, WeaponItem> weaponDictionary   = WeaponData.Items();
            Dictionary <int, string>     stringReplacements = new Dictionary <int, string>();

            foreach (WeaponItem weapon in weaponDictionary.Values)
            {
                RandomizeWeapon(weapon, nameRandomizer);
                stringReplacements.Add(weapon.Id, weapon.ToString());
                Weapons.Add(weapon.Id, weapon);
            }

            WriteToSpoilerLog(weaponDictionary);
            return(stringReplacements);
        }
Esempio n. 5
0
        /// <summary>
        /// Returns the object use to modify the weapons
        /// </summary>
        /// <returns />
        public static Dictionary <int, string> Randomize()
        {
            Weapons.Clear();
            WeaponAndArmorNameRandomizer nameRandomizer = new WeaponAndArmorNameRandomizer();

            Dictionary <int, WeaponItem> weaponDictionary   = WeaponData.Items();
            Dictionary <int, string>     stringReplacements = new Dictionary <int, string>();

            foreach (WeaponItem weapon in weaponDictionary.Values)
            {
                RandomizeWeapon(weapon, nameRandomizer);

                if (weapon.Id != 53)                 //TODO: remove in 0.3.0 - here to prevent seed from changing
                {
                    stringReplacements.Add(weapon.Id, weapon.ToString());
                    Weapons.Add(weapon.Id, weapon);
                }
            }

            WriteToSpoilerLog(weaponDictionary);
            return(stringReplacements);
        }