void ChurnUsers(GameEntity[] products, GameEntity niche) { var clientContainers = niche.nicheClientsContainer.Clients; var dumpingCompanies = products.Where(p => p.isDumping); var totalBrands = dumpingCompanies.Sum(p => p.branding.BrandPower); for (var i = 0; i < products.Length; i++) { var p = products[i]; var churnClients = Marketing.GetChurnClients(contexts.game, p.company.Id); Marketing.AddClients(p, -churnClients); clientContainers[0] += churnClients; continue; // send churn users to dumping companies foreach (var d in dumpingCompanies) { float clients = churnClients; if (totalBrands == 0) { clients /= dumpingCompanies.Count(); } else { clients *= p.branding.BrandPower / totalBrands; } Marketing.AddClients(d, (long)(clients)); } } }
protected override void Execute(List <GameEntity> entities) { var companies = Companies.GetProductCompanies(gameContext); foreach (var product in companies) { // churn users var churn = Marketing.GetChurnClients(product, gameContext); Marketing.AddClients(product, -churn); // add users if (product.isControlledByPlayer || product.isRelatedToPlayer) { //Debug.Log("Will lose " + churn); continue; } /*var myChannels = product.companyMarketingActivities.Channels; * * foreach (var c in myChannels) * { * var channelId = c.Key; * * var clients = Marketing.GetChannelClientGain(product, channelId); * Marketing.AddClients(product, clients); * }*/ } }
internal static void TestCampaign(CompanyTask task, GameContext gameContext) { var t = task as CompanyTaskMarketingTestCampaign; var c = Companies.Get(gameContext, t.CompanyId); Marketing.AddClients(c, 100); }
internal static void RegularCampaign(CompanyTask task, GameContext gameContext) { var t = task as CompanyTaskMarketingRegularCampaign; var c = Companies.Get(gameContext, t.CompanyId); var clients = Marketing.GetAudienceGrowth(c, gameContext); Marketing.AddClients(c, clients); }
internal static void BrandingCampaign(CompanyTask task, GameContext gameContext) { var t = task as CompanyTaskBrandingCampaign; var c = Companies.Get(gameContext, t.CompanyId); Marketing.AddBrandPower(c, Balance.BRAND_CAMPAIGN_BRAND_POWER_GAIN); var clients = Marketing.GetAudienceGrowth(c, gameContext); Marketing.AddClients(c, clients); }
void DistributeClients(GameEntity[] products, GameEntity niche) { var clientContainers = niche.nicheClientsContainer.Clients; foreach (var p in products) { var clients = Marketing.GetAudienceGrowth(p, gameContext); Marketing.AddClients(p, clients); var segId = p.productPositioning.Positioning; clientContainers[segId] -= clients; } niche.ReplaceNicheClientsContainer(clientContainers); }
private static long GiveInnovationBenefits(GameEntity product, GameContext gameContext) { Marketing.AddBrandPower(product, Balance.INNOVATION_BRAND_POWER_GAIN); // get your competitor's clients var products = Markets.GetProductsOnMarket(gameContext, product) .Where(p => p.isRelease) .Where(p => p.company.Id != product.company.Id); long sum = 0; foreach (var p in products) { var disloyal = Marketing.GetClients(p) / 6; Marketing.LooseClients(p, disloyal); Marketing.AddClients(product, disloyal); sum += disloyal; } return(sum); }