Beispiel #1
0
        public int upgrade(Item itemToUpgrade, Boolean isProtected)
        {
            UpgradeInfo info = itemToUpgrade.GetGlobalItem <UpgradeInfo>(mod);

            if (DushyUpgrade.IsAWeapon(itemToUpgrade))   //Si c'est une arme
            {
                int upgradeResult = upgradeWeapon(itemToUpgrade, isProtected);
                return(upgradeResult);
            }
            else if (DushyUpgrade.IsAnArmor(itemToUpgrade))     //Si c'est une armure
            {
                int upgradeResult = upgradeArmor(itemToUpgrade, isProtected);
                return(upgradeResult);
            }
            else
            {
                return(DushyUpgrade.NO_CHANGE);
            }
        }
Beispiel #2
0
        public int upgradeWithScroll(Item itemToUpgrade, Item upgradeScroll)
        {
            UpgradeInfo info        = itemToUpgrade.GetGlobalItem <UpgradeInfo>(mod);
            int         scrollLevel = getLevelFromScroll(mod, upgradeScroll);

            if (info.level >= scrollLevel)
            {
                return(DushyUpgrade.NO_CHANGE);
            }

            if (!info.upgraded)
            {
                info.baseName = itemToUpgrade.Name;
            }

            info.level    = scrollLevel;
            info.upgraded = true;
            itemToUpgrade.SetNameOverride(info.baseName + " +" + info.level);

            info.modifier = getDamageModifier(info.level);

            if (DushyUpgrade.IsAnArmor(itemToUpgrade))
            {
                info.baseArmor = itemToUpgrade.defense;

                itemToUpgrade.defense = (int)Math.Round((Convert.ToDouble(info.baseArmor * info.modifier) / 100));
            }
            else if (DushyUpgrade.IsAWeapon(itemToUpgrade))
            {
                info.baseCrit   = itemToUpgrade.crit;
                info.baseDamage = itemToUpgrade.damage;

                itemToUpgrade.damage = (int)Math.Round((Convert.ToDouble(info.baseDamage * info.modifier) / 100));
                itemToUpgrade.crit   = (int)Math.Round((Convert.ToDouble(info.baseCrit * info.modifier) / 100));
            }
            else
            {
                return(DushyUpgrade.NO_CHANGE);
            }
            return(DushyUpgrade.SUCCESS);
        }