Example #1
0
        public Dictionary <PopType, int> getYesVotesByType(IReformValue reform, ref Dictionary <PopType, int> divisionPopulationResult)
        {  // division by pop types
            Dictionary <PopType, int> divisionVotersResult = new Dictionary <PopType, int>();

            foreach (PopType popType in PopType.getAllPopTypes())
            {
                divisionVotersResult.Add(popType, 0);
                divisionPopulationResult.Add(popType, 0);
                foreach (Province province in ownedProvinces)
                {
                    foreach (PopUnit pop in province.AllPops.Where(x => x.Type == popType))
                    {
                        if (pop.getSayingYes(reform))
                        {
                            divisionPopulationResult[popType] += pop.population.Get();// * pop.getVotingPower();
                            if (pop.CanVoteInOwnCountry())
                            {
                                divisionVotersResult[popType] += pop.population.Get();// * pop.getVotingPower();
                            }
                        }
                    }
                }
            }
            return(divisionVotersResult);
        }
Example #2
0
        /// <summary>
        /// Not finished, don't use it
        /// </summary>
        /// <param name="reform"></param>
        public Procent getYesVotes2(IReformValue reform, ref Procent procentPopulationSayedYes)
        {
            int     totalPopulation       = AllPops.Sum(x => x.population.Get());
            int     votingPopulation      = 0;
            int     populationSayedYes    = 0;
            int     votersSayedYes        = 0;
            Procent procentVotersSayedYes = new Procent(0f);
            Dictionary <PopType, int> divisionPopulationResult = new Dictionary <PopType, int>();
            Dictionary <PopType, int> divisionVotersResult     = getYesVotesByType(reform, ref divisionPopulationResult);

            foreach (KeyValuePair <PopType, int> next in divisionVotersResult)
            {
                votersSayedYes += next.Value;
            }

            if (totalPopulation != 0)
            {
                procentPopulationSayedYes.Set((float)populationSayedYes / totalPopulation);
            }
            else
            {
                procentPopulationSayedYes.Set(0);
            }

            if (votingPopulation == 0)
            {
                procentVotersSayedYes.Set(0);
            }
            else
            {
                procentVotersSayedYes.Set((float)votersSayedYes / votingPopulation);
            }
            return(procentVotersSayedYes);
        }
Example #3
0
        public override void SetValue(IReformValue reformValue)
        {
            base.SetValue(reformValue);

            typedValue = reformValue as EconomyReformValue;
            if (typedValue == LaissezFaire)
            {
                if (owner.taxationForRich.tax.get() > 0.5f)
                {
                    owner.taxationForRich.SetValue(LaissezFaire.maxTax);
                }
                if (owner.taxationForPoor.tax.get() > 0.5f)
                {
                    owner.taxationForPoor.SetValue(LaissezFaire.maxTax);
                }
                owner.Provinces.AllProvinces.PerformAction(x => OnReformEnactedInProvince(x));
            }
            else if (typedValue == StateCapitalism)
            {
                if (owner.taxationForRich.tax.get() < 0.2f)
                {
                    owner.taxationForRich.SetValue(StateCapitalism.minTax);
                }
                if (owner.taxationForPoor.tax.get() < 0.2f)
                {
                    owner.taxationForPoor.SetValue(StateCapitalism.minTax);
                }
            }
        }
Example #4
0
        //private Movement(PopUnit firstPop, Country place) : base(place)
        //{
        //    members.Add(firstPop);
        //    Country.movements.Add(this);
        //}

        private Movement(AbstractReform reform, IReformValue goal, PopUnit firstPop, Country place) : base(place)// : this(firstPop, place)
        {
            members.Add(firstPop);
            Country.Politics.RegisterMovement(this);
            targetReformType  = reform;
            targetReformValue = goal;
            Flag = Nashet.Flag.Rebels;
        }
