Elin:Code Analysis/Housing: Difference between revisions

No edit summary
Line 117: Line 117:
public int GetResidentTax()
public int GetResidentTax()
{
{
if (!this.policies.IsActive(2512, 30))
if (!policies.IsActive(2512, 30))
{
{
return 0;
return 0;
}
}
int num = 0;
int num = 0;
int num2 = this.policies.IsActive(2500, 30) ? this.Evalue(2500) : 0;
int num2 = (policies.IsActive(2500, 30) ? Evalue(2500) : 0);
int num3 = this.policies.IsActive(2501, 30) ? this.Evalue(2501) : 0;
int num3 = (policies.IsActive(2501, 30) ? Evalue(2501) : 0);
int num4 = 50 + (int)Mathf.Sqrt((float)this.Evalue(2512)) * 5;
int num4 = 50 + (int)Mathf.Sqrt(Evalue(2512)) * 5;
foreach (Chara chara in this.members)
foreach (Chara member in members)
{
{
if (!chara.IsPC && chara.memberType == FactionMemberType.Default)
if (member.IsPC || member.memberType != 0)
{
{
bool isWealthy = chara.IsWealthy;
continue;
int num5 = 0;
}
foreach (Hobby hobby in chara.ListWorks(true).Concat(chara.ListHobbies(true)))
bool isWealthy = member.IsWealthy;
int num5 = 0;
foreach (Hobby item in member.ListWorks().Concat(member.ListHobbies()))
{
int num6 = item.source.tax * 100 / 100;
if (num6 > num5)
{
{
int num6 = hobby.source.tax * 100 / 100;
num5 = num6;
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);
}
}
}
int num7 = ((isWealthy ? 50 : 10) + member.LV * 2) * num5 / 100 * num4 / 100;
if (isWealthy && num2 > 0)
{
num7 = num7 * (150 + (int)Mathf.Sqrt(num2) * 5) / 100;
}
if (num3 > 0)
{
num7 += (80 + (int)Mathf.Sqrt(num3) * 5) * member.faith.source.tax / 100;
}
num7 = num7 * efficiency / (IsTaxFree ? 100 : 1000);
num += num7;
if (num7 > 0)
{
Log("bTax", num7.ToString() ?? "", member.Name);
}
}
}
}
this.statistics.tax += num;
statistics.tax += num;
return num;
return num;
}
}
</syntaxhighlight>If Resident Tax is active then:
</syntaxhighlight>
* The policy of wealth tax, faith tax, and resident tax must already have been enabled for 30 days, for these policies to count.
** The '''base tax percentage''' for each resident is calculated with (50 + Square root of resident tax lvl * 5).
** Each hobby of resident have a different tax base, this we call '''"hobby tax standard"''', we take the maximum among all hobbies of that resident.
*** For example, Reading is 120, Lottery is 140, Gacha is 160 (don't play gacha games guys), Smoking is 300, Extravagance is 400, Rambo is 30, and Supervisor is 0.
** The overall tax for a resident is calculated as:
*** If wealthy: (50 + resident level * 2) * base tax percentage% * hobby tax standard%.
*** If not wealthy: (10 + resident level * 2) * base tax percentage% * hobby tax standard%.
**** For example, a wealthy citizen of lv 5, whose hobby is reading and the resident tax policy level is 9, his tax is (50 + 2 * 5)* 120% * 65% = 46.8.
** Now we go to the policies.
*** If wealthy & wealthy tax activated:
**** the overall tax is modified by (150 + sqrt of wealthy tax policy lvl * 5)%.
*** If faith tax is activated:
**** the overall tax is modified by +(80 + sqrt of faith tax policy lvl) * Faith tax rate%.
***** The faith tax rate is different for each religion. Eyth of void: 500%. Ehekatl of luck: 300%, The lowest is Yakasha of Oblivion: 0%, and Lulwy of Wind: 25%.
** Finally, this tax rate is penalized for lack of efficiency or not in tax free land.
*** '''If your land is not tax free, all resident tax will be penalized by 90%!'''
 
* Let's look at an example.
** Here is a wealthy citizen, who has a hobby of Gacha, and is lvl 50, and he is worshiping Eyth of void. All your tax policies is at lvl 100, but the land is not tax free.
*** The overall tax before policies is : (50 + 50 * 2) * 160% * (50+50)% = 240 orens.
*** We then have wealthy tax, modified to 240 * (150 + 50)% = 480 orens
*** Then the faith tax modified to 480 + (80 + 50) * 500% = 1230 orens.
** But your land is not tax free, so the final tax is 123 orens. Making your blood boil already? Wanna buy a nuke for Mysilia?




[[Category:Elin Spoiler]]
[[Category:Elin Spoiler]]
[[Category:EN]]
[[Category:EN]]
426

edits