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);
356 int num2 = Evalue(3707);
357 int num3 = Evalue(3705) + Evalue(3710) * 2;
358 int num4 = 4 + num3 * 4;
359 int num5 = Mathf.Max(1, (100 + Evalue(2205) * 5 + Evalue(3703) * 100 - num2 * 80) / 10);
371 int num7 = 1 +
EClass.
rnd(num2 + num3 + 1);
372 for (
int i = 0; i < num7; i++)
383 int num8 = 3 + lv + Evalue(2206) / 5 + Evalue(3702) * 2 + Evalue(2202) / 2;
384 num8 = num8 * (100 + Evalue(3702) * 20 + Evalue(2206)) / 100;
385 num8 = num8 * (100 + (int)Mathf.Sqrt(Evalue(2811)) * 3) / 100;
393 if (luckyMonth || (policies.
IsActive(2822) && Mathf.Sqrt(Evalue(2822) / 2) + 5f >= (
float)
EClass.
rnd(100)))
402 if (chara !=
null && (chara.
id ==
"nun_mother" || chara.
id ==
"prostitute") && policies.
IsActive(2710))
412 chara.c_allowance = chara.LV * 100;
415 chara.c_allowance *= 10;
447 for (
int j = 0; j < ((!luckyMonth) ? 1 : 2); j++)
451 GenerateGarbage(date);
452 if (!date.IsRealTime)
465 ReceivePackages(date);
467 if (!date.IsRealTime && date.hour % 8 == 0)
471 for (
int k = 0; k < 3; k++)
499 foreach (
Chara member
in members)
511 for (
int i = 0; i < num; i++)
514 if (thingToClean ==
null)
535 foreach (
Chara member
in members)
543 foreach (
Chara member2
in members)
545 member2.c_isPrayed =
false;
546 member2.c_isTrained =
false;
555 luckyMonthDone =
false;
560 luckyMonth = (float)(flag ? 30 : 5) + Mathf.Sqrt(Evalue(2118)) * (
float)(flag ? 4 : 2) > (
float)
EClass.
rnd(720);
572 luckyMonthDone =
true;
580 foreach (
Chara member
in members)
596 if (member.
GetWork(
"Pioneer") !=
null)
607 lastStatistics = statistics;
613 int sortChance = 40 + GetCivility();
614 int unsortedCount = 0;
615 foreach (
Chara member
in members)
626 int num = Evalue(2702);
628 for (
int i = 0; i < num2; i++)
635 foreach (
Chara member2
in members)
642 void Generate(
Chara c)
657 string id =
"trash2";
664 id = ((
EClass.
rnd(3) == 0) ?
"529" :
"1170");
692 if (unsortedCount >= 5)
723 EClass.player.flags.elinGift =
true;
725 if (listPackage.Count == 0)
733 if (
item.id !=
"bill")
737 PutInMailBox(
item,
item.id ==
"cardboard_box" ||
item.id ==
"gift");
740 Msg.
Say(
"deliver_arrive", num.ToString() ??
"");
747 foreach (
Chara member
in members)
753 thing2.c_idRefCard = i.
id;
771 if (i.
race.breeder >=
EClass.
rnd(2500 - (
int)Mathf.Sqrt(Evalue(2827) * 100)))
775 Thing t2 = i.
MakeEgg(date.IsRealTime, 1, date.IsRealTime);
776 if (!date.IsRealTime)
784 if (!date.IsRealTime)
820 void GetOutcome(
Hobby h)
823 int num4 = h.
GetLv(i);
825 if (!i.elements.HasBase(
id))
827 i.elements.SetBase(
id, 1);
830 for (
int j = 0; j < h.
source.things.Length; j += 2)
832 string text = h.
source.things[j];
833 int num5 = Mathf.Max(1, h.
source.things[j + 1].ToInt() * num3 / 1000);
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";
896 i.TryPutShared(thing4);
903 i.MakeEgg(date.IsRealTime, num6);
911 foreach (
Chara member2
in members)
917 Log(
"bNurse", i, member2);
936 for (
int k = 0; k < num3 / 2; k++)
953 i.TryPutShared(thing6);
963 int num = Mathf.Min(100, 70 + (MaxSoil - soilCost));
968 if (cell.
obj != 0 && cell.
sourceObj.tag.Contains(
"flower"))
970 PlantData plantData = cell.TryGetPlant();
971 if (plantData != null && plantData.seed != null)
973 lv += plantData.seed.encLV + 1;
1009 Thing mailBox = GetMailBox();
1010 if (mailBox !=
null)
1016 Point mailBoxPos = GetMailBoxPos();
1031 Thing thing = GetMailBox();
1038 return thing.
pos.
GetNearestPoint(allowBlock:
false, allowChara:
true, allowInstalled:
false, ignoreCenter:
true).
Clamp(useBounds:
true);
1050 int num2 = (policies.
IsActive(2500, 30) ? Evalue(2500) : 0);
1051 int num3 = (policies.
IsActive(2501, 30) ? Evalue(2501) : 0);
1052 int num4 = 50 + (int)Mathf.Sqrt(Evalue(2512)) * 5;
1053 foreach (
Chara member
in members)
1063 int num6 = item.source.tax * 100 / 100;
1069 int num7 = ((isWealthy ? 50 : 10) + member.
LV * 2) * num5 / 100 * num4 / 100;
1070 if (isWealthy && num2 > 0)
1072 num7 = num7 * (150 + (int)Mathf.Sqrt(num2) * 5) / 100;
1076 num7 += (80 + (int)Mathf.Sqrt(num3) * 5) * member.
faith.
source.tax / 100;
1078 num7 = num7 * efficiency / (IsTaxFree ? 100 : 1000);
1082 Log(
"bTax", num7.ToString() ??
"", member.
Name);
1085 statistics.tax += num;
1091 int num = CountGuests();
1102 int maxHolders = traitBed.MaxHolders;
1104 num3 += traitBed.owner.LV * (100 + traitBed.owner.Quality / 2 + traitBed.owner.Evalue(750) / 2) / 100 * maxHolders;
1107 num = Mathf.Min(num, num2);
1111 num3 = num3 * (100 + 5 * (int)Mathf.Sqrt(Evalue(2812))) / 100;
1112 float num4 = 10f + Mathf.Sqrt(num) * 10f;
1115 num4 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2813))) / 100f;
1119 num4 = num4 * (float)(100 + num3) / 100f;
1121 num4 = Mathf.Min(num4, Mathf.Sqrt(Worth) / 15f + 5f);
1128 int num = CountGuests();
1131 float num2 = 10f + Mathf.Sqrt(num) * 10f;
1134 num2 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2815))) / 100f;
1136 num2 = Mathf.Min(num2, Mathf.Sqrt(
tourism) / 5f);
1143 GetIncome(ref incomeShop, ref statistics.
shop,
"getIncomeShop", tax:
false);
1144 GetIncome(ref incomeInn, ref statistics.
inn,
"getIncomeInn", tax:
true);
1145 GetIncome(ref incomeTourism, ref statistics.
tourism,
"getIncomeTourism", tax:
true);
1146 void GetIncome(ref
int n, ref
int stat,
string lang,
bool tax)
1148 if (tax && !IsTaxFree)
1172 thing = thing.
Split(1);
1183 elements.SetBase(
item.id, 1);
1192 elements.SetBase(2003, 1);
1193 elements.SetBase(4002, 1);
1194 elements.SetBase(2115, 1);
1195 elements.SetBase(2204, 1);
1196 elements.SetBase(2120, 1);
1209 elements.SetBase(element.
id, 1);
1213 elements.SetBase(2206, 10);
1216 elements.SetBase(2206, 15);
1230 ValidateUpgradePolicies();
1243 Element[] array = elements.dict.Values.ToArray();
1244 foreach (
Element element
in array)
1246 elements.SetBase(element.
id, 0);
1248 owner.landFeats =
null;
1283 policies.
AddPolicy(globalPolicy, show:
false);
1295 if (traitCoreZone !=
null)
1297 SE.Play(
"godbless");
1327 elements.SetBase(2003, Mathf.Min((lv - 1) * 2 + 1, 10));
1328 elements.SetBase(2115, (lv - 1) * admin + 1);
1329 elements.SetBase(2204, (lv - 1) *
food + 1);
1330 elements.GetElement(2003).CheckLevelBonus(elements);
1331 ValidateUpgradePolicies();
1334 elements.SetBase(list[1].
id, 1);
1338 elements.SetBase(list[2].
id, 1);
1342 List<Element> list2 = elements.dict.Values.Where((
Element a) => a.
source.category ==
"landfeat" && a.
HasTag(
"network")).ToList();
1347 foreach (
Element item2
in list2)
1349 elements.Remove(item2.
id);
1352 Msg.
Say(
"upgrade_hearth", lv.ToString() ??
"", owner.
Name);
1353 LogRaw(
"upgrade_hearth".langGame(lv.ToString() ??
"", owner.
Name),
"Good");
1355 void Set(
int a,
int f)
1366 if (exp < GetNextExp())
1377 return lv * lv * lv * 1000;
1391 if (exp >= GetNextExp() && CanUpgrade())
1409 return "hearth1".lang();
1412 for (
int i = 1; i < a; i++)
1414 string text2 = (
"hearth" + (i + 1)).lang();
1415 if (!text2.IsEmpty())
1417 text = text + text2 + Environment.NewLine;
1420 return text.TrimEnd(Environment.NewLine.ToCharArray());
1425 elements.ModBase(ele, v);
1431 if (members.Contains(c))
1469 RefreshEfficiency();
1471 if (uidMaid == 0 && c.
id ==
"maid")
1480 c.memberType = type;
1481 c.c_wasInPcParty =
false;
1482 RefreshEfficiency();
1518 RefreshEfficiency();
1524 if (members.Count == 0)
1528 foreach (
Chara member
in members)
1532 return (
int)(num / (float)members.Count);
1537 foreach (
Chara member
in members)
1551 c.isRestrained =
false;
1557 RefreshEfficiency();
1564 foreach (
Chara member
in members)
1576 if (
EClass.
rnd(4) == 0 || members.Count == 0)
1580 return members.RandomItem().Name;
1586 foreach (
Chara member
in members)
1627 listRecruit.ForeachReverse(delegate(
HireInfo i)
1635 listRecruit.Remove(i);
1638 listRecruit.Clear();
1639 lastUpdateReqruit = -1;
1643 listRecruit.ForeachReverse(delegate(
HireInfo i)
1647 if (!i.chara.IsGlobal)
1651 listRecruit.Remove(i);
1660 int num = 2 + (int)Mathf.Sqrt(Evalue(2513)) / 2;
1661 int num2 =
EClass.
rnd(3 + (
int)Mathf.Sqrt(Evalue(2513)) / 2) + num - listRecruit.Count;
1667 for (
int j = 0; j < num2; j++)
1689 listRecruit.Add(hireInfo);
1694 listRecruit.ForeachReverse(delegate(
HireInfo i)
1698 listRecruit.Remove(i);
1728 if (
item.chara == c)
1748 int num = 10 + Evalue(2203);
1749 if (Evalue(2701) > 0)
1751 num += 10 + (int)Mathf.Sqrt(Evalue(2701));
1753 if (Evalue(2702) > 0)
1755 num -= 10 + (int)Mathf.Sqrt(Evalue(2702));
1763 foreach (
Element value
in elements.dict.Values)
1765 if (value.
source.category ==
"culture")
1767 num += GetHearthIncome(value.
source.alias);
1776 foreach (KeyValuePair<int, Element>
item in elements.dict)
1778 if (
item.Value.source.aliasParent ==
id)
1783 return 0.2f * (float)num;
1794 return valueWithoutLink;
1797 public string Log(
string idLang,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null,
string ref4 =
null)
1799 Msg.alwaysVisible =
true;
1803 public string Log(
string idLang,
Card c1,
Card c2,
string ref1 =
null,
string ref2 =
null)
1805 Msg.alwaysVisible =
true;
1809 public string Log(
string idLang,
Card c1,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null)
1811 Msg.alwaysVisible =
true;
1815 public string LogRaw(
string text,
string col =
null)
1817 log.
Add(text, col.IsEmpty() ?
null : col);
1818 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)
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)
Thing TryMakeRandomItem(int lv=-1)
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 Clamp(bool useBounds=false)
Thing FindThing(Func< Thing, bool > func)
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false)
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)
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)