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