private void CalcCountryEffects(CK2Title title) { if (title.Rank == TitleRank.county) { ((Eu4Country)Owner).NumProvinces++; var provCountryEffects = World.CountryEffects.Sublists["province"]; //values if (provCountryEffects.Sublists.ContainsKey("values")) { var values = provCountryEffects.Sublists["values"]; if (values.Sublists.ContainsKey("technology")) { ((Eu4Country)Owner).CalcEffects(values.Sublists["technology"], TotalTech); } } //CalcEffects(values.Sublists["technology"], TotalTech * multiplier); var provCountryModifiers = provCountryEffects.Sublists["modifiers"]; var prov = title.Province; foreach (var mod in prov.Modifiers) { if (provCountryModifiers.Sublists.ContainsKey(mod)) { ((Eu4Country)Owner).CalcEffects(provCountryModifiers.Sublists[mod]); } } if (title.Province.Hospital) { var provCountryHospital = provCountryEffects.Sublists["hospital"]; ((Eu4Country)Owner).CalcEffectsProvince(provCountryHospital); foreach (var build in prov.HospitalBuildings) { if (provCountryHospital.Sublists.ContainsKey(build)) { ((Eu4Country)Owner).CalcEffectsProvince(provCountryHospital.Sublists[build]); } } } } else if (title.Rank == TitleRank.barony) { ((Eu4Country)Owner).NumHoldings++; var holdingCountryEffects = World.CountryEffects.Sublists["holding"]; var buildingEffects = holdingCountryEffects.Sublists["buildings"]; if (holdingCountryEffects.Sublists.ContainsKey(title.Type)) { ((Eu4Country)Owner).CalcEffectsHolding(holdingCountryEffects.Sublists[title.Type]); } foreach (var build in title.Buildings) { if (buildingEffects.Sublists.ContainsKey(build.Type)) { ((Eu4Country)Owner).CalcEffectsHolding(buildingEffects.Sublists[build.Type]); } } } }
private void CalcEffects(CK2Title title, float multiplier) { if (title.Rank == TitleRank.county) { var countyList = World.ProvinceEffects.Sublists["county"]; //values var values = countyList.Sublists["values"]; CalcEffects(values.Sublists["technology"], TotalTech * multiplier); // hospital var hospital = countyList.Sublists["hospital"]; if (title.Province.Hospital) { CalcEffects(hospital, multiplier); //hospital buildings foreach (var building in title.Province.HospitalBuildings) { if (hospital.Sublists.ContainsKey(building)) { CalcEffects(hospital.Sublists[building], multiplier); } } } //modifiers var modifiers = countyList.Sublists["modifiers"]; foreach (var modifier in title.Province.Modifiers) { if (modifiers.Sublists.ContainsKey(modifier)) { CalcEffects(modifiers.Sublists[modifier], 1f); } } } else if (title.Rank == TitleRank.barony) { var holdingList = World.ProvinceEffects.Sublists["holding"]; //holding type holdingList.Sublists.ForEach(title.Type, (sub) => { CalcEffects(sub, multiplier); }); var buildingList = holdingList.Sublists["buildings"]; //holding buildings foreach (var building in title.Buildings) { if (buildingList.Sublists.ContainsKey(building.Type)) { //high level buildings are already included in the list multiple times - no need to multiply by the level CalcEffects(buildingList.Sublists[building.Type], multiplier); // * building.Level); } } } }
private void AddToFormable(CK2Title t) { if (World.Formables.ContainsKey(t)) { World.Formables[t].Provinces.Add(this); } if (t.DejureLiegeTitle != null) { AddToFormable(t.DejureLiegeTitle); } }
private void AddStrength(CK2Title t, CK2CharacterBase lastHolder = null) { if (t?.Holder != null) { if (!t.IsRevolt && t.Holder != lastHolder) { ((CK2Character)t.Holder).AddStrength(Development); } AddStrength(t.LiegeTitle, t.Holder); } }
private void CheckLiege(CK2Title title) { if (title.DejureLiegeTitle == World.HRE || title.LiegeTitle == World.HRE) { IsHRE = true; } if (title.LiegeTitle != null) { CheckLiege(title.LiegeTitle); } if (title.DejureLiegeTitle != null) { CheckLiege(title.DejureLiegeTitle); } }
public Eu4Country(Eu4World world, CK2CharacterBase holder, string tag, string file, bool vanilla, CK2Title title = null) : base(world) { title = title ?? holder.PrimaryTitle; this.title = title; DisplayNoun = title.DisplayName; DisplayAdj = title.DisplayAdj; IsVanilla = vanilla; CountryTag = tag; World = world; FileName = file; Subjects = new List <string>(); this.holder = holder; GovernmentRank = (byte)((title.Rank == TitleRank.kingdom) ? 2 : (title.Rank == TitleRank.empire ? 3 : 1)); //if (world.TitleGovernmentMapper.ContainsKey(title.Name)) //{ // Government = world.TitleGovernmentMapper[title.Name]; //} //else //{ // //TODO: proper government flavour stuff ////world.GovernmentMapper // //Government = "feudal_monarchy"; //world.GovernmentMapper[holder.GovernmentType]; //} if (holder != null) { var prov = holder.Titles.Where(t => t.Rank == TitleRank.county).Select(t => t.Province).FirstOrDefault(); PrimaryCulture = holder.Culture == prov?.Culture ? World.MapCulture(prov).Name : World.MapCulture(holder.Culture).Name; Religion = World.MapReligion(holder.Religion)?.Name; } AcceptedCultures = new List <string>(); CalcEffects(); Government = GovernmentTypeWeights.OrderByDescending(w => w.Value).First().Key; Reforms = new List <string>(); Reforms.Add(GovernmentReformWeights.OrderByDescending(w => w.Value).First().Key); }
/// <summary> /// Returns true if in CK2 this title would be a dejure part of this country /// </summary> /// <param name="t"></param> /// <returns></returns> internal bool IsDejure(CK2Title t) { return(t.IsDirectDejureLiege(title)); }