void AddPolicyCard(PolicyType type, int index)
    {
        PolicyCard card = new PolicyCard();

        card.policyType      = type;
        card.policyIndex     = index;
        card.prosperityCount = Random.Range(1, 20);
        policyDeck.Add(card);
    }
    void AddPolicyCard(PolicyType type, int index, string profName, string profName2, JobTier tier, JobTier tier2)
    {
        PolicyCard card = new PolicyCard();

        card.policyType      = type;
        card.professionName  = profName;
        card.professionName2 = profName2;
        card.tierOne         = tier;
        card.tierTwo         = tier2;
        card.policyIndex     = index;
        card.prosperityCount = Random.Range(1, 20);
        policyDeck.Add(card);
    }
    void CreatePolicyDeck()
    {
        //CATEGORY ONE
        //+- Based on proffession
        for (int i = 0; i < Characters.professions.Length; ++i)
        {
            for (int j = 0; j < 2; ++j)
            {
                AddPolicyCard(PolicyType.Occupation, j, Characters.professions[i], "", JobTier.tierOne, JobTier.tierOne);
            }
        }
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                if (j != i)
                {
                    AddPolicyCard(PolicyType.Occupation, 3, Characters.professions[i], Characters.professions[j], JobTier.tierOne, JobTier.tierOne);
                }
            }
        }

        //CATEGORY TWO
        for (int i = 0; i < 3; ++i)
        {
            for (int j = 0; j < 3; ++j)
            {
                if (j != i)
                {
                    AddPolicyCard(PolicyType.OccupationHierarchy, 0, "", "", (JobTier)i, (JobTier)j);
                }
            }
            if (i != 2)
            {
                AddPolicyCard(PolicyType.OccupationHierarchy, 1, "", "", (JobTier)i, 0);
            }
        }

        AddPolicyCard(PolicyType.MigrationStatus, 0);
        AddPolicyCard(PolicyType.MigrationStatus, 1);
        AddPolicyCard(PolicyType.MigrationStatus, 2);

        //Randomise
        for (int i = 0; i < policyDeck.Count; i++)
        {
            PolicyCard temp        = policyDeck[i];
            int        randomIndex = Random.Range(i, policyDeck.Count);
            policyDeck[i]           = policyDeck[randomIndex];
            policyDeck[randomIndex] = temp;
        }
    }
    public void RpcUpdatePolicyCard(PolicyCard choices)
    {
        if (!isLocalPlayer)
        {
            return;
        }

        Transform characters = GameObject.Find("Characters").transform;

        for (int j = 0; j < characters.childCount; ++j)
        {
            characters.GetChild(j).GetComponent <CharacterScript>().OnPolicyCard(choices);
        }

        characters = GameObject.Find("OtherCharacters").transform;
        for (int i = 0; i < characters.childCount; ++i)
        {
            for (int j = 0; j < characters.GetChild(i).childCount; ++j)
            {
                characters.GetChild(i).GetChild(j).GetComponent <CharacterScript>().OnPolicyCard(choices);
            }
        }
        GameObject.Find("PreviousPolicy").GetComponent <PolicyScript>().setPolicy(choices);
    }
    public void setPolicy(PolicyCard card)
    {
        Text text = transform.Find("PolicyText").GetComponent <Text>();

        switch (card.policyType)
        {
        case PolicyType.MigrationStatus:
        {
            //If you have illegal migration status with N prosperity, gain Documented status - 2 Cards.
            if (card.policyIndex == 0)
            {
                text.text = "If you have undocumented migration status with positive prosperity, gain documented status";
            }
            //+n Prosperity if you are illegal, -N prosperity for legal. (vice versa) - 2 Cards.
            else if (card.policyIndex == 1)
            {
                text.text = "+" + card.prosperityCount.ToString() + " Prosperity if you are undocumented, -" + card.prosperityCount.ToString() + "prosperity for documented or local";
            }
            //Lose job if illegal with -n prosperity, legals get +N prosperity. (after 3 turns) - 2 Cards
            else if (card.policyIndex == 2)
            {
                text.text = "Lose job if undocumented with -" + card.prosperityCount.ToString() + " prosperity, legals get +" + card.prosperityCount.ToString() + " prosperity";
            }

            break;
        }

        case PolicyType.Occupation:
        {
            //If you are of X profession +-n. - one card for each profession = 7 cards (any duplicates?)
            if (card.policyIndex == 0)
            {
                text.text = "If you are of " + card.professionName + " profession +" + card.prosperityCount.ToString();
            }
            //If you are of -N prosperity as X profession +n else -n. - 7 cards
            else if (card.policyIndex == 1)
            {
                text.text = "If you are of positive prosperity as " + card.professionName + " profession +" + card.prosperityCount.ToString() + " else -" + card.prosperityCount.ToString() + " prospertity";
            }
            //If your prosperity is +n you get a promotion in your job, (if you are legal) (after n turns) - 7 cards.
            else if (card.policyIndex == 2)
            {
                text.text = "If your prosperity is +" + card.prosperityCount.ToString() + " you get a promotion in your job, if documented";
            }
            //Gain +N prosperity for X profession, lose -n prosperity for Z profession. - 4P2 = 12cards, only the first four occupation group.
            else if (card.policyIndex == 3)
            {
                text.text = "Gain +" + card.prosperityCount.ToString() + " prosperity for " + card.professionName + " profession, lose -" + card.prosperityCount.ToString() + " prosperity for " + card.professionName2 + " profession";
            }
            break;
        }

        case PolicyType.OccupationHierarchy:
        {
            //Tier X workers can gain +n prosperity but tier Z workers will lose -n Prosperity (Vice Versa.) - 3P2 = 6 cards.
            if (card.policyIndex == 0)
            {
                text.text = "Tier " + (card.tierOne + 1).ToString() + " workers can gain +" + card.prosperityCount.ToString() + " prosperity but " + card.tierTwo.ToString() + " workers will lose -" + card.prosperityCount.ToString() + " prosperity";
            }
            //Tier X workers can change jobs or promote, if positive prosperity. - 3 Cards.
            else if (card.policyIndex == 1)
            {
                text.text = card.tierOne.ToString() + " workers can change jobs or promote, if positive prosperity";
            }

            break;
        }
        }
    }
