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);
843 thing4.c_IDTState = 0;
845 bool flag = thing4.category.id ==
"garbage";
863 i.TryPutShared(thing4);
870 i.MakeEgg(date.IsRealTime, num6);
878 foreach (
Chara member2
in members)
884 Log(
"bNurse", i, member2);
903 for (
int k = 0; k < num3 / 2; k++)
920 i.TryPutShared(thing6);
930 int num = Mathf.Min(100, 70 + (MaxSoil - soilCost));
935 if (cell.
obj != 0 && cell.
sourceObj.tag.Contains(
"flower"))
937 PlantData plantData = cell.TryGetPlant();
938 if (plantData != null && plantData.seed != null)
940 lv += plantData.seed.encLV + 1;
976 Thing mailBox = GetMailBox();
983 Point mailBoxPos = GetMailBoxPos();
998 Thing thing = GetMailBox();
1005 return thing.
pos.
GetNearestPoint(allowBlock:
false, allowChara:
true, allowInstalled:
false, ignoreCenter:
true).
Clamp(useBounds:
true);
1017 int num2 = (policies.
IsActive(2500, 30) ? Evalue(2500) : 0);
1018 int num3 = (policies.
IsActive(2501, 30) ? Evalue(2501) : 0);
1019 int num4 = 50 + (int)Mathf.Sqrt(Evalue(2512)) * 5;
1020 foreach (
Chara member
in members)
1030 int num6 = item.source.tax * 100 / 100;
1036 int num7 = ((isWealthy ? 50 : 10) + member.
LV * 2) * num5 / 100 * num4 / 100;
1037 if (isWealthy && num2 > 0)
1039 num7 = num7 * (150 + (int)Mathf.Sqrt(num2) * 5) / 100;
1043 num7 += (80 + (int)Mathf.Sqrt(num3) * 5) * member.
faith.
source.tax / 100;
1045 num7 = num7 * efficiency / (IsTaxFree ? 100 : 1000);
1049 Log(
"bTax", num7.ToString() ??
"", member.
Name);
1052 statistics.tax += num;
1058 int num = CountGuests();
1069 int maxHolders = traitBed.MaxHolders;
1071 num3 += traitBed.owner.LV * (100 + traitBed.owner.Quality / 2 + traitBed.owner.Evalue(750) / 2) / 100 * maxHolders;
1074 num = Mathf.Min(num, num2);
1078 num3 = num3 * (100 + 5 * (int)Mathf.Sqrt(Evalue(2812))) / 100;
1079 float num4 = 10f + Mathf.Sqrt(num) * 10f;
1082 num4 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2813))) / 100f;
1086 num4 = num4 * (float)(100 + num3) / 100f;
1088 num4 = Mathf.Min(num4, Mathf.Sqrt(Worth) / 15f + 5f);
1095 int num = CountGuests();
1098 float num2 = 10f + Mathf.Sqrt(num) * 10f;
1101 num2 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2815))) / 100f;
1103 num2 = Mathf.Min(num2, Mathf.Sqrt(
tourism) / 5f);
1110 GetIncome(ref incomeShop, ref statistics.
shop,
"getIncomeShop", tax:
false);
1111 GetIncome(ref incomeInn, ref statistics.
inn,
"getIncomeInn", tax:
true);
1112 GetIncome(ref incomeTourism, ref statistics.
tourism,
"getIncomeTourism", tax:
true);
1113 void GetIncome(ref
int n, ref
int stat,
string lang,
bool tax)
1115 if (tax && !IsTaxFree)
1139 thing = thing.
Split(1);
1150 elements.SetBase(
item.id, 1);
1159 elements.SetBase(2003, 1);
1160 elements.SetBase(4002, 1);
1161 elements.SetBase(2115, 1);
1162 elements.SetBase(2204, 1);
1163 elements.SetBase(2120, 1);
1176 elements.SetBase(element.
id, 1);
1180 elements.SetBase(2206, 10);
1183 elements.SetBase(2206, 15);
1197 ValidateUpgradePolicies();
1203 elements.SetBase(list[1].
id, 0);
1204 elements.SetBase(list[2].
id, 0);
1246 policies.
AddPolicy(globalPolicy, show:
false);
1258 if (traitCoreZone !=
null)
1260 SE.Play(
"godbless");
1290 elements.SetBase(2003, Mathf.Min((lv - 1) * 2 + 1, 10));
1291 elements.SetBase(2115, (lv - 1) * admin + 1);
1292 elements.SetBase(2204, (lv - 1) *
food + 1);
1293 elements.GetElement(2003).CheckLevelBonus(elements);
1294 ValidateUpgradePolicies();
1297 elements.SetBase(list[1].
id, 1);
1301 elements.SetBase(list[2].
id, 1);
1305 List<Element> list2 = elements.dict.Values.Where((
Element a) => a.
source.category ==
"landfeat" && a.
HasTag(
"network")).ToList();
1310 foreach (
Element item2
in list2)
1312 elements.Remove(item2.
id);
1315 Msg.
Say(
"upgrade_hearth", lv.ToString() ??
"", owner.
Name);
1316 LogRaw(
"upgrade_hearth".langGame(lv.ToString() ??
"", owner.
Name),
"Good");
1318 void Set(
int a,
int f)
1329 if (exp < GetNextExp())
1340 return lv * lv * lv * 1000;
1354 if (exp >= GetNextExp() && CanUpgrade())
1372 return "hearth1".lang();
1375 for (
int i = 1; i < a; i++)
1377 string text2 = (
"hearth" + (i + 1)).lang();
1378 if (!text2.IsEmpty())
1380 text = text + text2 + Environment.NewLine;
1383 return text.TrimEnd(Environment.NewLine.ToCharArray());
1388 elements.ModBase(ele, v);
1394 if (!members.Contains(c))
1426 RefreshEfficiency();
1428 if (uidMaid == 0 && c.
id ==
"maid")
1438 c.memberType = type;
1439 c.c_wasInPcParty =
false;
1440 RefreshEfficiency();
1476 RefreshEfficiency();
1482 if (members.Count == 0)
1486 foreach (
Chara member
in members)
1490 return (
int)(num / (float)members.Count);
1495 foreach (
Chara member
in members)
1509 c.isRestrained =
false;
1515 RefreshEfficiency();
1522 foreach (
Chara member
in members)
1534 if (
EClass.
rnd(4) == 0 || members.Count == 0)
1538 return members.RandomItem().Name;
1544 foreach (
Chara member
in members)
1585 listRecruit.ForeachReverse(delegate(
HireInfo i)
1593 listRecruit.Remove(i);
1596 listRecruit.Clear();
1597 lastUpdateReqruit = -1;
1601 listRecruit.ForeachReverse(delegate(
HireInfo i)
1605 if (!i.chara.IsGlobal)
1609 listRecruit.Remove(i);
1618 int num = 2 + (int)Mathf.Sqrt(Evalue(2513)) / 2;
1619 int num2 =
EClass.
rnd(3 + (
int)Mathf.Sqrt(Evalue(2513)) / 2) + num - listRecruit.Count;
1625 for (
int j = 0; j < num2; j++)
1647 listRecruit.Add(hireInfo);
1652 listRecruit.ForeachReverse(delegate(
HireInfo i)
1656 listRecruit.Remove(i);
1686 if (
item.chara == c)
1706 int num = 10 + Evalue(2203);
1707 if (Evalue(2701) > 0)
1709 num += 10 + (int)Mathf.Sqrt(Evalue(2701));
1711 if (Evalue(2702) > 0)
1713 num -= 10 + (int)Mathf.Sqrt(Evalue(2702));
1721 foreach (
Element value
in elements.dict.Values)
1723 if (value.
source.category ==
"culture")
1725 num += GetHearthIncome(value.
source.alias);
1734 foreach (KeyValuePair<int, Element>
item in elements.dict)
1736 if (
item.Value.source.aliasParent ==
id)
1741 return 0.2f * (float)num;
1752 return valueWithoutLink;
1755 public string Log(
string idLang,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null,
string ref4 =
null)
1757 Msg.alwaysVisible =
true;
1761 public string Log(
string idLang,
Card c1,
Card c2,
string ref1 =
null,
string ref2 =
null)
1763 Msg.alwaysVisible =
true;
1767 public string Log(
string idLang,
Card c1,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null)
1769 Msg.alwaysVisible =
true;
1773 public string LogRaw(
string text,
string col =
null)
1775 log.
Add(text, col.IsEmpty() ?
null : col);
1776 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
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)
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)
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)