Ejemplo n.º 1
0
        public void ReInitaliseWeapons(Item item, JSONArray itemMods)
        {
            Debug.Log("Reinit Armour Item " + item.Name);
            if (item != null)
            {
                Debug.Log("Reinit Armour Item " + item.Name);

                EquipmentStats itemEquipStats = item.GetComponent <EquipmentStats>();

                foreach (var thisModification in itemMods)
                {
                    var modifyVar     = thisModification.Value["mod_var"];
                    var modifyValue   = thisModification.Value["mod_value"];
                    var modifyVarType = (WeaponModType)Enum.Parse(typeof(WeaponModType), thisModification.Value["mod_value_type"], true);


                    Debug.Log(modifyVarType);
                    switch (modifyVarType)
                    {
                    case WeaponModType.DAMAGE:
                        DamageType.Types type = (DamageType.Types)Enum.Parse(typeof(DamageType.Types), thisModification.Value["mod_var"], true);
                        WeaponHelper.AddWeaponDamage(item, type, modifyValue);
                        break;

                    case WeaponModType.IMPACT:
                        WeaponHelper.UpdateImpact(item, modifyValue);
                        break;

                    case WeaponModType.DURABILITY:
                        WeaponHelper.UpdateDurability(item, modifyValue);
                        break;

                    case WeaponModType.SPEED:
                        WeaponHelper.UpdateAttackSpeed(item, modifyValue);
                        break;

                    case WeaponModType.REACH:
                        WeaponHelper.UpdateAttackReach(item, modifyValue);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        //Roll for MOd Type
        //Roll For Quality
        //if Damage
        //Roll For Damage Type
        //Apply Mod
        public static ItemMod ReRollWeapon(Item item)
        {
            Debug.Log("Rerolling weapon");
            int statTypes    = (int)WeaponModType.COUNT - 1;
            int rollStatType = UnityEngine.Random.Range(0, statTypes);


            WeaponModType statTypeEnum = (WeaponModType)rollStatType;

            int rollQuality = RollHelper.RollForQuality();

            Debug.Log("Weapon Stat Chosen is " + statTypeEnum.ToString() + " value is " + rollQuality);


            EquipmentStats itemEquipStats  = item.GetComponent <EquipmentStats>();
            WeaponStats    itemWeaponStats = item.GetComponent <WeaponStats>();
            WeaponBaseData weaponBaseData  = item.GetComponent <WeaponBaseData>();


            Debug.Log("Weapon stats");
            Debug.Log(itemWeaponStats);

            switch (statTypeEnum)
            {
            //check the weapon damage type exists first
            case WeaponModType.DAMAGE:


                WeaponModDamageType type = RollHelper.RollForDamageType();
                Debug.Log("Damage type chosen is " + type.ToString());

                switch (type)
                {
                case WeaponModDamageType.Physical:
                    if (WeaponHelper.CheckWeaponHasDamageType(item, type))
                    {
                        //add to the current damage
                        Debug.Log("Weapon already has this damage type NotYetImplemented");
                    }
                    else
                    {
                        Debug.Log("Adding Physical damage");
                        WeaponHelper.AddWeaponDamage(item, DamageType.Types.Physical, rollQuality);
                        return(CreateItemModFor <Weapon>(item, rollQuality, "physical", "damage"));
                    }
                    break;

                case WeaponModDamageType.Ethereal:
                    if (WeaponHelper.CheckWeaponHasDamageType(item, type))
                    {
                        Debug.Log("Weapon already has this damage type NotYetImplemented");
                    }
                    else
                    {
                        Debug.Log("Adding Ethereal damage");
                        WeaponHelper.AddWeaponDamage(item, DamageType.Types.Ethereal, rollQuality);
                        return(CreateItemModFor <Weapon>(item, rollQuality, "ethereal", "damage"));
                    }
                    break;

                case WeaponModDamageType.Decay:
                    if (WeaponHelper.CheckWeaponHasDamageType(item, type))
                    {
                        Debug.Log("Weapon already has this damage type NotYetImplemented");
                    }
                    else
                    {
                        Debug.Log("Adding Decay damage");
                        WeaponHelper.AddWeaponDamage(item, DamageType.Types.Decay, rollQuality);
                        return(CreateItemModFor <Weapon>(item, rollQuality, "decay", "damage"));
                    }
                    break;

                case WeaponModDamageType.Electric:
                    if (WeaponHelper.CheckWeaponHasDamageType(item, type))
                    {
                        Debug.Log("Weapon already has this damage type NotYetImplemented");
                    }
                    else
                    {
                        Debug.Log("Adding Electric damage");
                        WeaponHelper.AddWeaponDamage(item, DamageType.Types.Electric, rollQuality);
                        return(CreateItemModFor <Weapon>(item, rollQuality, "electric", "damage"));
                    }
                    break;

                case WeaponModDamageType.Frost:
                    if (WeaponHelper.CheckWeaponHasDamageType(item, type))
                    {
                        Debug.Log("Weapon already has this damage type NotYetImplemented");
                    }
                    else
                    {
                        Debug.Log("Adding Frost damage");
                        WeaponHelper.AddWeaponDamage(item, DamageType.Types.Frost, rollQuality);
                        return(CreateItemModFor <Weapon>(item, rollQuality, "frost", "damage"));
                    }
                    break;

                case WeaponModDamageType.Fire:
                    if (WeaponHelper.CheckWeaponHasDamageType(item, type))
                    {
                        Debug.Log("Weapon already has this damage type NotYetImplemented");
                    }
                    else
                    {
                        Debug.Log("Adding Fire damage");
                        WeaponHelper.AddWeaponDamage(item, DamageType.Types.Fire, rollQuality);
                        return(CreateItemModFor <Weapon>(item, rollQuality, "fire", "damage"));
                    }
                    break;
                }
                break;

            case WeaponModType.SPEED:
                WeaponHelper.UpdateAttackSpeed(item, rollQuality);
                return(CreateItemModFor <Weapon>(item, rollQuality, "speed", "SPEED"));

            case WeaponModType.REACH:
                WeaponHelper.UpdateAttackReach(item, rollQuality);
                return(CreateItemModFor <Weapon>(item, rollQuality, "reach", "REACH"));

            case WeaponModType.DURABILITY:
                WeaponHelper.UpdateDurability(item, rollQuality);
                //outwardUTILS.ReflectionUpdateOrSetFloat(typeof(WeaponBaseData), weaponBaseData, "Durability", rollQuality);
                return(CreateItemModFor <Weapon>(item, rollQuality, "Durability", "DURABILITY"));

            case WeaponModType.IMPACT:
                WeaponHelper.UpdateImpact(item, rollQuality);
                //WeaponHelper.SetAttackStepKnockback(itemWeaponStats.Attacks, rollQuality);
                return(CreateItemModFor <Weapon>(item, rollQuality, "Impact", "IMPACT"));
            }
            return(null);
        }