Elin Decompiled Documentation EA 23.173 Stable Patch 1
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Pages
FactionBranch Class Reference
Inheritance diagram for FactionBranch:
EClass

Classes

class  Statistics
 

Public Member Functions

int GetNextExp (int _lv=-1)
 
int Evalue (int ele)
 
int GetProductBonus (Chara c)
 
void RefreshEfficiency ()
 
void Abandon ()
 
void OnCreate (Zone zone)
 
void SetOwner (Zone zone)
 
void OnActivateZone ()
 
void OnAfterSimulate ()
 
void OnUnloadMap ()
 
void OnSimulateHour (VirtualDate date)
 
void AutoClean ()
 
void OnSimulateDay (VirtualDate date)
 
void OnAdvanceDay ()
 
void OnSimulateMonth (VirtualDate date)
 
void GenerateGarbage (VirtualDate date)
 
bool TryTrash (Thing t)
 
void ReceivePackages (VirtualDate date)
 
void DailyOutcome (VirtualDate date)
 
void PutInMailBox (Thing t, bool outside=false, bool install=true)
 
Thing GetMailBox ()
 
Point GetMailBoxPos ()
 
int GetResidentTax ()
 
void CalcInnIncome ()
 
void CalcTourismIncome ()
 
void GetDailyIncome ()
 
Thing GetMeal (Chara c)
 
void OnClaimZone ()
 
void OnUnclaimZone ()
 
void ValidateUpgradePolicies ()
 
void Upgrade ()
 
bool CanUpgrade ()
 
int GetUpgradeCost ()
 
void ModExp (int a)
 
string GetHearthHint (int a)
 
void AddFeat (int ele, int v)
 
void AddMemeber (Chara c)
 
void ChangeMemberType (Chara c, FactionMemberType type)
 
void BanishMember (Chara c, bool skipMsg=false)
 
void RemoveMemeber (Chara c)
 
int GetHappiness (FactionMemberType type)
 
bool IsAllDead ()
 
void Recruit (Chara c)
 
Chara GetMaid ()
 
string GetRandomName ()
 
int CountMembers (FactionMemberType type, bool onlyAlive=false)
 
int CountGuests ()
 
int CountWealthyGuests ()
 
void UpdateReqruits (bool clear=false)
 
void AddRecruit (Chara c)
 
void RemoveRecruit (Chara c)
 
int CountNewRecruits ()
 
void ClearNewRecruits ()
 
bool IsRecruit (Chara c)
 
int CountPasture ()
 
int GetPastureCost ()
 
int GetCivility ()
 
float GetHearthIncome ()
 
float GetHearthIncome (string id)
 
int GetTechUpgradeCost (Element e)
 
string Log (string idLang, string ref1=null, string ref2=null, string ref3=null, string ref4=null)
 
string Log (string idLang, Card c1, Card c2, string ref1=null, string ref2=null)
 
string Log (string idLang, Card c1, string ref1=null, string ref2=null, string ref3=null)
 
string LogRaw (string text, string col=null)
 

Public Attributes

int lv = 1
 
int rank
 
int exp
 
int seedPlan
 
int temper
 
int uidMaid
 
int lastUpdateReqruit
 
int incomeShop
 
bool luckyMonth
 
bool luckyMonthDone
 
GStability stability
 
HomeResourceManager resources = new HomeResourceManager()
 
ResearchManager researches = new ResearchManager()
 
PolicyManager policies = new PolicyManager()
 
HappinessManager happiness = new HappinessManager()
 
MeetingManager meetings = new MeetingManager()
 
Thing stash
 
MsgLog log
 
Religion faith
 
ExpeditionManager expeditions = new ExpeditionManager()
 
List< HireInfolistRecruit = new List<HireInfo>()
 
int dateFound
 
int tourism
 
Statistics statistics = new Statistics()
 
Statistics lastStatistics = new Statistics()
 
Zone owner
 
int incomeInn
 
int incomeTourism
 
int efficiency = 100
 
List< Charamembers = new List<Chara>()
 

Properties

int Money [get]
 
int Worth [get]
 
int NumHeirloom [get]
 
int MaxAP [get]
 
int MaxPopulation [get]
 
int MaxSoil [get]
 
int ContentLV [get]
 
int DangerLV [get]
 
bool HasItemProtection [get]
 
bool HasNetwork [get]
 
bool IsTaxFree [get]
 
string RankText [get]
 
string TextLv [get]
 
bool IsStartBranch [get]
 
ElementContainerZone elements [get]
 
int MaxLv [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 
- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 7 of file FactionBranch.cs.

Member Function Documentation

◆ Abandon()

void FactionBranch.Abandon ( )
inline

Definition at line 236 of file FactionBranch.cs.

237 {
238 }

◆ AddFeat()

void FactionBranch.AddFeat ( int  ele,
int  v 
)
inline

Definition at line 1428 of file FactionBranch.cs.

1429 {
1430 elements.ModBase(ele, v);
1431 WidgetPopText.Say("rewardElement".lang(EClass.sources.elements.map[ele].GetName()));
1432 }
Definition: EClass.cs:5
static SourceManager sources
Definition: EClass.cs:42
Element ModBase(int ele, int v)
ElementContainerZone elements
SourceElement elements
static void Say(string text, FontColor fontColor=FontColor.Default, Sprite sprite=null)

References SourceManager.elements, WidgetPopText.Say(), and EClass.sources.

Referenced by ResearchPlan.ParseReward().

◆ AddMemeber()

void FactionBranch.AddMemeber ( Chara  c)
inline

Definition at line 1434 of file FactionBranch.cs.

1435 {
1436 if (members.Contains(c))
1437 {
1438 return;
1439 }
1442 c.SetGlobal();
1444 c.SetHomeZone(owner);
1445 foreach (Thing item in c.things.List((Thing a) => a.HasTag(CTAG.godArtifact)).Copy())
1446 {
1448 }
1449 if (c.OriginalHostility <= Hostility.Ally)
1450 {
1451 c.c_originalHostility = Hostility.Ally;
1452 }
1453 c.hostility = Hostility.Ally;
1454 c.enemy = null;
1455 c.orgPos = null;
1456 if (c.memberType != 0 && c.memberType != FactionMemberType.Livestock)
1457 {
1458 c.memberType = FactionMemberType.Default;
1459 }
1460 if (c.hp > c.MaxHP)
1461 {
1462 c.hp = c.MaxHP;
1463 }
1464 if (c.mana.value > c.mana.max)
1465 {
1466 c.mana.value = c.mana.max;
1467 }
1468 if (c.stamina.value > c.stamina.max)
1469 {
1470 c.stamina.value = c.stamina.max;
1471 }
1472 members.Add(c);
1476 if (uidMaid == 0 && c.id == "maid")
1477 {
1478 uidMaid = c.uid;
1479 }
1480 }
CTAG
Definition: CTAG.cs:2
FactionMemberType
Hostility
Definition: Hostility.cs:2
void PurgeDuplicateArtifact(Thing af)
Definition: Card.cs:3138
string id
Definition: Card.cs:31
int hp
Definition: Card.cs:226
bool HasTag(CTAG tag)
Definition: Card.cs:2531
int uid
Definition: Card.cs:118
ThingContainer things
Definition: Card.cs:34
void SetHomeZone(Zone zone)
Definition: Chara.cs:1278
Hostility OriginalHostility
Definition: Chara.cs:467
void SetFaction(Faction f)
Definition: Chara.cs:1271
void RefreshWorkElements(ElementContainer parent=null)
Definition: Chara.cs:8367
Faction faction
Definition: Chara.cs:423
Chara SetGlobal(Zone _home, int x, int z)
Definition: Chara.cs:1314
override int MaxHP
Definition: Chara.cs:704
Stats mana
Definition: Chara.cs:1006
FactionMemberType memberType
Definition: Chara.cs:46
Stats stamina
Definition: Chara.cs:998
static Faction Home
Definition: EClass.cs:26
static Chara pc
Definition: EClass.cs:14
void RefreshEfficiency()
List< Chara > members
void RemoveMemeber(Chara c)
FactionBranch FindBranch(Chara c)
Definition: FACTION.cs:425
ElementContainerFaction charaElements
Definition: FACTION.cs:146
void RemoveReserve(Chara c)
Definition: FACTION.cs:357
virtual int value
Definition: Stats.cs:56
virtual int max
Definition: Stats.cs:68
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
Definition: Thing.cs:8

References Faction.charaElements, Chara.faction, Faction.FindBranch(), Card.HasTag(), EClass.Home, Card.hp, Card.id, item, ThingContainer.List(), Chara.mana, Stats.max, Chara.MaxHP, Chara.memberType, ElementContainerFaction.OnAddMemeber(), Chara.OriginalHostility, EClass.pc, Card.PurgeDuplicateArtifact(), Chara.RefreshWorkElements(), RemoveMemeber(), Faction.RemoveReserve(), Chara.SetFaction(), Chara.SetGlobal(), Chara.SetHomeZone(), Chara.stamina, Card.things, Card.uid, and Stats.value.

Referenced by Chara._MakeAlly(), Zone.AbandonZone(), Zone.ClaimZone(), TraitFoodEggFertilized.Incubate(), QuestVernis.OnChangePhase(), QuestIntroInspector.OnComplete(), QuestVernis.OnComplete(), QuestDialog.OnDropReward(), Game.OnLoad(), QuestDebt.OnStart(), and CoreDebug.QuickStart().

◆ AddRecruit()

void FactionBranch.AddRecruit ( Chara  c)
inline

Definition at line 1686 of file FactionBranch.cs.

1687 {
1688 HireInfo hireInfo = new HireInfo
1689 {
1690 chara = c,
1691 isNew = true
1692 };
1693 hireInfo.deadline = EClass.world.date.GetRaw() + (EClass.rnd(5) + 1) * 1440 + EClass.rnd(24) * 60;
1694 listRecruit.Add(hireInfo);
1695 }
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
static int rnd(int a)
Definition: EClass.cs:58
static World world
Definition: EClass.cs:40
List< HireInfo > listRecruit
GameDate date
Definition: World.cs:6

References World.date, Date.GetRaw(), EClass.rnd(), and EClass.world.

◆ AutoClean()

void FactionBranch.AutoClean ( )
inline

Definition at line 497 of file FactionBranch.cs.

498 {
499 foreach (Chara member in members)
500 {
501 if (member.IsPCParty || !member.ExistsOnMap || member.memberType != 0)
502 {
503 continue;
504 }
505 Hobby hobby = member.GetWork("Clean") ?? member.GetWork("Chore");
506 if (hobby == null)
507 {
508 continue;
509 }
510 int num = (5 + EClass.rnd(5)) * hobby.GetEfficiency(member) / 100;
511 for (int i = 0; i < num; i++)
512 {
513 Thing thingToClean = AI_Haul.GetThingToClean(member);
514 if (thingToClean == null)
515 {
516 break;
517 }
519 }
520 }
521 }
static Thing GetThingToClean(Chara c=null)
Definition: AI_Haul.cs:34
bool ExistsOnMap
Definition: Card.cs:2021
Definition: Chara.cs:10
override bool IsPCParty
Definition: Chara.cs:611
Hobby GetWork(string id)
Definition: Chara.cs:8348
static Zone _zone
Definition: EClass.cs:20
Definition: Hobby.cs:4
int GetEfficiency(Chara c)
Definition: Hobby.cs:30
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
Definition: Zone.cs:2063

References EClass._zone, Card.ExistsOnMap, Hobby.GetEfficiency(), AI_Haul.GetThingToClean(), Chara.GetWork(), Chara.IsPCParty, Chara.memberType, EClass.rnd(), and Zone.TryAddThingInSharedContainer().

◆ BanishMember()

void FactionBranch.BanishMember ( Chara  c,
bool  skipMsg = false 
)
inline

Definition at line 1492 of file FactionBranch.cs.

1493 {
1494 RemoveMemeber(c);
1495 if (!skipMsg)
1496 {
1497 Msg.Say("banish", c, EClass._zone.Name);
1498 }
1499 if (c.IsGlobal)
1500 {
1501 c.OnBanish();
1502 }
1503 else
1504 {
1505 c.Destroy();
1506 }
1507 }
void Destroy()
Definition: Card.cs:4805
override bool IsGlobal
Definition: Chara.cs:606
void OnBanish()
Definition: Chara.cs:1284
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
virtual string Name
Definition: Spatial.cs:495

References EClass._zone, Card.Destroy(), Chara.IsGlobal, Spatial.Name, Chara.OnBanish(), and Msg.Say().

Referenced by CoreDebug.Fix_RemoveDemitas(), AI_Slaughter.Run(), and AI_Shopping.SellChara().

◆ CalcInnIncome()

void FactionBranch.CalcInnIncome ( )
inline

Definition at line 1093 of file FactionBranch.cs.

1094 {
1095 int num = CountGuests();
1096 if (num == 0)
1097 {
1098 return;
1099 }
1100 int num2 = 0;
1101 int num3 = 0;
1102 foreach (Thing thing in EClass._map.things)
1103 {
1104 if (thing.IsInstalled && thing.trait is TraitBed traitBed && traitBed.owner.c_bedType == BedType.guest)
1105 {
1106 int maxHolders = traitBed.MaxHolders;
1107 num2 += maxHolders;
1108 num3 += traitBed.owner.LV * (100 + traitBed.owner.Quality / 2 + traitBed.owner.Evalue(750) / 2) / 100 * maxHolders;
1109 }
1110 }
1111 num = Mathf.Min(num, num2);
1112 if (num != 0)
1113 {
1114 num3 /= num2;
1115 num3 = num3 * (100 + 5 * (int)Mathf.Sqrt(Evalue(2812))) / 100;
1116 float num4 = 10f + Mathf.Sqrt(num) * 10f;
1117 if (policies.IsActive(2813))
1118 {
1119 num4 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2813))) / 100f;
1120 }
1121 if (policies.IsActive(2812))
1122 {
1123 num4 = num4 * (float)(100 + num3) / 100f;
1124 }
1125 num4 = Mathf.Min(num4, Mathf.Sqrt(Worth) / 15f + 5f);
1126 incomeInn += EClass.rndHalf((int)num4) + EClass.rndHalf((int)num4);
1127 }
1128 }
BedType
Definition: BedType.cs:2
Trait trait
Definition: Card.cs:49
bool IsInstalled
Definition: Card.cs:2317
BedType c_bedType
Definition: Card.cs:912
static Map _map
Definition: EClass.cs:18
static int rndHalf(int a)
Definition: EClass.cs:82
int Evalue(int ele)
int CountWealthyGuests()
PolicyManager policies
List< Thing > things
Definition: Map.cs:49
bool IsActive(int id, int days=-1)
Card owner
Definition: Trait.cs:27

