暂存拟线虫药物

This commit is contained in:
2025-09-10 19:08:42 +08:00
parent d31f5c616a
commit f531d0a136
5 changed files with 233 additions and 2 deletions

Binary file not shown.

View File

@@ -90,11 +90,18 @@
<showRemainingTime>true</showRemainingTime>
</li>
<li Class="ArachnaeSwarm.HediffCompProperties_NecroticTransformation">
<!-- 3. 在这里指定你希望转化成的MutantDef的defName -->
<!-- 例如: Shambler, Ghoul, 或者您自己定义的其他变异体 -->
<mutantDef>ARA_MimicNematodeShambler</mutantDef>
<triggerSeverity>0.7</triggerSeverity>
</li>
<!-- ==================== 新增的共生组件 ==================== -->
<li Class="ArachnaeSwarm.HediffCompProperties_Symbiosis">
<!-- "钥匙": 只有当Pawn拥有这个Hediff时共生效果才会激活 -->
<requiredHediff>ARA_SymbioticStabilizer</requiredHediff>
<!-- "新的上限": 在共生状态下此Hediff的严重性最高只能达到0.8 -->
<newMaxSeverity>0.8</newMaxSeverity>
</li>
<li Class="HediffCompProperties_DisappearsOnDeath" />
</comps>

View File

@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<!-- ==================== 1. 物品定义:阿拉克涅信息素溶剂 ==================== -->
<ThingDef ParentName="MakeableDrugPillBase">
<defName>ARA_PheromoneSolvent</defName>
<label>阿拉克涅信息素溶剂</label>
<description>一种合成的化学制剂,能够模拟阿拉克涅虫群内部用于区分敌我的信息素。定期注射可以欺骗宿主体内的寄生虫,使其进入休眠的共生状态,从而抑制其致命的增殖行为。</description>
<descriptionHyperlinks>
<HediffDef>ARA_SymbioticStabilizer</HediffDef>
<HediffDef>ARA_MimicNematode</HediffDef>
</descriptionHyperlinks>
<graphicData>
<texPath>Things/Item/Drug/WakeUp</texPath> <!-- 暂时使用WakeUp的贴图可后续替换 -->
<graphicClass>Graphic_StackCount</graphicClass>
<color>(1.0, 0.647, 0.0, 0.5)</color> <!-- 橙色 -->
</graphicData>
<rotatable>false</rotatable>
<statBases>
<WorkToMake>1000</WorkToMake>
<MarketValue>50</MarketValue>
<Mass>0.01</Mass>
</statBases>
<techLevel>Industrial</techLevel>
<ingestible>
<drugCategory>Medical</drugCategory> <!-- 定义为医疗品,而非娱乐品 -->
<outcomeDoers>
<li Class="IngestionOutcomeDoer_GiveHediff">
<hediffDef>ARA_SymbioticStabilizer</hediffDef>
<severity>1.0</severity> <!-- 每次服用直接将效果补满 -->
</li>
</outcomeDoers>
</ingestible>
<recipeMaker>
<researchPrerequisite>MedicineProduction</researchPrerequisite> <!-- 假设需要基础制药解锁 -->
<recipeUsers>
<li>DrugLab</li>
</recipeUsers>
</recipeMaker>
<costList>
<Neutroamine>2</Neutroamine>
<ARA_InsectJelly>5</ARA_InsectJelly> <!-- 使用虫胶作为特色材料 -->
</costList>
<comps>
<li Class="CompProperties_Drug">
<chemical>ARA_Pheromone</chemical>
<addictiveness>0.05</addictiveness>
<needLevelOffset>1</needLevelOffset>
<listOrder>1000</listOrder>
</li>
</comps>
</ThingDef>
<!-- ==================== 2. Hediff定义共生稳定器效果 ==================== -->
<HediffDef>
<defName>ARA_SymbioticStabilizer</defName>
<label>信息素抑制</label>
<labelNoun>一种信息素抑制效果</labelNoun>
<description>阿拉克涅信息素溶剂的效果正在生效,它模拟了虫群的共生信号,抑制了体内寄生体的活性。</description>
<hediffClass>HediffWithComps</hediffClass>
<defaultLabelColor>(0.7, 1.0, 0.7)</defaultLabelColor>
<isBad>false</isBad>
<comps>
<li Class="HediffCompProperties_SeverityPerDay">
<severityPerDay>-0.34</severityPerDay> <!-- 严重性每天降低0.34大约3天从1.0掉到0 -->
<showHoursToRecover>true</showHoursToRecover>
</li>
</comps>
</HediffDef>
<!-- ==================== 3. 物品定义:阿拉克涅拟线种虫卵 ==================== -->
<ThingDef ParentName="MakeableDrugPillBase">
<defName>ARA_NematodeEgg</defName>
<label>阿拉克涅拟线种虫卵</label>
<description>一个经过特殊处理的阿拉克涅拟线种虫卵,可以被直接服用。服用后,虫卵会迅速在宿主体内孵化并释放大量阿拉克涅拟线虫,导致极其严重的感染。</description>
<descriptionHyperlinks>
<HediffDef>ARA_MimicNematode</HediffDef>
</descriptionHyperlinks>
<graphicData>
<texPath>Things/Item/Drug/Luciferium</texPath>
<graphicClass>Graphic_StackCount</graphicClass>
<color>(100,50,100)</color> <!-- 深紫色 -->
</graphicData>
<statBases>
<MarketValue>75</MarketValue>
<Mass>0.05</Mass>
</statBases>
<techLevel>Industrial</techLevel>
<ingestible>
<drugCategory>None</drugCategory> <!-- 修正:这不是药物,不应被药物政策管理 -->
<foodType>AnimalProduct</foodType>
<outcomeDoers>
<li Class="IngestionOutcomeDoer_GiveHediff">
<hediffDef>ARA_MimicNematode</hediffDef>
<severity>0.5</severity> <!-- 直接给予0.7的严重性 -->
</li>
</outcomeDoers>
</ingestible>
<recipeMaker IsNull="True" /> <!-- 明确声明此物品不可制造,以覆盖父类的设置 -->
</ThingDef>
<!-- ==================== 3. 阿拉克涅信息素成瘾机制 ==================== -->
<ChemicalDef>
<defName>ARA_Pheromone</defName>
<label>阿拉克涅信息素</label>
<addictionHediff>ARA_PheromoneAddiction</addictionHediff>
</ChemicalDef>
<NeedDef ParentName="DrugAddictionNeedBase">
<defName>Chemical_ARA_Pheromone</defName>
<needClass>Need_Chemical</needClass>
<label>信息素依赖</label>
<description>由于长期使用阿拉克涅信息素溶剂,此人的身体已经习惯了这种外部信息素的存在。如果中断使用,体内的拟线虫将因为失去抑制而猛烈反扑。</description>
<fallPerDay>0.333</fallPerDay>
<listPriority>50</listPriority>
</NeedDef>
<HediffDef ParentName="AddictionBase">
<defName>ARA_PheromoneAddiction</defName>
<label>信息素依赖</label>
<description>对阿拉克涅信息素溶剂产生了化学依赖。需要定期使用来维持体内的拟线虫生态平衡,否则会产生严重的戒断反应。</description>
<hediffClass>Hediff_Addiction</hediffClass>
<chemicalNeed>Chemical_ARA_Pheromone</chemicalNeed>
<stages>
<li>
<!-- 需求满足时,无效果 -->
</li>
<li>
<label>戒断反应</label>
<capMods>
<li>
<capacity>Consciousness</capacity>
<offset>-0.1</offset>
</li>
</capMods>
<hediffGivers>
<!-- 核心戒断效果:给予一次严重的寄生感染 -->
<li Class="ArachnaeSwarm.HediffGiver_RandomWithSeverity">
<hediff>ARA_MimicNematode</hediff>
<mtbDays>1</mtbDays>
<severityRange>0.1~0.2</severityRange> <!-- 使用我们新的严重性范围标签 -->
</li>
</hediffGivers>
</li>
</stages>
</HediffDef>
<ThoughtDef>
<defName>ARA_PheromoneWithdrawal</defName>
<workerClass>ThoughtWorker_Hediff</workerClass>
<hediff>ARA_PheromoneAddiction</hediff>
<validWhileDespawned>true</validWhileDespawned>
<stages>
<li>
<visible>false</visible>
</li>
<li>
<label>信息素戒断</label>
<description>我感觉很糟糕,体内的某些东西正在变得活跃......我需要信息素溶剂。</description>
<baseMoodEffect>-15</baseMoodEffect>
</li>
</stages>
</ThoughtDef>
</Defs>

View File

@@ -191,6 +191,7 @@
<Compile Include="ProphecyGearEffect.cs" />
<Compile Include="Hediff_ConfigurableMutant.cs" />
<Compile Include="HediffComp_Symbiosis.cs" />
<Compile Include="HediffGiver_RandomWithSeverity.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 自定义清理任务删除obj文件夹中的临时文件 -->

View File

@@ -0,0 +1,54 @@
using Verse;
namespace ArachnaeSwarm
{
/// <summary>
/// A custom HediffGiver that is similar to HediffGiver_Random,
/// but allows specifying a random severity range for the given hediff.
/// </summary>
public class HediffGiver_RandomWithSeverity : HediffGiver
{
// XML configurable fields
public float mtbDays;
public FloatRange severityRange = new FloatRange(0.01f, 1f);
public override void OnIntervalPassed(Pawn pawn, Hediff cause)
{
// Calculate the chance based on Mean Time Between (MTB) days and pawn-specific factors
float mtb = this.mtbDays;
float chanceFactor = ChanceFactor(pawn);
if (chanceFactor != 0f && Rand.MTBEventOccurs(mtb / chanceFactor, 60000f, 60f))
{
// Try to apply the hediff with our custom logic
if (TryApplyWithCustomSeverity(pawn))
{
// If successful, send a letter to the player
SendLetter(pawn, cause);
}
}
}
/// <summary>
/// Applies the hediff and then sets its severity to a random value within the specified range.
/// </summary>
/// <param name="pawn">The pawn to apply the hediff to.</param>
/// <returns>True if the hediff was successfully applied, false otherwise.</returns>
private bool TryApplyWithCustomSeverity(Pawn pawn)
{
// First, apply the hediff using the base class logic.
// This will add the hediff with its default initial severity.
if (base.TryApply(pawn))
{
// If the hediff was successfully added, find it.
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(this.hediff);
if (hediff != null)
{
// Set its severity to a random value from our configured range.
hediff.Severity = this.severityRange.RandomInRange;
return true;
}
}
return false;
}
}
}