Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Happiness Class Reference
Inheritance diagram for Happiness:
EClass

Public Member Functions

void SetOwner (FactionBranch _branch, FactionMemberType _type)
 
void OnAdvanceDay ()
 
void OnRefreshEffect ()
 
int GetTargetValue ()
 
string GetText ()
 
int CountMembers ()
 
void WriteNote (UINote n)
 

Public Attributes

int value
 
int lastValue
 
int modPolicy
 
FactionBranch branch
 
FactionMemberType type
 

Properties

string Name [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 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 4 of file Happiness.cs.

Member Function Documentation

◆ CountMembers()

int Happiness.CountMembers ( )
inline

Definition at line 95 of file Happiness.cs.

96 {
97 int num = 0;
98 foreach (Chara member in branch.members)
99 {
100 if (member.memberType == type)
101 {
102 num++;
103 }
104 }
105 return num;
106 }
Definition: Chara.cs:10
FactionMemberType memberType
Definition: Chara.cs:46
List< Chara > members
FactionBranch branch
Definition: Happiness.cs:14
FactionMemberType type
Definition: Happiness.cs:16

References branch, FactionBranch.members, Chara.memberType, and type.

Referenced by GetText().

◆ GetTargetValue()

int Happiness.GetTargetValue ( )
inline

Definition at line 37 of file Happiness.cs.

38 {
39 int num = 50;
40 if (branch.resources.food.value < 0)
41 {
42 num -= 100;
43 }
44 num += (branch.resources.fun.value - 50) / 4;
45 num += (branch.resources.culture.value - 50) / 4;
46 num += (branch.resources.medicine.value - 50) / 4;
47 num += (branch.resources.safety.value - 50) / 4;
48 foreach (Chara member in branch.members)
49 {
50 _ = member;
51 }
53 {
54 _ = item;
55 }
56 foreach (Policy item2 in branch.policies.list)
57 {
58 _ = item2;
59 }
60 return num + modPolicy;
61 }
PolicyManager policies
HomeResourceManager resources
int modPolicy
Definition: Happiness.cs:12
List< BaseHomeResource > list
List< Policy > list
Definition: PolicyManager.cs:7

References branch, HomeResourceManager.food, item, HomeResourceManager.list, PolicyManager.list, FactionBranch.members, modPolicy, FactionBranch.policies, FactionBranch.resources, and BaseHomeResource.value.

Referenced by OnAdvanceDay(), and WriteNote().

◆ GetText()

string Happiness.GetText ( )
inline

Definition at line 63 of file Happiness.cs.

64 {
65 if (CountMembers() == 0)
66 {
67 return " - %".TagColor(FontColor.Passive);
68 }
69 string text = value + "%";
70 int num = value - lastValue;
71 if (num != 0)
72 {
73 _ = 0;
74 }
75 if (value <= 30)
76 {
77 text = text.TagColor(FontColor.Bad);
78 }
79 else if (value >= 70)
80 {
81 text = text.TagColor(FontColor.Good);
82 }
83 string text2 = "";
84 if (num > 0)
85 {
86 text2 = "↑".TagColor(FontColor.Good);
87 }
88 else if (num < 0)
89 {
90 text2 = "↓".TagColor(FontColor.Bad);
91 }
92 return text + " " + text2;
93 }
FontColor
Definition: FontColor.cs:2
int CountMembers()
Definition: Happiness.cs:95
int value
Definition: Happiness.cs:7
int lastValue
Definition: Happiness.cs:10

References CountMembers(), lastValue, and value.

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

◆ OnAdvanceDay()

void Happiness.OnAdvanceDay ( )
inline

Definition at line 26 of file Happiness.cs.

27 {
29 value = (int)Mathf.Lerp(value, GetTargetValue(), 0.1f);
30 }
int GetTargetValue()
Definition: Happiness.cs:37

References GetTargetValue(), lastValue, and value.

◆ OnRefreshEffect()

void Happiness.OnRefreshEffect ( )
inline

Definition at line 32 of file Happiness.cs.

33 {
34 modPolicy = 0;
35 }

References modPolicy.

◆ SetOwner()

void Happiness.SetOwner ( FactionBranch  _branch,
FactionMemberType  _type 
)
inline

Definition at line 20 of file Happiness.cs.

21 {
22 branch = _branch;
23 type = _type;
24 }

References branch, and type.

◆ WriteNote()

void Happiness.WriteNote ( UINote  n)
inline

Definition at line 108 of file Happiness.cs.

109 {
110 n.Clear();
111 n.AddHeader(Name);
112 n.Space();
113 n.AddText("vTarget".lang() + GetTargetValue());
114 n.AddText("vCurrent".lang() + value);
115 n.AddText("vLast".lang() + lastValue);
116 n.Space();
117 n.AddText("policyHappiness".lang(modPolicy.ToString() ?? ""));
118 n.Build();
119 }
string Name
Definition: Happiness.cs:18
void Clear()
Definition: UINote.cs:35
UIItem AddHeader(string text, Sprite sprite=null)
Definition: UINote.cs:79
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void Build()
Definition: UINote.cs:49

References UINote.AddHeader(), UINote.AddText(), UINote.Build(), UINote.Clear(), GetTargetValue(), lastValue, modPolicy, Name, UINote.Space(), and value.

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

Member Data Documentation

◆ branch

FactionBranch Happiness.branch

Definition at line 14 of file Happiness.cs.

Referenced by CountMembers(), GetTargetValue(), and SetOwner().

◆ lastValue

int Happiness.lastValue

Definition at line 10 of file Happiness.cs.

Referenced by GetText(), OnAdvanceDay(), and WriteNote().

◆ modPolicy

int Happiness.modPolicy

Definition at line 12 of file Happiness.cs.

Referenced by GetTargetValue(), OnRefreshEffect(), and WriteNote().

◆ type

FactionMemberType Happiness.type

Definition at line 16 of file Happiness.cs.

Referenced by CountMembers(), and SetOwner().

◆ value

int Happiness.value

Definition at line 7 of file Happiness.cs.

Referenced by GetText(), OnAdvanceDay(), and WriteNote().

Property Documentation

◆ Name

string Happiness.Name
get

Definition at line 18 of file Happiness.cs.

Referenced by WriteNote().


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