References EClass._map, Card.c_bedType, PolicyManager.IsActive(), Card.IsInstalled, Trait.owner, EClass.rndHalf(), Map.things, and Card.trait.

◆ CalcTourismIncome()

void FactionBranch.CalcTourismIncome ( )
inline

Definition at line 1130 of file FactionBranch.cs.

1131 {
1132 int num = CountGuests();
1133 if (num != 0)
1134 {
1135 float num2 = 10f + Mathf.Sqrt(num) * 10f;
1136 if (policies.IsActive(2815))
1137 {
1138 num2 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2815))) / 100f;
1139 }
1140 num2 = Mathf.Min(num2, Mathf.Sqrt(tourism) / 5f);
1141 incomeTourism += EClass.rndHalf((int)num2) + EClass.rndHalf((int)num2);
1142 }
1143 }

References PolicyManager.IsActive(), EClass.rndHalf(), and tourism.

◆ CanUpgrade()

bool FactionBranch.CanUpgrade ( )
inline

Definition at line 1367 of file FactionBranch.cs.

1368 {
1369 if (lv < MaxLv)
1370 {
1371 if (exp < GetNextExp())
1372 {
1373 return EClass.debug.enable;
1374 }
1375 return true;
1376 }
1377 return false;
1378 }
bool enable
Definition: CoreDebug.cs:285
static CoreDebug debug
Definition: EClass.cs:48
int GetNextExp(int _lv=-1)

References EClass.debug, and CoreDebug.enable.

◆ ChangeMemberType()

void FactionBranch.ChangeMemberType ( Chara  c,
FactionMemberType  type 
)
inline

Definition at line 1482 of file FactionBranch.cs.

1483 {
1484 c.ClearBed();
1485 c.memberType = type;
1486 c.c_wasInPcParty = false;
1490 }
void ClearBed(Map map=null)
Definition: Chara.cs:6788

References Chara.ClearBed(), Chara.RefreshWorkElements(), and PolicyManager.Validate().

Referenced by TraitFoodEggFertilized.Incubate(), and BaseListPeople.OnClick().

◆ ClearNewRecruits()

void FactionBranch.ClearNewRecruits ( )
inline

Definition at line 1721 of file FactionBranch.cs.

1722 {
1723 foreach (HireInfo item in listRecruit)
1724 {
1725 item.isNew = false;
1726 }
1727 }

References item.

Referenced by LayerHire.OnKill(), and LayerQuestBoard.OnKill().

◆ CountGuests()

int FactionBranch.CountGuests ( )
inline

Definition at line 1601 of file FactionBranch.cs.

1602 {
1603 int num = 0;
1604 foreach (Chara chara in EClass._map.charas)
1605 {
1606 if (chara.memberType == FactionMemberType.Guest)
1607 {
1608 num++;
1609 }
1610 }
1611 return num;
1612 }
List< Chara > charas
Definition: Map.cs:81

References EClass._map, Map.charas, and Chara.memberType.

◆ CountMembers()

int FactionBranch.CountMembers ( FactionMemberType  type,
bool  onlyAlive = false 
)
inline

Definition at line 1588 of file FactionBranch.cs.

1589 {
1590 int num = 0;
1591 foreach (Chara member in members)
1592 {
1593 if (member.memberType == type && (!onlyAlive || !member.isDead) && (type != 0 || member.trait.IsCountAsResident))
1594 {
1595 num++;
1596 }
1597 }
1598 return num;
1599 }
new TraitChara trait
Definition: Chara.cs:499
bool isDead
Definition: Chara.cs:385
virtual bool IsCountAsResident
Definition: TraitChara.cs:67

References TraitChara.IsCountAsResident, Chara.isDead, Chara.memberType, and Chara.trait.

Referenced by OnSimulateHour(), RefreshEfficiency(), ContentHomeReport.RefreshInfo(), and UIHomeInfo.RefreshInfo().

◆ CountNewRecruits()

int FactionBranch.CountNewRecruits ( )
inline

Definition at line 1708 of file FactionBranch.cs.

1709 {
1710 int num = 0;
1711 foreach (HireInfo item in listRecruit)
1712 {
1713 if (item.isNew)
1714 {
1715 num++;
1716 }
1717 }
1718 return num;
1719 }

References item.

◆ CountPasture()

int FactionBranch.CountPasture ( )
inline

Definition at line 1741 of file FactionBranch.cs.

1742 {
1743 return EClass._map.Stocked.GetNum("pasture", onlyShared: true) + EClass._map.Installed.GetNum("pasture");
1744 }
PropsInstalled Installed
Definition: Map.cs:123
PropsStocked Stocked
Definition: Map.cs:121
int GetNum(string id, bool onlyShared=false)
Definition: Props.cs:395

References EClass._map, Props.GetNum(), Map.Installed, and Map.Stocked.

Referenced by UIHomeInfo.RefreshInfo().

◆ CountWealthyGuests()

int FactionBranch.CountWealthyGuests ( )
inline

Definition at line 1614 of file FactionBranch.cs.

1615 {
1616 int num = 0;
1617 foreach (Chara chara in EClass._map.charas)
1618 {
1619 if (chara.memberType == FactionMemberType.Guest && chara.IsWealthy)
1620 {
1621 num++;
1622 }
1623 }
1624 return num;
1625 }
bool IsWealthy
Definition: Chara.cs:921

References EClass._map, Map.charas, Chara.IsWealthy, and Chara.memberType.

◆ DailyOutcome()

void FactionBranch.DailyOutcome ( VirtualDate  date)
inline

Definition at line 744 of file FactionBranch.cs.