Example #6
0
    public void OnPolicyCard(PolicyCard card)
    {
        switch (card.policyType)
        {
        case PolicyType.MigrationStatus:
        {
            //If you have illegal migration status with N prosperity, gain Documented status - 2 Cards.
            if (card.policyIndex == 0)
            {
                if (migrationStatus == MigrationStatus.undocumented)
                {
                    if (prosperityCounter > 0)
                    {
                        migrationStatus = MigrationStatus.working;
                    }
                }
            }
            //+n Prosperity if you are illegal, -N prosperity for legal. (vice versa) - 2 Cards.
            else if (card.policyIndex == 1)
            {
                if (migrationStatus == MigrationStatus.undocumented)
                {
                    IncrementCounter(card.ammount);
                }
                else
                {
                    IncrementCounter(-card.ammount);
                }
            }
            //Lose job if illegal with -n prosperity, legals get +N prosperity. (after 3 turns) - 2 Cards
            else if (card.policyIndex == 2)
            {
                if (migrationStatus == MigrationStatus.undocumented)
                {
                    if (prosperityCounter < 0)
                    {
                        setJob("Unemployed");
                    }
                }
                else
                {
                    IncrementCounter(card.ammount);
                }
            }
            break;
        }

        case PolicyType.Occupation:
        {
            //If you are of X profession +-n. - one card for each profession = 7 cards (any duplicates?)
            if (card.policyIndex == 0)
            {
                if (jobTier == JobTier.tierOne)
                {
                    if (card.professionName == proffession)
                    {
                        IncrementCounter(card.ammount);
                    }
                }
            }
            //If you are of -N prosperity as X profession +n else -n. - 7 cards
            else if (card.policyIndex == 1)
            {
                if (jobTier == JobTier.tierOne && prosperityCounter < 0)
                {
                    if (card.professionName == proffession)
                    {
                        IncrementCounter(card.ammount);
                    }
                }
            }
            //If your prosperity is +n you get a promotion in your job, (if you are legal) (after n turns) - 7 cards.
            else if (card.policyIndex == 2)
            {
                if (migrationStatus != MigrationStatus.undocumented)
                {
                    if (jobTier != JobTier.tierThree)
                    {
                        if (prosperityCounter > 0)
                        {
                            if (jobTier == JobTier.tierOne)
                            {
                                setJob(Characters.tierTwoJobs[Random.Range(0, Characters.tierTwoJobs.Length)]);
                            }
                        }
                    }
                }
            }
            //Gain +N prosperity for X profession, lose -n prosperity for Z profession. - 4P2 = 12cards, only the first four occupation group.
            else if (card.policyIndex == 3)
            {
                if (card.professionName == proffession)
                {
                    IncrementCounter(card.ammount);
                }
                else if (card.professionName2 == proffession)
                {
                    IncrementCounter(-card.ammount);
                }
            }
            break;
        }

        case PolicyType.OccupationHierarchy:
        {
            //Tier X workers can gain +n prosperity but tier Z workers will lose -n Prosperity (Vice Versa.) - 3P2 = 6 cards.
            if (card.policyIndex == 0)
            {
                if (jobTier == JobTier.tierOne)
                {
                    IncrementCounter(card.ammount);
                }
                else
                {
                    IncrementCounter(-card.ammount);
                }
            }
            //Tier X workers can change jobs or promote, if positive prosperity. - 3 Cards.
            else if (card.policyIndex == 1)
            {
                if (prosperityCounter > 0)
                {
                    setJob(Characters.tierTwoJobs[Random.Range(0, Characters.tierTwoJobs.Length)]);
                }
            }
            break;
        }
        }
    }