Example #5
0
 /// <summary>
 /// Gets reform which can take given value
 /// </summary>
 public AbstractReform GetReform(IReformValue abstractReformValue)
 {
     foreach (var item in reforms)
     {
         if (item.AllPossibleValues.Any(x => x == abstractReformValue))
         {
             return(item);
         }
     }
     return(null);
 }
Example #6
0
        public Procent getYesVotes(IReformValue reform, ref Procent procentPopulationSayedYes)
        {
            // calculate how much of population wants selected reform
            int     totalPopulation       = AllPops.Sum(x => x.population.Get());
            int     votingPopulation      = 0;
            int     populationSayedYes    = 0;
            int     votersSayedYes        = 0;
            Procent procentVotersSayedYes = new Procent(0);

            //Procent procentPopulationSayedYes = new Procent(0f);
            foreach (Province province in ownedProvinces)
            {
                foreach (PopUnit pop in province.AllPops)
                {
                    if (pop.CanVoteInOwnCountry())
                    {
                        if (pop.getSayingYes(reform))
                        {
                            votersSayedYes     += pop.population.Get(); // * pop.getVotingPower();
                            populationSayedYes += pop.population.Get(); // * pop.getVotingPower();
                        }
                        votingPopulation += pop.population.Get();       // * pop.getVotingPower();
                    }
                    else
                    {
                        if (pop.getSayingYes(reform))
                        {
                            populationSayedYes += pop.population.Get();// * pop.getVotingPower();
                        }
                    }
                }
            }
            if (totalPopulation != 0)
            {
                procentPopulationSayedYes.Set((float)populationSayedYes / totalPopulation);
            }
            else
            {
                procentPopulationSayedYes.Set(0);
            }

            if (votingPopulation == 0)
            {
                procentVotersSayedYes.Set(0);
            }
            else
            {
                procentVotersSayedYes.Set((float)votersSayedYes / votingPopulation);
            }
            return(procentVotersSayedYes);
        }
Example #7
0
        public virtual void SetValue(IReformValue reformValue)
        {
            foreach (PopUnit pop in owner.Provinces.AllPops)
            {
                if (pop.getSayingYes(reformValue))
                {
                    pop.loyalty.Add(Options.PopLoyaltyBoostOnDiseredReformEnacted);
                    pop.loyalty.clamp100();
                }
            }
            var isThereSuchMovement = owner.Politics.AllMovements.FirstOrDefault(x => x.getGoal() == reformValue);

            if (isThereSuchMovement != null)
            {
                isThereSuchMovement.onRevolutionWon(false);
            }
            Value = reformValue;
        }
