Example #1
0
        static void GenerateItemProperties(Item item)
        {
            if (item.quality == Item.Quality.Unique)
            {
                UniqueItem uniqueItem = SelectUniqueForItem(item);
                if (uniqueItem != null)
                {
                    GenerateUnique(item, uniqueItem);
                }
                else
                {
                    item.quality = Item.Quality.Rare;
                }
            }

            if (item.quality == Item.Quality.Set)
            {
                SetItem setItem = SelectSetItem(item);
                if (setItem != null)
                {
                    GenerateSetItem(item, setItem);
                }
                else
                {
                    item.quality = Item.Quality.Rare;
                }
            }

            if (item.quality == Item.Quality.Magic)
            {
                int rand = Random.Range(0, 4);
                if (rand < 2)
                {
                    var prefixes = MagicAffix.GetSpawnableAffixes(item, MagicAffix.prefixes);
                    var prefix   = prefixes[Random.Range(0, prefixes.Count)];
                    AddAffix(item, prefix);
                    item.name = prefix.name + " " + item.name;
                }
                if (rand != 1)
                {
                    var suffixes = MagicAffix.GetSpawnableAffixes(item, MagicAffix.suffixes);
                    var suffix   = suffixes[Random.Range(0, suffixes.Count)];
                    AddAffix(item, suffix);
                    item.name += " " + suffix.name;
                }
            }
            else if (item.quality == Item.Quality.Rare)
            {
                var affixes = MagicAffix.GetSpawnableAffixes(item, MagicAffix.all);
                for (int i = 0; i < 4; ++i)
                {
                    var affix = affixes[Random.Range(0, affixes.Count)];
                    AddAffix(item, affix);
                }
            }
        }
Example #2
0
 private static void AddAffix(Item item, MagicAffix affix)
 {
     foreach (var mod in affix.mods)
     {
         if (mod.code == null)
         {
             break;
         }
         var prop = new Item.Property();
         prop.info          = ItemPropertyInfo.Find(mod.code);
         prop.param         = mod.param;
         prop.value         = Random.Range(mod.min, mod.max + 1);
         prop.min           = mod.min;
         prop.max           = mod.max;
         prop.classSpecific = affix.classSpecific;
         item.properties.Add(prop);
     }
 }
Example #3
0
        public static void LoadAll()
        {
            var sw = System.Diagnostics.Stopwatch.StartNew();

            Translation.Load();
            SoundInfo.Load();
            SoundEnvironment.Load();
            ObjectInfo.Load();
            BodyLoc.Load();
            ExpTable.Load();
            LevelType.Load();
            LevelWarpInfo.Load();
            LevelPreset.Load();
            LevelMazeInfo.Load();
            LevelInfo.Load();
            OverlayInfo.Load();
            MissileInfo.Load();
            ItemStat.Load();
            ItemRatio.Load();
            ItemType.Load();
            ItemPropertyInfo.Load();
            ItemSet.Load();
            UniqueItem.Load();
            SetItem.Load();
            TreasureClass.Load();
            MagicAffix.Load();
            CharStatsInfo.Load();
            MonLvl.Load();
            MonPreset.Load();
            MonSound.Load();
            MonStatsExtended.Load();
            MonStat.Load();
            SuperUnique.Load();
            SkillDescription.Load();
            SkillInfo.Load();
            SpawnPreset.Load();
            StateInfo.Load();
            Debug.Log("All txt files loaded in " + sw.ElapsedMilliseconds + " ms");
        }