public static Bonus <long> GetChurnBonus(GameContext gameContext, int companyId) => GetChurnBonus(gameContext, Companies.Get(gameContext, companyId));
public static List <InvestmentGoal> GetGroupOnlyGoals(GameEntity company, GameContext Q) { var goals = new List <InvestmentGoal>(); var groupGoals = new List <InvestorGoalType> { InvestorGoalType.AcquireCompany, InvestorGoalType.DominateSegment, // 50%+ users InvestorGoalType.DominateMarket, // OWN ALL COMPANIES InvestorGoalType.BuyBack, InvestorGoalType.IPO, }; #region data var income = Economy.GetIncome(Q, company); bool solidCompany = income > 50_000; GameEntity weakerCompany; // null; #endregion var daughters = Companies.GetDaughterProducts(Q, company); if (solidCompany) { if (daughters.Any()) { var flagship = daughters.First(); var flagshipCompetitors = Companies.GetDirectCompetitors(flagship, Q, false); if (flagshipCompetitors.Any()) { weakerCompany = flagshipCompetitors.OrderByDescending(c => Economy.CostOf(c, Q)).Last(); } else { weakerCompany = Companies.GetWeakerCompetitor(company, Q, true); } // if there are weaker companies if (weakerCompany != null) { var acquisitionGoal = new InvestmentGoalAcquireCompany(weakerCompany.company.Id, weakerCompany.company.Name); if (!CanCompleteGoal(company, Q, acquisitionGoal)) { goals.Add(acquisitionGoal); } } } } #region DominateSegment //if (solidCompany && company.companyFocus.Niches.Count == 1) //{ // var first = daughters.First(); // var positioning = Marketing.GetPositioning(first); // if (Companies.GetMarketShareOfCompanyMultipliedByHundred(company, Q) < 2) // goals.Add(InvestorGoalType.DominateSegment); //} #endregion if (solidCompany && daughters.Length > 2) { AddOnce(goals, company, new InvestmentGoalDominateMarket(company.companyFocus.Niches.First())); } if (Completed(company, InvestorGoalType.DominateMarket)) { return(OnlyGoal(new InvestmentGoalBuyBack())); } return(goals); }
public static bool IsCanUpgradeFeatures(GameEntity product) => Companies.IsEnoughResources(product, GetFeatureUpgradeCost());
public static IEnumerable <GameEntity> GetProductsOnMarket(GameContext context, NicheType niche) { return(Companies.GetProductCompanies(context).Where(p => p.product.Niche == niche)); }
internal static void ToggleCrunching(GameContext context, int companyId) { var c = Companies.Get(context, companyId); c.isCrunching = !c.isCrunching; }
// TODO 1 time public static long GetCompanySellingPrice(GameContext context, GameEntity target) { var desireToSell = Companies.GetDesireToSellCompany(target, context); return(CostOf(target, context) * desireToSell); }
public static GameEntity GetSelectedCompany(GameContext gameContext) { int companyId = (int)GetScreenData(gameContext)[Balance.MENU_SELECTED_COMPANY]; return(Companies.Get(gameContext, companyId)); }
public static void DismissTeam(GameEntity company, GameContext gameContext) { Companies.Log(company, "Dismiss team"); //Debug.Log("DISMISS TEAM WORKS BAD!" + company.company.Name); //Debug.LogWarning("DISMISS TEAM WORKS BAD!" + company.company.Name); }
public static bool IsEnoughResourcesForTask(GameEntity company, TeamTask teamTask, GameContext gameContext) { var cost = GetTaskCost(company, teamTask, gameContext); return Companies.IsEnoughResources(company, cost); }
internal static long GetCompanyMaintenance(GameContext gameContext, int companyId) => GetCompanyMaintenance(gameContext, Companies.Get(gameContext, companyId));
public static long GetInvestorCapitalCost(GameContext gameContext, GameEntity human) { var holdings = Companies.GetPersonalHoldings(gameContext, human.shareholder.Id, false); return(Economy.GetHoldingCost(gameContext, holdings)); }
public static void AddMoneyToInvestor(GameContext context, int investorId, long sum) { var investor = GetInvestorById(context, investorId); Companies.AddResources(investor, sum); }
public static List <ProductActions> GetProductActions(GameEntity product, InvestmentGoal goal) { var actions = new List <ProductActions>(); actions.Add(ProductActions.Features); actions.Add(ProductActions.GrabUsers); actions.Add(ProductActions.HandleTeam); actions.Add(ProductActions.Monetise); actions.Add(ProductActions.ReleaseApp); return(actions); actions.Add(ProductActions.HandleTeam); //Companies.Log(product, $"Working on goal: {goal.GetFormattedName()}"); switch (goal.InvestorGoalType) { case InvestorGoalType.ProductPrototype: actions.Add(ProductActions.Features); break; case InvestorGoalType.ProductFirstUsers: actions.Add(ProductActions.GrabUsers); actions.Add(ProductActions.Features); break; case InvestorGoalType.ProductBecomeMarketFit: actions.Add(ProductActions.Features); actions.Add(ProductActions.GrabUsers); break; case InvestorGoalType.ProductPrepareForRelease: actions.Add(ProductActions.HandleTeam); actions.Add(ProductActions.ReleaseApp); break; case InvestorGoalType.ProductRelease: actions.Add(ProductActions.HandleTeam); actions.Add(ProductActions.ReleaseApp); break; case InvestorGoalType.ProductStartMonetising: actions.Add(ProductActions.Monetise); actions.Add(ProductActions.Features); actions.Add(ProductActions.GrabUsers); actions.Add(ProductActions.HandleTeam); break; case InvestorGoalType.ProductRegainLoyalty: actions.Add(ProductActions.Features); actions.Add(ProductActions.RestoreLoyalty); actions.Add(ProductActions.HandleTeam); break; case InvestorGoalType.GainMoreSegments: actions.Add(ProductActions.RestoreLoyalty); actions.Add(ProductActions.Features); actions.Add(ProductActions.GrabUsers); actions.Add(ProductActions.HandleTeam); break; case InvestorGoalType.GrowUserBase: actions.Add(ProductActions.GrabUsers); actions.Add(ProductActions.Features); actions.Add(ProductActions.HandleTeam); break; case InvestorGoalType.GrowIncome: actions.Add(ProductActions.Features); actions.Add(ProductActions.GrabUsers); actions.Add(ProductActions.HandleTeam); break; case InvestorGoalType.BecomeProfitable: actions.Add(ProductActions.GrabUsers); actions.Add(ProductActions.Features); actions.Add(ProductActions.HandleTeam); break; default: Companies.Log(product, "DEFAULT goal"); actions.Add(ProductActions.GrabUsers); actions.Add(ProductActions.Features); actions.Add(ProductActions.HandleTeam); break; } return(actions); }
public static GameEntity GetController(InvestmentGoal goal, GameEntity company, GameContext gameContext) { return(goal.ControllerId == company.company.Id ? company : Companies.Get(gameContext, goal.ControllerId)); }
public static GameEntity[] GetProductsAvailableForSaleOnMarket(NicheType n, GameContext context) { return(GetProductsOnMarket(context, n) .Where(p => Companies.IsWillSellCompany(p, context)) .ToArray()); }
public static void FireManager(GameContext gameContext, HumanFF worker) => FireManager(Companies.Get(gameContext, worker.WorkerComponent.companyId), gameContext, worker.HumanComponent.Id);
public static GameEntity[] GetInstitutionalInvestors(GameContext gameContext, GameEntity e) { var investors = gameContext.GetEntities(GameMatcher.Shareholder); return(Array.FindAll(investors, s => Companies.IsInSphereOfInterest(s, e.niche.NicheType))); }
public static void FireManager(GameContext gameContext, GameEntity worker) => FireManager(Companies.Get(gameContext, worker.human.Id), worker);
public static long GetHoldingCost(GameContext context, int companyId) => GetHoldingCost(context, Companies.GetCompanyHoldings(context, companyId, true));
public static void TryToSpawnCompany(GameEntity niche, GameContext gameContext, MarketState phase, bool inPlayerSphereOfInfluence) { var segments = GetNichePositionings(niche.niche.NicheType, gameContext); var productsOnMarket = Markets.GetProductsOnMarket(niche, gameContext); bool willMakeSameProductWithPlayerFlagship = false; GameEntity playerFlagship = null; if (inPlayerSphereOfInfluence) { playerFlagship = Companies.GetPlayerFlagship(gameContext); if (niche.niche.NicheType == playerFlagship.product.Niche) { willMakeSameProductWithPlayerFlagship = true; } } float intensity = 1f / (1 + segments.Count); if (inPlayerSphereOfInfluence) { intensity = 1f; } foreach (var s in segments) { var productsCount = productsOnMarket.Count(p => p.productPositioning.Positioning == s.ID); bool willCompeteDirectly = false; // increase chances if player has companeis in that segment if (inPlayerSphereOfInfluence) { if (willMakeSameProductWithPlayerFlagship && Companies.IsDirectCompetitor(playerFlagship, niche, s.ID)) { willCompeteDirectly = true; } } var spawnChance = 0f; if (productsCount == 0) { spawnChance = 20; } else if (productsCount == 1) { spawnChance = 10; } else if (productsCount == 2) { spawnChance = 5; } else { spawnChance = 1; } if (willCompeteDirectly) { spawnChance *= 10; } spawnChance *= intensity; // take into account competition strength too // Noone wants to make a browser, cause Google exists already if (Random.Range(0f, 100f) < spawnChance) { var leaderFunds = Random.Range(50_000, 300_000); var product = SpawnCompany(niche, gameContext, leaderFunds); Marketing.ChangePositioning(product, gameContext, s.ID, true); // NotificationUtils.SendNewCompetitorPopup(gameContext, niche, product); } } }
private static long GetGroupIncome(GameContext context, GameEntity e) { return(Companies.GetCompanyHoldings(context, e.company.Id, true) .Sum(h => h.control * GetCompanyIncome(context, h.companyId) / 100)); }
public static bool IsCanUpgradeFeature(GameEntity product, int index) => GetFeatureRating(product, index) < 10 && Companies.IsEnoughResources(product, GetFeatureUpgradeCost());
private static long GetGroupOfCompaniesCost(GameContext context, GameEntity e) { var holdings = Companies.GetCompanyHoldings(context, e.company.Id, true); return(GetHoldingCost(context, holdings)); }
private static GameEntity CreateCompany( GameContext context, string name, CompanyType companyType, Dictionary <int, BlockOfShares> founders, HumanFF CEO) { var company = context.CreateEntity(); int id = GenerateCompanyId(context); company.AddCompany(id, name, companyType); company.isAlive = true; var culture = GetRandomCorporateCulture(); company.AddCorporateCulture(culture); SetIndependence(company, true); company.AddPartnerships(new List <int>()); company.AddCompanyResourceHistory(new List <ResourceTransaction>()); company.AddCompanyResource(new TeamResource()); Companies.SetResources(company, new TeamResource(0, Teams.GetPromotionCost(TeamRank.SmallTeam), 0, 0, 10000), "Initial capital"); // investments company.AddShareholders(founders); company.AddInvestmentProposals(new List <InvestmentProposal>()); company.AddInvestmentRounds(InvestmentRound.Preseed); company.AddCompanyGoal(new List <InvestmentGoal>()); // new InvestmentGoalGrowCost(1000000) company.AddCompletedGoals(new List <InvestorGoalType>()); // Branding? company.AddBranding(0); // teams company.AddWorkerOffers(new List <ExpiringJobOffer>()); company.AddTeam( 100, 50, new Dictionary <int, WorkerRole>(), new Dictionary <WorkerRole, int> { [WorkerRole.Programmer] = 0 }, new List <TeamInfo>(), 0 ); // add team for CEO Teams.AddTeam(company, context, TeamType.CrossfunctionalTeam); company.team.Teams[0].Workers = Teams.GetMaxTeamSize(TeamRank.Solo); company.team.Teams[0].HiringProgress = 100; // CEO int CeoID = CEO.HumanComponent.Id; CEO.HumanSkillsComponent.Traits.RemoveAll(t => t == Trait.Greedy); company.AddCEO(0, CeoID); company.AddEmployee(new Dictionary <int, WorkerRole>()); company.AddTeamEfficiency(new TeamEfficiency()); Teams.AttachToCompany(company, context, CEO, WorkerRole.CEO, 0); Teams.SetJobOffer(CEO, company, new JobOffer(0), 0, context); // uniqueness company.AddCompanyStrategies(RandomEnum <CompanySettingGrowthType> .GenerateValue(), RandomEnum <CompanySettingAttitudeToWorkers> .GenerateValue(), RandomEnum <CompanySettingControlDesire> .GenerateValue()); company.AddCompanyFocus(new List <NicheType>(), new List <IndustryType>()); company.AddMetricsHistory(new List <MetricsInfo>()); //e.AddCooldowns(new List<Cooldown>()); return(company); }
public static TeamInfo GetTeamOf(HumanFF human, GameContext gameContext) { return(GetTeamOf(human, Companies.Get(gameContext, human.WorkerComponent.companyId))); }
public static IEnumerable <GameEntity> GetProductsOnMarket(GameContext context, int companyId) { var c = Companies.Get(context, companyId); return(GetProductsOnMarket(context, c)); }
public static int GetLoyaltyChangeForManager(HumanFF worker, TeamInfo team, GameEntity company) { var culture = Companies.GetActualCorporateCulture(company); return(GetLoyaltyChangeForManager(worker, team, culture, company)); }
public static long GetChurnRate(GameContext gameContext, int companyId) => GetChurnRate(gameContext, Companies.Get(gameContext, companyId));
public static long Randomise(long baseValue, int nicheId) { return(Companies.GetRandomValue(baseValue, nicheId, 0)); }