public static void ApplyGroupInvestmentsToProfitBonus(GameEntity c, GameContext context, Bonus <long> bonus) { if (!Companies.IsGroup(c)) { return; } var holdings = Investments.GetHoldings(c, context, true); bool isOnlyHolding = holdings.Count == 1; foreach (var h in holdings) { var b = GetProfit(context, h.company, true); if (isOnlyHolding) { // render full description foreach (var d in b.bonusDescriptions) { if (d.HideIfZero) { bonus.AppendAndHideIfZero(d.Name, d.Value); } else { bonus.Append(d.Name, d.Value); } } } else { // general info is enough bonus.Append(h.company.company.Name, b.Sum()); } } }
public static long GetHoldingsCost(GameContext context, GameEntity entity) => GetHoldingsCost(context, Investments.GetHoldings(entity, context, true));
public static long GetInvestorCapitalCost(GameContext gameContext, GameEntity human) { var holdings = Investments.GetHoldings(human, gameContext, false); return(Economy.GetHoldingsCost(gameContext, holdings)); }
private static long GetGroupMaintenance(GameContext context, GameEntity company) { return(Investments.GetHoldings(company, context, true) .Sum(h => h.control * GetMaintenance(context, h.company) / 100)); }
private static long GetGroupIncome(GameContext context, GameEntity e) { return(Investments.GetHoldings(e, context, true) .Sum(h => h.control * GetIncome(context, h.company) / 100)); }