Skip to content

Commit 48469c2

Browse files
committed
update 1.6
1 parent 46f7a9c commit 48469c2

File tree

16 files changed

+729
-23
lines changed

16 files changed

+729
-23
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
*.sln
44
*.pdb
55
1.5/Source/obj/*
6+
1.6/Source/obj/*
7+
1.6/Assembiles/*
68
!Phephilia.dll
79

-512 Bytes
Binary file not shown.

1.5/Source/Core/Core.cs

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
namespace Phephilia.Core{
88

9-
public static class PrivateStaticMethodCapture
9+
public static class Utils
1010
{
1111
internal static void CaptureIncestuousInFunc()
1212
{
13-
PrivateStaticMethodCapture.FuncIncestuous = AccessTools.MethodDelegate<Func<Pawn, Pawn, bool>>(AccessTools.Method(typeof(RelationsUtility), "Incestuous", new Type[]
13+
Utils.FuncIncestuous = AccessTools.MethodDelegate<Func<Pawn, Pawn, bool>>(AccessTools.Method(typeof(RelationsUtility), "Incestuous", new Type[]
1414
{
1515
typeof(Pawn),
1616
typeof(Pawn)
@@ -37,22 +37,46 @@ public static int getTraitRomanceAge(Pawn pawn){
3737
}
3838
}
3939
public static class RomanceAgeOverride{
40-
public static float getRomanceAgeOverride(Pawn pawn){
41-
float expectancyLiftHuman = ThingDefOf.Human.race.lifeExpectancy;
42-
float expectancyLife = pawn.RaceProps.lifeExpectancy;
43-
// float expectancyLife2 = otherPawn.RaceProps.lifeExpectancy;
44-
float RomanceAge = pawn.ageTracker.AgeBiologicalYearsFloat;
45-
// float age2 = otherPawn.ageTracker.AgeBiologicalYearsFloat;
40+
// public static float getRomanceAgeOverride(Pawn pawn){
41+
// float expectancyLiftHuman = ThingDefOf.Human.race.lifeExpectancy;
42+
// float expectancyLife = pawn.RaceProps.lifeExpectancy;
43+
// // float expectancyLife2 = otherPawn.RaceProps.lifeExpectancy;
44+
// float RomanceAge = pawn.ageTracker.AgeBiologicalYearsFloat;
45+
// // float age2 = otherPawn.ageTracker.AgeBiologicalYearsFloat;
46+
// float minAge = GetMinRomanceAgeFromPreceptLabels(pawn);
47+
// if(expectancyLife > expectancyLiftHuman && RomanceAge > expectancyLiftHuman){
48+
// RomanceAge /= expectancyLife;
49+
// if(RomanceAge < minAge){
50+
// RomanceAge = minAge;
51+
// }
52+
// }
53+
// return RomanceAge;
54+
// }
55+
56+
public static float getRomanceAgeOverride(Pawn pawn)
57+
{
58+
float RomanceAge = GetEquivalentHumanAge(pawn);
4659
float minAge = GetMinRomanceAgeFromPreceptLabels(pawn);
47-
if(expectancyLife > expectancyLiftHuman && RomanceAge > expectancyLiftHuman){
48-
RomanceAge /= expectancyLife;
49-
if(RomanceAge < minAge){
50-
RomanceAge = minAge;
51-
}
52-
}
60+
if (RomanceAge < minAge) {
61+
RomanceAge = minAge;
62+
}
63+
5364
return RomanceAge;
5465
}
66+
public static float GetEquivalentHumanAge(Pawn pawn)
67+
{
68+
if (pawn == null || pawn.RaceProps == null)
69+
return 0f;
70+
float humanLifeExpectancy = ThingDefOf.Human.race.lifeExpectancy;
71+
float pawnExpectancyLife = pawn.RaceProps.lifeExpectancy;
72+
float age = pawn.ageTracker.AgeBiologicalYearsFloat;
73+
float factor = pawn.GetStatValue(StatDef.Named("LifespanFactor"));
74+
if (factor <= 0f)
75+
factor = 1f;
76+
return age / (pawnExpectancyLife * factor) * humanLifeExpectancy ;
77+
}
5578

79+
5680
public static int defaultMinAge = 14;
5781
public static int GetMinRomanceAgeFromPreceptLabels(Pawn pawn)
5882
{
@@ -82,10 +106,9 @@ public static int GetMinRomanceAgeFromPreceptLabels(Pawn pawn)
82106
return 18;
83107
default:
84108
continue;
85-
// 可扩展更多
86109
}
87110
}
88-
return defaultMinAge; // 没有找到任何指定的戒律时默认不限制
111+
return defaultMinAge;
89112
}
90113
}
91114
}

1.5/Source/HarmonyPatches/Patchs.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
using System;
77
// using System.Linq;
88
using UnityEngine;
9-
using Phephilia.HarmonyPatches;
10-
using System.Drawing.Text;
11-
using Verse.AI;
12-
// using phepholia.Core;
9+
// using Phephilia.HarmonyPatches;
10+
// using System.Drawing.Text;
11+
// using Verse.AI;
12+
using Phephilia.Core;
1313

1414
namespace Phephilia.HarmonyPatches
1515
{
@@ -127,7 +127,7 @@ private static float LovinAgeFactor(Pawn pawn, Pawn otherPawn)
127127
float lower = age1 - malelower;
128128
float upper = age1 + maleupper;
129129
float max = age1 + malemax;
130-
num = GenMath.FlatHill(0.2f, min, lower, upper, max, 0.2f, age1);
130+
num = GenMath.FlatHill(0.2f, min, lower, upper, max, 0.2f, age2);
131131
}
132132
else if (pawn.gender == Gender.Female)
133133
{

1.5/Source/phephilia.csproj

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,69 @@
44
<OutputPath>../Assemblies/</OutputPath>
55
<AssemblyName>Phephilia</AssemblyName>
66
<RootNamespace>Phephilia</RootNamespace>
7+
<ModTargetPath>C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\$(AssemblyName)</ModTargetPath>
8+
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<Outside Include="..\About\**\*" />
13+
<Defs Include="..\Defs\**\*" />
14+
<Langs Include="..\Languages\**\*" />
15+
<!-- <Outside Include="..\Textures\**\*" /> -->
16+
</ItemGroup>
17+
18+
<PropertyGroup>
19+
<ModVersion>1.5</ModVersion>
720
</PropertyGroup>
821

22+
<Target Name = "AfterBuildCopy" AfterTargets="Build">
23+
24+
<Copy SourceFiles="$(OutputPath)$(AssemblyName).dll"
25+
DestinationFolder="$(ModTargetPath)\$(ModVersion)\Assemblies"
26+
OverwriteReadOnlyFiles="true" />
27+
<Message Importance="high"
28+
Text="Copying $(OutputPath)$(AssemblyName).dll to $(ModTargetPath)" />
29+
30+
<Copy SourceFiles="@(Defs)"
31+
DestinationFiles="@(Defs->'$(ModTargetPath)\$(ModVersion)\Defs\%(RecursiveDir)%(Filename)%(Extension)')"
32+
OverwriteReadOnlyFiles="true" />
33+
<Message Importance="high"
34+
Text="Copying Defs to $(ModTargetPath)\$(ModVersion)" />
35+
36+
<Copy SourceFiles="@(Langs)"
37+
DestinationFiles="@(Langs->'$(ModTargetPath)\$(ModVersion)\Languages\%(RecursiveDir)%(Filename)%(Extension)')"
38+
OverwriteReadOnlyFiles="true" />
39+
<Message Importance="high"
40+
Text="Copying Langs to $(ModTargetPath)\$(ModVersion)" />
41+
42+
<Copy SourceFiles="@(Outside)"
43+
DestinationFiles="@(Outside->'$(ModTargetPath)\%(RecursiveDir)%(Filename)%(Extension)')"
44+
OverwriteReadOnlyFiles="true" />
45+
<Message Importance="high"
46+
Text="Copying Outside to $(ModTargetPath)" />
47+
</Target>
48+
49+
50+
51+
952
<ItemGroup>
1053
<Reference Include="Assembly-CSharp">
1154
<HintPath>../ExternalMods/Assembly-CSharp.dll</HintPath>
55+
<Private>false</Private>
1256
</Reference>
1357
<Reference Include="UnityEngine">
1458
<HintPath>../ExternalMods/UnityEngine.dll</HintPath>
59+
<Private>false</Private>
1560
</Reference>
1661
<Reference Include="UnityEngine.CoreModule">
1762
<HintPath>../ExternalMods/UnityEngine.CoreModule.dll</HintPath>
63+
<Private>false</Private>
1864
</Reference>
1965
</ItemGroup>
2066

2167
<ItemGroup>
22-
<PackageReference Include="Lib.Harmony" Version="2.2.2" />
68+
<PackageReference Include="Lib.Harmony" Version="2.2.2">
69+
<ExcludeAssets>runtime</ExcludeAssets>
70+
</PackageReference>
2371
</ItemGroup>
2472
</Project>
13 KB
Binary file not shown.

1.6/Defs/MinAgeforRomance.xml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Defs>
3+
4+
<IssueDef>
5+
<defName>Phephilia_MinRomanceAge</defName>
6+
<label>Romance Age Doctrine</label>
7+
<iconPath>UI/Issues/issue</iconPath>
8+
</IssueDef>
9+
10+
<!-- 7岁选项 -->
11+
<PreceptDef>
12+
<defName>MinAgeforRomance_7</defName>
13+
<issue>Phephilia_MinRomanceAge</issue>
14+
<label>Pedophilia</label>
15+
<description>This belief system allows people to accepte the relationship above 7.</description>
16+
<impact>Low</impact>
17+
<enabledForNPCFactions>true</enabledForNPCFactions>
18+
<displayOrderInIssue>35</displayOrderInIssue>
19+
<displayOrderInImpact>-100</displayOrderInImpact>
20+
<classic>true</classic>
21+
<defaultSelectionWeight>0.2</defaultSelectionWeight>
22+
</PreceptDef>
23+
24+
<!-- 10岁选项 -->
25+
<PreceptDef>
26+
<defName>MinAgeforRomance_10</defName>
27+
<label>Hebephilia</label>
28+
<description>Romantic relationships are only acceptable above 10.</description>
29+
<impact>Low</impact>
30+
<enabledForNPCFactions>true</enabledForNPCFactions>
31+
<issue>Phephilia_MinRomanceAge</issue>
32+
<displayOrderInIssue>30</displayOrderInIssue>
33+
<displayOrderInImpact>-100</displayOrderInImpact>
34+
<classic>true</classic>
35+
<defaultSelectionWeight>0.3</defaultSelectionWeight>
36+
</PreceptDef>
37+
38+
<!-- 14岁选项 -->
39+
<PreceptDef>
40+
<defName>MinAgeforRomance_14</defName>
41+
<label>Ephebophilia</label>
42+
<description>Romantic relationships are only acceptable above 14.</description>
43+
<impact>Low</impact>
44+
<issue>Phephilia_MinRomanceAge</issue>
45+
<enabledForNPCFactions>true</enabledForNPCFactions>
46+
<displayOrderInIssue>20</displayOrderInIssue>
47+
<displayOrderInImpact>-100</displayOrderInImpact>
48+
<classic>true</classic>
49+
<defaultSelectionWeight>1</defaultSelectionWeight>
50+
</PreceptDef>
51+
52+
<!-- 18岁选项 -->
53+
<PreceptDef>
54+
<defName>MinAgeforRomance_18</defName>
55+
<label>Teleiophilia</label>
56+
<description>Romantic relationships are only acceptable above 18.</description>
57+
<impact>Low</impact>
58+
<issue>Phephilia_MinRomanceAge</issue>
59+
<enabledForNPCFactions>true</enabledForNPCFactions>
60+
<displayOrderInIssue>10</displayOrderInIssue>
61+
<displayOrderInImpact>-100</displayOrderInImpact>
62+
<classic>true</classic>
63+
<defaultSelectionWeight>1</defaultSelectionWeight>
64+
</PreceptDef>
65+
66+
</Defs>

1.6/Defs/TraitforRomance.xml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
<Defs>
3+
<TraitDef>
4+
<defName>RomanceFetish_10</defName>
5+
<!-- <label>Taboo Breaker</label> -->
6+
<commonality>0.1</commonality>
7+
8+
<degreeDatas>
9+
<li>
10+
<label>Taboo Breaker</label>
11+
<description>{PAWN_nameDef} prefer younger ones.</description>
12+
<degree>0</degree>
13+
</li>
14+
</degreeDatas>
15+
<conflictingTraits>
16+
<li>RomanceFetish_IgnoreAll</li>
17+
<li>RomanceFetish_7</li>
18+
</conflictingTraits>
19+
</TraitDef>
20+
21+
<TraitDef>
22+
<defName>RomanceFetish_7</defName>
23+
<!-- <label>Lolita Complex</label> -->
24+
<commonality>0.05</commonality>
25+
26+
<degreeDatas>
27+
<li>
28+
<label>Lolita Complex</label>
29+
<description>{PAWN_nameDef} prefer an amoral romance.</description>
30+
<degree>0</degree>
31+
</li>
32+
</degreeDatas>
33+
<conflictingTraits>
34+
<li>RomanceFetish_IgnoreAll</li>
35+
<li>RomanceFetish_10</li>
36+
</conflictingTraits>
37+
</TraitDef>
38+
39+
<TraitDef>
40+
<defName>RomanceFetish_IgnoreAll</defName>
41+
<!-- <label>Unbound Lover</label> -->
42+
<commonality>1</commonality>
43+
44+
<degreeDatas>
45+
<li>
46+
<label>Unbound Lover</label>
47+
<description>{PAWN_nameDef} completely ignores social and religious norms on romance age.</description>
48+
<degree>0</degree>
49+
</li>
50+
</degreeDatas>
51+
<conflictingTraits>
52+
<li>RomanceFetish_7</li>
53+
<li>RomanceFetish_10</li>
54+
</conflictingTraits>
55+
</TraitDef>
56+
</Defs>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<LanguageData>
2+
<Phephilia_MinRomanceAge.label>恋爱年龄限制</Phephilia_MinRomanceAge.label>
3+
</LanguageData>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<LanguageData>
2+
<MinAgeforRomance_7.label>限制:7</MinAgeforRomance_7.label>
3+
<MinAgeforRomance_7.description>这种信仰体系让人们接受7岁及以上的恋爱关系。</MinAgeforRomance_7.description>
4+
<MinAgeforRomance_10.label>限制:10</MinAgeforRomance_10.label>
5+
<MinAgeforRomance_10.description>这种信仰体系让人们接受10岁及以上的恋爱关系。</MinAgeforRomance_10.description>
6+
<MinAgeforRomance_14.label>限制:14</MinAgeforRomance_14.label>
7+
<MinAgeforRomance_14.description>这种信仰体系让人们接受14岁及以上的恋爱关系。</MinAgeforRomance_14.description>
8+
<MinAgeforRomance_18.label>限制:18</MinAgeforRomance_18.label>
9+
<MinAgeforRomance_18.description>这种信仰体系让人们接受18岁及以上的恋爱关系。</MinAgeforRomance_18.description>
10+
11+
</LanguageData>

0 commit comments

Comments
 (0)