11
This commit is contained in:
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Defs>
|
<Defs>
|
||||||
<WulaFallenEmpire.DroneWorkModeDef>
|
<!-- <WulaFallenEmpire.DroneWorkModeDef>
|
||||||
<defName>Work</defName>
|
<defName>Work</defName>
|
||||||
<label>工作</label>
|
<label>工作</label>
|
||||||
<description>机械将执行分配的工作.</description>
|
<description>机械将执行分配的工作.</description>
|
||||||
@@ -22,5 +22,5 @@
|
|||||||
<description>机械将立即进入休眠状态.</description>
|
<description>机械将立即进入休眠状态.</description>
|
||||||
<iconPath>UI/Icons/WorkMode/SelfShutdown</iconPath>
|
<iconPath>UI/Icons/WorkMode/SelfShutdown</iconPath>
|
||||||
<uiOrder>30</uiOrder>
|
<uiOrder>30</uiOrder>
|
||||||
</WulaFallenEmpire.DroneWorkModeDef>
|
</WulaFallenEmpire.DroneWorkModeDef> -->
|
||||||
</Defs>
|
</Defs>
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Defs>
|
<Defs>
|
||||||
|
|
||||||
<JobDef>
|
<!-- <JobDef>
|
||||||
<defName>WULA_DroneSelfShutdown</defName>
|
<defName>WULA_DroneSelfShutdown</defName>
|
||||||
<driverClass>WulaFallenEmpire.JobDriver_DroneSelfShutdown</driverClass>
|
<driverClass>WulaFallenEmpire.JobDriver_DroneSelfShutdown</driverClass>
|
||||||
<reportString>关机自休眠.</reportString>
|
<reportString>关机自休眠.</reportString>
|
||||||
<casualInterruptible>false</casualInterruptible>
|
<casualInterruptible>false</casualInterruptible>
|
||||||
<allowOpportunisticPrefix>true</allowOpportunisticPrefix>
|
<allowOpportunisticPrefix>true</allowOpportunisticPrefix>
|
||||||
</JobDef>
|
</JobDef> -->
|
||||||
|
|
||||||
</Defs>
|
</Defs>
|
||||||
@@ -238,6 +238,35 @@
|
|||||||
</node>
|
</node>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<!-- 一段时间给个税证 -->
|
||||||
|
<li Class="QuestNode_LoopCount">
|
||||||
|
<loopCount>30</loopCount>
|
||||||
|
<storeLoopCounterAs>Give_Tex_Reward_Counter</storeLoopCounterAs>
|
||||||
|
<node Class="QuestNode_Sequence">
|
||||||
|
<nodes>
|
||||||
|
<li Class="QuestNode_Delay">
|
||||||
|
<delayTicks>900000</delayTicks><!-- 15days -->
|
||||||
|
<node Class="QuestNode_Sequence">
|
||||||
|
<nodes>
|
||||||
|
<li Class="QuestNode_Letter">
|
||||||
|
<label>缴税凭证?</label>
|
||||||
|
<text>尽管没有实质上的缴税,但是殖民地还是收到了一份缴税凭证。\n\n看起来某人正在悄悄答谢殖民地。</text>
|
||||||
|
<letterDef>PositiveEvent</letterDef>
|
||||||
|
</li>
|
||||||
|
<li Class="QuestNode_GenerateThingSet">
|
||||||
|
<thingSetMaker>WULA_Base_Tex_Reward</thingSetMaker>
|
||||||
|
<storeAs>permissionReward</storeAs>
|
||||||
|
</li>
|
||||||
|
<li Class="QuestNode_AddItemsReward">
|
||||||
|
<items>$permissionReward</items>
|
||||||
|
</li>
|
||||||
|
</nodes>
|
||||||
|
</node>
|
||||||
|
</li>
|
||||||
|
</nodes>
|
||||||
|
</node>
|
||||||
|
</li>
|
||||||
|
|
||||||
<!-- - - - - - - - -->
|
<!-- - - - - - - - -->
|
||||||
<!-- End conditions -->
|
<!-- End conditions -->
|
||||||
<!-- - - - - - - - -->
|
<!-- - - - - - - - -->
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
<!-- 时间配置 -->
|
<!-- 时间配置 -->
|
||||||
<fireAfterDaysPassed>0</fireAfterDaysPassed>
|
<fireAfterDaysPassed>0</fireAfterDaysPassed>
|
||||||
<checkIntervalDays>15</checkIntervalDays>
|
<checkIntervalDays>10</checkIntervalDays>
|
||||||
|
|
||||||
<!-- 可选配置 -->
|
<!-- 可选配置 -->
|
||||||
<preventDuplicateQuests>false</preventDuplicateQuests>
|
<preventDuplicateQuests>false</preventDuplicateQuests>
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ namespace WulaFallenEmpire
|
|||||||
List<Thing> thingList = cell.GetThingList(map);
|
List<Thing> thingList = cell.GetThingList(map);
|
||||||
foreach (Thing thing in thingList)
|
foreach (Thing thing in thingList)
|
||||||
{
|
{
|
||||||
if (IsValidTarget(thing) && !thingsInRange.Contains(thing))
|
// 修改:添加目标类型检查,只处理建筑和Pawn
|
||||||
|
if (IsValidTargetType(thing) && IsValidTarget(thing) && !thingsInRange.Contains(thing))
|
||||||
{
|
{
|
||||||
thingsInRange.Add(thing);
|
thingsInRange.Add(thing);
|
||||||
}
|
}
|
||||||
@@ -75,78 +76,120 @@ namespace WulaFallenEmpire
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查目标是否为建筑或Pawn
|
||||||
|
/// </summary>
|
||||||
|
private bool IsValidTargetType(Thing thing)
|
||||||
|
{
|
||||||
|
// 只针对建筑和Pawn
|
||||||
|
return thing is Building || thing is Pawn;
|
||||||
|
}
|
||||||
|
|
||||||
private bool IsValidTarget(Thing thing)
|
private bool IsValidTarget(Thing thing)
|
||||||
{
|
{
|
||||||
// 检查是否为 Pawn(Pawn 有独立的健康系统)
|
// 首先检查是否为建筑或Pawn(双重检查)
|
||||||
|
if (!(thing is Building || thing is Pawn))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否为 Pawn
|
||||||
if (thing is Pawn pawn)
|
if (thing is Pawn pawn)
|
||||||
{
|
{
|
||||||
Faction targetFaction = pawn.Faction;
|
// 移除植物检查,因为不再处理植物
|
||||||
Faction parentFaction = parent.Faction;
|
// 修改:简化Pawn检查逻辑
|
||||||
|
return IsValidPawnTarget(pawn);
|
||||||
if (pawn.Dead || pawn.Downed)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// 检查是否影响生物
|
|
||||||
if (!Props.affectPawns)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// 如果父物体没有派系,则只检查目标派系
|
|
||||||
if (parentFaction == null)
|
|
||||||
{
|
|
||||||
if (targetFaction == null && !Props.affectNeutral)
|
|
||||||
return false;
|
|
||||||
if (targetFaction != null && targetFaction.IsPlayer && !Props.affectFriendly)
|
|
||||||
return false;
|
|
||||||
if (targetFaction != null && !targetFaction.IsPlayer && !Props.affectHostile)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 正常阵营关系检查
|
|
||||||
if (targetFaction == null)
|
|
||||||
{
|
|
||||||
if (!Props.affectNeutral)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (targetFaction == parentFaction)
|
|
||||||
{
|
|
||||||
if (!Props.affectFriendly)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (targetFaction.HostileTo(parentFaction))
|
|
||||||
{
|
|
||||||
if (!Props.affectHostile)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!Props.affectNeutral)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
// 检查是否为建筑
|
||||||
|
else if (thing is Building building)
|
||||||
{
|
{
|
||||||
// 对于非 Pawn 物体,检查生命值系统
|
return IsValidBuildingTarget(building);
|
||||||
if (thing.def.useHitPoints == false || thing.HitPoints <= 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// 检查物体类型过滤
|
|
||||||
if (thing is Building && !Props.affectBuildings)
|
|
||||||
return false;
|
|
||||||
if (thing is Plant && !Props.affectPlants)
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果设置为影响所有物体,跳过后续检查
|
return false;
|
||||||
if (Props.affectEverything)
|
}
|
||||||
return true;
|
|
||||||
|
|
||||||
// 如果忽略阵营关系,跳过阵营检查
|
/// <summary>
|
||||||
|
/// 检查Pawn是否有效目标
|
||||||
|
/// </summary>
|
||||||
|
private bool IsValidPawnTarget(Pawn pawn)
|
||||||
|
{
|
||||||
|
// 基础检查:死亡或倒地的Pawn不是有效目标
|
||||||
|
if (pawn.Dead || pawn.Downed)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 检查是否影响Pawn
|
||||||
|
if (!Props.affectPawns)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 检查阵营关系
|
||||||
|
return CheckFactionRelationship(pawn.Faction);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查建筑是否有效目标
|
||||||
|
/// </summary>
|
||||||
|
private bool IsValidBuildingTarget(Building building)
|
||||||
|
{
|
||||||
|
// 基础检查:建筑必须有生命值且未损坏
|
||||||
|
if (building.def.useHitPoints == false || building.HitPoints <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 检查是否影响建筑
|
||||||
|
if (!Props.affectBuildings)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 检查阵营关系
|
||||||
|
return CheckFactionRelationship(building.Faction);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查阵营关系
|
||||||
|
/// </summary>
|
||||||
|
private bool CheckFactionRelationship(Faction targetFaction)
|
||||||
|
{
|
||||||
|
Faction parentFaction = parent.Faction;
|
||||||
|
|
||||||
|
// 如果忽略所有阵营关系检查,直接返回true
|
||||||
if (Props.ignoreFactionRelations)
|
if (Props.ignoreFactionRelations)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return true;
|
// 如果影响所有物体,直接返回true
|
||||||
|
if (Props.affectEverything)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// 父物体没有派系的情况
|
||||||
|
if (parentFaction == null)
|
||||||
|
{
|
||||||
|
// 目标也没有派系 - 检查是否影响中立
|
||||||
|
if (targetFaction == null)
|
||||||
|
return Props.affectNeutral;
|
||||||
|
|
||||||
|
// 目标是玩家 - 检查是否影响友好
|
||||||
|
if (targetFaction.IsPlayer)
|
||||||
|
return Props.affectFriendly;
|
||||||
|
|
||||||
|
// 目标是非玩家派系 - 检查是否影响敌对
|
||||||
|
return Props.affectHostile;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 父物体有派系的情况
|
||||||
|
if (targetFaction == null)
|
||||||
|
{
|
||||||
|
// 目标没有派系 - 检查是否影响中立
|
||||||
|
return Props.affectNeutral;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 目标与父物体同派系 - 检查是否影响友好
|
||||||
|
if (targetFaction == parentFaction)
|
||||||
|
return Props.affectFriendly;
|
||||||
|
|
||||||
|
// 目标与父物体敌对 - 检查是否影响敌对
|
||||||
|
if (targetFaction.HostileTo(parentFaction))
|
||||||
|
return Props.affectHostile;
|
||||||
|
|
||||||
|
// 其他情况视为中立 - 检查是否影响中立
|
||||||
|
return Props.affectNeutral;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyDamageToTarget(Thing target)
|
private void ApplyDamageToTarget(Thing target)
|
||||||
@@ -187,7 +230,7 @@ namespace WulaFallenEmpire
|
|||||||
{
|
{
|
||||||
damageFactor = Props.fixedDamageFactor;
|
damageFactor = Props.fixedDamageFactor;
|
||||||
}
|
}
|
||||||
// 使用心灵敏感度缩放
|
// 使用心灵敏感度缩放(仅对Pawn有效)
|
||||||
else if (Props.scaleWithPsychicSensitivity && target is Pawn pawn)
|
else if (Props.scaleWithPsychicSensitivity && target is Pawn pawn)
|
||||||
{
|
{
|
||||||
damageFactor = CalculatePsychicSensitivityFactor(pawn);
|
damageFactor = CalculatePsychicSensitivityFactor(pawn);
|
||||||
@@ -225,15 +268,14 @@ namespace WulaFallenEmpire
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void HandleSpecialEffects(Thing target, DamageInfo damageInfo)
|
private void HandleSpecialEffects(Thing target, DamageInfo damageInfo)
|
||||||
{
|
{
|
||||||
// 如果是 Pawn,可以添加额外的效果
|
// 显示伤害数值(调试用)
|
||||||
if (target is Pawn pawn)
|
if (Props.showDamageNumbers)
|
||||||
{
|
{
|
||||||
// 显示伤害数值(调试用)
|
MoteMaker.ThrowText(target.DrawPos, target.Map, damageInfo.Amount.ToString());
|
||||||
if (Props.showDamageNumbers)
|
|
||||||
{
|
|
||||||
MoteMaker.ThrowText(target.DrawPos, target.Map, damageInfo.Amount.ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 可以根据伤害类型添加额外效果
|
||||||
|
// 例如:火焰伤害点燃目标,电击伤害麻痹目标等
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PostExposeData()
|
public override void PostExposeData()
|
||||||
@@ -276,6 +318,8 @@ namespace WulaFallenEmpire
|
|||||||
public override string CompInspectStringExtra()
|
public override string CompInspectStringExtra()
|
||||||
{
|
{
|
||||||
string baseString = base.CompInspectStringExtra();
|
string baseString = base.CompInspectStringExtra();
|
||||||
|
|
||||||
|
// 状态信息
|
||||||
string statusText = enabled ?
|
string statusText = enabled ?
|
||||||
"AreaDamageEnabled".Translate() :
|
"AreaDamageEnabled".Translate() :
|
||||||
"AreaDamageDisabled".Translate();
|
"AreaDamageDisabled".Translate();
|
||||||
@@ -285,5 +329,34 @@ namespace WulaFallenEmpire
|
|||||||
else
|
else
|
||||||
return baseString + "\n" + statusText;
|
return baseString + "\n" + statusText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取范围内所有有效目标(调试和外部调用用)
|
||||||
|
/// </summary>
|
||||||
|
public List<Thing> GetValidTargetsInRange()
|
||||||
|
{
|
||||||
|
Map map = parent.Map;
|
||||||
|
List<Thing> validTargets = new List<Thing>();
|
||||||
|
|
||||||
|
if (map == null || !enabled)
|
||||||
|
return validTargets;
|
||||||
|
|
||||||
|
foreach (IntVec3 cell in GenRadial.RadialCellsAround(parent.Position, Props.radius, true))
|
||||||
|
{
|
||||||
|
if (!cell.InBounds(map))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
List<Thing> thingList = cell.GetThingList(map);
|
||||||
|
foreach (Thing thing in thingList)
|
||||||
|
{
|
||||||
|
if (IsValidTargetType(thing) && IsValidTarget(thing) && !validTargets.Contains(thing))
|
||||||
|
{
|
||||||
|
validTargets.Add(thing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return validTargets;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ namespace WulaFallenEmpire
|
|||||||
public bool affectHostile = true; // 是否影响敌方
|
public bool affectHostile = true; // 是否影响敌方
|
||||||
public bool affectBuildings = true; // 是否影响建筑
|
public bool affectBuildings = true; // 是否影响建筑
|
||||||
public bool affectPawns = true; // 是否影响生物
|
public bool affectPawns = true; // 是否影响生物
|
||||||
public bool affectPlants = false; // 是否影响植物
|
|
||||||
|
// 移除植物相关设置,因为现在只针对建筑和Pawn
|
||||||
|
// public bool affectPlants = false; // 已移除:不再影响植物
|
||||||
|
|
||||||
// 特殊设置
|
// 特殊设置
|
||||||
public bool ignoreFactionRelations = false; // 忽略所有阵营关系检查(用于无派系实体)
|
public bool ignoreFactionRelations = false; // 忽略所有阵营关系检查(用于无派系实体)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user