Example #1
0
        static string GetArtifactKey(ItemTypeAllowed type)
        {
            string key = "";

            if (type == ItemTypeAllowed.Weapon)
            {
                key = WeaponArtifacts[Random.Range(0, WeaponArtifacts.Count)];
            }
            else if (type == ItemTypeAllowed.Ammo)
            {
                key = AmmoArtifacts[Random.Range(0, AmmoArtifacts.Count)];
            }
            else if (type == ItemTypeAllowed.Wearable)
            {
                key = WearableArtifacts[Random.Range(0, WearableArtifacts.Count)];
            }
            else if (type == ItemTypeAllowed.Accessory)
            {
                key = ConsumableArtifacts[Random.Range(0, ConsumableArtifacts.Count)];
            }
            else if (type == ItemTypeAllowed.Any)
            {
                key = AnyArtifact[Random.Range(0, AnyArtifact.Count)];
            }

            return(key);
        }
Example #2
0
        static string GetItemKey(ItemTypeAllowed type)
        {
            string key = "";

            if (type == ItemTypeAllowed.Weapon)
            {
                key = Weapons[Random.Range(0, Weapons.Count)];
            }
            else if (type == ItemTypeAllowed.Ammo)
            {
                key = Ammo[Random.Range(0, Ammo.Count)];
            }
            else if (type == ItemTypeAllowed.Wearable)
            {
                key = Wearables[Random.Range(0, Wearables.Count)];
            }
            else if (type == ItemTypeAllowed.Accessory)
            {
                key = Consumables[Random.Range(0, Consumables.Count)];
            }
            else if (type == ItemTypeAllowed.Any)
            {
                key = AnyItem[Random.Range(0, AnyItem.Count)];
            }

            return(key);
        }
Example #3
0
        public ItemModifier(ItemModifier data)
        {
            if (data != null)
            {
                Name        = data.Name;
                Key         = data.Key;
                Description = data.Description;

                Type               = data.Type;
                MaterialHardness   = data.MaterialHardness;
                AllowedItemType    = data.AllowedItemType;
                HoursToBuild       = data.HoursToBuild;
                DurabilityModifier = data.DurabilityModifier;
                Actions            = data.Actions;
                Rarity             = data.Rarity;

                MainColor      = new GameColor(data.MainColor);
                SecondaryColor = new GameColor(data.SecondaryColor);

                Value = data.Value;

                Components = new List <AbilityComponent>();

                for (int i = 0; i < data.Components.Count; i++)
                {
                    Components.Add(data.Components[i]);
                }

                Effects = new List <AbilityEffect>();

                for (int i = 0; i < data.Effects.Count; i++)
                {
                    Effects.Add(data.Effects[i]);
                }
            }
            else
            {
                Debug.Log("ItemModifier(ItemModifier data) data == null");
                Name             = "";
                Key              = "";
                Power            = 0;
                HoursToBuild     = 0;
                Actions          = 0;
                Rarity           = Rarity.Common;
                Type             = ItemModifierType.None;
                AllowedItemType  = ItemTypeAllowed.None;
                MaterialHardness = MaterialHardness.None;

                MainColor      = new GameColor();
                SecondaryColor = new GameColor();

                Components = new List <AbilityComponent>();
                Effects    = new List <AbilityEffect>();
            }
        }
Example #4
0
        public static ItemData CreateArtifact(ItemTypeAllowed type)
        {
            bool     setDataAllowed = true;
            string   itemKey        = GetArtifactKey(type);
            ItemData newItem        = new ItemData(Database.GetItem(itemKey), 1);

            newItem.ArtifactData = GenerateArtifactData();

            if (setDataAllowed == true && Random.Range(1, 101) < 10)
            {
                newItem.SetData = GenerateSetData();
            }

            newItem.CalculateAttributes();
            newItem.SetText();

            return(newItem);
        }
Example #5
0
        public ItemModifier()
        {
            Name        = "";
            Key         = "";
            Description = "empty";

            Power            = 0;
            HoursToBuild     = 0;
            Actions          = 0;
            Rarity           = Rarity.Common;
            Type             = ItemModifierType.None;
            AllowedItemType  = ItemTypeAllowed.None;
            MaterialHardness = MaterialHardness.None;

            MainColor      = new GameColor();
            SecondaryColor = new GameColor();
            Components     = new List <AbilityComponent>();
            Effects        = new List <AbilityEffect>();
        }
Example #6
0
        public static ItemData CreateRandomItem(ItemTypeAllowed type, int pre_chance, int post_chance)
        {
            string itemKey = GetItemKey(type);
            string material = GetMaterial(itemKey);
            string plus = "", pre = "", post = "";

            plus = Qualities[Random.Range(0, Qualities.Count)];

            if (Random.Range(0, 100) < pre_chance)
            {
                pre = PreEnchants[Random.Range(0, PreEnchants.Count)];
            }

            if (Random.Range(0, 100) < post_chance)
            {
                post = PostEnchants[Random.Range(0, PostEnchants.Count)];
            }

            ItemData item = CreateItem(itemKey, material, plus, pre, post, 1);

            return(item);
        }
Example #7
0
        public ItemModifier(string name, string key, int power, int hours, int value, int dur_mod, int actions,
                            ItemModifierType type, MaterialHardness hardness, ItemTypeAllowed item_type, Rarity rarity)
        {
            Name        = name;
            Key         = key;
            Description = "empty";

            Type = type;

            Actions            = actions;
            Power              = power;
            HoursToBuild       = hours;
            DurabilityModifier = dur_mod;
            Value              = value;
            Rarity             = rarity;
            MaterialHardness   = hardness;
            AllowedItemType    = item_type;

            MainColor      = new GameColor();
            SecondaryColor = new GameColor();

            Components = new List <AbilityComponent>();
            Effects    = new List <AbilityEffect>();
        }
Example #8
0
        public static ItemShort CreateRandomItemShort(ItemTypeAllowed type, int pre_chance, int post_chance)
        {
            ItemData item = CreateRandomItem(type, pre_chance, post_chance);

            return(new ItemShort(item));
        }