暂存烧脑

This commit is contained in:
2025-09-16 11:51:29 +08:00
parent 35ed2c01d5
commit 040bb17f94
7 changed files with 156 additions and 2 deletions

Binary file not shown.

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<AbilityDef>
<defName>ARA_PsychicBrainburn</defName>
<label>心灵烧灼</label>
<description>通过一次强力的心灵冲击,直接摧毁目标生物的意识核心,使其永久失去知觉。</description>
<iconPath>UI/Abilities/Slaughter</iconPath>
<cooldownTicksRange>5000</cooldownTicksRange>
<aiCanUse>false</aiCanUse>
<displayOrder>300</displayOrder>
<displayGizmoWhileUndrafted>true</displayGizmoWhileUndrafted>
<disableGizmoWhileUndrafted>false</disableGizmoWhileUndrafted>
<showPsycastEffects>false</showPsycastEffects>
<sendMessageOnCooldownComplete>true</sendMessageOnCooldownComplete>
<stunTargetWhileCasting>true</stunTargetWhileCasting>
<moteOffsetAmountTowardsTarget>0.5</moteOffsetAmountTowardsTarget>
<warmupMote>Mote_HoraxSmallSpellWarmup</warmupMote>
<warmupEffecter>HoraxianAbilityCasting</warmupEffecter>
<warmupSound>AnomalyAbilityWarmup</warmupSound>
<writeCombatLog>true</writeCombatLog>
<verbProperties>
<verbClass>Verb_CastAbility</verbClass>
<warmupTime>1.5</warmupTime>
<range>25</range>
<targetParams>
<canTargetPawns>true</canTargetPawns>
<canTargetBuildings>false</canTargetBuildings>
<canTargetSelf>false</canTargetSelf>
</targetParams>
</verbProperties>
<comps>
<li Class="ArachnaeSwarm.CompProperties_PsychicBrainburn">
<!-- 视觉效果 -->
<effecterDef>Skip_Entry</effecterDef>
<!-- 设为 true 则只能对血肉生物使用。设为 false 则也可以对机械体使用。 -->
<requiresFlesh>false</requiresFlesh>
</li>
</comps>
</AbilityDef>
</Defs>

View File

@@ -182,6 +182,11 @@
<MoveSpeed>0.25</MoveSpeed>
</equippedStatOffsets>
<costStuffCount>0</costStuffCount>
<comps>
<li Class="CompProperties_CauseHediff_Apparel">
<hediff>ARA_TerrainBasedHediff</hediff>
</li>
</comps>
</ThingDef>
<ApparelLayerDef>

View File

@@ -174,7 +174,7 @@
<comps>
<li Class="CompProperties_Glower">
<glowRadius>6</glowRadius>
<color>(0.9, 0.9 ,0.5, 0)</color>
<glowColor>(230, 230, 128, 0)</glowColor>
</li>
<li Class="ArachnaeSwarm.CompProperties_SpawnPawnFromList">
<spawnablePawns>
@@ -288,7 +288,7 @@
<comps>
<li Class="CompProperties_Glower">
<glowRadius>6</glowRadius>
<color>(0.9, 0.9 ,0.5, 0)</color>
<glowColor>(230, 230, 128, 0)</glowColor>
</li>
<li Class="ArachnaeSwarm.CompProperties_SpawnPawnFromList">
<spawnablePawns>

View File

@@ -205,6 +205,12 @@
<Compile Include="Morphable\CompAbilityEffect_Transform.cs" />
<Compile Include="Morphable\Building_Morphable.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="HediffCompProperties_TerrainBasedSeverity.cs" />
<Compile Include="HediffComp_TerrainBasedSeverity.cs" />
<Compile Include="CompAbilityEffect_PsychicBrainburn.cs" />
<Compile Include="CompProperties_PsychicBrainburn.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 自定义清理任务删除obj文件夹中的临时文件 -->
<Target Name="CleanDebugFiles" AfterTargets="Build">

View File

@@ -0,0 +1,80 @@
using Verse;
using RimWorld;
using System.Linq;
namespace ArachnaeSwarm
{
public class CompAbilityEffect_PsychicBrainburn : CompAbilityEffect
{
public new CompProperties_PsychicBrainburn Props => (CompProperties_PsychicBrainburn)props;
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
{
base.Apply(target, dest);
Pawn pawn = target.Pawn;
if (pawn == null)
{
return;
}
// 查找作为意识来源的身体部位
BodyPartRecord brain = pawn.health.hediffSet.GetNotMissingParts()
.FirstOrDefault(p => p.def.tags.Contains(BodyPartTagDefOf.ConsciousnessSource));
if (brain != null)
{
// 施加巨大伤害以摧毁大脑
float damageAmount = 99999f;
float penetration = 999f;
pawn.TakeDamage(new DamageInfo(DamageDefOf.Burn, damageAmount, penetration, -1f, parent.pawn, brain));
// 如果在XML中定义了效果则生成它
if (Props.effecterDef != null)
{
Props.effecterDef.Spawn(pawn.Position, pawn.Map, 1f);
}
}
}
public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
{
Pawn pawn = target.Pawn;
if (pawn == null)
{
return false;
}
// 检查目标是否是血肉生物如果XML中设置为需要
if (Props.requiresFlesh && !pawn.RaceProps.IsFlesh)
{
if (throwMessages)
{
Messages.Message("MessageCannotUseOnMechanical".Translate(pawn.Named("PAWN")), pawn, MessageTypeDefOf.RejectInput);
}
return false;
}
// 检查目标是否有意识来源部位
BodyPartRecord brain = pawn.health.hediffSet.GetNotMissingParts()
.FirstOrDefault(p => p.def.tags.Contains(BodyPartTagDefOf.ConsciousnessSource));
if (brain == null)
{
if (throwMessages)
{
Messages.Message("MessageTargetHasNoBrain".Translate(pawn.Named("PAWN")), pawn, MessageTypeDefOf.RejectInput);
}
return false;
}
return base.Valid(target, throwMessages);
}
public override bool AICanTargetNow(LocalTargetInfo target)
{
// AI不应主动使用此技能
return false;
}
}
}

View File

@@ -0,0 +1,20 @@
using Verse;
using RimWorld;
namespace ArachnaeSwarm
{
public class CompProperties_PsychicBrainburn : CompProperties_AbilityEffect
{
// 如果为true则技能只能对血肉生物使用。
// 如果为false则可以对机械体等非血肉生物使用。
public bool requiresFlesh = true;
// 在目标身上产生的视觉效果。
public EffecterDef effecterDef;
public CompProperties_PsychicBrainburn()
{
compClass = typeof(CompAbilityEffect_PsychicBrainburn);
}
}
}