745 {
746 Thing thing = null;
747 foreach (Chara member in members)
748 {
749 Chara i = member;
750 if (EClass.rnd(EClass.debug.enable ? 2 : (360 * members.Count)) == 0 && !i.IsPC && EClass.pc.faction.IsGlobalPolicyActive(2712) && i.things.Find((Thing t) => t.id == "panty" && t.c_idRefCard == i.id) == null && !i.things.IsFull())
751 {
752 Thing thing2 = ThingGen.Create("panty");
753 thing2.c_idRefCard = i.id;
754 i.AddThing(thing2);
755 }
756 if (i.IsPCParty || !i.ExistsOnMap)
757 {
758 continue;
759 }
761 if (i.memberType == FactionMemberType.Livestock)
762 {
763 if (thing == null)
764 {
765 thing = EClass._map.Stocked.Find("pasture", -1, -1, shared: true) ?? EClass._map.Installed.Find("pasture");
766 }
767 if (thing == null)
768 {
769 continue;
770 }
771 if (i.race.breeder >= EClass.rnd(2500 - (int)Mathf.Sqrt(Evalue(2827) * 100)))
772 {
773 if (EClass.rnd(3) != 0)
774 {
775 Thing t2 = i.MakeEgg(date.IsRealTime, 1, date.IsRealTime);
776 if (!date.IsRealTime)
777 {
778 i.TryPutShared(t2);
779 }
780 }
781 else
782 {
783 Thing t3 = i.MakeMilk(date.IsRealTime, 1, date.IsRealTime);
784 if (!date.IsRealTime)
785 {
786 i.TryPutShared(t3);
787 }
788 }
789 }
790 if (i.HaveFur())
791 {
792 if (i.HasElement(1533))
793 {
794 i.c_fur = 0;
795 }
796 else
797 {
798 i.c_fur++;
799 if (EClass.rnd(4) == 0 && i.HasElement(1532))
800 {
801 i.c_fur++;
802 }
803 }
804 }
805 thing.ModNum(-1);
806 if (thing.isDestroyed || thing.Num == 0)
807 {
808 thing = null;
809 }
810 continue;
811 }
812 foreach (Hobby item in i.ListHobbies())
813 {
814 GetOutcome(item);
815 }
816 foreach (Hobby item2 in i.ListWorks())
817 {
818 GetOutcome(item2);
819 }
820 void GetOutcome(Hobby h)
821 {
822 int num3 = h.GetEfficiency(i) * GetProductBonus(i) / 100;
823 int num4 = h.GetLv(i);
824 int id = EClass.sources.elements.alias[h.source.skill].id;
825 if (!i.elements.HasBase(id))
826 {
827 i.elements.SetBase(id, 1);
828 }
829 i.ModExp(id, 100);
830 for (int j = 0; j < h.source.things.Length; j += 2)
831 {
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;
835 if (num5 % 1000 > EClass.rnd(1000))
836 {
837 num6++;
838 }
839 if (num6 != 0)
840 {
841 if (!(text == "_egg"))
842 {
843 if (text == "milk")
844 {
845 i.MakeMilk(date.IsRealTime, num6);
846 }
847 else
848 {
849 Thing thing4 = ((!text.StartsWith("#")) ? ThingGen.Create(h.source.things[j], -1, num4) : ThingGen.CreateFromCategory(text.Replace("#", ""), num4));
850 if (thing4 != null)
851 {
852 num6 *= thing4.trait.CraftNum;
853 if (thing4.category.id == "fish" && EClass.rnd(EClass.debug.enable ? 1 : 5) == 0)
854 {
855 int num7 = Mathf.Min(EClass.rnd(EClass.rnd(EClass.rnd(EClass.curve(num4, 100, 50, 70) + 50))) / 50, 3);
856 if (num7 > 0)
857 {
858 thing4.SetTier(num7);
859 num6 /= num7 + 1;
860 }
861 }
862 if (num6 < 1)
863 {
864 num6 = 1;
865 }
866 if (!thing4.trait.CanStack)
867 {
868 num6 = 1;
869 }
870 thing4.SetNum(num6);
871 thing4.SetBlessedState(BlessedState.Normal);
872 thing4.TryMakeRandomItem(num4);
873 if (thing4.IsAmmo)
874 {
875 thing4.ChangeMaterial("iron");
876 thing4.c_IDTState = 0;
877 }
878 bool flag = thing4.category.id == "garbage";
879 if (thing4.trait is TraitFoodMeal)
880 {
881 if (thing4.HasTag(CTAG.dish_fail))
882 {
883 flag = true;
884 }
885 else
886 {
887 CraftUtil.MakeDish(thing4, num4 + 10, i);
888 if (thing4.id == "lunch_dystopia")
889 {
890 flag = true;
891 }
892 }
893 }
894 if (flag)
895 {
896 TryTrash(thing4);
897 }
898 else
899 {
900 i.TryPutShared(thing4);
901 }
902 }
903 }
904 }
905 else
906 {
907 i.MakeEgg(date.IsRealTime, num6);
908 }
909 }
910 }
911 switch (h.source.alias)
912 {
913 case "Nurse":
914 {
915 foreach (Chara member2 in members)
916 {
917 if (!member2.IsPCParty)
918 {
919 if (member2.isDead && member2.CanRevive() && EClass.rnd(num3) > EClass.rnd(100))
920 {
921 Log("bNurse", i, member2);
922 member2.Revive(member2.pos, msg: true);
923 if (date.IsRealTime && member2.c_wasInPcParty)
924 {
925 EClass.pc.party.AddMemeber(member2, showMsg: true);
926 }
927 break;
928 }
929 if (EClass.rnd(num3) > EClass.rnd(100))
930 {
931 member2.CureHost(CureType.HealComplete);
932 }
933 }
934 }
935 break;
936 }
937 case "Chore":
938 case "Clean":
939 {
940 for (int k = 0; k < num3 / 2; k++)
941 {
942 Point randomPoint = EClass._map.bounds.GetRandomPoint();
943 if (randomPoint.HasDecal)
944 {
945 EClass._map.SetDecal(randomPoint.x, randomPoint.z);
946 }
947 }
948 break;
949 }
950 case "TreasureHunt":
951 if (EClass.rnd(num3) > EClass.rnd(EClass.debug.enable ? 100 : 5000))
952 {
954 if (thing5 != null)
955 {
956 Thing thing6 = ThingGen.CreateTreasure("chest_treasure", thing5.LV);
957 i.TryPutShared(thing6);
958 thing5.Destroy();
959 WidgetPopText.Say("foundTreasure".lang(thing6.Name));
960 }
961 }
962 break;
963 }
964 }
965 }
966 int soilCost = EClass._zone.GetSoilCost();
967 int num = Mathf.Min(100, 70 + (MaxSoil - soilCost));
968 int flower = 5;
969 int lv = 1;
970 EClass._map.bounds.ForeachCell(delegate(Cell cell)
971 {
972 if (cell.obj != 0 && cell.sourceObj.tag.Contains("flower"))
973 {
974 PlantData plantData = cell.TryGetPlant();
975 if (plantData != null && plantData.seed != null)
976 {
977 lv += plantData.seed.encLV + 1;
978 }
979 else
980 {
981 lv++;
982 }
983 flower++;
984 }
985 });
986 lv /= flower;
987 int num2 = 0;
988 foreach (Thing thing7 in EClass._map.things)
989 {
990 if (thing7.IsInstalled && thing7.trait is TraitBeekeep && !thing7.things.IsFull())
991 {
992 flower -= 3 + EClass.rnd(5 + num2 * 4);
993 num2++;
994 if (flower < 0)
995 {
996 break;
997 }
998 if (EClass.rnd(100) <= num)
999 {
1000 Thing thing3 = ThingGen.Create("honey");
1001 thing3.SetEncLv(lv / 10);
1002 thing3.elements.SetBase(2, EClass.curve(lv, 50, 10, 80));
1003 thing7.AddThing(thing3);
1004 }
1005 }
1006 }
1007 }
BlessedState
Definition: BlessedState.cs:2
CureType
Definition: CureType.cs:2
void SetTier(int a, bool setTraits=true)
Definition: Card.cs:3718
bool isDestroyed
Definition: Card.cs:71
bool IsAmmo
Definition: Card.cs:2183
ElementContainerCard elements
Definition: Card.cs:37
bool c_wasInPcParty
Definition: Card.cs:984
bool HasElement(int ele, int req=1)
Definition: Card.cs:5588
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2957
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3020
string Name
Definition: Card.cs:2073
Thing SetNum(int a)
Definition: Card.cs:3356
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:3744
Point pos
Definition: Card.cs:55
Thing MakeMilk(bool effect=true, int num=1, bool addToZone=true, BlessedState? state=null)
Definition: Card.cs:5441
void SetEncLv(int a)
Definition: Card.cs:3713
bool HaveFur()
Definition: Card.cs:7462
Thing TryMakeRandomItem(int lv=-1)
Definition: Card.cs:5160
void ModExp(string alias, int a)
Definition: Card.cs:2584
int Num
Definition: Card.cs:154
SourceCategory.Row category
Definition: Card.cs:1985
void ModNum(int a, bool notify=true)
Definition: Card.cs:3376
int c_fur
Definition: Card.cs:1301
int LV
Definition: Card.cs:370
string c_idRefCard
Definition: Card.cs:1697
Thing MakeEgg(bool effect=true, int num=1, bool addToZone=true, int fertChance=20, BlessedState? state=null)
Definition: Card.cs:5425
Definition: Cell.cs:7
byte obj
Definition: Cell.cs:38
SourceObj.Row sourceObj
Definition: Cell.cs:1072
bool CanRevive()
Definition: Chara.cs:4726
void TryPutShared(Thing t, List< Thing > containers=null, bool dropIfFail=true)
Definition: Chara.cs:4151
void CureHost(CureType type, int p=100, BlessedState state=BlessedState.Normal)
Definition: Chara.cs:8830
override bool IsPC
Definition: Chara.cs:608
Party party
Definition: Chara.cs:43
List< Hobby > ListHobbies(bool useMemberType=true)
Definition: Chara.cs:8328
List< Hobby > ListWorks(bool useMemberType=true)
Definition: Chara.cs:8301
void Revive(Point p=null, bool msg=false)
Definition: Chara.cs:4752
SourceRace.Row race
Definition: Chara.cs:460
static void MakeDish(Thing food, int lv, Chara crafter=null)
Definition: CraftUtil.cs:55
static int curve(int a, int start, int step, int rate=75)
Definition: EClass.cs:63
Element SetBase(string alias, int v, int potential=0)
bool HasBase(int ele)
int GetProductBonus(Chara c)
bool TryTrash(Thing t)
bool IsGlobalPolicyActive(int id)
Definition: FACTION.cs:442
SourceHobby.Row source
Definition: Hobby.cs:7
int GetLv(Chara c)
Definition: Hobby.cs:21
Definition: Log.cs:4
void ForeachCell(Action< Cell > action)
Definition: MapBounds.cs:279
Point GetRandomPoint()
Definition: MapBounds.cs:97
void SetDecal(int x, int z, int id=0, int amount=1, bool refresh=true)
Definition: Map.cs:2037
MapBounds bounds
Definition: Map.cs:52
void AddMemeber(Chara c, bool showMsg=false)
Definition: Party.cs:56
Definition: Point.cs:9
bool HasDecal
Definition: Point.cs:139
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
Thing Find(int uid)
Definition: Props.cs:357
Thing Find(int uid)
bool IsFull(int y=0)
static Thing CreateTreasure(string id, int lv, TreasureType type=TreasureType.Map)
Definition: ThingGen.cs:224
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
virtual int CraftNum
Definition: Trait.cs:132
virtual bool CanStack
Definition: Trait.cs:150
bool IsRealTime
Definition: VirtualDate.cs:7
Thing TryGetThingFromSharedContainer(Func< Thing, bool > func)
Definition: Zone.cs:2186
int GetSoilCost()
Definition: Zone.cs:3547

References EClass._map, EClass._zone, Party.AddMemeber(), Card.AddThing(), Map.bounds, Card.c_fur, Card.c_idRefCard, Card.c_wasInPcParty, Chara.CanRevive(), Trait.CanStack, Card.category, Card.ChangeMaterial(), Trait.CraftNum, ThingGen.Create(), ThingGen.CreateFromCategory(), ThingGen.CreateTreasure(), Chara.CureHost(), EClass.curve(), EClass.debug, Card.Destroy(), SourceManager.elements, CoreDebug.enable, Card.ExistsOnMap, Chara.faction, Props.Find(), ThingContainer.Find(), MapBounds.ForeachCell(), Hobby.GetEfficiency(), Hobby.GetLv(), MapBounds.GetRandomPoint(), Zone.GetSoilCost(), Point.HasDecal, Card.HasElement(), Card.HasTag(), Card.HaveFur(), Card.id, Map.Installed, Card.IsAmmo, Chara.isDead, Card.isDestroyed, ThingContainer.IsFull(), Faction.IsGlobalPolicyActive(), Chara.IsPC, Chara.IsPCParty, item, Chara.ListWorks(), Card.LV, CraftUtil.MakeDish(), Card.MakeEgg(), Card.MakeMilk(), Chara.memberType, Card.ModNum(), Card.Name, Card.Num, Cell.obj, Chara.party, EClass.pc, Card.pos, Chara.race, Chara.RefreshWorkElements(), Chara.Revive(), EClass.rnd(), WidgetPopText.Say(), Card.SetBlessedState(), Map.SetDecal(), Card.SetNum(), Card.SetTier(), Hobby.source, Cell.sourceObj, EClass.sources, Map.Stocked, Card.things, Card.trait, Zone.TryGetThingFromSharedContainer(), Card.TryMakeRandomItem(), Chara.TryPutShared(), Point.x, and Point.z.

◆ Evalue()

◆ GenerateGarbage()

void FactionBranch.GenerateGarbage ( VirtualDate  date)
inline

Definition at line 611 of file FactionBranch.cs.

612 {
613 int sortChance = 40 + GetCivility();
614 int unsortedCount = 0;
615 foreach (Chara member in members)
616 {
617 if (!member.IsPCParty && member.ExistsOnMap)
618 {
619 Hobby hobby = member.GetWork("Clean") ?? member.GetWork("Chore");
620 if (hobby != null)
621 {
622 sortChance += 20 * hobby.GetEfficiency(member) / 100;
623 }
624 }
625 }
626 int num = Evalue(2702);
627 int num2 = EClass.rnd(2);
628 for (int i = 0; i < num2; i++)
629 {
630 if (num == 0 || EClass.rnd(num + (EClass.debug.enable ? 100000 : 10)) == 0)
631 {
632 Generate(null);
633 }
634 }
635 foreach (Chara member2 in members)
636 {
637 if (!member2.IsPCParty && member2.ExistsOnMap && (num == 0 || EClass.rnd(num + (EClass.debug.enable ? 100000 : 10)) == 0))
638 {
639 Generate(member2);
640 }
641 }
642 void Generate(Chara c)
643 {
644 if (c == null || EClass.rnd(5) == 0)
645 {
646 if (EClass.rnd(80) == 0)
647 {
649 }
650 else if (EClass.rnd(40) == 0)
651 {
652 Thing thing;
653 Add(thing = ThingGen.CreateFromTag("garbage"));
654 }
655 else
656 {
657 string id = "trash2";
658 if (EClass.rnd(3) == 0)
659 {
660 id = "trash1";
661 }
662 if (EClass.rnd(10) == 0)
663 {
664 id = ((EClass.rnd(3) == 0) ? "529" : "1170");
665 }
666 if (c != null && (!c.IsUnique || c.memberType == FactionMemberType.Livestock) && EClass.rnd((c.memberType == FactionMemberType.Livestock) ? 2 : 50) == 0)
667 {
668 id = "_poop";
669 }
670 if (EClass.rnd(200000) == 0)
671 {
672 id = "goodness";
673 }
674 Add(ThingGen.Create(id));
675 }
676 }
677 void Add(Thing t)
678 {
679 if (sortChance < EClass.rnd(100))
680 {
681 EClass._zone.TryAddThing(t, (c != null) ? (c.pos.GetRandomPoint(2) ?? c.pos).GetNearestPoint() : EClass._zone.bounds.GetRandomSurface(), destroyIfFail: true);
682 }
683 else
684 {
685 if (t.id == "_poop" && EClass.rnd(150) == 0)
686 {
687 t.ChangeMaterial((EClass.rnd(2) == 0) ? "silver" : "gold");
688 }
689 if (!TryTrash(t))
690 {
691 unsortedCount++;
692 if (unsortedCount >= 5)
693 {
694 Tutorial.Reserve("garbage");
695 }
696 }
697 }
698 }
699 }
700 }
list. Add(item3)
bool IsUnique
Definition: Card.cs:2027
Point GetRandomSurface(int x, int z, int radius, bool walkable=true, bool allowWater=false)
Definition: MapBounds.cs:182
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:753
static Thing CreateFromTag(string idTag, int lv=-1)
Definition: ThingGen.cs:80
static void Reserve(string idStep, Action onBeforePlay=null)
Definition: Tutorial.cs:55
MapBounds bounds
Definition: Zone.cs:46
bool TryAddThing(Thing target, Point p, bool destroyIfFail=false)
Definition: Zone.cs:2160

References EClass._zone, Add(), Zone.bounds, Card.ChangeMaterial(), ThingGen.Create(), ThingGen.CreateFromCategory(), ThingGen.CreateFromTag(), EClass.debug, CoreDebug.enable, Card.ExistsOnMap, Hobby.GetEfficiency(), Point.GetRandomPoint(), MapBounds.GetRandomSurface(), Chara.GetWork(), Card.id, Chara.IsPCParty, Card.IsUnique, Chara.memberType, Card.pos, Tutorial.Reserve(), EClass.rnd(), and Zone.TryAddThing().

◆ GetCivility()

int FactionBranch.GetCivility ( )
inline

Definition at line 1751 of file FactionBranch.cs.

1752 {
1753 int num = 10 + Evalue(2203);
1754 if (Evalue(2701) > 0)
1755 {
1756 num += 10 + (int)Mathf.Sqrt(Evalue(2701));
1757 }
1758 if (Evalue(2702) > 0)
1759 {
1760 num -= 10 + (int)Mathf.Sqrt(Evalue(2702));
1761 }
1762 return num;
1763 }

Referenced by UIHomeInfo.RefreshInfo().

◆ GetDailyIncome()

void FactionBranch.GetDailyIncome ( )
inline

Definition at line 1145 of file FactionBranch.cs.

1146 {
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)
1151 {
1152 if (tax && !IsTaxFree)
1153 {
1154 n = n * 10 / 100;
1155 }
1156 if (n != 0)
1157 {
1158 Msg.Say(lang, Lang._currency(n, "money"), owner.Name);
1159 Thing t = ThingGen.Create("money").SetNum(n);
1160 EClass.pc.Pick(t);
1161 stat += n;
1162 n = 0;
1163 }
1164 }
1165 }
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4017
Statistics statistics
Definition: Lang.cs:6
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:162

References Lang._currency(), ThingGen.Create(), FactionBranch.Statistics.inn, Spatial.Name, EClass.pc, Chara.Pick(), Msg.Say(), Card.SetNum(), FactionBranch.Statistics.shop, and FactionBranch.Statistics.tourism.

Referenced by OnAfterSimulate().

◆ GetHappiness()

int FactionBranch.GetHappiness ( FactionMemberType  type)
inline

Definition at line 1526 of file FactionBranch.cs.

1527 {
1528 float num = 0f;
1529 if (members.Count == 0)
1530 {
1531 return 0;
1532 }
1533 foreach (Chara member in members)
1534 {
1535 num += (float)member.happiness;
1536 }
1537 return (int)(num / (float)members.Count);
1538 }
int happiness
Definition: Chara.cs:108

References Chara.happiness.

◆ GetHearthHint()

string FactionBranch.GetHearthHint ( int  a)
inline

Definition at line 1410 of file FactionBranch.cs.

1411 {
1412 if (a <= 1)
1413 {
1414 return "hearth1".lang();
1415 }
1416 string text = "";
1417 for (int i = 1; i < a; i++)
1418 {
1419 string text2 = ("hearth" + (i + 1)).lang();
1420 if (!text2.IsEmpty())
1421 {
1422 text = text + text2 + Environment.NewLine;
1423 }
1424 }
1425 return text.TrimEnd(Environment.NewLine.ToCharArray());
1426 }

Referenced by UIHomeInfo.RefreshInfo().

◆ GetHearthIncome() [1/2]

float FactionBranch.GetHearthIncome ( )
inline

Definition at line 1765 of file FactionBranch.cs.

1766 {
1767 float num = 0f;
1768 foreach (Element value in elements.dict.Values)
1769 {
1770 if (value.source.category == "culture")
1771 {
1772 num += GetHearthIncome(value.source.alias);
1773 }
1774 }
1775 return num;
1776 }
Dictionary< int, Element > dict
SourceElement.Row source
Definition: ELEMENT.cs:271
float GetHearthIncome()

References Element.source.

◆ GetHearthIncome() [2/2]

float FactionBranch.GetHearthIncome ( string  id)
inline

Definition at line 1778 of file FactionBranch.cs.

1779 {
1780 int num = 0;
1781 foreach (KeyValuePair<int, Element> item in elements.dict)
1782 {
1783 if (item.Value.source.aliasParent == id)
1784 {
1785 num++;
1786 }
1787 }
1788 return 0.2f * (float)num;
1789 }

References item.

◆ GetMaid()

Chara FactionBranch.GetMaid ( )
inline

Definition at line 1567 of file FactionBranch.cs.

1568 {
1569 foreach (Chara member in members)
1570 {
1571 if (member.IsAliveInCurrentZone && member.IsMaid)
1572 {
1573 return member;
1574 }
1575 }
1576 return null;
1577 }
override bool IsAliveInCurrentZone
Definition: Chara.cs:557
bool IsMaid
Definition: Chara.cs:893

References Chara.IsAliveInCurrentZone, and Chara.IsMaid.

Referenced by MeetingManager.CallNext().

◆ GetMailBox()

Thing FactionBranch.GetMailBox ( )
inline

Definition at line 1028 of file FactionBranch.cs.

1029 {
1030 return EClass._map.props.installed.FindEmptyContainer<TraitMailPost>();
1031 }
PropsManager props
Definition: Map.cs:91
PropsInstalled installed
Definition: PropsManager.cs:8

References EClass._map, PropsManager.installed, and Map.props.

◆ GetMailBoxPos()

Point FactionBranch.GetMailBoxPos ( )
inline

Definition at line 1033 of file FactionBranch.cs.

1034 {
1035 Thing thing = GetMailBox();
1036 if (thing == null)
1037 {
1039 }
1040 if (thing != null)
1041 {
1042 return thing.pos.GetNearestPoint(allowBlock: false, allowChara: true, allowInstalled: false, ignoreCenter: true).Clamp(useBounds: true);
1043 }
1044 return EClass._map.GetCenterPos();
1045 }
Thing GetMailBox()
Point GetCenterPos()
Definition: MapBounds.cs:52
Point Clamp(bool useBounds=false)
Definition: Point.cs:988
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false)
Definition: Point.cs:607

References EClass._map, Point.Clamp(), Props.Find(), MapBounds.GetCenterPos(), Point.GetNearestPoint(), PropsManager.installed, Card.pos, and Map.props.

◆ GetMeal()

Thing FactionBranch.GetMeal ( Chara  c)
inline

Definition at line 1167 of file FactionBranch.cs.

1168 {
1169 if (c.things.IsFull())
1170 {
1171 return null;
1172 }
1173 Thing thing = EClass._zone.TryGetThingFromSharedContainer((Thing t) => c.CanEat(t, shouldEat: true) && !t.c_isImportant);
1174 if (thing != null)
1175 {
1176 thing = thing.Split(1);
1177 }
1178 return thing;
1179 }
Thing Split(int a)
Definition: Card.cs:3345
bool c_isImportant
Definition: Card.cs:996
bool CanEat(Thing t, bool shouldEat=false)
Definition: Chara.cs:7061

References EClass._zone, Card.c_isImportant, Chara.CanEat(), ThingContainer.IsFull(), Card.Split(), Card.things, and Zone.TryGetThingFromSharedContainer().

Referenced by AI_Idle.Run().

◆ GetNextExp()

int FactionBranch.GetNextExp ( int  _lv = -1)
inline

Definition at line 156 of file FactionBranch.cs.

157 {
158 if (_lv == -1)
159 {
160 _lv = lv;
161 }
162 return _lv * _lv * 100 + 100;
163 }

References lv.

Referenced by WidgetStatsBar.Build(), LayerShippingResult.Refresh(), and CoreDebug.UpdateInput().

◆ GetPastureCost()

int FactionBranch.GetPastureCost ( )
inline

Definition at line 1746 of file FactionBranch.cs.

1747 {
1748 return CountMembers(FactionMemberType.Livestock);
1749 }
int CountMembers(FactionMemberType type, bool onlyAlive=false)

Referenced by UIHomeInfo.RefreshInfo().

◆ GetProductBonus()

int FactionBranch.GetProductBonus ( Chara  c)
inline

Definition at line 179 of file FactionBranch.cs.

180 {
181 if (c.isDead || c.IsPCParty)
182 {
183 return 0;
184 }
185 if (c.memberType == FactionMemberType.Livestock)
186 {
187 return 100;
188 }
189 return Mathf.Max(1, (90 + Evalue(2116) / 2) * efficiency / 100);
190 }

References efficiency, Evalue(), Chara.isDead, Chara.IsPCParty, and Chara.memberType.

◆ GetRandomName()

string FactionBranch.GetRandomName ( )
inline

Definition at line 1579 of file FactionBranch.cs.

1580 {
1581 if (EClass.rnd(4) == 0 || members.Count == 0)
1582 {
1583 return EClass.player.title;
1584 }
1585 return members.RandomItem().Name;
1586 }
static Player player
Definition: EClass.cs:12
string title
Definition: Player.cs:924

References EClass.player, EClass.rnd(), and Player.title.

Referenced by BaseArea.GetRandomName().

◆ GetResidentTax()

int FactionBranch.GetResidentTax ( )
inline

Definition at line 1047 of file FactionBranch.cs.

