public static Bonus <int> GetHRBasedNewManagerRatingBonus(GameEntity company, GameContext gameContext) { var bonus = new Bonus <int>("New manager rating"); var managingCompany = Companies.GetManagingCompanyOf(company, gameContext); var productsOfManagingCompany = Companies.GetDaughterProducts(gameContext, managingCompany); bool hasGlobalMarkets = productsOfManagingCompany .Select(p => Markets.Get(gameContext, p)) .Count(m => m.nicheBaseProfile.Profile.AudienceSize == AudienceSize.Global) > 0; int positionOnMarket = 0; if (company.hasProduct) { var clampedPosition = Mathf.Clamp(Markets.GetPositionOnMarket(gameContext, company), 0, 5); positionOnMarket = (5 - clampedPosition) * 2; } bonus .Append("Base value", C.NEW_MANAGER_RATING_MIN) .Append("Mission", 0) .AppendAndHideIfZero("Position on market", positionOnMarket) .Append("Has Global Markets", hasGlobalMarkets ? 10 : 0) //.Append("Is TOP10 Company", 0) //.Append("Is TOP10 in teams", 0) ; return(bonus); }
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); }
public static MarketRequirementsComponent GetMarketRequirementsForCompany(GameContext gameContext, GameEntity c) { if (!c.hasMarketRequirements) { var niche = Markets.Get(gameContext, c); var reqs = Markets.GetMarketRequirements(gameContext, niche); c.AddMarketRequirements(reqs.Features); } return(c.marketRequirements); }
public static void WrapProductWithAdditionalData(GameEntity product, GameContext gameContext) { if (!product.hasNicheSegments) { product.AddNicheSegments(Markets.GetNichePositionings(product.product.Niche, gameContext)); } if (!product.hasNicheBaseProfile) { product.AddNicheBaseProfile(Markets.Get(gameContext, product).nicheBaseProfile.Profile); } Markets.CopyChannelInfosToProductCompany(product, gameContext); }
public static void NotifyAllProductsAboutMarketRequirementsChanges(GameEntity product, GameContext gameContext) { var niche = Markets.Get(gameContext, product); // Calculate changes in market Markets.GetMarketRequirements(gameContext, niche); // Notify var copy = Markets.CopyMarketRequirements(niche.marketRequirements.Features); foreach (var c in Companies.GetDirectCompetitors(product, gameContext, true)) { c.ReplaceMarketRequirements(copy); } }
// Start new Campaign public static void StartNewCampaign(GameContext gameContext, NicheType NicheType, string text) { var startCapital = Markets.GetStartCapital(NicheType, gameContext); var niche = Markets.Get(gameContext, NicheType); var group = PreparePlayerCompany(niche, startCapital, text, gameContext); PrepareMarket(niche, startCapital, gameContext); var flagship = Companies.CreateProductAndAttachItToGroup(gameContext, NicheType, group); Companies.TurnProductToPlayerFlagship(flagship, gameContext, NicheType, group); LoadGameScene(); }
public static void UpdateMarketRequirements(GameEntity product, GameContext gameContext) { var niche = Markets.Get(gameContext, product.product.Niche); var demand = Products.GetMarketDemand(niche); var newLevel = Products.GetProductLevel(product); if (newLevel > demand) { bool revolution = newLevel - demand > 1; // innovation //var clientChange = GiveInnovationBenefits(product, gameContext, revolution); var brandGain = revolution ? C.REVOLUTION_BRAND_POWER_GAIN : C.INNOVATION_BRAND_POWER_GAIN; Marketing.AddBrandPower(product, brandGain); // notify about innovation var player = Companies.GetPlayerCompany(gameContext); var daughters = Companies.GetDaughtersAmount(player); //if (Companies.IsInPlayerSphereOfInterest(product, gameContext) && Markets.GetCompetitorsAmount(product, gameContext) > 1 && daughters == 1) // NotificationUtils.AddPopup(gameContext, new PopupMessageInnovation(product.company.Id, clientChange)); // && Markets.GetCompetitorsAmount(product, gameContext) > 1 && daughters == 1 if (Companies.IsInPlayerSphereOfInterest(product, gameContext)) { NotificationUtils.AddNotification(gameContext, new NotificationMessageInnovation(product.company.Id, newLevel, revolution, 0, brandGain)); } niche.ReplaceSegment(newLevel); // order matters RemoveTechLeaders(product, gameContext); product.isTechnologyLeader = true; } else if (newLevel == demand) { // if you are techonology leader and you fail to innovate, you will not lose tech leadership if (product.isTechnologyLeader) { return; } RemoveTechLeaders(product, gameContext); } }