Example #8
0
        public override void SetValue(IReformValue selectedReform)
        {
            base.SetValue(selectedReform);
            typedValue = selectedReform as GovernmentReformValue;
            owner.setPrefix();

            if (typedValue == Tribal)
            {
                owner.economy.SetValue(Economy.StateCapitalism);
                //owner.serfdom.setValue(Serfdom.AbolishedAndNationalized);
                owner.minimalWage.SetValue(MinimalWage.None);
                owner.unemploymentSubsidies.SetValue(UnemploymentSubsidies.None);
                owner.minorityPolicy.SetValue(MinorityPolicy.Residency);
                owner.taxationForPoor.SetValue(Tribal.defaultPoorTax);
                //owner.taxationForRich.setValue(TaxationForRich.PossibleStatuses[10]);
            }
            else
            if (typedValue == Aristocracy)
            {
                owner.economy.SetValue(Economy.StateCapitalism);
                //owner.serfdom.setValue(Serfdom.AbolishedAndNationalizated);
                owner.minimalWage.SetValue(MinimalWage.None);
                owner.unemploymentSubsidies.SetValue(UnemploymentSubsidies.None);
                owner.minorityPolicy.SetValue(MinorityPolicy.Residency);
                //owner.taxationForPoor.setValue(TaxationForPoor.PossibleStatuses[5]);
                owner.taxationForRich.SetValue(Aristocracy.defaultRichTax);
            }
            else
            if (typedValue == Polis)
            {
                if (owner.economy == Economy.PlannedEconomy)
                {
                    owner.economy.SetValue(Economy.StateCapitalism);
                }
                //owner.serfdom.setValue(Serfdom.AbolishedAndNationalizated);
                //owner.minimalWage.setValue(MinimalWage.None);
                //owner.unemploymentSubsidies.setValue(UnemploymentSubsidies.None);
                //owner.minorityPolicy.setValue(MinorityPolicy.Residency);
                //owner.taxationForPoor.setValue(TaxationForPoor.PossibleStatuses[5]);
                //owner.taxationForRich.setValue(TaxationForRich.PossibleStatuses[10]);
            }
            else
            if (typedValue == Despotism)
            {
                owner.economy.SetValue(Economy.StateCapitalism);
                //owner.serfdom.setValue(Serfdom.AbolishedAndNationalizated);
                //owner.minimalWage.setValue(MinimalWage.None);
                //owner.unemploymentSubsidies.setValue(UnemploymentSubsidies.None);
                //owner.minorityPolicy.setValue(MinorityPolicy.Equality);
                //owner.taxationForPoor.setValue(TaxationForPoor.PossibleStatuses[5]);
                //owner.taxationForRich.setValue(TaxationForRich.PossibleStatuses[10]);
            }
            else
            if (typedValue == Theocracy)
            {
                owner.economy.SetValue(Economy.StateCapitalism);
                //owner.serfdom.setValue(Serfdom.AbolishedAndNationalizated);
                //owner.minimalWage.setValue(MinimalWage.None);
                //owner.unemploymentSubsidies.setValue(UnemploymentSubsidies.None);
                owner.minorityPolicy.SetValue(MinorityPolicy.Equality);
                //owner.taxationForPoor.setValue(TaxationForPoor.PossibleStatuses[5]);
                //owner.taxationForRich.setValue(TaxationForRich.PossibleStatuses[10]);
            }
            else
            if (typedValue == WealthDemocracy)
            {
                owner.economy.SetValue(Economy.Interventionism);
                //owner.serfdom.setValue(Serfdom.AbolishedAndNationalizated);
                //owner.minimalWage.setValue(MinimalWage.None);
                //owner.unemploymentSubsidies.setValue(UnemploymentSubsidies.None);
                //owner.minorityPolicy.setValue(MinorityPolicy.Equality);
                //owner.taxationForPoor.setValue(TaxationForPoor.PossibleStatuses[5]);
                //owner.taxationForRich.setValue(TaxationForRich.PossibleStatuses[10]);
            }
            else
            if (typedValue == Democracy)
            {
                if (owner.economy == Economy.PlannedEconomy)
                {
                    owner.economy.SetValue(Economy.LaissezFaire);
                }
                //owner.serfdom.setValue(Serfdom.AbolishedAndNationalizated);
                //owner.minimalWage.setValue(MinimalWage.None);
                //owner.unemploymentSubsidies.setValue(UnemploymentSubsidies.None);
                //owner.minorityPolicy.setValue(MinorityPolicy.Equality);
                //owner.taxationForPoor.setValue(TaxationForPoor.PossibleStatuses[5]);
                //owner.taxationForRich.setValue(TaxationForRich.PossibleStatuses[10]);
            }
            else
            if (typedValue == BourgeoisDictatorship)
            {
                owner.economy.SetValue(Economy.LaissezFaire);
                //owner.serfdom.setValue(Serfdom.AbolishedAndNationalizated);
                owner.minimalWage.SetValue(MinimalWage.None);
                owner.unemploymentSubsidies.SetValue(UnemploymentSubsidies.None);
                owner.minorityPolicy.SetValue(MinorityPolicy.Equality);
                owner.taxationForPoor.SetValue(BourgeoisDictatorship.defaultPoorTax);
                owner.taxationForRich.SetValue(BourgeoisDictatorship.defaultRichTax);
            }
            else
            if (typedValue == Junta)
            {
                owner.economy.SetValue(Economy.StateCapitalism);
                //owner.serfdom.setValue(Serfdom.AbolishedAndNationalizated);
                //owner.minimalWage.setValue(MinimalWage.None);
                //owner.unemploymentSubsidies.setValue(UnemploymentSubsidies.None);
                //owner.minorityPolicy.setValue(MinorityPolicy.Equality);
                //owner.taxationForPoor.setValue(TaxationForPoor.PossibleStatuses[5]);
                //owner.taxationForRich.setValue(TaxationForRich.PossibleStatuses[10]);
            }
            else
            if (typedValue == ProletarianDictatorship)
            {
                owner.economy.SetValue(Economy.PlannedEconomy);
                //owner.serfdom.setValue(Serfdom.AbolishedAndNationalizated);
                owner.minimalWage.SetValue(MinimalWage.None);
                owner.unemploymentSubsidies.SetValue(UnemploymentSubsidies.None);
                owner.minorityPolicy.SetValue(MinorityPolicy.Equality);
                owner.taxationForPoor.SetValue(ProletarianDictatorship.defaultPoorTax);
                owner.taxationForRich.SetValue(ProletarianDictatorship.defaultRichTax);

                //nationalization
                owner.Bank.Nationalize();

                foreach (var province in owner.AllProvinces)
                {
                    OnReformEnactedInProvince(province);
                }
            }
            if (owner == Game.Player)
            {
                //MainCamera.refreshAllActive();
                UIEvents.RiseSomethingVisibleToPlayerChangedInWorld(EventArgs.Empty, this);
            }
        }