1048 {
1049 if (!policies.IsActive(2512, 30))
1050 {
1051 return 0;
1052 }
1053 int num = 0;
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)
1058 {
1059 if (member.IsPC || member.memberType != 0)
1060 {
1061 continue;
1062 }
1063 bool isWealthy = member.IsWealthy;
1064 int num5 = 0;
1065 foreach (Hobby item in member.ListWorks().Concat(member.ListHobbies()))
1066 {
1067 int num6 = item.source.tax * 100 / 100;
1068 if (num6 > num5)
1069 {
1070 num5 = num6;
1071 }
1072 }
1073 int num7 = ((isWealthy ? 50 : 10) + member.LV * 2) * num5 / 100 * num4 / 100;
1074 if (isWealthy && num2 > 0)
1075 {
1076 num7 = num7 * (150 + (int)Mathf.Sqrt(num2) * 5) / 100;
1077 }
1078 if (num3 > 0)
1079 {
1080 num7 += (80 + (int)Mathf.Sqrt(num3) * 5) * member.faith.source.tax / 100;
1081 }
1082 num7 = num7 * efficiency / (IsTaxFree ? 100 : 1000);
1083 num += num7;
1084 if (num7 > 0)
1085 {
1086 Log("bTax", num7.ToString() ?? "", member.Name);
1087 }
1088 }
1089 statistics.tax += num;
1090 return num;
1091 }
Religion faith
Definition: Chara.cs:435
SourceReligion.Row source
Definition: Religion.cs:32

References Chara.faith, PolicyManager.IsActive(), Chara.IsPC, Chara.IsWealthy, item, Chara.ListHobbies(), Chara.ListWorks(), Card.LV, Chara.memberType, Card.Name, and Religion.source.

Referenced by Faction.GetResidentTax().

◆ GetTechUpgradeCost()

int FactionBranch.GetTechUpgradeCost ( Element  e)
inline

Definition at line 1791 of file FactionBranch.cs.

1792 {
1793 int valueWithoutLink = e.ValueWithoutLink;
1794 valueWithoutLink += e.CostLearn;
1795 if (e.source.max != 0 && e.ValueWithoutLink >= e.source.max)
1796 {
1797 return 0;
1798 }
1799 return valueWithoutLink;
1800 }
int ValueWithoutLink
Definition: ELEMENT.cs:292
virtual int CostLearn
Definition: ELEMENT.cs:312

References Element.CostLearn, Element.source, and Element.ValueWithoutLink.

Referenced by ButtonElement.Refresh(), and LayerHome.RefreshFeat().

◆ GetUpgradeCost()

int FactionBranch.GetUpgradeCost ( )
inline

Definition at line 1380 of file FactionBranch.cs.

1381 {
1382 return lv * lv * lv * 1000;
1383 }

◆ IsAllDead()

bool FactionBranch.IsAllDead ( )
inline

Definition at line 1540 of file FactionBranch.cs.

1541 {
1542 foreach (Chara member in members)
1543 {
1544 if (!member.isDead)
1545 {
1546 return false;
1547 }
1548 }
1549 return true;
1550 }

References Chara.isDead.

Referenced by ZoneEventSiege.OnTickRound().

◆ IsRecruit()

bool FactionBranch.IsRecruit ( Chara  c)
inline

Definition at line 1729 of file FactionBranch.cs.

1730 {
1731 foreach (HireInfo item in listRecruit)
1732 {
1733 if (item.chara == c)
1734 {
1735 return true;
1736 }
1737 }
1738 return false;
1739 }

References item.

Referenced by DramaOutcome.chara_hired().

◆ Log() [1/3]

string FactionBranch.Log ( string  idLang,
Card  c1,
Card  c2,
string  ref1 = null,
string  ref2 = null 
)
inline

Definition at line 1808 of file FactionBranch.cs.

1809 {
1810 Msg.alwaysVisible = true;
1811 return LogRaw(Msg.GetRawText(idLang, c1, c2, ref1, ref2), EClass.sources.langGame.map[idLang].logColor);
1812 }
string LogRaw(string text, string col=null)
static string GetRawText(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:37
LangGame langGame

References Msg.GetRawText(), SourceManager.langGame, and EClass.sources.

◆ Log() [2/3]

string FactionBranch.Log ( string  idLang,
Card  c1,
string  ref1 = null,
string  ref2 = null,
string  ref3 = null 
)
inline

Definition at line 1814 of file FactionBranch.cs.

1815 {
1816 Msg.alwaysVisible = true;
1817 return LogRaw(Msg.GetRawText(idLang, c1, ref1, ref2, ref3), EClass.sources.langGame.map[idLang].logColor);
1818 }

References Msg.GetRawText(), SourceManager.langGame, and EClass.sources.

◆ Log() [3/3]

string FactionBranch.Log ( string  idLang,
string  ref1 = null,
string  ref2 = null,
string  ref3 = null,
string  ref4 = null 
)
inline

Definition at line 1802 of file FactionBranch.cs.

1803 {
1804 Msg.alwaysVisible = true;
1805 return LogRaw(Msg.GetRawText(idLang, ref1, ref2, ref3, ref4), EClass.sources.langGame.map[idLang].logColor);
1806 }

References Msg.GetRawText(), SourceManager.langGame, and EClass.sources.

Referenced by AI_Shopping.Buy(), Zone.ClaimZone(), Chara.Die(), Expedition.End(), ElementContainerCard.OnLevelUp(), ElementContainerZone.OnLevelUp(), Chara.Revive(), and Expedition.Start().

◆ LogRaw()

string FactionBranch.LogRaw ( string  text,
string  col = null 
)
inline

Definition at line 1820 of file FactionBranch.cs.

1821 {
1822 log.Add(text, col.IsEmpty() ? null : col);
1823 Msg.alwaysVisible = false;
1824 Msg.SetColor();
1825 return text;
1826 }
void Add(Data data)
Definition: MsgLog.cs:53
static void SetColor()
Definition: Msg.cs:22

References MsgLog.Add(), and Msg.SetColor().

◆ ModExp()

void FactionBranch.ModExp ( int  a)
inline

Definition at line 1385 of file FactionBranch.cs.

1386 {
1387 if (policies.IsActive(2515))
1388 {
1389 return;
1390 }
1391 if (policies.IsActive(2516))
1392 {
1393 a = a * 150 / 100 + EClass.rnd(2);
1394 }
1395 exp += a;
1396 if (exp >= GetNextExp() && CanUpgrade())
1397 {
1398 if (EClass.core.version.demo && lv >= 3)
1399 {
1400 exp = 0;
1401 Msg.Say("demoLimit2");
1402 }
1403 else
1404 {
1405 Upgrade();
1406 }
1407 }
1408 }
Version version
Definition: BaseCore.cs:17
static Core core
Definition: EClass.cs:6
bool demo
Definition: Version.cs:14

References EClass.core, Version.demo, PolicyManager.IsActive(), EClass.rnd(), Msg.Say(), and BaseCore.version.

Referenced by CoreDebug.UpdateInput().

◆ OnActivateZone()

void FactionBranch.OnActivateZone ( )
inline

Definition at line 277 of file FactionBranch.cs.

278 {
279 incomeInn = 0;
280 incomeTourism = 0;
281 foreach (Chara member in members)
282 {
283 if (member.IsAliveInCurrentZone && !member.pos.IsInBounds)
284 {
286 }
288 }
290 }
void MoveImmediate(Point p, bool focus=true, bool cancelAI=true)
Definition: Card.cs:5501
void ValidateUpgradePolicies()
bool IsInBounds
Definition: Point.cs:104

References EClass._map, elements, MapBounds.GetCenterPos(), Point.GetNearestPoint(), incomeInn, incomeTourism, Chara.IsAliveInCurrentZone, Point.IsInBounds, members, Card.MoveImmediate(), Card.pos, Chara.RefreshWorkElements(), and ValidateUpgradePolicies().

◆ OnAdvanceDay()

void FactionBranch.OnAdvanceDay ( )
inline

Definition at line 577 of file FactionBranch.cs.

578 {
579 int num = 0;
580 foreach (Chara member in members)
581 {
582 if (member.IsPC || member.isDead)
583 {
584 continue;
585 }
586 if (member.IsPCParty || member.currentZone == EClass.pc.currentZone)
587 {
588 member.c_daysWithPC++;
589 }
590 if (member.memberType == FactionMemberType.Default)
591 {
592 if (EClass.rnd(3) == 0)
593 {
594 num++;
595 }
596 if (member.GetWork("Pioneer") != null)
597 {
598 num += 3;
599 }
600 }
601 }
602 ModExp(num);
603 }
int c_daysWithPC
Definition: Card.cs:1445
Zone currentZone
Definition: Chara.cs:251
void ModExp(int a)

References Card.c_daysWithPC, Chara.currentZone, Chara.GetWork(), Chara.isDead, Chara.IsPC, Chara.IsPCParty, Chara.memberType, EClass.pc, and EClass.rnd().

Referenced by Faction.OnAdvanceDay().

◆ OnAfterSimulate()

void FactionBranch.OnAfterSimulate ( )
inline

Definition at line 292 of file FactionBranch.cs.

293 {
294 if (!EClass.game.isLoading)
295 {
297 }
298 foreach (Chara chara in EClass._map.charas)
299 {
300 if (!chara.IsPCParty && !chara.noMove)
301 {
302 if ((chara.pos.cell.HasBlock || chara.pos.cell.hasDoor) && !chara.isRestrained && !chara.HasCondition<ConSuspend>())
303 {
304 chara.MoveImmediate(chara.pos.GetNearestPoint(allowBlock: false, allowChara: false) ?? chara.pos);
305 }
307 {
308 EClass.pc.party.AddMemeber(chara, showMsg: true);
309 }
310 }
311 }
312 }
bool isRestrained
Definition: Card.cs:550
bool noMove
Definition: Card.cs:754
bool HasBlock
Definition: Cell.cs:643
bool hasDoor
Definition: Cell.cs:258
bool HasCondition(string alias)
Definition: Chara.cs:8764
static Game game
Definition: EClass.cs:8
void GetDailyIncome()
bool isLoading
Definition: Game.cs:235
bool simulatingZone
Definition: Player.cs:1099
Cell cell
Definition: Point.cs:51

References EClass._map, Party.AddMemeber(), Card.c_wasInPcParty, Point.cell, Map.charas, EClass.game, GetDailyIncome(), Point.GetNearestPoint(), Cell.HasBlock, Chara.HasCondition(), Cell.hasDoor, Game.isLoading, Chara.IsPCParty, Card.isRestrained, Card.MoveImmediate(), Card.noMove, Chara.party, EClass.pc, EClass.player, Card.pos, and Player.simulatingZone.

Referenced by Zone.OnVisit().

◆ OnClaimZone()

void FactionBranch.OnClaimZone ( )
inline

Definition at line 1181 of file FactionBranch.cs.

1182 {
1184 {
1185 foreach (SourceElement.Row item in EClass.sources.elements.rows.Where((SourceElement.Row a) => a.category == "tech"))
1186 {
1187 elements.SetBase(item.id, 1);
1188 }
1189 foreach (SourceElement.Row item2 in EClass.sources.elements.rows.Where((SourceElement.Row a) => a.category == "policy" && !a.tag.Contains("hidden")))
1190 {
1191 policies.AddPolicy(item2.id);
1192 }
1193 }
1194 else
1195 {
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);
1201 policies.AddPolicy(2512);
1202 policies.AddPolicy(2702);
1203 policies.AddPolicy(2703);
1204 policies.AddPolicy(2516);
1205 policies.AddPolicy(2515);
1206 policies.AddPolicy(2514);
1207 }
1209 {
1210 policies.Activate(2514);
1211 }
1212 Element element = EClass._zone.ListLandFeats()[0];
1213 elements.SetBase(element.id, 1);
1214 switch (element.id)
1215 {
1216 case 3604:
1217 elements.SetBase(2206, 10);
1218 break;
1219 case 3602:
1220 elements.SetBase(2206, 15);
1221 break;
1222 }
1224 {
1226 }
1228 {
1229 foreach (SourceElement.Row item3 in EClass.sources.elements.rows.Where((SourceElement.Row a) => a.category == "policy"))
1230 {
1231 policies.AddPolicy(item3.id);
1232 }
1233 }
1235 }
bool allPolicy
Definition: CoreDebug.cs:236
bool allHomeSkill
Definition: CoreDebug.cs:194
int id
Definition: ELEMENT.cs:248
void AddMemeber(Chara c)
int CountTaxFreeLand()
Definition: FACTION.cs:550
Zone StartZone
Definition: Game.cs:269
void Activate(int id)
void AddPolicy(string id)
List< Element > ListLandFeats()
Definition: Zone.cs:2948

References EClass._zone, PolicyManager.Activate(), PolicyManager.AddPolicy(), CoreDebug.allHomeSkill, CoreDebug.allPolicy, Faction.CountTaxFreeLand(), EClass.debug, SourceManager.elements, Chara.faction, EClass.game, Card.id, Element.id, item, Zone.ListLandFeats(), EClass.pc, EClass.sources, and Game.StartZone.

Referenced by Zone.ClaimZone().

◆ OnCreate()

void FactionBranch.OnCreate ( Zone  zone)
inline

Definition at line 240 of file FactionBranch.cs.

241 {
242 SetOwner(zone);
243 stash = ThingGen.Create("container_salary");
247 }
void RemoveThings()
Definition: Card.cs:3171
Religion faith
void SetOwner(Zone zone)
ReligionManager religions
Definition: Game.cs:158
ReligionEyth Eyth

References ThingGen.Create(), World.date, dateFound, ReligionManager.Eyth, faith, EClass.game, Date.GetRaw(), Game.religions, Card.RemoveThings(), SetOwner(), stash, and EClass.world.

Referenced by Zone.ClaimZone().

◆ OnSimulateDay()

void FactionBranch.OnSimulateDay ( VirtualDate  date)
inline

Definition at line 523 of file FactionBranch.cs.

524 {
525 if (owner == null || owner.mainFaction != EClass.Home)
526 {
527 return;
528 }
532 if (!date.IsRealTime)
533 {
534 BranchMap branchMap = date.GetBranchMap();
535 foreach (Chara member in members)
536 {
537 if (!member.IsPCParty && member.memberType != FactionMemberType.Livestock && !member.faith.IsEyth && !member.c_isPrayed && branchMap.altarMap.Contains(member.faith.id))
538 {
539 AI_Pray.Pray(member, silent: true);
540 }
541 }
542 }
543 foreach (Chara member2 in members)
544 {
545 member2.c_isPrayed = false;
546 member2.c_isTrained = false;
547 }
548 if (date.day != 1)
549 {
550 return;
551 }
552 luckyMonth = false;
553 if (date.month == 1)
554 {
555 luckyMonthDone = false;
556 }
557 if (!luckyMonthDone)
558 {
559 bool flag = EClass.pc.faith == EClass.game.religions.Luck;
560 luckyMonth = (float)(flag ? 30 : 5) + Mathf.Sqrt(Evalue(2118)) * (float)(flag ? 4 : 2) > (float)EClass.rnd(720);
561 if (EClass.debug.enable)
562 {
563 luckyMonth = true;
564 }
565 if (luckyMonth)
566 {
567 Log("lucky_month", EClass._zone.Name);
568 Msg.Say("lucky_month", EClass._zone.Name);
569 Msg.Say("umi");
570 SE.Play("godbless");
571 EClass.world.SendPackage(ThingGen.Create("book_kumiromi"));
572 luckyMonthDone = true;
573 }
574 }
575 }
static void Pray(Chara c, bool silent=false)
Definition: AI_Pray.cs:52
HashSet< string > altarMap
Definition: BranchMap.cs:5
bool c_isPrayed
Definition: Card.cs:1044
int month
Definition: Date.cs:50
int day
Definition: Date.cs:62
HappinessManager happiness
ResearchManager researches
HomeResourceManager resources
ReligionLuck Luck
bool IsEyth
Definition: Religion.cs:44
virtual string id
Definition: Religion.cs:26
Faction mainFaction
Definition: Spatial.cs:430
BranchMap GetBranchMap()
Definition: VirtualDate.cs:44
void SendPackage(Thing p)
Definition: World.cs:68

References EClass._zone, Card.c_isPrayed, ThingGen.Create(), EClass.debug, CoreDebug.enable, Chara.faith, EClass.game, VirtualDate.GetBranchMap(), EClass.Home, Religion.id, Religion.IsEyth, Chara.IsPCParty, VirtualDate.IsRealTime, ReligionManager.Luck, Spatial.mainFaction, Chara.memberType, Spatial.Name, HappinessManager.OnSimulateDay(), HomeResourceManager.OnSimulateDay(), ResearchManager.OnSimulateDay(), AI_Pray.Pray(), Game.religions, EClass.rnd(), Msg.Say(), World.SendPackage(), and EClass.world.

Referenced by Zone.OnSimulateDay().

◆ OnSimulateHour()

void FactionBranch.OnSimulateHour ( VirtualDate  date)
inline

Definition at line 318 of file FactionBranch.cs.

319 {
320 int num = CountMembers(FactionMemberType.Default, onlyAlive: true);
321 int starveChance = Mathf.Max(num - MaxPopulation, 0);
322 members.ForeachReverse(delegate(Chara c)
323 {
324 if (!c.IsPCParty && c.IsAliveInCurrentZone && !c.noMove)
325 {
326 if (EClass.rnd(24 * members.Count) < starveChance)
327 {
328 starveChance--;
329 }
330 else
331 {
332 c.TickWork(date);
333 }
334 if (!date.IsRealTime && EClass.rnd(3) != 0 && c.memberType == FactionMemberType.Default)
335 {
336 c.hunger.Mod(1);
337 if (c.hunger.GetPhase() >= 3)
338 {
339 Thing meal = GetMeal(c);
340 if (meal != null)
341 {
342 FoodEffect.Proc(c, meal);
343 meal.Destroy();
344 }
345 else
346 {
347 c.hunger.Mod(-50);
348 }
349 }
350 }
351 }
352 });
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);
360 int num6 = 10;
361 if (policies.IsActive(2709))
362 {
363 num6 = 0;
364 }
366 {
367 num5 /= 2;
368 }
369 if ((date.IsRealTime || num2 > 0) && !EClass.debug.enable && EClass.rnd(num5) == 0 && !EClass.pc.IsDeadOrSleeping && EClass._map.CountHostile() < num4)
370 {
371 int num7 = 1 + EClass.rnd(num2 + num3 + 1);
372 for (int i = 0; i < num7; i++)
373 {
375 }
376 }
377 if ((date.IsRealTime || num2 == 0) && num6 != 0 && EClass.rnd(num6) == 0 && EClass._map.CountWildAnimal() < num4)
378 {
380 }
381 if (EClass.rnd(5) == 0 && policies.IsActive(2810))
382 {
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;
386 if (luckyMonth)
387 {
388 num8 = num8 * 2 + 5;
389 }
390 if (EClass._map.CountGuest() < num8)
391 {
392 Chara chara;
393 if (luckyMonth || (policies.IsActive(2822) && Mathf.Sqrt(Evalue(2822) / 2) + 5f >= (float)EClass.rnd(100)))
394 {
397 }
398 else
399 {
401 }
402 if (chara != null && (chara.id == "nun_mother" || chara.id == "prostitute") && policies.IsActive(2710))
403 {
404 chara.Destroy();
405 chara = null;
406 }
407 if (chara != null)
408 {
410 chara.memberType = FactionMemberType.Guest;
411 chara.SetInt(34, EClass.world.date.GetRaw());
412 chara.c_allowance = chara.LV * 100;
413 if (chara.IsWealthy)
414 {
415 chara.c_allowance *= 10;
416 }
417 if (date.IsRealTime)
418 {
419 Msg.Say("guestArrive", chara.Name);
420 }
421 else
422 {
423 chara.TryAssignBed();
424 }
425 }
426 }
427 }
428 foreach (Chara chara3 in EClass._map.charas)
429 {
430 if (chara3.memberType != FactionMemberType.Guest || ((chara3.c_allowance > 0 || EClass.rnd(2) != 0) && chara3.GetInt(34) + 10080 >= EClass.world.date.GetRaw()))
431 {
432 continue;
433 }
434 foreach (Chara item in EClass._zone.ListMinions(chara3))
435 {
436 item.Destroy();
437 }
438 if (!chara3.IsGlobal)
439 {
440 chara3.Destroy();
441 }
442 chara3.ClearBed();
443 break;
444 }
445 if (date.hour == 5)
446 {
447 for (int j = 0; j < ((!luckyMonth) ? 1 : 2); j++)
448 {
449 DailyOutcome(date);
450 }
451 GenerateGarbage(date);
452 if (!date.IsRealTime)
453 {
454 AutoClean();
455 }
458 if (date.IsRealTime)
459 {
461 }
462 }
463 if (!EClass.player.simulatingZone && date.hour == 6)
464 {
465 ReceivePackages(date);
466 }
467 if (!date.IsRealTime && date.hour % 8 == 0)
468 {
469 foreach (Chara item2 in EClass._map.charas.Where((Chara c) => c.memberType == FactionMemberType.Guest).ToList())
470 {
471 for (int k = 0; k < 3; k++)
472 {
473 AI_Shopping.TryShop(item2, realtime: false);
474 }
475 }
476 AI_Shopping.TryRestock(EClass.pc, realtime: false);
477 }
478 if (EClass.rnd(24) == 0 || EClass.debug.enable)
479 {
480 foreach (Thing thing in EClass._map.things)
481 {
482 if (EClass.rnd(20) == 0 && thing.trait is TraitFoodEggFertilized && thing.pos.FindThing<TraitBed>() != null)
483 {
484 Chara chara2 = TraitFoodEggFertilized.Incubate(thing, thing.pos);
485 thing.ModNum(-1);
486 if (date.IsRealTime)
487 {
488 chara2.PlaySound("egg");
489 }
490 break;
491 }
492 }
493 }
495 }
SpawnPosition
Definition: SpawnPosition.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
static bool TryRestock(Chara c, bool realtime)
Definition: AI_Shopping.cs:94
static bool TryShop(Chara c, bool realtime)
Definition: AI_Shopping.cs:10
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
void SetInt(int id, int value=0)
Definition: BaseCard.cs:39
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5798
int c_allowance
Definition: Card.cs:1289
static Chara CreateWealthy(int lv=-1)
Definition: CharaGen.cs:53
TraitBed TryAssignBed()
Definition: Chara.cs:6815
override bool IsDeadOrSleeping
Definition: Chara.cs:569
int hour
Definition: Date.cs:74
bool IsNight
Definition: Date.cs:112
MeetingManager meetings
ExpeditionManager expeditions
void DailyOutcome(VirtualDate date)
void CalcInnIncome()
void CalcTourismIncome()
void GenerateGarbage(VirtualDate date)
void ReceivePackages(VirtualDate date)
int CountHostile()
Definition: Map.cs:2453
int CountGuest()
Definition: Map.cs:2440
int CountWildAnimal()
Definition: Map.cs:2466
void OnSimulateHour(VirtualDate date)
Thing FindThing(Func< Thing, bool > func)
Definition: Point.cs:1120
void OnSimulateHour(VirtualDate date)
static SpawnSetting HomeWild(int lv)
Definition: SpawnSetting.cs:91
static SpawnSetting HomeEnemy(int lv)
static SpawnSetting HomeGuest(int lv)
static Chara Incubate(Thing egg, Point pos, Card incubator=null)
List< Chara > ListMinions(Chara c)
Definition: Zone.cs:3521
Chara SpawnMob(Point pos=null, SpawnSetting setting=null)
Definition: Zone.cs:2655
Card AddCard(Card t, Point point)
Definition: Zone.cs:1920
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)
Definition: Zone.cs:1309

