mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Simple implementation of a Rut gene
This commit is contained in:
parent
8d1d43b691
commit
35d9662663
8 changed files with 140 additions and 3 deletions
33
Source/Genes/Breeding/Genes/Gene_Rut.cs
Normal file
33
Source/Genes/Breeding/Genes/Gene_Rut.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace RJW_Genes
|
||||
{
|
||||
public class Gene_Rut : Gene
|
||||
{
|
||||
public override void Tick()
|
||||
{
|
||||
base.Tick();
|
||||
|
||||
if (pawn == null || pawn.genes == null)
|
||||
return;
|
||||
|
||||
var chanceExtension = this.def.GetModExtension<TickBasedChanceExtension>();
|
||||
if (chanceExtension == null) return;
|
||||
|
||||
if (pawn.IsHashIntervalTick(chanceExtension.tickInterval)){
|
||||
Random r = new Random();
|
||||
if (r.NextDouble() < chanceExtension.eventChance)
|
||||
{
|
||||
Hediff rut = pawn.health.GetOrAddHediff(HediffDefOf.rjw_genes_genetic_rut);
|
||||
rut.Severity = 1;
|
||||
ModLog.Debug($"Pawn {pawn} gained rjw_genes_genetic_rut based on chance.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue