mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Implemented Animal-Reduce for CockEater, documentation improvement.
This commit is contained in:
parent
d6aeca7249
commit
94a51be2f7
1 changed files with 51 additions and 29 deletions
|
@ -1,16 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using rjw.Modules.Interactions.Helpers;
|
||||
|
||||
namespace RJW_Genes
|
||||
{
|
||||
/// <summary>
|
||||
/// The CockEater Ability bites off the first found non-artifical cock of an target pawn.
|
||||
/// It will restore {MINIMUM_LIFEFORCE_GAIN} multiplied by up to 2-times the Cock-Size.
|
||||
/// Consuming a "towering" cock will give 2*{MINIMUM_LIFEFORCE_GAIN}, resulting in default 0.5f LifeForce.
|
||||
/// This number is reduced for consuming animals by Settings.
|
||||
///
|
||||
/// Balancing note: With the Cock-Eaters a drain of 0.08 is normal per day. This means 1 average cock should hold for 3-4 days of fertilin-fuel and half a day for an animal.
|
||||
/// </summary>
|
||||
public class CompAbilityEffect_CockEater : CompAbilityEffect
|
||||
{
|
||||
private new CompProperties_AbilityCockEater Props
|
||||
|
@ -20,16 +21,20 @@ namespace RJW_Genes
|
|||
return (CompProperties_AbilityCockEater)this.props;
|
||||
}
|
||||
}
|
||||
|
||||
public const float MINIMUM_LIFEFORCE_GAIN = 0.25f;
|
||||
|
||||
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
|
||||
{
|
||||
base.Apply(target, dest);
|
||||
Pawn pawn = target.Pawn;
|
||||
if (pawn == null)
|
||||
Pawn CockBiter = this.parent.pawn;
|
||||
Pawn CockBittenPawn = target.Pawn;
|
||||
if (CockBittenPawn == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var partBPR = Genital_Helper.get_genitalsBPR(pawn);
|
||||
var parts = Genital_Helper.get_PartsHediffList(pawn, partBPR);
|
||||
var partBPR = Genital_Helper.get_genitalsBPR(CockBittenPawn);
|
||||
var parts = Genital_Helper.get_PartsHediffList(CockBittenPawn, partBPR);
|
||||
if (!parts.NullOrEmpty())
|
||||
{
|
||||
foreach (Hediff part in parts)
|
||||
|
@ -39,50 +44,67 @@ namespace RJW_Genes
|
|||
|
||||
if (Genital_Helper.is_penis(part))
|
||||
{
|
||||
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(this.parent.pawn), part.Severity); ;
|
||||
pawn.health.RemoveHediff(part);
|
||||
pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.rjw_genes_cock_eaten, pawn, null);
|
||||
break; //Only one penis at the time
|
||||
}
|
||||
}
|
||||
|
||||
float gained_lifeforce = MINIMUM_LIFEFORCE_GAIN * (1 + part.Severity);
|
||||
if (CockBittenPawn.IsAnimal())
|
||||
{
|
||||
gained_lifeforce *= RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor;
|
||||
}
|
||||
// Increase LifeForce for Biter
|
||||
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(CockBiter), gained_lifeforce);
|
||||
|
||||
// Handle Damage for Bitten
|
||||
CockBittenPawn.health.RemoveHediff(part);
|
||||
CockBittenPawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.rjw_genes_cock_eaten, CockBittenPawn, null);
|
||||
|
||||
//Only one penis at the time
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For validity, there are a few checks:
|
||||
/// 1. Target has Penis
|
||||
/// 2. Target is either Colonist / Prisoner
|
||||
/// 3. If the Target is an enemy, it must be downed.
|
||||
/// </summary>
|
||||
public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
|
||||
{
|
||||
Pawn pawn = target.Pawn;
|
||||
if (pawn != null)
|
||||
Pawn CockBiteTarget = target.Pawn;
|
||||
if (CockBiteTarget != null)
|
||||
{
|
||||
bool flag = pawn.Faction == this.parent.pawn.Faction || pawn.IsPrisonerOfColony;
|
||||
bool flag2 = pawn.HostileTo(this.parent.pawn);
|
||||
bool flag3 = pawn.Downed;
|
||||
if (!flag && !(flag2 && flag3))
|
||||
bool CockBiteTargetIsColonistOrPrisoner = CockBiteTarget.Faction == this.parent.pawn.Faction || CockBiteTarget.IsPrisonerOfColony;
|
||||
bool CockBiteTargetIsHostile = CockBiteTarget.HostileTo(this.parent.pawn);
|
||||
bool CockBiteTargetIsDowned = CockBiteTarget.Downed;
|
||||
|
||||
if (!CockBiteTargetIsColonistOrPrisoner && !(CockBiteTargetIsHostile && CockBiteTargetIsDowned))
|
||||
{
|
||||
if (throwMessages)
|
||||
{
|
||||
if(flag2 && !flag3)
|
||||
if(CockBiteTargetIsHostile && !CockBiteTargetIsDowned)
|
||||
{
|
||||
Messages.Message(pawn.Name + " is hostile, but not downed.", pawn, MessageTypeDefOf.RejectInput, false);
|
||||
Messages.Message(CockBiteTarget.Name + " is hostile, but not downed.", CockBiteTarget, MessageTypeDefOf.RejectInput, false);
|
||||
}
|
||||
else if (!flag)
|
||||
else if (!CockBiteTargetIsColonistOrPrisoner)
|
||||
{
|
||||
Messages.Message(pawn.Name + " is not a part of the colony or hostile.", pawn, MessageTypeDefOf.RejectInput, false);
|
||||
Messages.Message(CockBiteTarget.Name + " is not a part of the colony or hostile.", CockBiteTarget, MessageTypeDefOf.RejectInput, false);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!Genital_Helper.has_penis_fertile(pawn))
|
||||
if (!Genital_Helper.has_penis_fertile(CockBiteTarget))
|
||||
{
|
||||
if (throwMessages)
|
||||
{
|
||||
Messages.Message(pawn.Name + " has no penis", pawn, MessageTypeDefOf.RejectInput, false);
|
||||
Messages.Message(CockBiteTarget.Name + " has no penis", CockBiteTarget, MessageTypeDefOf.RejectInput, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return base.Valid(target, throwMessages);
|
||||
}
|
||||
|
||||
public override bool GizmoDisabled(out string reason)
|
||||
{
|
||||
Pawn_GeneTracker genes = this.parent.pawn.genes;
|
||||
|
|
Loading…
Reference in a new issue