示例#1
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);
        }
示例#2
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]);
                }
            }
            //});
        }
示例#3
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);
                }
            }
        }