/// <summary> /// Deactivates a policy /// </summary> /// <param name="mCost">Cost of the deactivation in money (relative)</param> /// <param name="gCost">Cost of the deactivation in glory (relative)</param> internal void Deactivate(out int mCost, out int gCost) { mCost = MoneyAmount.GetValueOrDefault(0); gCost = GloryAmount.GetValueOrDefault(0); actualValue = minValue; Active = false; }
/// <summary> /// Computes a full description of the value /// </summary> /// <returns>A long description</returns> public string CompletePresentation() { string pres = "==" + Name + "=="; pres += Environment.NewLine; pres += Description + Environment.NewLine; pres += "Valeur : <" + minValue + " :" + Value + ": " + maxValue + ">" + Environment.NewLine; if (MoneyAmount.HasValue && MoneyAmount.GetValueOrDefault(0) < 0) { pres += "Coûte " + MoneyImpacted + " pièces d'or par tour" + Environment.NewLine; } if (MoneyAmount.HasValue && MoneyAmount.GetValueOrDefault(0) > 0) { pres += "Rapporte " + MoneyImpacted + " pièces d'or par tour" + Environment.NewLine; } if (GloryAmount.HasValue && GloryAmount.GetValueOrDefault(0) < 0) { pres += "Coûte " + Math.Abs(GloryAmount.Value) + " gloire" + Environment.NewLine; } if (GloryAmount.HasValue && GloryAmount.GetValueOrDefault(0) > 0) { pres += "Rapporte " + GloryImpacted + " gloire par tour" + Environment.NewLine; } pres += "Actuellement " + ((Active != false) ? "en action" : "hors action"); return(pres); }
/// <summary> /// Computes the cost of a policy change according to a given amount /// </summary> /// <param name="amount">Amount to be set (min to max)</param> /// <param name="mCost">Cost in money (relative)</param> /// <param name="gCost">Cost in glory (relative)</param> public void PreviewPolicyChange(ref int amount, out int mCost, out int gCost) { amount = Math.Min(Math.Max(amount, minValue), maxValue); double delta = Math.Abs(actualValue - amount); delta /= maxValue - minValue; delta = cost(delta); mCost = (int)(MoneyAmount.GetValueOrDefault(0) * delta); gCost = (int)(GloryAmount.GetValueOrDefault(0) * delta); }