Example #9
0
 public override void SetValue(IReformValue selectedReform)
 {
     base.SetValue(selectedReform);
     typedValue = selectedReform as PovertyAidReformValue;
     PovertyAidSize.Recalculate();
 }
Example #10
0
 public override void SetValue(IReformValue selectedReform)
 {
     base.SetValue(selectedReform);
     typedValue = selectedReform as MinorityPolicyValue;
 }
Example #11
0
 public override void SetValue(IReformValue selectedReform)
 {
     base.SetValue(selectedReform);
     typedValue = selectedReform as MinWageReformValue;
     WageSize.Recalculate();
 }
Example #12
0
 public override void SetValue(IReformValue selectedReform)
 {
     base.SetValue(selectedReform);
     typedValue = selectedReform as SerfdomReformValue;
 }
Example #13
0
        //slider.onValueChanged.AddListener(ListenerMethod);

        public void onChoiceValueChanged()
        {
            selectedReformValue = assotiateTable[dropDown.value];
            refresh(false);
        }
Example #14
0
        //public bool isThatReformEnacted(int value)
        //{
        //    return typedvalue == PossibleStatuses[value];
        //}


        public override void SetValue(IReformValue selectedReform)
        {
            base.SetValue(selectedReform);
            typedValue = selectedReform as UnemploymentReformValue;
            SubsizionSize.Recalculate();
        }
 /// <summary>
 /// Could be wrong for some reforms!  Assumes that reforms go in conservative-liberal order
 /// </summary>
 public virtual bool IsMoreConservativeThan(IReformValue anotherReform)
 {
     return(ID < anotherReform.ID);
 }
Example #16
0
 public override void SetValue(IReformValue selectedReform)
 {
     base.SetValue(selectedReform);
     typedValue = selectedReform as FamilyPlanningValue;
 }
 public virtual int GetRelativeConservatism(IReformValue two)
 {
     return(this.ID - two.ID);
 }
Example #18
0
 public override void SetValue(IReformValue reformValue)
 {
     base.SetValue(reformValue);
     typedValue = reformValue as UBIReformValue;
     UBISize.Recalculate();
 }
Example #19
0
 public override void SetValue(IReformValue reformValue)
 {
     base.SetValue(reformValue);
     this.tax = reformValue as ProcentReformValue;
 }