1
This commit is contained in:
Binary file not shown.
@@ -7,11 +7,11 @@
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:hediffs\\hediffcomp_reflectmeleedamage.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\ara_defof.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ara_defof.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:ara_defof.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\jobs\\jobdriver_supercarry\\jobdriver_supercarry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\jobs\\jobdriver_supercarry\\jobdriver_supercarry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:jobs\\jobdriver_supercarry\\jobdriver_supercarry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
@@ -122,8 +122,7 @@
|
||||
"RelativeToolTip": "ARA_DefOf.cs",
|
||||
"ViewState": "AgIAAFQAAAAAAAAAAAAUwGcAAAAmAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-03-24T08:34:43.383Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2026-03-24T08:34:43.383Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -133,7 +132,7 @@
|
||||
"RelativeDocumentMoniker": "Hediffs\\HediffComp_ReflectMeleeDamage.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Hediffs\\HediffComp_ReflectMeleeDamage.cs",
|
||||
"RelativeToolTip": "Hediffs\\HediffComp_ReflectMeleeDamage.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAwAAAA4AAAAAAAAAA==",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAAoAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-03-24T08:33:52.75Z",
|
||||
"EditorCaption": ""
|
||||
@@ -148,8 +147,7 @@
|
||||
"RelativeToolTip": "Jobs\\JobDriver_SuperCarry\\JobDriver_SuperCarry.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAAA3AAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-03-06T03:21:58.524Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2026-03-06T03:21:58.524Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace ArachnaeSwarmVerse
|
||||
public class HediffCompProperties_ReflectMeleeDamage : HediffCompProperties
|
||||
{
|
||||
public float reflectMultiplier = 3.0f; // 反射倍数,默认300%
|
||||
public bool showReflectionEffect = true; // 是否显示反射效果
|
||||
public bool reflectOnlyMelee = true; // 是否只反射近战伤害
|
||||
public bool includeToolBasedRanged = false; // 是否包含使用工具的远程伤害
|
||||
public float minDamageToReflect = 0.1f; // 最小反射伤害阈值
|
||||
|
||||
public string fixedDamageDefName = null; // 固定伤害类型的def名称,如果不为null,则反射伤害将使用此def
|
||||
|
||||
public HediffCompProperties_ReflectMeleeDamage()
|
||||
{
|
||||
this.compClass = typeof(HediffComp_ReflectMeleeDamage);
|
||||
@@ -127,7 +127,8 @@ namespace ArachnaeSwarmVerse
|
||||
{
|
||||
isProcessingReflection = true;
|
||||
lastReflectionTick = Find.TickManager.TicksGame;
|
||||
|
||||
DamageDef damageDef = originalDinfo.Def;
|
||||
|
||||
// 计算反射伤害
|
||||
float reflectedAmount = originalDinfo.Amount * ReflectMultiplier;
|
||||
|
||||
@@ -143,10 +144,23 @@ namespace ArachnaeSwarmVerse
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (Props.fixedDamageDefName != null)
|
||||
{
|
||||
DamageDef fixedDef = DefDatabase<DamageDef>.GetNamedSilentFail(Props.fixedDamageDefName);
|
||||
if (fixedDef != null)
|
||||
{
|
||||
damageDef = fixedDef;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Warning($"[ReflectMeleeDamage] Could not find DamageDef with name '{Props.fixedDamageDefName}' for reflection. Using original damage def.");
|
||||
}
|
||||
}
|
||||
|
||||
// 创建反射伤害信息
|
||||
DamageInfo reflectedDinfo = new DamageInfo(
|
||||
def: originalDinfo.Def,
|
||||
def: damageDef,
|
||||
amount: reflectedAmount,
|
||||
armorPenetration: originalDinfo.ArmorPenetrationInt,
|
||||
angle: Rand.Range(0, 359),
|
||||
@@ -177,12 +191,6 @@ namespace ArachnaeSwarmVerse
|
||||
// 对攻击者造成伤害
|
||||
attacker.TakeDamage(reflectedDinfo);
|
||||
|
||||
// 显示反射效果
|
||||
if (Props.showReflectionEffect)
|
||||
{
|
||||
ShowReflectionEffect(pawn, attacker);
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
if (pawn.Faction == Faction.OfPlayer && attacker.Faction != Faction.OfPlayer)
|
||||
{
|
||||
@@ -207,43 +215,6 @@ namespace ArachnaeSwarmVerse
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示反射效果
|
||||
/// </summary>
|
||||
private void ShowReflectionEffect(Pawn pawn, Thing attacker)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 显示反弹粒子
|
||||
if (pawn.Spawned && attacker.Spawned && pawn.Map == attacker.Map)
|
||||
{
|
||||
Vector3 startPos = pawn.DrawPos;
|
||||
Vector3 endPos = attacker.DrawPos;
|
||||
|
||||
// 创建一个从反射者到攻击者的弹道效果
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
MoteThrown mote = (MoteThrown)ThingMaker.MakeThing(ARA_ThingDefOf.Mote_SparkSimple, null);
|
||||
mote.Scale = Rand.Range(0.5f, 0.8f);
|
||||
mote.exactPosition = startPos + new Vector3(
|
||||
Rand.Range(-0.3f, 0.3f),
|
||||
0f,
|
||||
Rand.Range(-0.3f, 0.3f)
|
||||
);
|
||||
mote.SetVelocity(
|
||||
(endPos - startPos).normalized.x * Rand.Range(15f, 25f),
|
||||
0f
|
||||
);
|
||||
GenSpawn.Spawn(mote, pawn.Position, pawn.Map);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"[ReflectMeleeDamage] Error showing reflection effect: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在Pawn受到伤害后调用
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user