Exemplo n.º 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)))));
        }
Exemplo n.º 2
0
 public static void AddOnce(List <InvestmentGoal> goals, GameEntity company, InvestmentGoal goal)
 {
     if (!Completed(company, goal.InvestorGoalType))
     {
         goals.Add(goal);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
    public void SetEntity(InvestmentGoal goal, int index)
    {
        InvestmentGoal = goal;
        this.index     = index;

        ViewRender();
    }
Exemplo n.º 6
0
    public void SetEntity(InvestmentGoal goal, int index)
    {
        InvestmentGoal = goal;
        this.index     = index;

        AddOrRemoveTargetLink(goal);

        ViewRender();
    }
Exemplo n.º 7
0
    public void SetGoal(InvestmentGoal investorGoal)
    {
        InvestorGoal  = investorGoal.InvestorGoalType;
        goalWasChosen = true;

        Goal = investorGoal;

        ViewRender();
    }
Exemplo n.º 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();
        }
    }
Exemplo n.º 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);
    }
Exemplo n.º 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)
                }
            });
Exemplo n.º 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!"
                },
            });
        }
Exemplo n.º 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);
        }
Exemplo n.º 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}"
                }
            });
        }
Exemplo n.º 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;
    }
Exemplo n.º 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"
                },
            });
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 17
0
 // Goal requirements
 public static GameEntity GetProduct(InvestmentGoal goal, GameEntity company, GameContext gameContext)
 {
     return(GetExecutor(goal, company, gameContext));
 }
Exemplo n.º 18
0
    InvestmentGoal Goal; // => Investments.GetInvestmentGoal(MyCompany, Q, InvestorGoal);

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

        ViewRender();
    }
Exemplo n.º 19
0
 public static GameEntity GetController(InvestmentGoal goal, GameEntity company, GameContext gameContext)
 {
     return(goal.ControllerId == company.company.Id ? company : Companies.Get(gameContext, goal.ControllerId));
 }
Exemplo n.º 20
0
 public static bool CanCompleteGoal(GameEntity company, GameContext gameContext, InvestmentGoal goal)
 {
     return(IsCompleted(goal, company, gameContext));
 }
Exemplo n.º 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})"
                }
            });
        }
Exemplo n.º 22
0
 void AddOrRemoveGoalLinks(InvestmentGoal goal)
 {
     AddOrRemoveTargetLink(goal);
 }
Exemplo n.º 23
0
        public static void CompleteGoal2(GameEntity company, InvestmentGoal goal)
        {
            company.completedGoals.Goals.Add(goal.InvestorGoalType);

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