예제 #1
0
        public static void SendJobOffer(HumanFF worker, JobOffer jobOffer, GameEntity company, GameContext gameContext)
        {
            var offer = new ExpiringJobOffer
            {
                JobOffer     = jobOffer,
                CompanyId    = company.company.Id,
                DecisionDate = ScheduleUtils.GetCurrentDate(gameContext) + 30,
                HumanId      = worker.HumanComponent.Id
            };

            AddOrReplaceOffer(company, worker, offer);
        }
예제 #2
0
        internal static GameEntity AddTimedAction(GameContext gameContext, CompanyTask companyTask, int duration)
        {
            if (HasTask(gameContext, companyTask))
            {
                return(null);
            }

            var e = gameContext.CreateEntity();

            var start = ScheduleUtils.GetCurrentDate(gameContext);

            e.AddTimedAction(false, companyTask, start, duration, start + duration);

            return(e);
        }
예제 #3
0
        public static void LoadGameData(GameContext gameContext)
        {
            ClearEntities();
            LoadEntities(gameContext);

            ScheduleUtils.PauseGame(gameContext);

            //var MyCompany = Companies.GetPlayerCompany(gameContext);
            //var playerFlagship = Companies.GetFlagship(gameContext, MyCompany) ?? null;

            //ScreenUtils.SetSelectedHuman(gameContext, ScreenUtils.GetPlayer(gameContext).human.Id);
            //ScreenUtils.SetSelectedCompany(gameContext, Companies.GetPlayerFlagshipID(gameContext));

            //ScreenUtils.SetSelectedNiche(gameContext, NicheType.Com_Blogs);
        }
예제 #4
0
        public static bool IsAppropriateStartNiche(GameEntity niche, GameContext gameContext)
        {
            var profile = niche.nicheBaseProfile.Profile;
            var phase   = GetMarketState(niche);

            var isOpened      = ScheduleUtils.GetCurrentDate(gameContext) >= niche.nicheLifecycle.OpenDate;
            var isPerspective = phase == MarketState.Idle || phase == MarketState.Innovation || phase == MarketState.Trending;

            var isCheap = profile.AppComplexity < AppComplexity.Hard;

            var isBig = profile.AudienceSize == AudienceSize.Global; // GetMarketPotentialRating(niche) > 3;



            return(isPerspective && isOpened && isCheap && !isBig);
        }
        public static void ApplyInvestmentsToProfitBonus(GameEntity c, GameContext context, Bonus <long> bonus)
        {
            //var investmentTaker = c.isFlagship ? Companies.GetManagingCompanyOf(c, context) : c;
            var investmentTaker = c;

            var date = ScheduleUtils.GetCurrentDate(context);

            if (investmentTaker.shareholders.Shareholders.Count > 1)
            {
                var investments = investmentTaker.shareholders.Shareholders.Values
                                  .Select(v => v.Investments.Where(z => WillPayInvestmentRightNow(z, date)).Select(z => z.Portion).Sum())
                                  .Sum();

                bonus.AppendAndHideIfZero("Investments", investments);
            }
        }
        public static void SpawnProposals(GameContext context, GameEntity company)
        {
            long cost = Economy.CostOf(company, context);
            var  date = ScheduleUtils.GetCurrentDate(context);

            var potentialInvestors = GetPotentialInvestors(context, company);

            foreach (var potentialInvestor in potentialInvestors)
            {
                var modifier = 50 + UnityEngine.Random.Range(0, 100);

                long valuation = cost * modifier / 100;

                var max = GetMaxInvestingAmountForInvestorType(potentialInvestor);

                var ShareholderId = potentialInvestor.shareholder.Id;
                var Duration      = 10; // UnityEngine.Random.Range(5, 10);

                // TODO increase offer on early stages
                // or increase company valuation instead!
                var offer = Math.Min(valuation / 20, max);

                //var goal = new InvestmentGoalUnknown(InvestorGoalType.GrowCompanyCost);
                var goal = company.companyGoal.Goals[0];


                var p = new InvestmentProposal
                {
                    Investment       = new Investment(offer, Duration, goal, date),
                    AdditionalShares = (int)GetNewSharesSize(context, company, offer),

                    ShareholderId = ShareholderId,
                    WasAccepted   = false
                };

                // you cannot invest in yourself!
                if (company.hasShareholder && company.shareholder.Id == ShareholderId)
                {
                    continue;
                }

                AddInvestmentProposal(company, p);
            }
        }
        public static TeamResource GetProductCompanyResourceChange(GameEntity company, GameContext gameContext)
        {
            long money = GetProfit(gameContext, company);
            var  ideas = Products.GetExpertiseGain(company);

            var upgrades = 0;

            var date = ScheduleUtils.GetCurrentDate(gameContext);

            if (ScheduleUtils.IsPeriodicalMonthEnd(date))
            {
                upgrades = Products.GetIterationMonthlyGain(company);
            }

            return(new TeamResource(
                       upgrades,
                       0,
                       0,
                       ideas,
                       money
                       ));
        }
예제 #8
0
        public static void LogFinancialTransactions(GameEntity company)
        {
            var historyFormatted = company.companyResourceHistory.Actions.Select(r => $"{ScheduleUtils.GetFormattedDate(r.Date)} {r.Tag}: {Visuals.PositiveOrNegativeMinified(r.TeamResource)}");

            Log(company, string.Join("\n", historyFormatted));
        }
 public static int GetYear(int year) => ScheduleUtils.GetDateByYear(year);