Esempio n. 1
0
        /// <summary>Remove gold from an RpgAccount.</summary>
        /// <exception cref="NotEnoughGoldException"></exception>
        public static void RemoveGold(this RpgAccount account, uint amount)
        {
            if (!account.HasEnoughGold(amount))
            {
                throw new NotEnoughGoldException();
            }

            account.RemoveItemCount(GoldId, amount);
        }
Esempio n. 2
0
        public static StatUpgradeResult UpgradeEndurance(this RpgAccount account)
        {
            var cost = JustineCore.Utilities.GetGeneralCurveCost((int)(account.Endurance + 1));
            var gold = account.GetItemCount(1);

            if (cost > gold)
            {
                return(StatUpgradeResult.NotEnoughGold);
            }

            account.RemoveItemCount(1, (uint)cost);
            account.Endurance++;

            return(StatUpgradeResult.Success);
        }
Esempio n. 3
0
        public static StatUpgradeResult HealFor50(this RpgAccount account)
        {
            var cost = 50;
            var gold = account.GetItemCount(1);

            if (50 > gold)
            {
                return(StatUpgradeResult.NotEnoughGold);
            }

            account.RemoveItemCount(1, (uint)cost);
            account.Health = Math.Clamp(account.Health + 50, 0, account.MaxHealth);

            return(StatUpgradeResult.Success);
        }