Exemple #1
0
 public Vic2Country GetCountry(Eu4CountryBase eu4Country)
 {
     if (eu4Country == null)
     {
         return(null);
     }
     return(Vic2Countries.Find(c => c.Eu4Country == eu4Country));
 }
Exemple #2
0
        public string GetV2Government(Eu4CountryBase eu4Country)
        {
            var govern = Map(Government, eu4Country.Government);

            if (govern == "monarchy")
            {
                foreach (var mon in Monarchies)
                {
                    if (eu4Country.Absolutism < mon.MaxAbsolutism && eu4Country.Absolutism >= mon.MinAbsolutism)
                    {
                        govern = mon.ID;
                        break;
                    }
                }
            }
            return(govern);
        }
Exemple #3
0
        public Vic2Country(Vic2World vic2World, Eu4CountryBase eu4Country)
        {
            World            = vic2World;
            CountryTag       = vic2World.V2Mapper.GetV2Country(eu4Country.CountryTag);
            IsVic2Country    = !vic2World.ExistingCountries.Add(CountryTag);
            Eu4Country       = eu4Country;
            MapColour        = eu4Country.MapColour;
            GraphicalCulture = "Generic";
            DisplayNoun      = eu4Country.DisplayNoun;
            DisplayAdj       = eu4Country.DisplayAdj;

            PrimaryCulture   = vic2World.V2Mapper.GetV2Culture(eu4Country.PrimaryCulture);
            AcceptedCultures = eu4Country.AcceptedCultures.ConvertAll(c => vic2World.V2Mapper.GetV2Culture(c));

            Religion = vic2World.V2Mapper.GetV2Religion(eu4Country.Religion);

            Government = vic2World.V2Mapper.GetV2Government(eu4Country);

            Capital = vic2World.GetBestVic2ProvinceMatch(eu4Country.Capital);

            //base literacy
            Literacy = 0.1f;

            IsCivilised = eu4Country.Institutions.Values.All(b => b);
            // -100 - 100 scaled to 0 - 100
            //Prestige = (eu4Country.Prestige + 100) / 2;

            Prestige = (100 * eu4Country.GreatPowerScore) / eu4Country.World.GreatestPower.GreatPowerScore;

            LastElection = eu4Country.LastElection;

            CalcEffects(vic2World);
            // TODO: make this less of a hack
            if (Government == "absolute_monarchy" && Reforms.vote_franschise != vote_franschise.none_voting)
            {
                Government = "prussian_constitutionalism";
            }
            if (Government == null)
            {
                Console.WriteLine("Uh oh");
            }
            //RulingParty = PoliticalParties.First(p => p.Ideology == UpperHouse.GetMode());
        }
Exemple #4
0
        public static void IterateCountryEffects(Vic2World vic2World, Eu4CountryBase country, PdxSublist effects, Action <Dictionary <string, float> > callback)
        {
            if (effects.Sublists.ContainsKey("ideas"))
            {
                //idea groups
                foreach (var idea in country.Ideas)
                {
                    if (effects.GetSublist("ideas").Sublists.ContainsKey(idea.Key))
                    {
                        callback(effects.GetSublist("ideas").GetSublist(idea.Key).FloatValues.ToDictionary(effect => effect.Key, effect => (idea.Value + 1) * effect.Value.Sum()));
                    }
                }
            }

            // country flags
            if (effects.Sublists.ContainsKey("country_flags"))
            {
                foreach (var flag in country.Flags)
                {
                    if (effects.GetSublist("country_flags").Sublists.ContainsKey(flag))
                    {
                        callback(effects.GetSublist("country_flags").GetSublist(flag).FloatValues.ToDictionary(effect => effect.Key, effect => effect.Value.Sum()));
                    }
                }
            }
            // religion
            if (effects.Sublists.ContainsKey("religion"))
            {
                if (effects.GetSublist("religion").Sublists.ContainsKey(country.Religion))
                {
                    callback(effects.GetSublist("religion").GetSublist(country.Religion).FloatValues.ToDictionary(effect => effect.Key, effect => effect.Value.Sum()));
                    //newCallback(effects.GetSublist("religion").GetSublist(country.Religion), 1);
                }
            }

            // government
            if (effects.Sublists.ContainsKey("government"))
            {
                if (effects.GetSublist("government").Sublists.ContainsKey(country.Government))
                {
                    callback(effects.GetSublist("government").GetSublist(country.Government).FloatValues.ToDictionary(effect => effect.Key, effect => effect.Value.Sum()));
                    //newCallback(effects.GetSublist("government").GetSublist(country.Government), 1);
                    //callback(effects.Sublists["government"].Sublists[country.Government].KeyValuePairs.ToDictionary(effect => effect.Key, effect => float.Parse(effect.Value)));
                }
            }

            // policies
            if (effects.Sublists.ContainsKey("policies"))
            {
                foreach (var policy in country.Policies)
                {
                    if (effects.GetSublist("policies").Sublists.ContainsKey(policy))
                    {
                        callback(effects.GetSublist("policies").GetSublist(policy).FloatValues.ToDictionary(effect => effect.Key, effect => effect.Value.Sum()));
                        //newCallback(effects.GetSublist("policies").GetSublist(policy), 1);
                        //callback(effects.Sublists["policies"].Sublists[policy].KeyValuePairs.ToDictionary(effect => effect.Key, effect => float.Parse(effect.Value)));
                    }
                }
            }

            // values

            vic2World.ValueEffect(effects, callback, "mercantilism", country.Mercantilism);
            vic2World.ValueEffect(effects, callback, "legitimacy", country.Legitimacy);                    // - 50);
            vic2World.ValueEffect(effects, callback, "republican_tradition", country.RepublicanTradition); // - 50);
            vic2World.ValueEffect(effects, callback, "stability", country.Stability);
            vic2World.ValueEffect(effects, callback, "absolutism", country.Absolutism);
            // tech
            vic2World.ValueEffect(effects, callback, "adm_tech", country.AdmTech);
            vic2World.ValueEffect(effects, callback, "dip_tech", country.DipTech);
            vic2World.ValueEffect(effects, callback, "mil_tech", country.MilTech);


            //institutions
            if (effects.Sublists.ContainsKey("institutions"))
            {
                foreach (var institution in country.Institutions)
                {
                    var key = institution.Value ? institution.Key : ("not_" + institution.Key);
                    if (effects.Sublists["institutions"].Sublists.ContainsKey(key))
                    {
                        callback(effects.GetSublist("institutions").GetSublist(key).FloatValues.ToDictionary(effect => effect.Key, effect => effect.Value.Sum()));
                    }
                }
            }
        }