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)
588 if (member.
GetWork(
"Pioneer") !=
null)
599 lastStatistics = statistics;
605 int sortChance = 40 + GetCivility();
606 int unsortedCount = 0;
607 foreach (
Chara member
in members)
618 int num = Evalue(2702);
620 for (
int i = 0; i < num2; i++)
627 foreach (
Chara member2
in members)
634 void Generate(
Chara c)
649 string id =
"trash2";
656 id = ((
EClass.
rnd(3) == 0) ?
"529" :
"1170");
684 if (unsortedCount >= 5)
715 EClass.player.flags.elinGift =
true;
717 if (listPackage.Count == 0)
725 if (
item.id !=
"bill")
729 PutInMailBox(
item,
item.id ==
"cardboard_box" ||
item.id ==
"gift");
732 Msg.
Say(
"deliver_arrive", num.ToString() ??
"");
739 foreach (
Chara member
in members)
745 thing2.c_idRefCard = i.
id;
763 if (i.
race.breeder >=
EClass.
rnd(2500 - (
int)Mathf.Sqrt(Evalue(2827) * 100)))
767 Thing t2 = i.
MakeEgg(date.IsRealTime, 1, date.IsRealTime);
768 if (!date.IsRealTime)
776 if (!date.IsRealTime)
801 void GetOutcome(
Hobby h)
804 int num4 = h.
GetLv(i);
806 if (!i.elements.HasBase(
id))
808 i.elements.SetBase(
id, 1);
811 for (
int j = 0; j < h.
source.things.Length; j += 2)
813 string text = h.
source.things[j];
814 int num5 = Mathf.Max(1, h.
source.things[j + 1].ToInt() * num3 / 1000);
815 int num6 = num5 / 1000;
822 if (!(text ==
"_egg"))
826 i.MakeMilk(date.IsRealTime, num6);
857 thing4.c_IDTState = 0;
859 bool flag = thing4.category.id ==
"garbage";
877 i.TryPutShared(thing4);
884 i.MakeEgg(date.IsRealTime, num6);
892 foreach (
Chara member2
in members)
898 Log(
"bNurse", i, member2);
917 for (
int k = 0; k < num3 / 2; k++)
934 i.TryPutShared(thing6);
944 int num = Mathf.Min(100, 70 + (MaxSoil - soilCost));
949 if (cell.
obj != 0 && cell.
sourceObj.tag.Contains(
"flower"))
951 PlantData plantData = cell.TryGetPlant();
952 if (plantData != null && plantData.seed != null)
954 lv += plantData.seed.encLV + 1;
990 Thing mailBox = GetMailBox();
997 Point mailBoxPos = GetMailBoxPos();
1012 Thing thing = GetMailBox();
1019 return thing.
pos.
GetNearestPoint(allowBlock:
false, allowChara:
true, allowInstalled:
false, ignoreCenter:
true).
Clamp(useBounds:
true);
1031 int num2 = (policies.
IsActive(2500, 30) ? Evalue(2500) : 0);
1032 int num3 = (policies.
IsActive(2501, 30) ? Evalue(2501) : 0);
1033 int num4 = 50 + (int)Mathf.Sqrt(Evalue(2512)) * 5;
1034 foreach (
Chara member
in members)
1044 int num6 = item.source.tax * 100 / 100;
1050 int num7 = ((isWealthy ? 50 : 10) + member.
LV * 2) * num5 / 100 * num4 / 100;
1051 if (isWealthy && num2 > 0)
1053 num7 = num7 * (150 + (int)Mathf.Sqrt(num2) * 5) / 100;
1057 num7 += (80 + (int)Mathf.Sqrt(num3) * 5) * member.
faith.
source.tax / 100;
1059 num7 = num7 * efficiency / (IsTaxFree ? 100 : 1000);
1063 Log(
"bTax", num7.ToString() ??
"", member.
Name);
1066 statistics.tax += num;
1072 int num = CountGuests();
1083 int maxHolders = traitBed.MaxHolders;
1085 num3 += traitBed.owner.LV * (100 + traitBed.owner.Quality / 2 + traitBed.owner.Evalue(750) / 2) / 100 * maxHolders;
1088 num = Mathf.Min(num, num2);
1092 num3 = num3 * (100 + 5 * (int)Mathf.Sqrt(Evalue(2812))) / 100;
1093 float num4 = 10f + Mathf.Sqrt(num) * 10f;
1096 num4 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2813))) / 100f;
1100 num4 = num4 * (float)(100 + num3) / 100f;
1102 num4 = Mathf.Min(num4, Mathf.Sqrt(Worth) / 15f + 5f);
1109 int num = CountGuests();
1112 float num2 = 10f + Mathf.Sqrt(num) * 10f;
1115 num2 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2815))) / 100f;
1117 num2 = Mathf.Min(num2, Mathf.Sqrt(
tourism) / 5f);
1124 GetIncome(ref incomeShop, ref statistics.
shop,
"getIncomeShop", tax:
false);
1125 GetIncome(ref incomeInn, ref statistics.
inn,
"getIncomeInn", tax:
true);
1126 GetIncome(ref incomeTourism, ref statistics.
tourism,
"getIncomeTourism", tax:
true);
1127 void GetIncome(ref
int n, ref
int stat,
string lang,
bool tax)
1129 if (tax && !IsTaxFree)
1153 thing = thing.
Split(1);
1164 elements.SetBase(
item.id, 1);
1173 elements.SetBase(2003, 1);
1174 elements.SetBase(4002, 1);
1175 elements.SetBase(2115, 1);
1176 elements.SetBase(2204, 1);
1177 elements.SetBase(2120, 1);
1190 elements.SetBase(element.
id, 1);
1194 elements.SetBase(2206, 10);
1197 elements.SetBase(2206, 15);
1211 ValidateUpgradePolicies();
1217 elements.SetBase(list[1].
id, 0);
1218 elements.SetBase(list[2].
id, 0);
1260 policies.
AddPolicy(globalPolicy, show:
false);
1272 if (traitCoreZone !=
null)
1274 SE.Play(
"godbless");
1304 elements.SetBase(2003, Mathf.Min((lv - 1) * 2 + 1, 10));
1305 elements.SetBase(2115, (lv - 1) * admin + 1);
1306 elements.SetBase(2204, (lv - 1) *
food + 1);
1307 elements.GetElement(2003).CheckLevelBonus(elements);
1308 ValidateUpgradePolicies();
1311 elements.SetBase(list[1].
id, 1);
1315 elements.SetBase(list[2].
id, 1);
1319 List<Element> list2 = elements.dict.Values.Where((
Element a) => a.
source.category ==
"landfeat" && a.
HasTag(
"network")).ToList();
1324 foreach (
Element item2
in list2)
1326 elements.Remove(item2.
id);
1329 Msg.
Say(
"upgrade_hearth", lv.ToString() ??
"", owner.
Name);
1330 LogRaw(
"upgrade_hearth".langGame(lv.ToString() ??
"", owner.
Name),
"Good");
1332 void Set(
int a,
int f)
1343 if (exp < GetNextExp())
1354 return lv * lv * lv * 1000;
1368 if (exp >= GetNextExp() && CanUpgrade())
1386 return "hearth1".lang();
1389 for (
int i = 1; i < a; i++)
1391 string text2 = (
"hearth" + (i + 1)).lang();
1392 if (!text2.IsEmpty())
1394 text = text + text2 + Environment.NewLine;
1397 return text.TrimEnd(Environment.NewLine.ToCharArray());
1402 elements.ModBase(ele, v);
1408 if (members.Contains(c))
1446 RefreshEfficiency();
1448 if (uidMaid == 0 && c.
id ==
"maid")
1457 c.memberType = type;
1458 c.c_wasInPcParty =
false;
1459 RefreshEfficiency();
1495 RefreshEfficiency();
1501 if (members.Count == 0)
1505 foreach (
Chara member
in members)
1509 return (
int)(num / (float)members.Count);
1514 foreach (
Chara member
in members)
1528 c.isRestrained =
false;
1534 RefreshEfficiency();
1541 foreach (
Chara member
in members)
1553 if (
EClass.
rnd(4) == 0 || members.Count == 0)
1557 return members.RandomItem().Name;
1563 foreach (
Chara member
in members)
1604 listRecruit.ForeachReverse(delegate(
HireInfo i)
1612 listRecruit.Remove(i);
1615 listRecruit.Clear();
1616 lastUpdateReqruit = -1;
1620 listRecruit.ForeachReverse(delegate(
HireInfo i)
1624 if (!i.chara.IsGlobal)
1628 listRecruit.Remove(i);
1637 int num = 2 + (int)Mathf.Sqrt(Evalue(2513)) / 2;
1638 int num2 =
EClass.
rnd(3 + (
int)Mathf.Sqrt(Evalue(2513)) / 2) + num - listRecruit.Count;
1644 for (
int j = 0; j < num2; j++)
1666 listRecruit.Add(hireInfo);
1671 listRecruit.ForeachReverse(delegate(
HireInfo i)
1675 listRecruit.Remove(i);
1705 if (
item.chara == c)
1725 int num = 10 + Evalue(2203);
1726 if (Evalue(2701) > 0)
1728 num += 10 + (int)Mathf.Sqrt(Evalue(2701));
1730 if (Evalue(2702) > 0)
1732 num -= 10 + (int)Mathf.Sqrt(Evalue(2702));
1740 foreach (
Element value
in elements.dict.Values)
1742 if (value.
source.category ==
"culture")
1744 num += GetHearthIncome(value.
source.alias);
1753 foreach (KeyValuePair<int, Element>
item in elements.dict)
1755 if (
item.Value.source.aliasParent ==
id)
1760 return 0.2f * (float)num;
1771 return valueWithoutLink;
1774 public string Log(
string idLang,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null,
string ref4 =
null)
1776 Msg.alwaysVisible =
true;
1780 public string Log(
string idLang,
Card c1,
Card c2,
string ref1 =
null,
string ref2 =
null)
1782 Msg.alwaysVisible =
true;
1786 public string Log(
string idLang,
Card c1,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null)
1788 Msg.alwaysVisible =
true;
1792 public string LogRaw(
string text,
string col =
null)
1794 log.
Add(text, col.IsEmpty() ?
null : col);
1795 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
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))
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)
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 MakeMilk(bool effect=true, int num=1, bool addToZone=true)
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Thing MakeEgg(bool effect=true, int num=1, bool addToZone=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)