mirror of
https://gitgud.io/amevarashi/rjw-sexperience-ideology.git
synced 2024-08-15 00:43:19 +00:00
Moved precepts romanceChanceFactor to DefExtention
This commit is contained in:
parent
be1e5c5d5d
commit
f7206347da
5 changed files with 159 additions and 83 deletions
|
@ -1,5 +1,4 @@
|
|||
using RJWSexperience.Ideology.Filters;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Verse;
|
||||
|
||||
|
@ -12,5 +11,63 @@ namespace RJWSexperience.Ideology.Precepts
|
|||
public class DefExtension_Incest : DefModExtension
|
||||
{
|
||||
public List<BloodRelationDegree> allowManualRomanceOnlyFor;
|
||||
public List<BloodRelationDegreeFactor> bloodRelationDegreeRomanceFactors;
|
||||
|
||||
private Dictionary<BloodRelationDegree, float> _relationDegreeFactorsDict;
|
||||
|
||||
public bool TryGetRomanceChanceFactor(BloodRelationDegree relationDegree, out float romanceChanceFactor)
|
||||
{
|
||||
if (bloodRelationDegreeRomanceFactors.NullOrEmpty())
|
||||
{
|
||||
romanceChanceFactor = 1f;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_relationDegreeFactorsDict == null)
|
||||
{
|
||||
_relationDegreeFactorsDict = new Dictionary<BloodRelationDegree, float>();
|
||||
foreach (BloodRelationDegreeFactor relationDegreeFactor in bloodRelationDegreeRomanceFactors)
|
||||
{
|
||||
_relationDegreeFactorsDict.Add((BloodRelationDegree)relationDegreeFactor.bloodRelationDegree, relationDegreeFactor.romanceChanceFactor);
|
||||
}
|
||||
}
|
||||
|
||||
return _relationDegreeFactorsDict.TryGetValue(relationDegree, out romanceChanceFactor);
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
foreach (BloodRelationDegreeFactor factor in bloodRelationDegreeRomanceFactors)
|
||||
{
|
||||
foreach(string error in factor.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BloodRelationDegreeFactor
|
||||
{
|
||||
public BloodRelationDegree? bloodRelationDegree;
|
||||
public float romanceChanceFactor;
|
||||
|
||||
public IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
if (bloodRelationDegree == null)
|
||||
{
|
||||
yield return "<bloodRelationDegree> is empty";
|
||||
}
|
||||
|
||||
if (romanceChanceFactor == 0f)
|
||||
{
|
||||
yield return "<romanceChanceFactor> should be > 0";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue