mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Start of Cocoon Gene, minor fixes to cockeater
This commit is contained in:
		
							parent
							
								
									88f588631c
								
							
						
					
					
						commit
						fead22f28c
					
				
					 12 changed files with 253 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -0,0 +1,81 @@
 | 
			
		|||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	/// <summary>
 | 
			
		||||
	/// The CocoonWeaver Ability applies the RJW-Cocoon to a pawn.
 | 
			
		||||
	/// Friendly Pawns can always be cocooned, neutral and hostile pawns must be downed. 
 | 
			
		||||
	/// </summary>
 | 
			
		||||
	public class CompAbilityEffect_CocoonWeaver : CompAbilityEffect
 | 
			
		||||
	{
 | 
			
		||||
		private new CompProperties_AbilityCocoonWeaver Props
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return (CompProperties_AbilityCocoonWeaver)this.props;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
 | 
			
		||||
		{
 | 
			
		||||
			base.Apply(target, dest);
 | 
			
		||||
 | 
			
		||||
			Pawn CocooningPawn = this.parent.pawn;
 | 
			
		||||
			Pawn PawnToCocoon = target.Pawn;
 | 
			
		||||
			
 | 
			
		||||
			// Error Case - Null Pawn
 | 
			
		||||
			if (PawnToCocoon == null)
 | 
			
		||||
			{
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			PawnToCocoon.health.AddHediff(HediffDef.Named("RJW_Cocoon"));
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/// <summary>
 | 
			
		||||
		/// For validity, there are a few checks:
 | 
			
		||||
		/// 0. Target is not already cocooned 
 | 
			
		||||
		/// 1. Target is either Colonist / Prisoner 
 | 
			
		||||
		/// 2. If the Target is an enemy or neutral, it must be downed. 
 | 
			
		||||
		/// </summary>
 | 
			
		||||
		public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
 | 
			
		||||
		{
 | 
			
		||||
			Pawn cocoonTarget = target.Pawn;
 | 
			
		||||
			if (cocoonTarget != null)
 | 
			
		||||
			{
 | 
			
		||||
				bool CocoonTargetIsColonistOrPrisoner = cocoonTarget.Faction == this.parent.pawn.Faction || cocoonTarget.IsPrisonerOfColony;
 | 
			
		||||
				bool CocoonTargetIsHostile = cocoonTarget.HostileTo(this.parent.pawn);
 | 
			
		||||
				bool CocoonTargetIsDowned = cocoonTarget.Downed;
 | 
			
		||||
 | 
			
		||||
				if (cocoonTarget.health.hediffSet.hediffs.Any(t => t.def.defName == "RJW_Cocoon"))
 | 
			
		||||
				{
 | 
			
		||||
					if (throwMessages)
 | 
			
		||||
						Messages.Message(cocoonTarget.Name + " is already cocooned.", cocoonTarget, MessageTypeDefOf.RejectInput, false);
 | 
			
		||||
					return false;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
				if (!CocoonTargetIsColonistOrPrisoner && !(CocoonTargetIsHostile && CocoonTargetIsDowned))
 | 
			
		||||
				{
 | 
			
		||||
					if (throwMessages)
 | 
			
		||||
					{
 | 
			
		||||
						if(CocoonTargetIsHostile && !CocoonTargetIsDowned)
 | 
			
		||||
                        {
 | 
			
		||||
							Messages.Message(cocoonTarget.Name + " is hostile, but not downed.", cocoonTarget, MessageTypeDefOf.RejectInput, false);
 | 
			
		||||
						}
 | 
			
		||||
						else if (!CocoonTargetIsColonistOrPrisoner)
 | 
			
		||||
						{
 | 
			
		||||
							Messages.Message(cocoonTarget.Name + " is not a part of the colony or hostile.", cocoonTarget, MessageTypeDefOf.RejectInput, false);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			return base.Valid(target, throwMessages);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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_AbilityCocoonWeaver : CompProperties_AbilityEffect
 | 
			
		||||
	{
 | 
			
		||||
		public CompProperties_AbilityCocoonWeaver()
 | 
			
		||||
		{
 | 
			
		||||
			this.compClass = typeof(CompAbilityEffect_CocoonWeaver);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -51,9 +51,9 @@ namespace RJW_Genes
 | 
			
		|||
                        }
 | 
			
		||||
						// Increase LifeForce for Biter
 | 
			
		||||
						GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(CockBiter), gained_lifeforce);
 | 
			
		||||
 | 
			
		||||
						// Handle Damage for Bitten 
 | 
			
		||||
						CockBittenPawn.health.RemoveHediff(part);
 | 
			
		||||
						CockBittenPawn.TakeDamage(new DamageInfo(DamageDefOf.Bite, 99999f, 999f, hitPart: Genital_Helper.get_genitalsBPR(CockBittenPawn)));
 | 
			
		||||
						//CockBittenPawn.health.RemoveHediff(part);
 | 
			
		||||
						CockBittenPawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.rjw_genes_cock_eaten, CockBittenPawn, null);
 | 
			
		||||
 | 
			
		||||
						//Only one penis at the time
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -87,6 +87,8 @@
 | 
			
		|||
    <Compile Include="Genes\Genitalia\Gene_DemonicGenitalia.cs" />
 | 
			
		||||
    <Compile Include="Genes\Genitalia\Gene_EquineGenitalia.cs" />
 | 
			
		||||
    <Compile Include="Genes\Genitalia\GenitaliaChanger.cs" />
 | 
			
		||||
    <Compile Include="Genes\Hive\Abilities\CompAbilityEffect_CocoonWeaver.cs" />
 | 
			
		||||
    <Compile Include="Genes\Hive\Abilities\CompProperties_AbilityCocoonWeaver.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\AbilityUtility.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\UI\Alert_LowFertilin.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_CasterIsNaked.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue