Exemple #1
0
        /// <summary>
        /// Assuming that Type is same, province is changing
        /// </summary>
        public ReadOnlyValue getLifeQuality(PopUnit pop)
        {
            if (!HasJobsFor(pop.Type))
            {
                return(ReadOnlyValue.Zero);
            }
            else
            {
                // common part
                var lifeQuality = getAverageNeedsFulfilling(pop.Type);

                if (!lifeQuality.isBiggerThan(pop.needsFulfilled, Options.PopNeedsEscapingBarrier))
                {
                    return(ReadOnlyValue.Zero);
                }

                // checks for same culture and type
                if (getSimilarPopUnit(pop) != null)
                {
                    lifeQuality.Add(Options.PopSameCultureMigrationPreference);
                }


                if (this.Country == pop.Country)
                // migration part
                {
                    if (!pop.isStateCulture() && !isCoreFor(pop))
                    {
                        lifeQuality.Subtract(0.2f, false);
                    }
                }
                else // immigration part
                {
                    // reforms preferences
                    if (pop.Type.isPoorStrata())
                    {
                        lifeQuality.Add(Country.unemploymentSubsidies.LifeQualityImpact); // . ID * 2 / 100f);
                        lifeQuality.Add(Country.minimalWage.LifeQualityImpact);           //.ID * 1 / 100f);
                        lifeQuality.Add(Country.taxationForRich.LifeQualityImpact);       //.ID * 1 / 100f);
                    }
                    else if (pop.Type.isRichStrata())
                    {
                        if (Country.economy == Economy.LaissezFaire)
                        {
                            lifeQuality.Add(0.05f);
                        }
                        else if (Country.economy == Economy.Interventionism)
                        {
                            lifeQuality.Add(0.02f);
                        }
                    }

                    if (pop.loyalty.get() < 0.3f)
                    {
                        lifeQuality.Add(0.05f, false);
                    }
                    //todo - serfdom

                    if (!pop.CanVoteWithThatGovernment(Country.government.typedValue)) // includes Minority politics, but not only
                    {
                        lifeQuality.Subtract(-0.10f, false);
                    }

                    if (country.Culture != pop.culture && country.minorityPolicy != MinorityPolicy.Equality)
                    {
                        //lifeQuality.Subtract(Options.PopMinorityMigrationBarier, false);
                        return(ReadOnlyValue.Zero);
                    }
                }

                return(lifeQuality);
            }
        }