public static void TurnProductToPlayerFlagship(GameEntity company, GameContext Q, NicheType nicheType, GameEntity parentCompany) { company.isFlagship = true; AttachToPlayer(company); company.AddChannelExploration(new Dictionary <int, int>(), new List <int>(), 1); // give bad positioning initially var infos = Marketing.GetAudienceInfos(); Marketing.AddClients(company, -50); var positionings = Markets.GetNichePositionings(nicheType, Q); var positioningWorths = positionings.OrderBy(Markets.GetPositioningValue); // TODO POSITIONING var rand = Random.Range(0, 2); var newPositioning = rand < 1 ? 0 : 3; // positioningWorths.ToArray()[rand].ID; // 0 - teens, 3 - old people Marketing.ChangePositioning(company, Q, newPositioning); Marketing.AddClients(company, 50); // give good salary to CEO, so he will not leave company var CEO = Humans.Get(Q, GetCEOId(company)); var GroupCeoID = GetCEOId(parentCompany); CEO.AddPseudoHuman(GroupCeoID); // var salary = Teams.GetSalaryPerRating(CEO); // Teams.SetJobOffer(CEO, company, new JobOffer(salary), 0, Q); }
public static void InitializeTeamTaskIfNotPending(GameEntity product, int date, GameContext gameContext, TeamTask task) { if (task.IsPending) return; task.StartDate = date; if (task.IsMarketingTask) { var channelId = (task as TeamTaskChannelActivity).ChannelId; var channel = Markets.GetMarketingChannel(gameContext, channelId); if (!Marketing.IsActiveInChannel(product, channelId)) { var cost = Marketing.GetChannelCost(product, channelId); var payer = Companies.GetPayer(product, gameContext); if (Companies.Pay(payer, cost, "Marketing " + channel)) { Marketing.EnableChannelActivity(product, channel); var gain = Marketing.GetChannelClientGain(product, channelId); Marketing.AddClients(product, gain); var duration = Marketing.GetCampaignDuration(product, gain); task.EndDate = date + duration; } } } }
public static GameEntity CreateProduct(GameContext context, GameEntity product, NicheType nicheType) { product.AddProduct(nicheType, 0); var niche = Markets.Get(context, nicheType); // market state product.AddNicheState(Markets.GetMarketState(niche), 100); // product.AddNicheSegments(Markets.GetNichePositionings(nicheType, context)); // product.AddNicheBaseProfile(Markets.Get(context, product).nicheBaseProfile.Profile); product.AddProductUpgrades(new Dictionary <ProductUpgrade, bool> { [ProductUpgrade.SimpleConcept] = true, [ProductUpgrade.PlatformWeb] = true, }); // positioning var audiences = Marketing.GetAudienceInfos(); var coreId = Random.Range(0, audiences.Count); product.AddProductPositioning(coreId); // development product.AddFeatures(new Dictionary <string, float>()); product.AddSupportUpgrades(new Dictionary <string, int>()); product.AddExpertise(Random.Range(1, 4)); Markets.GetMarketRequirementsForCompany(context, product); // var serverFeature = Products.GetHighloadFeatures(product)[0]; // Teams.AddTeamTask(product, ScheduleUtils.GetCurrentDate(context), context, 0, new TeamTaskSupportFeature(serverFeature)); // clients product.AddMarketing(new Dictionary <int, long>()); product.AddSourceOfClients(new Dictionary <int, long>()); product.AddCompanyMarketingActivities(new Dictionary <int, long>()); // Markets.CopyChannelInfosToProductCompany(product, context); Marketing.AddClients(product, 50); // sphere of interest AddFocusNiche(product, nicheType, context); AddFocusIndustry(Markets.GetIndustry(nicheType, context), product); WrapProductWithAdditionalData(product, context); return(product); }
internal static void PrepareMarket(GameEntity niche, long startCapital, GameContext gameContext) { var segments = Marketing.GetAudienceInfos(); // spawn competitors for (var i = 0; i < 5; i++) { var funds = Random.Range(20, 50) * startCapital; var c = Markets.SpawnCompany(niche, gameContext, funds); var features = Products.GetAllFeaturesForProduct(); var teams = Random.Range(3, 9); for (var j = 0; j < teams; j++) { Teams.AddTeam(c, gameContext, TeamType.CrossfunctionalTeam); } foreach (var f in features) { if (f.FeatureBonus.isRetentionFeature) { Products.ForceUpgradeFeature(c, f.Name, Random.Range(2f, 5f), gameContext); } } var clients = 50_000d * Mathf.Pow(10, Random.Range(0.87f, 2.9f)) * (i + 1); //var positioning = c.productPositioning.Positioning; foreach (var s in segments) { if (s.ID == Marketing.GetCoreAudienceId(c)) { var audience = System.Convert.ToInt64(clients * Random.Range(0.1f, 0.5f)); Marketing.AddClients(c, audience); } } } // spawn investors for (var i = 0; i < C.AMOUNT_OF_INVESTORS_ON_STARTING_NICHE; i++) { var fund = Companies.GenerateInvestmentFund(gameContext, RandomUtils.GenerateInvestmentCompanyName(), 500000); Companies.AddFocusNiche(fund, niche.niche.NicheType, gameContext); } }
internal static void ReturnUsersWhenCompanyIsClosed(GameEntity e, GameContext gameContext) { var users = Marketing.GetClients(e); var niche = GetNiche(gameContext, e.product.Niche); var companies = GetProductsOnMarket(gameContext, e.company.Id); var powers = companies.Sum(c => c.branding.BrandPower + 1) - e.branding.BrandPower; foreach (var c in companies) { if (c == e) { continue; } var part = (long)((1 + c.branding.BrandPower) * users / powers); Marketing.AddClients(c, part); } Marketing.AddClients(e, -users); }