References CountMembers(), if(), Chara.IsAliveInCurrentZone, Chara.IsPCParty, VirtualDate.IsRealTime, MaxPopulation, members, Chara.memberType, Card.noMove, and EClass.rnd().

Referenced by Zone.OnSimulateHour().

◆ OnSimulateMonth()

void FactionBranch.OnSimulateMonth ( VirtualDate  date)
inline

Definition at line 605 of file FactionBranch.cs.

606 {
608 statistics = new Statistics();
609 }
Statistics lastStatistics

Referenced by Zone.OnSimulateMonth().

◆ OnUnclaimZone()

void FactionBranch.OnUnclaimZone ( )
inline

Definition at line 1237 of file FactionBranch.cs.

1238 {
1239 List<Element> source = owner.ListLandFeats();
1240 if (lv >= 5)
1241 {
1242 foreach (Element item in source.Where((Element a) => a.HasTag("network")).ToList())
1243 {
1245 }
1246 }
1247 Element[] array = elements.dict.Values.ToArray();
1248 foreach (Element element in array)
1249 {
1250 elements.SetBase(element.id, 0);
1251 }
1252 owner.landFeats = null;
1254 owner.branch = null;
1255 }
bool HasTag(string tag)
Definition: ELEMENT.cs:471

References Faction.elements, Chara.faction, Element.HasTag(), Element.id, item, Zone.ListLandFeats(), ElementContainer.ModBase(), and EClass.pc.

Referenced by Zone.AbandonZone().

◆ OnUnloadMap()

void FactionBranch.OnUnloadMap ( )
inline

Definition at line 314 of file FactionBranch.cs.

315 {
316 }

Referenced by Zone.UnloadMap().

◆ PutInMailBox()

void FactionBranch.PutInMailBox ( Thing  t,
bool  outside = false,
bool  install = true 
)
inline

Definition at line 1009 of file FactionBranch.cs.

1010 {
1011 if (!outside)
1012 {
1013 Thing mailBox = GetMailBox();
1014 if (mailBox != null)
1015 {
1016 mailBox.AddCard(t);
1017 return;
1018 }
1019 }
1020 Point mailBoxPos = GetMailBoxPos();
1021 EClass._zone.AddCard(t, mailBoxPos);
1022 if (install)
1023 {
1024 t.Install();
1025 }
1026 }
Card AddCard(Card c)
Definition: Card.cs:3006
Card Install()
Definition: Card.cs:3590
Point GetMailBoxPos()

References EClass._zone, Card.AddCard(), Zone.AddCard(), and Card.Install().

◆ ReceivePackages()

void FactionBranch.ReceivePackages ( VirtualDate  date)
inline

Definition at line 713 of file FactionBranch.cs.

714 {
716 {
717 return;
718 }
719 List<Thing> listPackage = EClass.game.cards.listPackage;
720 if (EClass.player.stats.days >= 2 && !EClass.player.flags.elinGift && Steam.HasDLC(ID_DLC.BackerReward))
721 {
722 listPackage.Add(ThingGen.Create("gift"));
723 EClass.player.flags.elinGift = true;
724 }
725 if (listPackage.Count == 0)
726 {
727 return;
728 }
729 SE.Play("notice");
730 int num = 0;
731 foreach (Thing item in listPackage)
732 {
733 if (item.id != "bill")
734 {
735 num++;
736 }
737 PutInMailBox(item, item.id == "cardboard_box" || item.id == "gift");
738 WidgetPopText.Say("popDeliver".lang(item.Name));
739 }
740 Msg.Say("deliver_arrive", num.ToString() ?? "");
741 listPackage.Clear();
742 }
ID_DLC
Definition: ID_DLC.cs:2
void Add(Act a, string s="")
Definition: ActPlan.cs:11
List< Thing > listPackage
Definition: CardManager.cs:61
void PutInMailBox(Thing t, bool outside=false, bool install=true)
CardManager cards
Definition: Game.cs:155
bool elinGift
Definition: Player.cs:374
int days
Definition: Player.cs:75
Flags flags
Definition: Player.cs:1014
Stats stats
Definition: Player.cs:936
Definition: Steam.cs:8
static bool HasDLC(ID_DLC id)
Definition: Steam.cs:39

References ActPlan.List.Add(), Game.cards, ThingGen.Create(), Player.Stats.days, Player.Flags.elinGift, Player.flags, EClass.game, Steam.HasDLC(), item, CardManager.listPackage, EClass.player, Msg.Say(), WidgetPopText.Say(), Player.simulatingZone, and Player.stats.

◆ Recruit()

void FactionBranch.Recruit ( Chara  c)
inline

Definition at line 1552 of file FactionBranch.cs.

1553 {
1554 RemoveRecruit(c);
1555 AddMemeber(c);
1556 c.isRestrained = false;
1557 if (c.currentZone != EClass._zone && !c.isDead)
1558 {
1560 EClass._zone.AddCard(c, point);
1561 }
1564 Msg.Say("hire".langGame(c.Name));
1565 }
void RemoveRecruit(Chara c)
TraitManager traits
Definition: Props.cs:18
TraitSet GetTraitSet(Type t)
Definition: TraitManager.cs:94
Point GetPoint()
Definition: Trait.cs:725

References EClass._map, EClass._zone, Zone.AddCard(), Chara.currentZone, Trait.GetPoint(), TraitManager.GetTraitSet(), Map.Installed, Chara.isDead, Card.Name, EClass.pc, Card.pos, Chara.RefreshWorkElements(), Msg.Say(), and Props.traits.

Referenced by DramaOutcome.chara_hired(), DramaOutcome.chara_hired_ticket(), ListPeopleCallReserve.OnClick(), and DramaOutcome.QuestExploration_MeetFarris2().

◆ RefreshEfficiency()

void FactionBranch.RefreshEfficiency ( )
inline

Definition at line 192 of file FactionBranch.cs.

193 {
194 int num = 100;
195 int num2 = CountMembers(FactionMemberType.Default);
196 int ration = 0;
197 foreach (Chara member in members)
198 {
199 if (member.memberType != 0 || member.IsPCParty || member.homeBranch == null || member.homeBranch.owner == null)
200 {
201 continue;
202 }
203 foreach (Hobby item in member.ListHobbies())
204 {
205 TryAdd(item);
206 }
207 foreach (Hobby item2 in member.ListWorks())
208 {
209 TryAdd(item2);
210 }
211 }
212 if (num2 > MaxPopulation)
213 {
214 num -= (num2 - MaxPopulation) * 20 * 100 / (100 + 20 * (int)Mathf.Sqrt(ration));
215 }
216 if (efficiency < 0)
217 {
218 efficiency = 0;
219 }
220 efficiency = num;
221 void TryAdd(Hobby h)
222 {
223 if (!h.source.elements.IsEmpty())
224 {
225 for (int i = 0; i < h.source.elements.Length; i += 2)
226 {
227 if (h.source.elements[i] == 2207)
228 {
229 ration += h.source.elements[i + 1];
230 }
231 }
232 }
233 }
234 }
FactionBranch homeBranch
Definition: Chara.cs:932

References CountMembers(), efficiency, Chara.homeBranch, Chara.IsPCParty, item, Chara.ListHobbies(), Chara.ListWorks(), MaxPopulation, members, Chara.memberType, owner, and Hobby.source.

Referenced by Party.AddMemeber(), UIHomeInfo.RefreshReport(), Party.RemoveMember(), and SetOwner().

◆ RemoveMemeber()

void FactionBranch.RemoveMemeber ( Chara  c)
inline

◆ RemoveRecruit()

void FactionBranch.RemoveRecruit ( Chara  c)
inline

Definition at line 1697 of file FactionBranch.cs.

1698 {
1699 listRecruit.ForeachReverse(delegate(HireInfo i)
1700 {
1701 if (i.chara == c)
1702 {
1703 listRecruit.Remove(i);
1704 }
1705 });
1706 }
Chara chara
Definition: HireInfo.cs:6

References HireInfo.chara.

◆ SetOwner()

void FactionBranch.SetOwner ( Zone  zone)
inline

Definition at line 249 of file FactionBranch.cs.

250 {
251 owner = zone;
252 resources.SetOwner(this);
253 researches.SetOwner(this);
254 policies.SetOwner(this);
255 happiness.SetOwner(this);
256 expeditions.SetOwner(this);
257 meetings.SetOwner(this);
258 foreach (Chara value in EClass.game.cards.globalCharas.Values)
259 {
260 if (value == null)
261 {
262 Debug.LogError("exception: c==null");
263 }
264 else if (EClass.pc == null)
265 {
266 Debug.LogError("exception: pc==null");
267 }
268 else if (value.homeZone == zone && value.faction == EClass.pc.faction)
269 {
270 members.Add(value);
272 }
273 }
275 }
GlobalCharaList globalCharas
Definition: CardManager.cs:46
Zone homeZone
Definition: Chara.cs:263
void SetOwner(FactionBranch _branch)
void SetOwner(FactionBranch _owner)
void SetOwner(FactionBranch _owner)
void SetOwner(FactionBranch _branch)
void SetOwner(FactionBranch _owner)
void SetOwner(FactionBranch _branch)

References Game.cards, Faction.charaElements, Debug, expeditions, Chara.faction, EClass.game, CardManager.globalCharas, happiness, Chara.homeZone, meetings, members, ElementContainerFaction.OnAddMemeber(), owner, EClass.pc, policies, RefreshEfficiency(), researches, resources, ExpeditionManager.SetOwner(), MeetingManager.SetOwner(), ResearchManager.SetOwner(), HappinessManager.SetOwner(), HomeResourceManager.SetOwner(), and PolicyManager.SetOwner().

Referenced by OnCreate(), and Zone.OnLoad().

◆ TryTrash()

bool FactionBranch.TryTrash ( Thing  t)
inline

Definition at line 702 of file FactionBranch.cs.

703 {
704 Thing thing = ((t.id == "_poop" || t.source._origin == "dish") ? EClass._map.props.installed.FindEmptyContainer<TraitContainerCompost>(t) : (t.isFireproof ? EClass._map.props.installed.FindEmptyContainer<TraitContainerUnburnable>(t) : EClass._map.props.installed.FindEmptyContainer<TraitContainerBurnable>(t)));
705 if (thing != null)
706 {
707 thing.AddCard(t);
708 return true;
709 }
710 return EClass._zone.TryAddThingInSpot<TraitSpotGarbage>(t, useContainer: false);
711 }

References EClass._map, EClass._zone, Card.AddCard(), PropsManager.installed, and Map.props.

◆ UpdateReqruits()

void FactionBranch.UpdateReqruits ( bool  clear = false)
inline

Definition at line 1627 of file FactionBranch.cs.

