Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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);
        }