Elin:Code Analysis/Housing: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1: Line 1:
This is (TENATIVELY) the code block that determines the amount of visitors that visit a settlement and the type of visitors that visit.<syntaxhighlight lang="c#" line="1" start="0">
== Housing: Visitors / Publicity / Attractiveness ==
This is (TENATIVELY) the code block that determines the amount of visitors that visit a settlement and the type of visitors that visit.
 
{| class="wikitable sortable mw-collapsible"
|+
!Eclass Names
!Eclass Values
|-
|Attraction
|2206
|-
|Tourist Safety
|2811
|-
|Ancient Ruin
|3702
|-
|Celebrity's Heaven
|2822
|-
|Open for Buisness
|2810
|-
|Motherless Zone
|2710
|-
|Publicity
|2202
|}
<syntaxhighlight lang="c#" line="1" start="0">


if (EClass.rnd(5) == 0 && this.policies.IsActive(2810, -1))
if (EClass.rnd(5) == 0 && this.policies.IsActive(2810, -1))
Line 65: Line 94:


and if they're wealthy its * 1000
and if they're wealthy its * 1000
TLDR; if you want to build a settlement that generates orens through visitors you should use a snowy / ancient ruin tile
== Housing: Taxes ==
<syntaxhighlight lang="c#" line="1" start="1">
public int GetResidentTax()
{
if (!this.policies.IsActive(2512, 30))
{
return 0;
}
int num = 0;
int num2 = this.policies.IsActive(2500, 30) ? this.Evalue(2500) : 0;
int num3 = this.policies.IsActive(2501, 30) ? this.Evalue(2501) : 0;
int num4 = 50 + (int)Mathf.Sqrt((float)this.Evalue(2512)) * 5;
foreach (Chara chara in this.members)
{
if (!chara.IsPC && chara.memberType == FactionMemberType.Default)
{
bool isWealthy = chara.IsWealthy;
int num5 = 0;
foreach (Hobby hobby in chara.ListWorks(true).Concat(chara.ListHobbies(true)))
{
int num6 = hobby.source.tax * 100 / 100;
if (num6 > num5)
{
num5 = num6;
}
}
int num7 = ((isWealthy ? 50 : 10) + chara.LV * 2) * num5 / 100 * num4 / 100;
if (isWealthy && num2 > 0)
{
num7 = num7 * (150 + (int)Mathf.Sqrt((float)num2) * 5) / 100;
}
if (num3 > 0)
{
num7 += (80 + (int)Mathf.Sqrt((float)num3) * 5) * chara.faith.source.tax / 100;
}
num7 = num7 * this.efficiency / (this.IsTaxFree ? 100 : 1000);
num += num7;
if (num7 > 0)
{
this.Log("bTax", num7.ToString() ?? "", chara.Name, null, null);
}
}
}
this.statistics.tax += num;
return num;
}
</syntaxhighlight>
152

edits