1628 {
1630 if (clear)
1631 {
1632 listRecruit.ForeachReverse(delegate(HireInfo i)
1633 {
1634 if (!i.chara.IsGlobal)
1635 {
1636 i.chara.Destroy();
1637 }
1638 if (i.chara.isDestroyed)
1639 {
1640 listRecruit.Remove(i);
1641 }
1642 });
1643 listRecruit.Clear();
1644 lastUpdateReqruit = -1;
1645 }
1646 else
1647 {
1648 listRecruit.ForeachReverse(delegate(HireInfo i)
1649 {
1650 if (i.Hours < 0)
1651 {
1652 if (!i.chara.IsGlobal)
1653 {
1654 i.chara.Destroy();
1655 }
1656 listRecruit.Remove(i);
1657 }
1658 });
1659 }
1661 {
1662 return;
1663 }
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;
1667 if (num2 <= 0)
1668 {
1669 return;
1670 }
1671 new List<Chara>(EClass.game.cards.globalCharas.Values).Shuffle();
1672 for (int j = 0; j < num2; j++)
1673 {
1674 Chara chara = CharaGen.CreateFromFilter("c_neutral", ContentLV + Mathf.Min(EClass.player.stats.days, 10));
1675 if (chara.isBackerContent || chara.source.quality != 0)
1676 {
1677 j--;
1678 }
1679 else
1680 {
1681 AddRecruit(chara);
1682 }
1683 }
1684 }
bool isBackerContent
Definition: Card.cs:897
static Chara CreateFromFilter(string id, int lv=-1, int levelRange=-1)
Definition: CharaGen.cs:22
SourceChara.Row source
Definition: Chara.cs:154
void AddRecruit(Chara c)
int Hours
Definition: HireInfo.cs:26

References HireInfo.chara, HireInfo.Hours, if(), Card.isDestroyed, Chara.IsGlobal, and HomeResourceManager.Refresh().

Referenced by LayerQuestBoard.OnInit().

◆ Upgrade()

void FactionBranch.Upgrade ( )
inline

Definition at line 1294 of file FactionBranch.cs.

1295 {
1296 List<Element> list = owner.ListLandFeats();
1297 if (owner.IsActiveZone)
1298 {
1299 TraitCoreZone traitCoreZone = EClass._map.FindThing<TraitCoreZone>();
1300 if (traitCoreZone != null)
1301 {
1302 SE.Play("godbless");
1303 traitCoreZone.owner.PlayEffect("aura_heaven");
1304 }
1305 }
1306 lv++;
1307 exp = 0;
1308 int admin = 4;
1309 int food = 4;
1310 Set(4, 3);
1311 switch (list[0].id)
1312 {
1313 case 3500:
1314 Set(5, 3);
1315 break;
1316 case 3604:
1317 Set(4, 3);
1318 break;
1319 case 3600:
1320 Set(5, 3);
1321 break;
1322 case 3601:
1323 Set(4, 4);
1324 break;
1325 case 3603:
1326 Set(6, 2);
1327 break;
1328 case 3602:
1329 Set(5, 2);
1330 break;
1331 }
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);
1337 if (lv == 4)
1338 {
1339 elements.SetBase(list[1].id, 1);
1340 }
1341 if (lv == 7)
1342 {
1343 elements.SetBase(list[2].id, 1);
1344 }
1345 if (lv >= 5)
1346 {
1347 List<Element> list2 = elements.dict.Values.Where((Element a) => a.source.category == "landfeat" && a.HasTag("network")).ToList();
1348 foreach (Element item in list2)
1349 {
1351 }
1352 foreach (Element item2 in list2)
1353 {
1354 elements.Remove(item2.id);
1355 }
1356 }
1357 Msg.Say("upgrade_hearth", lv.ToString() ?? "", owner.Name);
1358 LogRaw("upgrade_hearth".langGame(lv.ToString() ?? "", owner.Name), "Good");
1359 Tutorial.Reserve("stone");
1360 void Set(int a, int f)
1361 {
1362 admin = a;
1363 food = f;
1364 }
1365 }
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Definition: Card.cs:5832
void Remove(int id)
Element GetElement(string alias)
void CheckLevelBonus(ElementContainer owner, UINote n=null)
Definition: ELEMENT.cs:961
Thing FindThing(Func< Thing, bool > func)
Definition: Map.cs:2578
bool IsActiveZone
Definition: Zone.cs:488

References EClass._map, Faction.elements, Chara.faction, Map.FindThing(), food, Element.HasTag(), Element.id, Zone.IsActiveZone, item, Zone.ListLandFeats(), ElementContainer.ModBase(), Spatial.Name, Trait.owner, EClass.pc, Card.PlayEffect(), Tutorial.Reserve(), Msg.Say(), and Element.source.

◆ ValidateUpgradePolicies()

void FactionBranch.ValidateUpgradePolicies ( )
inline

Definition at line 1257 of file FactionBranch.cs.

1258 {
1259 if (lv >= 2)
1260 {
1261 if (!policies.HasPolicy(2705))
1262 {
1263 policies.AddPolicy(2705);
1265 }
1266 if (!policies.HasPolicy(2708))
1267 {
1268 policies.AddPolicy(2708);
1270 }
1271 if (!policies.HasPolicy(2707))
1272 {
1273 policies.AddPolicy(2707);
1274 }
1275 if (!policies.HasPolicy(2709))
1276 {
1277 policies.AddPolicy(2709);
1278 }
1279 if (!policies.HasPolicy(2715))
1280 {
1281 policies.AddPolicy(2715);
1282 }
1283 }
1284 foreach (int globalPolicy in EClass.pc.faction.globalPolicies)
1285 {
1286 if (!policies.HasPolicy(globalPolicy))
1287 {
1288 policies.AddPolicy(globalPolicy, show: false);
1290 }
1291 }
1292 }
HashSet< int > globalPolicies
Definition: FACTION.cs:144
void SetGlobalPolicyActive(int id, bool active)
Definition: FACTION.cs:455
bool HasPolicy(int id)

References PolicyManager.AddPolicy(), Chara.faction, Faction.globalPolicies, PolicyManager.HasPolicy(), Faction.IsGlobalPolicyActive(), EClass.pc, and Faction.SetGlobalPolicyActive().

Referenced by OnActivateZone(), and TraitBookSkill.OnRead().

Member Data Documentation

◆ dateFound

int FactionBranch.dateFound

Definition at line 103 of file FactionBranch.cs.

Referenced by OnCreate(), and UIHomeInfo.RefreshInfo().

◆ efficiency

int FactionBranch.efficiency = 100

Definition at line 120 of file FactionBranch.cs.

Referenced by GetProductBonus(), RefreshEfficiency(), and UIHomeInfo.RefreshReport().

◆ exp

int FactionBranch.exp

Definition at line 40 of file FactionBranch.cs.

Referenced by WidgetStatsBar.Build(), and GameDate.ShipGoods().

◆ expeditions

ExpeditionManager FactionBranch.expeditions = new ExpeditionManager()

◆ faith

Religion FactionBranch.faith

◆ happiness

◆ incomeInn

int FactionBranch.incomeInn

Definition at line 116 of file FactionBranch.cs.

Referenced by OnActivateZone().

◆ incomeShop

int FactionBranch.incomeShop

Definition at line 55 of file FactionBranch.cs.

◆ incomeTourism

int FactionBranch.incomeTourism

Definition at line 118 of file FactionBranch.cs.

Referenced by OnActivateZone().

◆ lastStatistics

Statistics FactionBranch.lastStatistics = new Statistics()

Definition at line 112 of file FactionBranch.cs.

Referenced by ItemStatistics.Refresh().

◆ lastUpdateReqruit

int FactionBranch.lastUpdateReqruit

Definition at line 52 of file FactionBranch.cs.

◆ listRecruit

List<HireInfo> FactionBranch.listRecruit = new List<HireInfo>()

Definition at line 100 of file FactionBranch.cs.

Referenced by LayerQuestBoard.RefreshHire().

◆ log

MsgLog FactionBranch.log
Initial value:
= new MsgLog
{
id = "log"
}
Definition: MsgLog.cs:7

Definition at line 88 of file FactionBranch.cs.

Referenced by ContentHomeLog.RefreshLog(), and GameDate.ShipGoods().

◆ luckyMonth

bool FactionBranch.luckyMonth

Definition at line 58 of file FactionBranch.cs.

Referenced by WidgetDate._Refresh().

◆ luckyMonthDone

bool FactionBranch.luckyMonthDone

Definition at line 61 of file FactionBranch.cs.

◆ lv

◆ meetings

MeetingManager FactionBranch.meetings = new MeetingManager()

Definition at line 82 of file FactionBranch.cs.

Referenced by Meeting.OnEndDrama(), UIHomeInfo.RefreshReport(), and SetOwner().

◆ members

◆ owner

◆ policies

◆ rank

int FactionBranch.rank

◆ researches

◆ resources

◆ seedPlan

int FactionBranch.seedPlan

Definition at line 43 of file FactionBranch.cs.

Referenced by ResearchManager.ShowNewPlans().

◆ stability

GStability FactionBranch.stability
Initial value:
{
value = 1
}

Definition at line 64 of file FactionBranch.cs.

◆ stash

Thing FactionBranch.stash

Definition at line 85 of file FactionBranch.cs.

Referenced by OnCreate().

◆ statistics

Statistics FactionBranch.statistics = new Statistics()

Definition at line 109 of file FactionBranch.cs.

Referenced by ContentHomeLog.OnSwitchContent().

◆ temper

int FactionBranch.temper

Definition at line 46 of file FactionBranch.cs.

Referenced by UIHomeInfo.RefreshInfo().

◆ tourism

int FactionBranch.tourism

Definition at line 106 of file FactionBranch.cs.

Referenced by WidgetStatsBar.Build(), and HomeResourceWorth.WriteNote().

◆ uidMaid

int FactionBranch.uidMaid

Property Documentation

◆ ContentLV

int FactionBranch.ContentLV
get

Definition at line 136 of file FactionBranch.cs.

◆ DangerLV

int FactionBranch.DangerLV
get

Definition at line 138 of file FactionBranch.cs.

◆ elements

◆ HasItemProtection

bool FactionBranch.HasItemProtection
get

Definition at line 140 of file FactionBranch.cs.

Referenced by ActEffect.DamageEle(), Map.TryShatter(), and Chara.TryTakeSharedItems().

◆ HasNetwork

bool FactionBranch.HasNetwork
get

Definition at line 142 of file FactionBranch.cs.

Referenced by Evalue(), ButtonElement.Refresh(), and TraitTeleporter.TryTeleport().

◆ IsStartBranch

bool FactionBranch.IsStartBranch
get

Definition at line 150 of file FactionBranch.cs.

◆ IsTaxFree

bool FactionBranch.IsTaxFree
get

Definition at line 144 of file FactionBranch.cs.

◆ MaxAP

int FactionBranch.MaxAP
get

Definition at line 130 of file FactionBranch.cs.

Referenced by UICurrency.Build(), and LayerPolicy.RefreshPolicyList().

◆ MaxLv

int FactionBranch.MaxLv
get

Definition at line 154 of file FactionBranch.cs.

Referenced by UIHomeInfo.RefreshInfo().

◆ MaxPopulation

int FactionBranch.MaxPopulation
get

Definition at line 132 of file FactionBranch.cs.

Referenced by OnSimulateHour(), RefreshEfficiency(), and UIHomeInfo.RefreshInfo().

◆ MaxSoil

int FactionBranch.MaxSoil
get

Definition at line 134 of file FactionBranch.cs.

Referenced by UIHomeInfo.RefreshInfo().

◆ Money

int FactionBranch.Money
get

Definition at line 124 of file FactionBranch.cs.

◆ NumHeirloom

int FactionBranch.NumHeirloom
get

Definition at line 128 of file FactionBranch.cs.

Referenced by HomeResourceWorth.WriteNote().

◆ RankText

string FactionBranch.RankText
get

Definition at line 146 of file FactionBranch.cs.

Referenced by ContentHomeReport.RefreshInfo(), and UIHomeInfo.RefreshInfo().

◆ TextLv

string FactionBranch.TextLv
get

◆ Worth

int FactionBranch.Worth
get

Definition at line 126 of file FactionBranch.cs.

Referenced by Faction.CountWealth(), and UIHomeInfo.RefreshInfo().


The documentation for this class was generated from the following file: