2using System.Collections.Generic;
122 public List<Chara>
members =
new List<Chara>();
162 return _lv * _lv * 100 + 100;
214 num -= (num2 -
MaxPopulation) * 20 * 100 / (100 + 20 * (
int)Mathf.Sqrt(ration));
223 if (!h.
source.elements.IsEmpty())
225 for (
int i = 0; i < h.
source.elements.Length; i += 2)
227 if (h.
source.elements[i] == 2207)
229 ration += h.
source.elements[i + 1];
262 Debug.LogError(
"exception: c==null");
266 Debug.LogError(
"exception: pc==null");
326 if (EClass.rnd(24 * members.Count) < starveChance)
337 if (c.hunger.GetPhase() >= 3)
339 Thing meal = GetMeal(c);
342 FoodEffect.Proc(c, meal);
355 int num2 = Evalue(3707);
356 int num3 = Evalue(3705) + Evalue(3710) * 2;
357 int num4 = 4 + num3 * 4;
358 int num5 = Mathf.Max(1, (100 + Evalue(2205) * 5 + Evalue(3703) * 100 - num2 * 80) / 10);
370 int num7 = 1 +
EClass.
rnd(num2 + num3 + 1);
371 for (
int i = 0; i < num7; i++)
382 int num8 = 3 + lv + Evalue(2206) / 5 + Evalue(3702) * 2 + Evalue(2202) / 2;
383 num8 = num8 * (100 + Evalue(3702) * 20 + Evalue(2206)) / 100;
384 num8 = num8 * (100 + (int)Mathf.Sqrt(Evalue(2811)) * 3) / 100;
392 if (luckyMonth || (policies.
IsActive(2822) && Mathf.Sqrt(Evalue(2822) / 2) + 5f >= (
float)
EClass.
rnd(100)))
401 if (chara !=
null && (chara.
id ==
"nun_mother" || chara.
id ==
"prostitute") && policies.
IsActive(2710))
411 chara.c_allowance = chara.LV * 100;
414 chara.c_allowance *= 10;
446 for (
int j = 0; j < ((!luckyMonth) ? 1 : 2); j++)
450 GenerateGarbage(date);
451 if (!date.IsRealTime)
464 ReceivePackages(date);
466 if (!date.IsRealTime && date.hour % 8 == 0)
470 for (
int k = 0; k < 3; k++)
498 foreach (
Chara member
in members)
510 for (
int i = 0; i < num; i++)
513 if (thingToClean ==
null)
534 foreach (
Chara member
in members)
542 foreach (
Chara member2
in members)
544 member2.c_isPrayed =
false;
545 member2.c_isTrained =
false;
554 luckyMonthDone =
false;
559 luckyMonth = (float)(flag ? 30 : 5) + Mathf.Sqrt(Evalue(2118)) * (
float)(flag ? 4 : 2) > (
float)
EClass.
rnd(720);
571 luckyMonthDone =
true;
579 foreach (
Chara member
in members)
595 if (member.
GetWork(
"Pioneer") !=
null)
606 lastStatistics = statistics;
612 int sortChance = 40 + GetCivility();
613 int unsortedCount = 0;
614 foreach (
Chara member
in members)
625 int num = Evalue(2702);
627 for (
int i = 0; i < num2; i++)
634 foreach (
Chara member2
in members)
641 void Generate(
Chara c)
656 string id =
"trash2";
663 id = ((
EClass.
rnd(3) == 0) ?
"529" :
"1170");
691 if (unsortedCount >= 5)
722 EClass.player.flags.elinGift =
true;
724 if (listPackage.Count == 0)
732 if (
item.id !=
"bill")
736 PutInMailBox(
item,
item.id ==
"cardboard_box" ||
item.id ==
"gift");
739 Msg.
Say(
"deliver_arrive", num.ToString() ??
"");
746 foreach (
Chara member
in members)
752 thing2.c_idRefCard = i.
id;
770 if (i.
race.breeder >=
EClass.
rnd(2500 - (
int)Mathf.Sqrt(Evalue(2827) * 100)))
774 Thing t2 = i.
MakeEgg(date.IsRealTime, 1, date.IsRealTime);
775 if (!date.IsRealTime)
783 if (!date.IsRealTime)
819 void GetOutcome(
Hobby h)
822 int num4 = h.
GetLv(i);
824 if (!i.elements.HasBase(
id))
826 i.elements.SetBase(
id, 1);
829 for (
int j = 0; j < h.
source.things.Length; j += 2)
831 string text = h.
source.things[j];
832 int num5 = Mathf.Max(1, h.
source.things[j + 1].ToInt() * num3 / 1000);
833 Debug.Log(i.Name +
"/" + num3 +
"/" + num5);
834 int num6 = num5 / 1000;
841 if (!(text ==
"_egg"))
845 i.MakeMilk(date.IsRealTime, num6);
876 thing4.c_IDTState = 0;
878 bool flag = thing4.category.id ==
"garbage";
888 if (thing4.
id ==
"lunch_dystopia")
900 i.TryPutShared(thing4);
907 i.MakeEgg(date.IsRealTime, num6);
915 foreach (
Chara member2
in members)
921 Log(
"bNurse", i, member2);
940 for (
int k = 0; k < num3 / 2; k++)
957 i.TryPutShared(thing6);
967 int num = Mathf.Min(100, 70 + (MaxSoil - soilCost));
972 if (cell.
obj != 0 && cell.
sourceObj.tag.Contains(
"flower"))
974 PlantData plantData = cell.TryGetPlant();
975 if (plantData != null && plantData.seed != null)
977 lv += plantData.seed.encLV + 1;
1013 Thing mailBox = GetMailBox();
1014 if (mailBox !=
null)
1020 Point mailBoxPos = GetMailBoxPos();
1035 Thing thing = GetMailBox();
1042 return thing.
pos.
GetNearestPoint(allowBlock:
false, allowChara:
true, allowInstalled:
false, ignoreCenter:
true).
Clamp(useBounds:
true);
1054 int num2 = (policies.
IsActive(2500, 30) ? Evalue(2500) : 0);
1055 int num3 = (policies.
IsActive(2501, 30) ? Evalue(2501) : 0);
1056 int num4 = 50 + (int)Mathf.Sqrt(Evalue(2512)) * 5;
1057 foreach (
Chara member
in members)
1067 int num6 = item.source.tax * 100 / 100;
1073 int num7 = ((isWealthy ? 50 : 10) + member.
LV * 2) * num5 / 100 * num4 / 100;
1074 if (isWealthy && num2 > 0)
1076 num7 = num7 * (150 + (int)Mathf.Sqrt(num2) * 5) / 100;
1080 num7 += (80 + (int)Mathf.Sqrt(num3) * 5) * member.
faith.
source.tax / 100;
1082 num7 = num7 * efficiency / (IsTaxFree ? 100 : 1000);
1086 Log(
"bTax", num7.ToString() ??
"", member.
Name);
1089 statistics.tax += num;
1095 int num = CountGuests();
1106 int maxHolders = traitBed.MaxHolders;
1108 num3 += traitBed.owner.LV * (100 + traitBed.owner.Quality / 2 + traitBed.owner.Evalue(750) / 2) / 100 * maxHolders;
1111 num = Mathf.Min(num, num2);
1115 num3 = num3 * (100 + 5 * (int)Mathf.Sqrt(Evalue(2812))) / 100;
1116 float num4 = 10f + Mathf.Sqrt(num) * 10f;
1119 num4 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2813))) / 100f;
1123 num4 = num4 * (float)(100 + num3) / 100f;
1125 num4 = Mathf.Min(num4, Mathf.Sqrt(Worth) / 15f + 5f);
1132 int num = CountGuests();
1135 float num2 = 10f + Mathf.Sqrt(num) * 10f;
1138 num2 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2815))) / 100f;
1140 num2 = Mathf.Min(num2, Mathf.Sqrt(
tourism) / 5f);
1147 GetIncome(ref incomeShop, ref statistics.
shop,
"getIncomeShop", tax:
false);
1148 GetIncome(ref incomeInn, ref statistics.
inn,
"getIncomeInn", tax:
true);
1149 GetIncome(ref incomeTourism, ref statistics.
tourism,
"getIncomeTourism", tax:
true);
1150 void GetIncome(ref
int n, ref
int stat,
string lang,
bool tax)
1152 if (tax && !IsTaxFree)
1176 thing = thing.
Split(1);
1187 elements.SetBase(
item.id, 1);
1196 elements.SetBase(2003, 1);
1197 elements.SetBase(4002, 1);
1198 elements.SetBase(2115, 1);
1199 elements.SetBase(2204, 1);
1200 elements.SetBase(2120, 1);
1213 elements.SetBase(element.
id, 1);
1217 elements.SetBase(2206, 10);
1220 elements.SetBase(2206, 15);
1234 ValidateUpgradePolicies();
1247 Element[] array = elements.dict.Values.ToArray();
1248 foreach (
Element element
in array)
1250 elements.SetBase(element.
id, 0);
1252 owner.landFeats =
null;
1254 owner.branch =
null;
1288 policies.
AddPolicy(globalPolicy, show:
false);
1300 if (traitCoreZone !=
null)
1302 SE.Play(
"godbless");
1332 elements.SetBase(2003, Mathf.Min((lv - 1) * 2 + 1, 10));
1333 elements.SetBase(2115, (lv - 1) * admin + 1);
1334 elements.SetBase(2204, (lv - 1) *
food + 1);
1335 elements.GetElement(2003).CheckLevelBonus(elements);
1336 ValidateUpgradePolicies();
1339 elements.SetBase(list[1].
id, 1);
1343 elements.SetBase(list[2].
id, 1);
1347 List<Element> list2 = elements.dict.Values.Where((
Element a) => a.
source.category ==
"landfeat" && a.
HasTag(
"network")).ToList();
1352 foreach (
Element item2
in list2)
1354 elements.Remove(item2.
id);
1357 Msg.
Say(
"upgrade_hearth", lv.ToString() ??
"", owner.
Name);
1358 LogRaw(
"upgrade_hearth".langGame(lv.ToString() ??
"", owner.
Name),
"Good");
1360 void Set(
int a,
int f)
1371 if (exp < GetNextExp())
1382 return lv * lv * lv * 1000;
1396 if (exp >= GetNextExp() && CanUpgrade())
1414 return "hearth1".lang();
1417 for (
int i = 1; i < a; i++)
1419 string text2 = (
"hearth" + (i + 1)).lang();
1420 if (!text2.IsEmpty())
1422 text = text + text2 + Environment.NewLine;
1425 return text.TrimEnd(Environment.NewLine.ToCharArray());
1430 elements.ModBase(ele, v);
1436 if (members.Contains(c))
1474 RefreshEfficiency();
1476 if (uidMaid == 0 && c.
id ==
"maid")
1485 c.memberType = type;
1486 c.c_wasInPcParty =
false;
1487 RefreshEfficiency();
1523 RefreshEfficiency();
1529 if (members.Count == 0)
1533 foreach (
Chara member
in members)
1537 return (
int)(num / (float)members.Count);
1542 foreach (
Chara member
in members)
1556 c.isRestrained =
false;
1562 RefreshEfficiency();
1569 foreach (
Chara member
in members)
1581 if (
EClass.
rnd(4) == 0 || members.Count == 0)
1585 return members.RandomItem().Name;
1591 foreach (
Chara member
in members)
1632 listRecruit.ForeachReverse(delegate(
HireInfo i)
1640 listRecruit.Remove(i);
1643 listRecruit.Clear();
1644 lastUpdateReqruit = -1;
1648 listRecruit.ForeachReverse(delegate(
HireInfo i)
1652 if (!i.chara.IsGlobal)
1656 listRecruit.Remove(i);
1665 int num = 2 + (int)Mathf.Sqrt(Evalue(2513)) / 2;
1666 int num2 =
EClass.
rnd(3 + (
int)Mathf.Sqrt(Evalue(2513)) / 2) + num - listRecruit.Count;
1672 for (
int j = 0; j < num2; j++)
1698 listRecruit.Add(hireInfo);
1703 listRecruit.ForeachReverse(delegate(
HireInfo i)
1707 listRecruit.Remove(i);
1737 if (
item.chara == c)
1757 int num = 10 + Evalue(2203);
1758 if (Evalue(2701) > 0)
1760 num += 10 + (int)Mathf.Sqrt(Evalue(2701));
1762 if (Evalue(2702) > 0)
1764 num -= 10 + (int)Mathf.Sqrt(Evalue(2702));
1772 foreach (
Element value
in elements.dict.Values)
1774 if (value.
source.category ==
"culture")
1776 num += GetHearthIncome(value.
source.alias);
1785 foreach (KeyValuePair<int, Element>
item in elements.dict)
1787 if (
item.Value.source.aliasParent ==
id)
1792 return 0.2f * (float)num;
1803 return valueWithoutLink;
1806 public string Log(
string idLang,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null,
string ref4 =
null)
1808 Msg.alwaysVisible =
true;
1812 public string Log(
string idLang,
Card c1,
Card c2,
string ref1 =
null,
string ref2 =
null)
1814 Msg.alwaysVisible =
true;
1818 public string Log(
string idLang,
Card c1,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null)
1820 Msg.alwaysVisible =
true;
1824 public string LogRaw(
string text,
string col =
null)
1826 log.
Add(text, col.IsEmpty() ?
null : col);
1827 Msg.alwaysVisible =
false;
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
static Thing GetThingToClean(Chara c=null)
static void Pray(Chara c, bool silent=false)
void Add(Act a, string s="")
int GetInt(int id, int? defaultInt=null)
void SetInt(int id, int value=0)
GlobalCharaList globalCharas
List< Thing > listPackage
void SetTier(int a, bool setTraits=true)
Thing TryMakeRandomItem(int lv=-1, TryMakeRandomItemSource itemSource=TryMakeRandomItemSource.Default, Chara crafter=null)
void PurgeDuplicateArtifact(Thing af)
ElementContainerCard elements
bool HasElement(int ele, int req=1)
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Thing AddThing(string id, int lv=-1)
virtual void SetBlessedState(BlessedState s)
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Thing MakeMilk(bool effect=true, int num=1, bool addToZone=true, BlessedState? state=null)
void MoveImmediate(Point p, bool focus=true, bool cancelAI=true)
SourceCategory.Row category
void ModNum(int a, bool notify=true)
Thing MakeEgg(bool effect=true, int num=1, bool addToZone=true, int fertChance=20, BlessedState? state=null)
static Chara CreateWealthy(int lv=-1)
static Chara CreateFromFilter(string id, int lv=-1, int levelRange=-1)
void SetHomeZone(Zone zone)
override bool IsAliveInCurrentZone
Hostility OriginalHostility
void SetFaction(Faction f)
void TryPutShared(Thing t, List< Thing > containers=null, bool dropIfFail=true)
void CureHost(CureType type, int p=100, BlessedState state=BlessedState.Normal)
void RefreshWorkElements(ElementContainer parent=null)
bool HasCondition(string alias)
Chara SetGlobal(Zone _home, int x, int z)
bool CanEat(Thing t, bool shouldEat=false)
override bool IsDeadOrSleeping
List< Hobby > ListHobbies(bool useMemberType=true)
FactionMemberType memberType
List< Hobby > ListWorks(bool useMemberType=true)
void Revive(Point p=null, bool msg=false)
void ClearBed(Map map=null)
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
static void MakeDish(Thing food, int lv, Chara crafter=null)
int GetRaw(int offsetHours=0)
static int curve(int a, int start, int step, int rate=75)
static SourceManager sources
static int rndHalf(int a)
void OnRemoveMember(Chara c)
void OnAddMemeber(Chara c)
Element ModBase(int ele, int v)
Element SetBase(string alias, int v, int potential=0)
int GetRoadDist(int gx, int gy)
void SetOwner(FactionBranch _branch)
int GetProductBonus(Chara c)
string Log(string idLang, Card c1, Card c2, string ref1=null, string ref2=null)
ExpeditionManager expeditions
void DailyOutcome(VirtualDate date)
HappinessManager happiness
string Log(string idLang, Card c1, string ref1=null, string ref2=null, string ref3=null)
void RemoveRecruit(Chara c)
void OnSimulateMonth(VirtualDate date)
int CountMembers(FactionMemberType type, bool onlyAlive=false)
void ChangeMemberType(Chara c, FactionMemberType type)
void AddFeat(int ele, int v)
Statistics lastStatistics
ResearchManager researches
string GetHearthHint(int a)
int GetTechUpgradeCost(Element e)
void OnSimulateDay(VirtualDate date)
int GetNextExp(int _lv=-1)
float GetHearthIncome(string id)
void GenerateGarbage(VirtualDate date)
void RemoveMemeber(Chara c)
void UpdateReqruits(bool clear=false)
void OnSimulateHour(VirtualDate date)
List< HireInfo > listRecruit
string LogRaw(string text, string col=null)
void PutInMailBox(Thing t, bool outside=false, bool install=true)
void ReceivePackages(VirtualDate date)
string Log(string idLang, string ref1=null, string ref2=null, string ref3=null, string ref4=null)
HomeResourceManager resources
int GetHappiness(FactionMemberType type)
ElementContainerZone elements
void BanishMember(Chara c, bool skipMsg=false)
void ValidateUpgradePolicies()
FactionBranch FindBranch(Chara c)
ElementContainerFaction charaElements
bool IsGlobalPolicyActive(int id)
ElementContainerZone elements
HashSet< int > globalPolicies
void RemoveReserve(Chara c)
void SetGlobalPolicyActive(int id, bool active)
ReligionManager religions
void SetOwner(FactionBranch _owner)
int GetEfficiency(Chara c)
void SetOwner(FactionBranch _owner)
static string _currency(object a, string IDCurrency)
void ForeachCell(Action< Cell > action)
Point GetRandomSurface(int x, int z, int radius, bool walkable=true, bool allowWater=false)
Thing FindThing(Func< Thing, bool > func)
void SetDecal(int x, int z, int id=0, int amount=1, bool refresh=true)
void OnSimulateHour(VirtualDate date)
void SetOwner(FactionBranch _branch)
static string GetRawText(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
void AddMemeber(Chara c, bool showMsg=false)
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Point Clamp(bool useBounds=false)
Thing FindThing(Func< Thing, bool > func)
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
void AddPolicy(string id)
bool IsActive(int id, int days=-1)
void OnSimulateHour(VirtualDate date)
void SetOwner(FactionBranch _owner)
int GetNum(string id, bool onlyShared=false)
SourceReligion.Row source
void SetOwner(FactionBranch _branch)
static SpawnSetting HomeWild(int lv)
static SpawnSetting HomeEnemy(int lv)
static SpawnSetting HomeGuest(int lv)
static bool HasDLC(ID_DLC id)
void OnUpdateRecruit(FactionBranch branch)
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
static Thing CreateTreasure(string id, int lv, TreasureType type=TreasureType.Map)
static Thing CreateFromTag(string idTag, int lv=-1)
static Thing CreateFromCategory(string idCat, int lv=-1)
static Thing Create(string id, int idMat=-1, int lv=-1)
virtual bool IsCountAsResident
static Chara Incubate(Thing egg, Point pos, Card incubator=null)
TraitSet GetTraitSet(Type t)
static void Reserve(string idStep, Action onBeforePlay=null)
static void Say(string text, FontColor fontColor=FontColor.Default, Sprite sprite=null)
void SendPackage(Thing p)
List< Chara > ListMinions(Chara c)
Thing TryGetThingFromSharedContainer(Func< Thing, bool > func)
ElementContainerZone elements
Chara SpawnMob(Point pos=null, SpawnSetting setting=null)
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
bool TryAddThing(Thing target, Point p, bool destroyIfFail=false)
List< Element > ListLandFeats()
Card AddCard(Card t, Point point)
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)