예제 #1
0
        public static string GetFormattedRequirements(InvestmentGoal goal, GameEntity company1, GameContext gameContext)
        {
            var executor = GetExecutor(goal, company1, gameContext);

            return("as " + executor.company.Name + "\n" + string.Join("\n", GetGoalRequirements(goal, executor, gameContext)
                                                                      .Select(g => Visuals.Colorize($"<b>{g.description}</b>", IsRequirementMet(g, executor, gameContext)))));
        }
예제 #2
0
 public static void AddOnce(List <InvestmentGoal> goals, GameEntity company, InvestmentGoal goal)
 {
     if (!Completed(company, goal.InvestorGoalType))
     {
         goals.Add(goal);
     }
 }
예제 #3
0
        public static bool CompleteGoal(GameEntity company, GameContext gameContext, InvestmentGoal goal, bool forceComplete = false)
        {
            //Companies.Log(company, "Try complete goal: " + goal.GetFormattedName());
            bool willComplete = forceComplete || CanCompleteGoal(company, gameContext, goal);

            if (willComplete)
            {
                Companies.LogSuccess(company, $"Completed goal: {goal.GetFormattedName()}");

                var executor = GetExecutor(goal, company, gameContext);

                CompleteGoal2(executor, goal);

                if (goal.NeedsReport)
                {
                    var controller = GetController(goal, company, gameContext);

                    CompleteGoal2(controller, goal);
                }
            }
            //else
            //{
            //    Companies.Log(company, "Not all requirements were met (\n\n" + goal.GetFormattedRequirements(company, gameContext));
            //}


            return(willComplete);
        }
예제 #4
0
        private static void AddCompanyGoal2(GameEntity company, InvestmentGoal goal)
        {
            // remove possible duplicates
            company.companyGoal.Goals.RemoveAll(g => g.InvestorGoalType == goal.InvestorGoalType);

            company.companyGoal.Goals.Add(goal);
        }
예제 #5
0
    public void SetEntity(InvestmentGoal goal, int index)
    {
        InvestmentGoal = goal;
        this.index     = index;

        ViewRender();
    }
예제 #6
0
    public void SetEntity(InvestmentGoal goal, int index)
    {
        InvestmentGoal = goal;
        this.index     = index;

        AddOrRemoveTargetLink(goal);

        ViewRender();
    }
예제 #7
0
    public void SetGoal(InvestmentGoal investorGoal)
    {
        InvestorGoal  = investorGoal.InvestorGoalType;
        goalWasChosen = true;

        Goal = investorGoal;

        ViewRender();
    }
예제 #8
0
    void AddOrRemoveTargetLink(InvestmentGoal goal)
    {
        bool hasLink = false;

        if (goal.InvestorGoalType == InvestorGoalType.AcquireCompany || goal.InvestorGoalType == InvestorGoalType.OutcompeteCompanyByCost || goal.InvestorGoalType == InvestorGoalType.OutcompeteCompanyByIncome || goal.InvestorGoalType == InvestorGoalType.OutcompeteCompanyByUsers)
        {
            hasLink = true;
            var l = AddIfAbsent <LinkToProjectView>();

            if (goal is InvestmentGoalAcquireCompany)
            {
                l.CompanyId = (goal as InvestmentGoalAcquireCompany).CompanyId;
            }

            if (goal is InvestmentGoalOutcompeteByCost)
            {
                l.CompanyId = (goal as InvestmentGoalOutcompeteByCost).CompanyId;
            }

            if (goal is InvestmentGoalOutcompeteByIncome)
            {
                l.CompanyId = (goal as InvestmentGoalOutcompeteByIncome).CompanyId;
            }

            if (goal is InvestmentGoalOutcompeteByUsers)
            {
                l.CompanyId = (goal as InvestmentGoalOutcompeteByUsers).CompanyId;
            }
        }
        else
        {
            RemoveIfExists <LinkToProjectView>();
        }

        if (goal.InvestorGoalType == InvestorGoalType.DominateMarket)
        {
            hasLink = true;
            var l = AddIfAbsent <LinkToNiche>();

            l.SetNiche((goal as InvestmentGoalDominateMarket).TargetMarket);
        }
        else
        {
            RemoveIfExists <LinkToNiche>();
        }


        if (hasLink)
        {
            ShowLink();
        }
        else
        {
            HideLink();
        }
    }
예제 #9
0
    void WorkOnGoal(GameEntity product, InvestmentGoal goal)
    {
        var actions = Investments.GetProductActions(product, goal);

        foreach (var action in actions)
        {
            ManageProduct(action, product);
        }

        //Investments.CompleteGoal(product, gameContext, goal);
    }
예제 #10
0
        private static List <GoalRequirements> GetInvestmentGoalMillionUsersReqs(InvestmentGoal goal, GameEntity company, GameContext gameContext)
        {
            var        g       = goal as InvestmentGoalMillionUsers;
            GameEntity product = GetProduct(goal, company, gameContext);

            return(new List <GoalRequirements>
            {
                new GoalRequirements
                {
                    have = Marketing.GetUsers(product),
                    need = 1_000_000,

                    description = "Users > " + Format.Minify(g.TargetUsersAmount)
                }
            });
예제 #11
0
        private static List <GoalRequirements> GetInvestmentGoalReleaseReqs(InvestmentGoal goal, GameEntity company, GameContext gameContext)
        {
            GameEntity product = GetProduct(goal, company, gameContext);

            return(new List <GoalRequirements>
            {
                new GoalRequirements
                {
                    have = product.isRelease ? 1 : 0,
                    need = 1,

                    description = "PRESS RELEASE BUTTON!"
                },
            });
        }
예제 #12
0
        public static bool IsCompleted(InvestmentGoal goal, GameEntity company1, GameContext gameContext)
        {
            var company = GetExecutor(goal, company1, gameContext);

            var r = GetGoalRequirements(goal, company, gameContext);

            foreach (var req in r)
            {
                if (!IsRequirementMet(req, company, gameContext))
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #13
0
        private static List <GoalRequirements> GetInvestmentGoalMakePrototypeReqs(InvestmentGoal goal, GameEntity company, GameContext gameContext)
        {
            GameEntity product = GetProduct(goal, company, gameContext);
            var        loyalty = 5;

            return(new List <GoalRequirements>
            {
                new GoalRequirements
                {
                    have = (long)Marketing.GetChurnRate(product, gameContext),
                    need = loyalty,
                    reversedCheck = true,

                    description = $"Churn < {loyalty}"
                }
            });
        }
예제 #14
0
    public int StartDate;        // you will not get money before that date

    public Investment(long Offer, int Duration, InvestmentGoal investmentGoal, int StartDate)
    {
        this.Offer    = Offer;
        this.Duration = Duration;

        this.StartDate = StartDate;

        RemainingPeriods = Duration * 4;

        if (RemainingPeriods > 0)
        {
            Portion = Offer / RemainingPeriods;
        }
        else
        {
            Portion = Offer;
        }

        InvestmentGoal = investmentGoal;
    }
예제 #15
0
        private static List <GoalRequirements> GetInvestmentGoalPrepareForReleaseReqs(InvestmentGoal goal, GameEntity company, GameContext gameContext)
        {
            GameEntity product = GetProduct(goal, company, gameContext);
            int        teams   = 5;

            return(new List <GoalRequirements>
            {
                new GoalRequirements
                {
                    have = product.team.Teams[0].Managers.Count,
                    need = teams,

                    description = $"Has at least {teams} workers in Core team"
                },
            });
        }
예제 #16
0
        public static void AddCompanyGoal(GameEntity company, GameContext gameContext, InvestmentGoal goal)
        {
            var executor   = GetExecutor(goal, company, gameContext);
            var controller = GetController(goal, company, gameContext);

            if (goal.NeedsReport)
            {
                AddCompanyGoal2(executor, goal);
                AddCompanyGoal2(controller, goal);

                Companies.Log(executor, "ADD GOAL " + goal.GetFormattedName() + " as executor");
                Companies.Log(controller, "ADD GOAL " + goal.GetFormattedName() + " as controller");
            }
            else
            {
                Companies.Log(executor, "ADD GOAL " + goal.GetFormattedName() + " as executor && controller");
                AddCompanyGoal2(executor, goal);
            }
        }
예제 #17
0
 // Goal requirements
 public static GameEntity GetProduct(InvestmentGoal goal, GameEntity company, GameContext gameContext)
 {
     return(GetExecutor(goal, company, gameContext));
 }
예제 #18
0
    InvestmentGoal Goal; // => Investments.GetInvestmentGoal(MyCompany, Q, InvestorGoal);

    public void SetEntity(InvestmentGoal goal)
    {
        Goal = goal;

        ViewRender();
    }
예제 #19
0
 public static GameEntity GetController(InvestmentGoal goal, GameEntity company, GameContext gameContext)
 {
     return(goal.ControllerId == company.company.Id ? company : Companies.Get(gameContext, goal.ControllerId));
 }
예제 #20
0
 public static bool CanCompleteGoal(GameEntity company, GameContext gameContext, InvestmentGoal goal)
 {
     return(IsCompleted(goal, company, gameContext));
 }
예제 #21
0
        public static List <GoalRequirements> GetGoalRequirements(InvestmentGoal goal, GameEntity company, GameContext gameContext)
        {
            // products
            if (goal is InvestmentGoalMakePrototype)
            {
                return(GetInvestmentGoalMakePrototypeReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalMakeProductMarketFit)
            {
                return(GetInvestmentGoalMakeProductMarketFitReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalPrepareForRelease)
            {
                return(GetInvestmentGoalPrepareForReleaseReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalRelease)
            {
                return(GetInvestmentGoalReleaseReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalFirstUsers)
            {
                return(GetInvestmentGoalFirstUsersReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalMillionUsers)
            {
                return(GetInvestmentGoalMillionUsersReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalMoreSegments)
            {
                return(GetWrappedGoalList(new GoalRequirements {
                    description = "Get more segments", have = 1, need = 1
                }));
            }

            if (goal is InvestmentGoalGrowAudience)
            {
                return(GetInvestmentGoalGrowAudienceReqs(goal, company, gameContext));
            }

            // all

            if (goal is InvestmentGoalBecomeProfitable)
            {
                return(GetInvestmentGoalBecomeProfitableReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalGrowProfit)
            {
                return(GetInvestmentGoalGrowProfitReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalRegainLoyalty)
            {
                return(GetWrappedGoalList(new GoalRequirements {
                    have = 1, need = 1, description = "Regain loyalty"
                }));
            }

            if (goal is InvestmentGoalStartMonetisation)
            {
                return(GetInvestmentGoalStartMonetisationReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalGrowCost)
            {
                return(GetInvestmentGoalGrowCostReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalOutcompeteByIncome)
            {
                return(GetInvestmentGoalOutcompeteByIncomeReqs(goal, company, gameContext));
            }


            if (goal is InvestmentGoalOutcompeteByUsers)
            {
                return(GetInvestmentGoalOutcompeteByUsersReqs(goal, company, gameContext));
            }


            if (goal is InvestmentGoalOutcompeteByCost)
            {
                return(GetInvestmentGoalOutcompeteByCostReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalBuyBack)
            {
                return(GetInvestmentGoalBuyBackReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalDominateMarket)
            {
                return(GetInvestmentGoalDominateMarketReqs(goal, company, gameContext));
            }

            if (goal is InvestmentGoalAcquireCompany)
            {
                return(GetInvestmentGoalAcquireCompanyReqs(goal, company, gameContext));
            }

            return(new List <GoalRequirements>
            {
                new GoalRequirements
                {
                    have = 14,
                    need = 44,

                    description = $"Unknown GOAL ({goal.InvestorGoalType})"
                }
            });
        }
예제 #22
0
 void AddOrRemoveGoalLinks(InvestmentGoal goal)
 {
     AddOrRemoveTargetLink(goal);
 }
예제 #23
0
        public static void CompleteGoal2(GameEntity company, InvestmentGoal goal)
        {
            company.completedGoals.Goals.Add(goal.InvestorGoalType);

            company.companyGoal.Goals.Remove(goal);
        }
예제 #24
0
 public static List <InvestmentGoal> OnlyGoal(InvestmentGoal goal) => new List <InvestmentGoal>
 {
     goal
 };
예제 #25
0
        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);
        }