Beispiel #1
0
        private void CalcPoliticalParties(Dictionary <string, float> effects, IdeologyModifier baseModifier)
        {
            //PoliticalParties = new List<PoliticalParty>();

            //IterateIdeaEffects(vic2World, (Dictionary<string, float> effects, byte ideaLevel) =>
            //{
            foreach (var policy in Policies.policyTypes)
            {
                if (effects.ContainsKey(policy.Name))
                {
                    baseModifier.AddModifier(policy, effects[policy.Name]);
                }
            }
            //});
        }
Beispiel #2
0
        public static IdeologyModifier operator +(IdeologyModifier a, IdeologyModifier b)
        {
            var newMod = new IdeologyModifier();

            foreach (var pol in Eu4ToVic2.Policies.policyTypes)
            {
                newMod.AddModifier(pol, 0);
            }
            foreach (var pol in a.Policies)
            {
                newMod.AddModifier(pol.Key, pol.Value);
            }
            foreach (var pol in b.Policies)
            {
                newMod.AddModifier(pol.Key, pol.Value);
            }
            return(newMod);
        }
Beispiel #3
0
 private void FinalisePoliticalParties(Vic2World vic2World, IdeologyModifier baseModifier)
 {
     if (Eu4Country?.CountryTag == "Z16")
     {
         Console.WriteLine("Me!");
     }
     foreach (var ideology in vic2World.IdeologyModifiers)
     {
         var polParty      = new PoliticalParty(CountryTag + "_" + Enum.GetName(typeof(Ideology), ideology.Key), ideology.Key, vic2World);
         var totalModifier = baseModifier + ideology.Value;
         foreach (var pol in totalModifier.Policies)
         {
             polParty.SetIssue(pol.Key, pol.Value);
         }
         PoliticalParties.Add(polParty);
         if (ideology.Key == UpperHouse?.GetMode())
         {
             RulingParty = polParty;
         }
     }
 }
Beispiel #4
0
        private void CalcEffects(Vic2World vic2World)
        {
            NationalValues = new NV();

            TechSchools = new TechSchoolValues();

            Reforms = new Reforms();
            var reforms = new Dictionary <Type, float>();

            UpperHouse = new UHouse();

            PoliticalParties  = new List <PoliticalParty>();
            BasePartyModifier = new IdeologyModifier();

            Technologies = new List <string>();
            var techInvestment = new Dictionary <string, float>();
            var femaleLeaders  = 0f;

            foreach (var techCategory in vic2World.TechOrder.Keys)
            {
                techInvestment.Add(techCategory, 0);
            }
            IterateEffects(vic2World, (Dictionary <string, float> effects) =>
            {
                CalcNationalValues(effects);
                CalcTechSchool(effects);
                CalcReforms(effects, reforms);
                CalcUpperHouse(effects);
                CalcPoliticalParties(effects, BasePartyModifier);
                CalcLiteracy(effects);
                CalcConsciousness(effects);
                CalcMilitancy(effects);
                CalcTechnology(effects, techInvestment);
                femaleLeaders = CalcFemaleLeaders(effects, femaleLeaders);
            });
            FinaliseReforms(reforms);
            FinalisePoliticalParties(vic2World, BasePartyModifier);
            FinaliseTechnology(techInvestment, vic2World.TechOrder);
            FinaliseFemaleLeaders(femaleLeaders);
        }
Beispiel #5
0
        private void LoadPoliticalParties()
        {
            Console.WriteLine("Loading party ideologies...");
            IdeologyModifiers = new Dictionary <Ideology, IdeologyModifier>();
            var parties = PdxSublist.ReadFile("political_parties.txt");

            foreach (var ideology in (Ideology[])Enum.GetValues(typeof(Ideology)))
            {
                var name = Enum.GetName(typeof(Ideology), ideology);
                if (parties.Sublists.ContainsKey(name))
                {
                    var party = new IdeologyModifier();

                    foreach (var policy in Policies.policyTypes)
                    {
                        if (parties.Sublists[name].FloatValues.ContainsKey(policy.Name))
                        {
                            party.AddModifier(policy, parties.Sublists[name].FloatValues[policy.Name].Sum());
                        }
                    }
                    IdeologyModifiers.Add(ideology, party);
                }
            }
        }
Beispiel #6
0
        private Vic2Country(Vic2World world, string tag, IEnumerable <Vic2Country> cultureNations, Vic2Culture primaryCulture)
        {
            World           = world;
            CountryTag      = tag;
            IsVic2Country   = !world.ExistingCountries.Add(tag);
            IsCultureNation = true;
            if (!IsVic2Country)
            {
                Console.WriteLine($"Creating nation for {primaryCulture.DisplayName} culture... ({primaryCulture.Name})");
                GraphicalCulture = "Generic";
                world.Vic2Countries.Add(this);
                //setup
                Capital = 1;

                PrimaryCulture = primaryCulture.Name;

                // Name generator
                DisplayNoun = world.LocalisationHelper.GetSublist("culture_nation").GetString("noun").Replace("%CULTURE%", primaryCulture.DisplayName).Replace("\"", string.Empty);
                DisplayAdj  = world.LocalisationHelper.GetSublist("culture_nation").GetString("adj").Replace("%CULTURE%", primaryCulture.DisplayName).Replace("\"", string.Empty);
                if (primaryCulture.DisplayName.Last() == 'n' && "aeiu".Contains(primaryCulture.DisplayName[primaryCulture.DisplayName.Length - 2]))
                {
                    DisplayNoun = primaryCulture.DisplayName.Substring(0, primaryCulture.DisplayName.Length - 1);
                    //DisplayNoun = world.LocalisationHelper.GetSublist("culture_nation").GetString("noun").Replace("%CULTURE%", primaryCulture.DisplayName).Replace("\"", string.Empty);
                }
                else if (primaryCulture.DisplayName.Last() == 'n' && primaryCulture.DisplayName[primaryCulture.DisplayName.Length - 2] == 'o')
                {
                    //TODO: make this less of a hack
                    if (primaryCulture.DisplayName.EndsWith("eton"))
                    {
                        DisplayNoun = primaryCulture.DisplayName.Substring(0, primaryCulture.DisplayName.Length - 4) + "ittany";
                    }
                    else
                    {
                        DisplayNoun = primaryCulture.DisplayName + 'y';
                    }
                    DisplayAdj = primaryCulture.DisplayName;
                }
                else if (primaryCulture.DisplayName.Last() == 'a')
                {
                    DisplayNoun = primaryCulture.DisplayName;
                    DisplayAdj  = primaryCulture.DisplayName + 'n';
                }
                else if (primaryCulture.DisplayName.Last() == 'i')
                {
                    DisplayNoun = primaryCulture.DisplayName + 'a';
                }
                else if ("ou".Contains(primaryCulture.DisplayName.Last()))
                {
                    DisplayNoun = primaryCulture.DisplayName + "ria";
                }
                else if (primaryCulture.DisplayName.EndsWith("ese"))
                {
                    DisplayNoun = primaryCulture.DisplayName.Substring(0, primaryCulture.DisplayName.Length - 3);
                }
                else if (primaryCulture.DisplayName.Last() == 'e')
                {
                    DisplayNoun = primaryCulture.DisplayName;
                }
                else if (primaryCulture.DisplayName.Last() == 'r' && "aeiou".Contains(primaryCulture.DisplayName[primaryCulture.DisplayName.Length - 2]))
                {
                    DisplayNoun = primaryCulture.DisplayName + "ia";
                }


                AcceptedCultures  = new List <string>();
                PoliticalParties  = new List <PoliticalParty>();
                BasePartyModifier = new IdeologyModifier();
                foreach (var nation in cultureNations)
                {
                    BasePartyModifier += nation.BasePartyModifier;
                }

                FinalisePoliticalParties(world, BasePartyModifier);



                MapColour = primaryCulture.Colour;
                // the most common religion out of nations with that culture
                //Religion = cultureNations.GroupBy(c => c.Religion).Select(c => new {
                //	Name = c.Key, Count = c.Count()
                //}).OrderByDescending(x => x.Count).Select(x => x.Name).First();
                //
                ////most common government type
                //Government = cultureNations.GroupBy(c => c.Government).Select(c => new {
                //	Name = c.Key,
                //	Count = c.Count()
                //}).OrderByDescending(x => x.Count).Select(x => x.Name).First();
            }
        }