rjw-genes/Source/Genes/Life_Force/GeneGizmo_ResourceLifeForce.cs
Shabakur 1f865320b0 Adding Lifeforce and succubus wings gene
Adds lifeforce gene and functions for gaining lifeforce from oral sex and mental break if lifeforce reaches zero. Also add succubus wings drawn by me
2022-12-27 13:48:38 +01:00

84 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using UnityEngine;
namespace RJW_Genes
{
//Copied from GeneGizmo_ResourceHemogen, with small modifications
public class GeneGizmo_ResourceLifeForce : GeneGizmo_Resource
{
public GeneGizmo_ResourceLifeForce(Gene_Resource gene, List<IGeneResourceDrain> drainGenes, Color barColor, Color barhighlightColor) : base(gene, drainGenes, barColor, barhighlightColor)
{
this.draggableBar = true;
}
public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth, GizmoRenderParms parms)
{
return base.GizmoOnGUI(topLeft, maxWidth, parms);
}
protected override string GetTooltip()
{
this.tmpDrainGenes.Clear();
string text = string.Format("{0}: {1} / {2}\n", this.gene.ResourceLabel.CapitalizeFirst().Colorize(ColoredText.TipSectionTitleColor), this.gene.ValueForDisplay, this.gene.MaxForDisplay);
if (this.gene.pawn.IsColonistPlayerControlled || this.gene.pawn.IsPrisonerOfColony)
{
if (this.gene.targetValue <= 0f)
{
text += "NeverConsumeCum";
}
else
{
text = text + ("ConsumeCumBelow" + ": ") + this.gene.PostProcessValue(this.gene.targetValue);
}
}
if (!this.drainGenes.NullOrEmpty<IGeneResourceDrain>())
{
float num = 0f;
foreach (IGeneResourceDrain geneResourceDrain in this.drainGenes)
{
if (geneResourceDrain.CanOffset)
{
this.tmpDrainGenes.Add(new Pair<IGeneResourceDrain, float>(geneResourceDrain, geneResourceDrain.ResourceLossPerDay));
num += geneResourceDrain.ResourceLossPerDay;
}
}
if (num != 0f)
{
string text2 = (num < 0f) ? "RegenerationRate".Translate() : "DrainRate".Translate();
text = string.Concat(new string[]
{
text,
"\n\n",
text2,
": ",
"PerDay".Translate(Mathf.Abs(this.gene.PostProcessValue(num))).Resolve()
});
foreach (Pair<IGeneResourceDrain, float> pair in this.tmpDrainGenes)
{
text = string.Concat(new string[]
{
text,
"\n - ",
pair.First.DisplayLabel.CapitalizeFirst(),
": ",
"PerDay".Translate(this.gene.PostProcessValue(-pair.Second).ToStringWithSign()).Resolve()
});
}
}
}
if (!this.gene.def.resourceDescription.NullOrEmpty())
{
text = text + "\n\n" + this.gene.def.resourceDescription.Formatted(this.gene.pawn.Named("PAWN")).Resolve();
}
return text;
}
private List<Pair<IGeneResourceDrain, float>> tmpDrainGenes = new List<Pair<IGeneResourceDrain, float>>();
}
}