mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	CockEater gene
CockEater gene with ability and negative thoughtdef for target
This commit is contained in:
		
							parent
							
								
									3cf2d44c82
								
							
						
					
					
						commit
						a64cecbab3
					
				
					 9 changed files with 206 additions and 3 deletions
				
			
		
							
								
								
									
										87
									
								
								Source/Genes/Life_Force/CompAbilityEffect_CockEater.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								Source/Genes/Life_Force/CompAbilityEffect_CockEater.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,87 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
using rjw.Modules.Interactions.Helpers;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	public class CompAbilityEffect_CockEater : CompAbilityEffect
 | 
			
		||||
	{
 | 
			
		||||
		private new CompProperties_AbilityCockEater Props
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return (CompProperties_AbilityCockEater)this.props;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
 | 
			
		||||
		{
 | 
			
		||||
			base.Apply(target, dest);
 | 
			
		||||
			Pawn pawn = target.Pawn;
 | 
			
		||||
			if (pawn == null)
 | 
			
		||||
			{
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
			var partBPR = Genital_Helper.get_genitalsBPR(pawn);
 | 
			
		||||
			var parts = Genital_Helper.get_PartsHediffList(pawn, partBPR);
 | 
			
		||||
			if (!parts.NullOrEmpty())
 | 
			
		||||
			{
 | 
			
		||||
				foreach (Hediff part in parts)
 | 
			
		||||
				{
 | 
			
		||||
					if (GenitaliaChanger.IsArtificial(part))
 | 
			
		||||
						continue;
 | 
			
		||||
 | 
			
		||||
					if (rjw.Genital_Helper.is_penis(part))
 | 
			
		||||
					{
 | 
			
		||||
						GeneUtility.OffsetLifeForce(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
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
 | 
			
		||||
		{
 | 
			
		||||
			Pawn pawn = target.Pawn;
 | 
			
		||||
			if (pawn != 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))
 | 
			
		||||
				{
 | 
			
		||||
					if (throwMessages)
 | 
			
		||||
					{
 | 
			
		||||
						if(flag2 && !flag3)
 | 
			
		||||
                        {
 | 
			
		||||
							Messages.Message(pawn.Name + " is hostile, but not downed.", pawn, MessageTypeDefOf.RejectInput, false);
 | 
			
		||||
						}
 | 
			
		||||
						else if (!flag)
 | 
			
		||||
						{
 | 
			
		||||
							Messages.Message(pawn.Name + " is not a part of the colony or hostile.", pawn, MessageTypeDefOf.RejectInput, false);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
				if (!Genital_Helper.has_penis_fertile(pawn))
 | 
			
		||||
				{
 | 
			
		||||
					if (throwMessages)
 | 
			
		||||
					{
 | 
			
		||||
						Messages.Message(pawn.Name + " has no penis", pawn, MessageTypeDefOf.RejectInput, false);
 | 
			
		||||
					}
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			return base.Valid(target, throwMessages);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -38,6 +38,7 @@ namespace RJW_Genes
 | 
			
		|||
			//FleckMaker.AttachedOverlay(pawn, FleckDefOf.FlashHollow, Vector3.zero, 1.5f, -1f);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Not yet implemented, but the heal should also trigger after normal sex
 | 
			
		||||
		public void AfterSex(Pawn pawn, Pawn target)
 | 
			
		||||
		{
 | 
			
		||||
			List<Hediff> hediffs = target.health.hediffSet.hediffs;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										18
									
								
								Source/Genes/Life_Force/CompProperties_AbilityCockEater.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Source/Genes/Life_Force/CompProperties_AbilityCockEater.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	public class CompProperties_AbilityCockEater : CompProperties_AbilityEffect
 | 
			
		||||
	{
 | 
			
		||||
		public CompProperties_AbilityCockEater()
 | 
			
		||||
		{
 | 
			
		||||
			this.compClass = typeof(CompAbilityEffect_CockEater);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue