我去
This commit is contained in:
Binary file not shown.
@@ -3,12 +3,20 @@
|
||||
"WorkspaceRootPath": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|e:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\building_comps\\ara_compinteractiveproducer\\compinteractiveproducer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:building_comps\\ara_compinteractiveproducer\\compinteractiveproducer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|e:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\thingcomp_guardianpsyfield.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:thingcomp_guardianpsyfield.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|e:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\building_comps\\wula_mutifuelspawner\\comprefuelablenutrition_withkey.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:building_comps\\wula_mutifuelspawner\\comprefuelablenutrition_withkey.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\building_comps\\ara_nutrientvat\\building_nutrientvat.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:building_comps\\ara_nutrientvat\\building_nutrientvat.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\building_comps\\ara_nutrientnetwork\\compnutrientprovider.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:building_comps\\ara_nutrientnetwork\\compnutrientprovider.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\building_comps\\ara_nutrientnetwork\\complinedrawer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:building_comps\\ara_nutrientnetwork\\complinedrawer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
@@ -27,28 +35,51 @@
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "CompInteractiveProducer.cs",
|
||||
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\ARA_CompInteractiveProducer\\CompInteractiveProducer.cs",
|
||||
"RelativeDocumentMoniker": "Building_Comps\\ARA_CompInteractiveProducer\\CompInteractiveProducer.cs",
|
||||
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\ARA_CompInteractiveProducer\\CompInteractiveProducer.cs",
|
||||
"RelativeToolTip": "Building_Comps\\ARA_CompInteractiveProducer\\CompInteractiveProducer.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAB4AAAA0AAAAAAAAAA==",
|
||||
"Title": "ThingComp_GuardianPsyField.cs",
|
||||
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ThingComp_GuardianPsyField.cs",
|
||||
"RelativeDocumentMoniker": "ThingComp_GuardianPsyField.cs",
|
||||
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ThingComp_GuardianPsyField.cs",
|
||||
"RelativeToolTip": "ThingComp_GuardianPsyField.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAoAAAAgAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-10-02T10:43:34.234Z",
|
||||
"WhenOpened": "2025-10-02T16:24:06.176Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "CompRefuelableNutrition_WithKey.cs",
|
||||
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\WULA_MutiFuelSpawner\\CompRefuelableNutrition_WithKey.cs",
|
||||
"RelativeDocumentMoniker": "Building_Comps\\WULA_MutiFuelSpawner\\CompRefuelableNutrition_WithKey.cs",
|
||||
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\WULA_MutiFuelSpawner\\CompRefuelableNutrition_WithKey.cs",
|
||||
"RelativeToolTip": "Building_Comps\\WULA_MutiFuelSpawner\\CompRefuelableNutrition_WithKey.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAFsAAAAcAAAAAAAAAA==",
|
||||
"Title": "Building_NutrientVat.cs",
|
||||
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\ARA_NutrientVat\\Building_NutrientVat.cs",
|
||||
"RelativeDocumentMoniker": "Building_Comps\\ARA_NutrientVat\\Building_NutrientVat.cs",
|
||||
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\ARA_NutrientVat\\Building_NutrientVat.cs",
|
||||
"RelativeToolTip": "Building_Comps\\ARA_NutrientVat\\Building_NutrientVat.cs",
|
||||
"ViewState": "AgIAAF8AAAAAAAAAAAAswJkBAAANAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-10-02T06:18:10.518Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2025-10-02T15:30:05.897Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "CompNutrientProvider.cs",
|
||||
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\ARA_NutrientNetwork\\CompNutrientProvider.cs",
|
||||
"RelativeDocumentMoniker": "Building_Comps\\ARA_NutrientNetwork\\CompNutrientProvider.cs",
|
||||
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\ARA_NutrientNetwork\\CompNutrientProvider.cs",
|
||||
"RelativeToolTip": "Building_Comps\\ARA_NutrientNetwork\\CompNutrientProvider.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAABkAAAAZAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-10-02T15:29:28.358Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "CompLineDrawer.cs",
|
||||
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\ARA_NutrientNetwork\\CompLineDrawer.cs",
|
||||
"RelativeDocumentMoniker": "Building_Comps\\ARA_NutrientNetwork\\CompLineDrawer.cs",
|
||||
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\ARA_NutrientNetwork\\CompLineDrawer.cs",
|
||||
"RelativeToolTip": "Building_Comps\\ARA_NutrientNetwork\\CompLineDrawer.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAABkAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-10-02T15:11:03.083Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace ArachnaeSwarm
|
||||
{
|
||||
if (ruinedPercent > 0f)
|
||||
{
|
||||
return "RuinedByTemperature".Translate() + ": " + ruinedPercent.ToStringPercent();
|
||||
return "CocoonRuinedByTemperature".Translate() + ": " + ruinedPercent.ToStringPercent();
|
||||
}
|
||||
return base.CompInspectStringExtra();
|
||||
}
|
||||
|
||||
@@ -61,7 +61,8 @@ namespace ArachnaeSwarm
|
||||
var potentialTargets = parent.Map.listerBuildings.allBuildingsColonist.Where(b =>
|
||||
b != parent &&
|
||||
Props.linkableBuildings.Contains(b.def) &&
|
||||
parent.Position.DistanceTo(b.Position) <= Props.maxDistance
|
||||
parent.Position.DistanceTo(b.Position) <= Props.maxDistance &&
|
||||
HasLineOfSight(parent, b) // 新增:检查视线
|
||||
);
|
||||
|
||||
linkedBuildings.AddRange(potentialTargets);
|
||||
@@ -72,6 +73,88 @@ namespace ArachnaeSwarm
|
||||
}
|
||||
}
|
||||
|
||||
// 修复后的方法:检查两点之间是否有墙体遮挡
|
||||
private bool HasLineOfSight(Thing from, Thing to)
|
||||
{
|
||||
IntVec3 fromPos = from.Position;
|
||||
IntVec3 toPos = to.Position;
|
||||
|
||||
// 如果两个建筑在同一位置,直接返回true
|
||||
if (fromPos == toPos) return true;
|
||||
|
||||
// 使用更兼容的视线检查方法
|
||||
if (!GenSight.LineOfSight(fromPos, toPos, parent.Map))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 额外检查:确保路径上没有阻挡视线的建筑
|
||||
foreach (IntVec3 cell in GetLineCells(fromPos, toPos))
|
||||
{
|
||||
// 跳过起点和终点
|
||||
if (cell == fromPos || cell == toPos) continue;
|
||||
|
||||
// 检查该单元格是否有阻挡视线的建筑
|
||||
List<Thing> things = parent.Map.thingGrid.ThingsListAt(cell);
|
||||
foreach (Thing thing in things)
|
||||
{
|
||||
// 如果是建筑且阻挡视线
|
||||
if (thing.def.passability == Traversability.Impassable &&
|
||||
thing.def.category == ThingCategory.Building &&
|
||||
!IsPassableBuilding(thing.def)) // 排除可通行的建筑类型
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 获取两点之间的直线上的所有单元格
|
||||
private IEnumerable<IntVec3> GetLineCells(IntVec3 start, IntVec3 end)
|
||||
{
|
||||
// 使用简单的Bresenham直线算法
|
||||
int x0 = start.x;
|
||||
int y0 = start.z;
|
||||
int x1 = end.x;
|
||||
int y1 = end.z;
|
||||
|
||||
int dx = Mathf.Abs(x1 - x0);
|
||||
int dy = Mathf.Abs(y1 - y0);
|
||||
int sx = x0 < x1 ? 1 : -1;
|
||||
int sy = y0 < y1 ? 1 : -1;
|
||||
int err = dx - dy;
|
||||
|
||||
while (true)
|
||||
{
|
||||
yield return new IntVec3(x0, 0, y0);
|
||||
|
||||
if (x0 == x1 && y0 == y1) break;
|
||||
|
||||
int e2 = 2 * err;
|
||||
if (e2 > -dy)
|
||||
{
|
||||
err -= dy;
|
||||
x0 += sx;
|
||||
}
|
||||
if (e2 < dx)
|
||||
{
|
||||
err += dx;
|
||||
y0 += sy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检查建筑类型是否允许管线通过
|
||||
private bool IsPassableBuilding(ThingDef def)
|
||||
{
|
||||
// 门、栅栏门等可通行的建筑不算阻挡
|
||||
return def.IsDoor ||
|
||||
def.passability == Traversability.PassThroughOnly ||
|
||||
def.passability == Traversability.Standable;
|
||||
}
|
||||
|
||||
public override void PostPrintOnto(SectionLayer layer)
|
||||
{
|
||||
base.PostPrintOnto(layer);
|
||||
@@ -86,4 +169,4 @@ namespace ArachnaeSwarm
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
public class CompProperties_NutrientProvider : CompProperties_Facility
|
||||
{
|
||||
public float maxEfficiency = 0.9f;
|
||||
|
||||
public CompProperties_NutrientProvider()
|
||||
{
|
||||
compClass = typeof(CompNutrientProvider);
|
||||
|
||||
@@ -24,6 +24,20 @@ namespace ArachnaeSwarm
|
||||
[StaticConstructorOnStartup]
|
||||
public class HediffComp_TopTurret : HediffComp, IAttackTargetSearcher
|
||||
{
|
||||
// 添加 null 检查的属性
|
||||
private HediffCompProperties_TopTurret Props
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.props == null)
|
||||
{
|
||||
Log.Error("HediffComp_TopTurret: props is null");
|
||||
return null;
|
||||
}
|
||||
return this.props as HediffCompProperties_TopTurret;
|
||||
}
|
||||
}
|
||||
|
||||
public Thing Thing
|
||||
{
|
||||
get
|
||||
@@ -32,14 +46,6 @@ namespace ArachnaeSwarm
|
||||
}
|
||||
}
|
||||
|
||||
private HediffCompProperties_TopTurret Props
|
||||
{
|
||||
get
|
||||
{
|
||||
return (HediffCompProperties_TopTurret)this.props;
|
||||
}
|
||||
}
|
||||
|
||||
public Verb CurrentEffectiveVerb
|
||||
{
|
||||
get
|
||||
@@ -68,6 +74,11 @@ namespace ArachnaeSwarm
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.gun == null)
|
||||
{
|
||||
Log.Warning("HediffComp_TopTurret: gun is null");
|
||||
return null;
|
||||
}
|
||||
return this.gun.TryGetComp<CompEquippable>();
|
||||
}
|
||||
}
|
||||
@@ -76,7 +87,13 @@ namespace ArachnaeSwarm
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GunCompEq.PrimaryVerb;
|
||||
var comp = this.GunCompEq;
|
||||
if (comp == null)
|
||||
{
|
||||
Log.Warning("HediffComp_TopTurret: GunCompEq is null");
|
||||
return null;
|
||||
}
|
||||
return comp.PrimaryVerb;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +147,7 @@ namespace ArachnaeSwarm
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.turretMat == null)
|
||||
if (this.turretMat == null && this.Props?.turretDef?.graphicData != null)
|
||||
{
|
||||
this.turretMat = MaterialPool.MatFrom(this.Props.turretDef.graphicData.texPath);
|
||||
}
|
||||
@@ -142,25 +159,71 @@ namespace ArachnaeSwarm
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Props.autoAttack;
|
||||
return this.Props?.autoAttack ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void CompPostMake()
|
||||
{
|
||||
base.CompPostMake();
|
||||
|
||||
// 添加 null 检查
|
||||
if (this.Props == null)
|
||||
{
|
||||
Log.Error("HediffComp_TopTurret: Props is null in CompPostMake");
|
||||
return;
|
||||
}
|
||||
|
||||
this.MakeGun();
|
||||
}
|
||||
|
||||
private void MakeGun()
|
||||
{
|
||||
this.gun = ThingMaker.MakeThing(this.Props.turretDef, null);
|
||||
this.UpdateGunVerbs();
|
||||
// 添加详细的 null 检查
|
||||
if (this.Props == null)
|
||||
{
|
||||
Log.Error("HediffComp_TopTurret: Props is null in MakeGun");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.Props.turretDef == null)
|
||||
{
|
||||
Log.Error("HediffComp_TopTurret: Props.turretDef is null");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.gun = ThingMaker.MakeThing(this.Props.turretDef, null);
|
||||
if (this.gun == null)
|
||||
{
|
||||
Log.Error($"HediffComp_TopTurret: Failed to create gun from turretDef '{this.Props.turretDef.defName}'");
|
||||
return;
|
||||
}
|
||||
this.UpdateGunVerbs();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"HediffComp_TopTurret: Exception in MakeGun: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateGunVerbs()
|
||||
{
|
||||
List<Verb> allVerbs = this.gun.TryGetComp<CompEquippable>().AllVerbs;
|
||||
if (this.gun == null)
|
||||
{
|
||||
Log.Warning("HediffComp_TopTurret: gun is null in UpdateGunVerbs");
|
||||
return;
|
||||
}
|
||||
|
||||
var comp = this.gun.TryGetComp<CompEquippable>();
|
||||
if (comp == null)
|
||||
{
|
||||
Log.Warning("HediffComp_TopTurret: CompEquippable is null");
|
||||
return;
|
||||
}
|
||||
|
||||
List<Verb> allVerbs = comp.AllVerbs;
|
||||
for (int i = 0; i < allVerbs.Count; i++)
|
||||
{
|
||||
Verb verb = allVerbs[i];
|
||||
@@ -171,9 +234,17 @@ namespace ArachnaeSwarm
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override void CompPostTick(ref float severityAdjustment)
|
||||
{
|
||||
base.CompPostTick(ref severityAdjustment);
|
||||
|
||||
// 添加 null 检查
|
||||
if (this.AttackVerb == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.CanShoot)
|
||||
{
|
||||
return;
|
||||
@@ -265,4 +336,4 @@ namespace ArachnaeSwarm
|
||||
[Unsaved(false)]
|
||||
public Material turretMat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace ArachnaeSwarm
|
||||
public class CompProperties_GuardianPsyField : CompProperties
|
||||
{
|
||||
public float radius = 5.9f;
|
||||
public int hitPoints = 100;
|
||||
public int baseHitPoints = 100; // 重命名为基础生命值
|
||||
public int rechargeDelay = 3200; // Ticks after breaking
|
||||
public int rechargeHitPointsIntervalTicks = 60; // Ticks to restore 1 HP
|
||||
|
||||
@@ -27,6 +27,10 @@ namespace ArachnaeSwarm
|
||||
|
||||
public Color color = Color.cyan;
|
||||
|
||||
// 新增:心灵敏感度倍率设置
|
||||
public float minSensitivityMultiplier = 0f; // 最低倍率
|
||||
public float maxSensitivityMultiplier = 10.0f; // 最高倍率
|
||||
|
||||
public CompProperties_GuardianPsyField()
|
||||
{
|
||||
compClass = typeof(ThingComp_GuardianPsyField);
|
||||
@@ -44,7 +48,24 @@ namespace ArachnaeSwarm
|
||||
public CompProperties_GuardianPsyField Props => (CompProperties_GuardianPsyField)props;
|
||||
private Pawn PawnOwner => parent as Pawn;
|
||||
public bool IsOnCooldown => ticksToReset > 0;
|
||||
public int HitPointsMax => Props.hitPoints;
|
||||
|
||||
// 修改:基于心灵敏感度计算最大生命值
|
||||
public int HitPointsMax
|
||||
{
|
||||
get
|
||||
{
|
||||
if (PawnOwner == null) return Props.baseHitPoints;
|
||||
|
||||
// 获取心灵敏感度
|
||||
float psychicSensitivity = PawnOwner.GetStatValue(StatDefOf.PsychicSensitivity);
|
||||
|
||||
// 计算倍率,限制在最小和最大倍率之间
|
||||
float multiplier = Mathf.Clamp(psychicSensitivity, Props.minSensitivityMultiplier, Props.maxSensitivityMultiplier);
|
||||
|
||||
// 返回基于心灵敏感度的生命值
|
||||
return Mathf.RoundToInt(Props.baseHitPoints * multiplier);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Material ForceFieldMat = MaterialPool.MatFrom("Other/ForceField", ShaderDatabase.MoteGlow);
|
||||
private static readonly MaterialPropertyBlock MatPropertyBlock = new MaterialPropertyBlock();
|
||||
@@ -99,7 +120,9 @@ namespace ArachnaeSwarm
|
||||
wasNotAtFullHp = true;
|
||||
if(this.parent.IsHashIntervalTick(Props.rechargeHitPointsIntervalTicks))
|
||||
{
|
||||
currentHitPoints += (int)(HitPointsMax * Props.hitPointsPctPerInterval);
|
||||
// 修改:基于当前最大生命值计算恢复量
|
||||
int healAmount = Mathf.Max(1, (int)(HitPointsMax * Props.hitPointsPctPerInterval));
|
||||
currentHitPoints += healAmount;
|
||||
if(currentHitPoints > HitPointsMax) currentHitPoints = HitPointsMax;
|
||||
PawnOwner.psychicEntropy.OffsetPsyfocusDirectly(-Props.psyfocusCostPerInterval);
|
||||
}
|
||||
@@ -246,7 +269,16 @@ namespace ArachnaeSwarm
|
||||
Text.Font = GameFont.Small;
|
||||
Text.Anchor = TextAnchor.MiddleCenter;
|
||||
|
||||
TaggedString statusText = shield.IsOnCooldown ? "Cooldown" : new TaggedString(shield.currentHitPoints + " / " + shield.HitPointsMax);
|
||||
// 修改:显示当前/最大生命值,并显示心灵敏感度倍率
|
||||
string statusText;
|
||||
if (shield.IsOnCooldown)
|
||||
{
|
||||
statusText = "Cooldown";
|
||||
}
|
||||
else
|
||||
{
|
||||
statusText = $"{shield.currentHitPoints} / {shield.HitPointsMax}";
|
||||
}
|
||||
Widgets.Label(barRect, statusText);
|
||||
|
||||
Text.Anchor = TextAnchor.UpperLeft;
|
||||
@@ -254,4 +286,4 @@ namespace ArachnaeSwarm
|
||||
return new GizmoResult(GizmoState.Clear);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user