diff --git a/.gitignore b/.gitignore index dcff767d..2d2bf7ca 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,10 @@ *.log *.cache *.tmp + +# Build outputs and debug files +**/obj/Debug/ +**/obj/Release/ +**/bin/Debug/ +**/bin/Release/ +*.csproj.CoreCompileInputs.cache diff --git a/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/Assemblies/WulaFallenEmpire.dll index 372405ab..d0d59f33 100644 Binary files a/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/Assemblies/WulaFallenEmpire.pdb b/1.6/Assemblies/WulaFallenEmpire.pdb index bfb305f9..a565f103 100644 Binary files a/1.6/Assemblies/WulaFallenEmpire.pdb and b/1.6/Assemblies/WulaFallenEmpire.pdb differ diff --git a/1.6/Defs/AbilityDefs/Abilities_WULA_Emergency.xml b/1.6/Defs/AbilityDefs/Abilities_WULA_Emergency.xml new file mode 100644 index 00000000..e2bc7ec2 --- /dev/null +++ b/1.6/Defs/AbilityDefs/Abilities_WULA_Emergency.xml @@ -0,0 +1,36 @@ + + + + + WULA_EmergencyEnergyRestore + + 激活紧急能量协议,暂时将能量需求锁定在100%,持续10秒后恢复到原来的能量水平。只能在倒地时使用。 + UI/Abilities/MetalbloodInjection + 72000 + true + true + false + CastAbilityOnThing + false + false + + Verb_CastAbility + 0 + 1 + Psycast_Skip_Entry + + true + false + false + + + +
  • + 600 + WULA_EmergencyEnergyRestore_Hediff + true +
  • +
    +
    + +
    \ No newline at end of file diff --git a/1.6/Defs/HediffDefs/Hediffs_BodyParts_WULA.xml b/1.6/Defs/HediffDefs/Hediffs_BodyParts_WULA.xml index 2f2f0ad2..edbe0fac 100644 --- a/1.6/Defs/HediffDefs/Hediffs_BodyParts_WULA.xml +++ b/1.6/Defs/HediffDefs/Hediffs_BodyParts_WULA.xml @@ -138,7 +138,7 @@ 立刻激活能源炉的超载能力,极大增加近战的命中率和速度,并且不会被敌人的近战减速。 UI/Abilities/MetalbloodInjection - 1800 + 1800 false true false @@ -244,10 +244,13 @@
  • - + 0 + + + 0.5 - + 0.9
  • @@ -310,7 +313,9 @@ WULA_Energy_Furnace_Hediff_DM_Engine 一台由暗物质作为能源驱动的合成人能源炉,拥有永不枯竭的动力,合成人安装后将不再需要充电。 - WULA_Energy_Furnace_DM_Engine + + WULA_Energy_Furnace_DM_Engine + WULA_Energy_Furnace_DM_Engine @@ -334,13 +339,17 @@ WULA_Energy_Furnace_DM_Engine 一台由暗物质作为能源驱动的合成人能源炉,拥有永不枯竭的动力,合成人安装后将不再需要充电。 - Install_WULA_Energy_Furnace_DM_Engine + + Install_WULA_Energy_Furnace_DM_Engine + 100 4 1 -
  • RewardStandardMidFreq
  • + +
  • RewardStandardMidFreq
  • +
    WULA_Synth_Addons_2_Technology @@ -360,7 +369,8 @@ WULA_Energy_Furnace_Hediff_DM_Engine 安装暗物质能源炉中 - + + false
  • @@ -393,7 +403,9 @@ WULA_Energy_Furnace_Hediff_DM_CPU 由填充非交互性暗物质微粒的卡西米尔共振腔构成的处理器,极大增强合成人的意识。 - WULA_Energy_Furnace_DM_CPU + + WULA_Energy_Furnace_DM_CPU + WULA_Energy_Furnace_DM_CPU @@ -414,13 +426,17 @@ WULA_Energy_Furnace_DM_CPU 由填充非交互性暗物质微粒的卡西米尔共振腔构成的处理器,用于替换过时的生物处理器,极大增强合成人的意识。 - Install_WULA_Energy_Furnace_DM_CPU + + Install_WULA_Energy_Furnace_DM_CPU + 100 8 2 -
  • RewardStandardMidFreq
  • + +
  • RewardStandardMidFreq
  • +
    WULA_Synth_Addons_2_Technology @@ -440,7 +456,8 @@ WULA_Energy_Furnace_Hediff_DM_CPU 安装暗物质处理器中 - + + false
  • @@ -474,7 +491,9 @@ Hediff_Implant 利用暗物质压缩而成的内嵌式中子装甲层和结构层,植入机械乌拉的体内时将使得她们获得强大的防御力。 - WULA_Skeleton_Neutronium + + WULA_Skeleton_Neutronium + WULA_Skeleton_Neutronium @@ -502,12 +521,16 @@ WULA_Skeleton_Neutronium 利用暗物质压缩而成的内嵌式中子装甲层和结构层,植入机械乌拉的体内时将使得她们获得强大的防御力。 - Install_WULA_Energy_Furnace_DM_Engine + + Install_WULA_Energy_Furnace_DM_Engine + 100 2 -
  • RewardStandardMidFreq
  • + +
  • RewardStandardMidFreq
  • +
    WULA_Synth_Addons_2_Technology @@ -527,7 +550,8 @@ WULA_Skeleton_Hediff_Neutronium 安装零素骨架中 - + + false
  • @@ -639,7 +663,7 @@ (0.5, 0.8, 1.0) false true - 1 + 1 0 3 True @@ -724,7 +748,7 @@ (0.5, 0.8, 1.0) false true - 1 + 1 0 3 True @@ -791,12 +815,13 @@ Steel false - + + WULA_Body_Fixed
  • WulaSpecies
  • - + 1500 3 @@ -830,12 +855,13 @@ Steel false - + + WULA_Body_Fixed
  • WulaSpecies
  • - + 3000 7 @@ -869,12 +895,13 @@ Steel false - + + WULA_Body_Fixed
  • WulaSpecies
  • - + 3000 7 @@ -908,12 +935,13 @@ Steel false - + + WULA_Body_Fixed
  • WulaSpecies
  • - + 1500 3 @@ -947,12 +975,13 @@ Steel false - + + WULA_Body_Fixed
  • WulaSpecies
  • - + 1500 3 @@ -994,12 +1023,13 @@ Steel false - + + WULA_Body_Fixed
  • WulaSpecies
  • - + 7000
  • WULA_Repair_All_Technology
  • @@ -1039,7 +1069,7 @@ 这个合成人的破损已被细致地修复。 false true - false + false
  • 1 @@ -1066,7 +1096,8 @@
  • WULA_Synth_Psi_Technology
  • WULA_Soul_Wedge - + + false 2 @@ -1089,7 +1120,7 @@ true true true - true + true Brain
  • diff --git a/1.6/Defs/HediffDefs/Hediffs_WULA_Emergency.xml b/1.6/Defs/HediffDefs/Hediffs_WULA_Emergency.xml new file mode 100644 index 00000000..e8da5c8d --- /dev/null +++ b/1.6/Defs/HediffDefs/Hediffs_WULA_Emergency.xml @@ -0,0 +1,35 @@ + + + + + WULA_EmergencyEnergyRestore_Hediff + + 紧急能量协议激活中,能量需求被暂时锁定在100%。 + WulaFallenEmpire.Hediff_EmergencyEnergyRestore + (0.2, 0.8, 1.0) + false + 1.0 + false + +
  • + 600 + true +
  • +
    + +
  • + +
  • + Consciousness + 1.0 +
  • +
  • + Moving + 1.0 +
  • + + +
    + + + \ No newline at end of file diff --git a/1.6/Defs/PawnKinds/PawnKinds_Wula.xml b/1.6/Defs/PawnKinds/PawnKinds_Wula.xml index 95faad9a..5edc3128 100644 --- a/1.6/Defs/PawnKinds/PawnKinds_Wula.xml +++ b/1.6/Defs/PawnKinds/PawnKinds_Wula.xml @@ -29,7 +29,9 @@
  • Wula_Apparel_Init
  • - + +
  • WULA_EmergencyEnergyRestore
  • +
    0 0 1000~2000 @@ -71,7 +73,9 @@
  • Wula_Apparel_Init
  • - + +
  • WULA_EmergencyEnergyRestore
  • +
    0 @@ -87,7 +91,7 @@ - + Wula_AI_Heavy_Panzer_PawnKind @@ -107,12 +111,12 @@ 99999~99999 - +
  • WULA_AI_Heavy_Panzer_AT_Weapon
  • - 1 + 1
    Wula_AI_Heavy_Panzer_Gunnery_PawnKind @@ -133,14 +137,14 @@ 99999~99999 - +
  • WULA_AI_Heavy_Panzer_Gunner_Weapon
  • - 1 + 1
    - + Mech_WULA_Cat @@ -203,7 +207,7 @@
  • Wula_Constructor_Cat_Weapon
  • - +
  • Wula/Things/WULA_Constructor_Cat/WULA_Cat_Thin @@ -219,7 +223,7 @@ Mech_WULA_Cat_Assault Mech_WULA_Cat_Assault - +
  • Wula/Things/WULA_Assault_Cat/WULA_Cat_Thin @@ -238,7 +242,7 @@ Mech_WULA_Cat_Bomb Mech_WULA_Cat_Bomb - +
  • Wula/Things/WULA_bomb_Cat/WULA_Cat_Thin @@ -265,7 +269,7 @@
  • Wula_Assault_Cat_Weapon
  • - +
  • Wula/Things/WULA_Commander_Cat/WULA_Cat_Thin diff --git a/1.6/Defs/ThingDefs_Misc/Apparel/WULA_ShieldBelt.xml b/1.6/Defs/ThingDefs_Misc/Apparel/WULA_ShieldBelt.xml new file mode 100644 index 00000000..e69de29b diff --git a/1.6/Defs/ThingDefs_Misc/Weapons/WULA_ExplosiveBeamWeapons.xml b/1.6/Defs/ThingDefs_Misc/Weapons/WULA_ExplosiveBeamWeapons.xml index aaa75ef4..37ce988e 100644 --- a/1.6/Defs/ThingDefs_Misc/Weapons/WULA_ExplosiveBeamWeapons.xml +++ b/1.6/Defs/ThingDefs_Misc/Weapons/WULA_ExplosiveBeamWeapons.xml @@ -1,204 +1,205 @@ - - - WULA_LightExplosiveBeam - - 乌拉帝国的轻型爆炸射线武器,每发射线都会在目标位置产生小型爆炸。适合对付轻装甲目标。 - Ultra - - Wula/Weapon/WULA_RW_Fractal_AR - Graphic_Single - 1.35 - - Interact_ChargeRifle - -
  • LongShots
  • -
  • RangedHeavy
  • - - - 15000 - 2.8 - 0.6 - 0.85 - 0.7 - 0.45 - 1.2 - - - 120 - 25 - 2 - - -
  • - WulaFallenEmpire.Verb_ShootBeamExplosive - true - 0.3 - 25 - 4 - 8 - 2 - Burn - BeamGraser_Shooting - Mote_GraserBeamBase - - - true - 1 - 1.8 - Flame - 15 - Explosion_Small - 0.6 -
  • -
    - - -
  • WULA_Cube_Productor_Energy
  • -
    - WULA_Synth_Weapon_2_Stun_Technology - - 4 - -
    - + + + WULA_LightExplosiveBeam + + 乌拉帝国的轻型爆炸射线武器,每发射线都会在目标位置产生小型爆炸。适合对付轻装甲目标。 + Ultra + + Wula/Weapon/WULA_RW_Fractal_AR + Graphic_Single + 1.35 + + Interact_ChargeRifle + +
  • LongShots
  • +
  • RangedHeavy
  • +
    + + 15000 + 2.8 + 0.6 + 0.85 + 0.7 + 0.45 + 1.2 + + + 120 + 25 + 2 + + +
  • + WulaFallenEmpire.Verb_ShootBeamExplosive - - - WULA_HeavyExplosiveBeam - - 乌拉帝国的重型爆炸射线武器,每三发射线会触发一次大威力爆炸,并在爆炸区域留下燃料污渍。 - Ultra - - Wula/Weapon/WULA_RW_Fractal_AR - Graphic_Single - 1.75 - - Interact_ChargeRifle - -
  • LongShots
  • -
  • RangedHeavy
  • - - - 35000 - 4.2 - 0.45 - 0.8 - 0.65 - 0.4 - 2.1 - - - 200 - 60 - 6 - 15 - - -
  • - WulaFallenEmpire.Verb_ShootBeamExplosive - true - 0.8 - 35 - 9 - 5 - 4 - Stun - BeamGraser_Shooting - Mote_GraserBeamBase - GraserBeam_End - - - true - 3 - 3.2 - Bomb - 35 - 0.4 - Explosion_Bomb - 0.4 - Filth_Fuel - 0.25 - 2 -
  • -
    - - -
  • WULA_Cube_Productor_Energy
  • -
    - WULA_Synth_Weapon_2_Stun_Technology - - 6 - -
    -
    + + true + 0.3 + 25 + 4 + 8 + Burn - - - WULA_ToxicExplosiveBeam - - 乌拉帝国的毒气射线武器,每两发射线会触发毒气爆炸,在目标区域释放有毒气体。 - Ultra - - Wula/Weapon/WULA_RW_Fractal_AR - Graphic_Single - 1.55 - - Interact_ChargeRifle - -
  • LongShots
  • -
  • RangedHeavy
  • -
    - - 28000 - 3.6 - 0.55 - 0.85 - 0.7 - 0.5 - 1.8 - - - 150 - 40 - 4 - 25 - - -
  • - WulaFallenEmpire.Verb_ShootBeamExplosive - true - 0.6 - 28 - 6 - 7 - 2.5 - ToxGas - BeamGraser_Shooting - Mote_GraserBeamBase - - - true - 2 - 2.8 - ToxGas - 20 - Explosion_Gas - ToxGas - 0.1 -
  • -
    - - -
  • WULA_Cube_Productor_Energy
  • -
    - WULA_Synth_Weapon_2_Stun_Technology - - 5 - -
    -
    + + 1000 + -1 + 0 + 0 + 0 + + + 0 + BeamGraser_Shooting + Fleck_BeamBurn + 0.32 + Mote_GraserBeamBase + GraserBeam_End + + + 0 + 0 + 0 + + + true + + +
  • (0, 0)
  • +
  • (0.65, 0.4)
  • +
  • (1, 0.75)
  • +
    +
    + + + + true + + + + true + 1 + 1.8 + Flame + 15 + Explosion_Bomb + 0.6 + + + + +
  • WULA_Cube_Productor_Energy
  • +
    + WULA_Synth_Weapon_2_Stun_Technology + + 4 + +
    + + + + + WULA_HeavyExplosiveBeam + + 乌拉帝国的重型爆炸射线武器,每三发射线会触发一次大威力爆炸,并在爆炸区域留下燃料污渍。 + Ultra + + Wula/Weapon/WULA_RW_Fractal_AR + Graphic_Single + 1.75 + + Interact_ChargeRifle + +
  • LongShots
  • +
  • RangedHeavy
  • +
    + + 35000 + 4.2 + 0.45 + 0.8 + 0.65 + 0.4 + 2.1 + + + 200 + 60 + 6 + 15 + + +
  • + WulaFallenEmpire.Verb_ShootBeamExplosive + + + true + 0.8 + 35 + 9 + 5 + Stun + + + 1000 + -1 + 0 + 0 + 0 + + + 0 + BeamGraser_Shooting + Fleck_BeamBurn + 0.32 + Mote_GraserBeamBase + GraserBeam_End + + + 0 + 0 + 0 + + + true + + +
  • (0, 0)
  • +
  • (0.65, 0.4)
  • +
  • (1, 0.75)
  • + + + + + + true + + + + true + 3 + 3.2 + Bomb + 35 + 0.4 + Explosion_Bomb + 0.4 + Filth_Fuel + 0.25 + 2 + +
    + + +
  • WULA_Cube_Productor_Energy
  • +
    + WULA_Synth_Weapon_2_Stun_Technology + + 6 + +
    +
    \ No newline at end of file diff --git a/Documentation/ExplosiveBeamWeapons/开发指南.md b/Documentation/ExplosiveBeamWeapons/开发指南.md deleted file mode 100644 index de01f3b0..00000000 --- a/Documentation/ExplosiveBeamWeapons/开发指南.md +++ /dev/null @@ -1,259 +0,0 @@ -# 爆炸射线武器开发指南 - -## 架构概述 - -爆炸射线武器系统基于RimWorld原版的射线武器系统,通过继承和扩展实现爆炸功能。 - -### 核心类结构 - -``` -Verb (RimWorld原版) -└── Verb_ShootBeam (RimWorld原版) - └── Verb_ShootBeamExplosive (自定义) - -VerbProperties (RimWorld原版) -└── VerbPropertiesExplosiveBeam (自定义) -``` - -## 代码架构 - -### 1. Verb_ShootBeamExplosive.cs - -#### 核心字段 -```csharp -private int explosionShotCounter = 0; // 爆炸计数器 -``` - -#### 关键方法 -- `TryCastShot()`: 重写射击方法,添加爆炸逻辑 -- `TriggerExplosion()`: 触发爆炸的核心方法 -- `ExposeData()`: 保存/加载数据 - -#### 工作流程 -1. 调用基类的 `TryCastShot()` -2. 如果射击成功且启用爆炸,递增计数器 -3. 当计数器达到间隔值时,触发爆炸并重置计数器 - -### 2. VerbPropertiesExplosiveBeam.cs - -#### 配置属性分类 -- **基础控制**: `enableExplosion`, `explosionShotInterval` -- **伤害属性**: `explosionRadius`, `explosionDamage`, `explosionDamageDef` -- **效果属性**: `explosionSound`, `explosionEffecter` -- **后续效果**: `postExplosionSpawn*`, `postExplosionGasType` - -## 扩展开发 - -### 添加新的爆炸类型 - -1. **在VerbPropertiesExplosiveBeam中添加新属性** -```csharp -public bool enableChainExplosion = false; -public int chainExplosionCount = 3; -public float chainExplosionDelay = 0.5f; -``` - -2. **在Verb_ShootBeamExplosive中实现逻辑** -```csharp -private void TriggerChainExplosion(VerbPropertiesExplosiveBeam props) -{ - // 实现连锁爆炸逻辑 -} -``` - -### 添加条件爆炸 - -```csharp -// 基于目标类型的条件爆炸 -private bool ShouldExplodeForTarget(Thing target) -{ - if (target is Pawn pawn) - { - return pawn.RaceProps.Humanlike; - } - return true; -} -``` - -### 添加爆炸延迟 - -```csharp -private void ScheduleDelayedExplosion(IntVec3 pos, float delay) -{ - Find.TickManager.ScheduleCallback(() => { - TriggerExplosion(explosiveProps); - }, (int)(delay * 60)); // 转换为ticks -} -``` - -## 性能优化 - -### 1. 爆炸频率控制 -- 避免每发都爆炸的设计 -- 使用合理的 `explosionShotInterval` -- 考虑武器的射速和爆炸威力平衡 - -### 2. 效果缓存 -```csharp -private static Dictionary cachedEffecters = new Dictionary(); - -private Effecter GetCachedEffecter(EffecterDef def) -{ - string key = def.defName; - if (!cachedEffecters.ContainsKey(key)) - { - cachedEffecters[key] = def.Spawn(); - } - return cachedEffecters[key]; -} -``` - -### 3. 范围检查优化 -```csharp -private bool IsValidExplosionPosition(IntVec3 pos) -{ - return pos.InBounds(caster.Map) && - pos.GetThingList(caster.Map).Any(t => t.def.category == ThingCategory.Pawn); -} -``` - -## 调试技巧 - -### 1. 日志输出 -```csharp -if (Prefs.DevMode) -{ - Log.Message($"[ExplosiveBeam] Shot {explosionShotCounter}/{explosiveProps.explosionShotInterval}"); -} -``` - -### 2. 可视化调试 -```csharp -if (DebugSettings.godMode) -{ - // 在爆炸位置显示调试信息 - MoteMaker.ThrowText(explosionCell.ToVector3(), caster.Map, - $"Explosion: {explosiveProps.explosionDamage}", Color.red); -} -``` - -### 3. 性能监控 -```csharp -private static Stopwatch explosionTimer = new Stopwatch(); - -private void TriggerExplosion(VerbPropertiesExplosiveBeam explosiveProps) -{ - explosionTimer.Start(); - // ... 爆炸逻辑 - explosionTimer.Stop(); - - if (explosionTimer.ElapsedMilliseconds > 5) - { - Log.Warning($"Explosion took {explosionTimer.ElapsedMilliseconds}ms"); - } - explosionTimer.Reset(); -} -``` - -## 兼容性考虑 - -### 1. 模组兼容性 -- 使用命名空间避免冲突 -- 检查其他模组的Harmony补丁 -- 提供配置选项禁用功能 - -### 2. 版本兼容性 -```csharp -#if VERSION_1_4 - // 1.4版本特定代码 -#elif VERSION_1_5 - // 1.5版本特定代码 -#endif -``` - -### 3. 保存兼容性 -```csharp -public override void ExposeData() -{ - base.ExposeData(); - - // 向后兼容的数据保存 - if (Scribe.mode == LoadSaveMode.LoadingVars) - { - // 处理旧版本数据 - } - - Scribe_Values.Look(ref explosionShotCounter, "explosionShotCounter", 0); -} -``` - -## 测试框架 - -### 单元测试示例 -```csharp -[Test] -public void TestExplosionInterval() -{ - var verb = new Verb_ShootBeamExplosive(); - var props = new VerbPropertiesExplosiveBeam - { - enableExplosion = true, - explosionShotInterval = 3 - }; - - // 模拟3次射击 - for (int i = 0; i < 3; i++) - { - bool shouldExplode = (i == 2); // 第3发应该爆炸 - Assert.AreEqual(shouldExplode, verb.ShouldTriggerExplosion()); - } -} -``` - -## 最佳实践 - -### 1. 配置验证 -```csharp -public override void PostLoad() -{ - base.PostLoad(); - - if (explosionShotInterval <= 0) - { - Log.Error($"Invalid explosionShotInterval: {explosionShotInterval}"); - explosionShotInterval = 1; - } - - if (explosionRadius < 0) - { - Log.Warning($"Negative explosion radius: {explosionRadius}"); - explosionRadius = 0; - } -} -``` - -### 2. 错误处理 -```csharp -private void TriggerExplosion(VerbPropertiesExplosiveBeam explosiveProps) -{ - try - { - // 爆炸逻辑 - } - catch (Exception e) - { - Log.Error($"Error in explosion: {e}"); - // 优雅降级,不影响基础射击功能 - } -} -``` - -### 3. 资源管理 -```csharp -public override void Destroy(DestroyMode mode = DestroyMode.Vanish) -{ - // 清理资源 - cachedEffecters.Clear(); - base.Destroy(mode); -} -``` \ No newline at end of file diff --git a/Documentation/ExplosiveBeamWeapons/测试说明.md b/Documentation/ExplosiveBeamWeapons/测试说明.md deleted file mode 100644 index 17acf3e8..00000000 --- a/Documentation/ExplosiveBeamWeapons/测试说明.md +++ /dev/null @@ -1,157 +0,0 @@ -# 爆炸射线武器测试说明 - -## 已实现的功能 - -### 1. 核心功能 -- ✅ 继承自原版 Verb_ShootBeam 的所有功能 -- ✅ 可配置的爆炸触发间隔 -- ✅ 可配置的爆炸伤害、范围、类型 -- ✅ 可配置的音效和特效 -- ✅ 可配置的爆炸后效果(生成物品、气体等) - -### 2. 配置选项 -- `enableExplosion`: 爆炸开关 -- `explosionShotInterval`: 爆炸间隔(每x发触发一次) -- `explosionRadius`: 爆炸半径 -- `explosionDamageDef`: 爆炸伤害类型 -- `explosionDamage`: 爆炸伤害值 -- `explosionSound`: 爆炸音效 -- `chanceToStartFire`: 点燃概率 -- `postExplosionSpawnThingDef`: 爆炸后生成物品 - -### 3. 示例武器 -已创建三个示例武器: -1. **CLa-15"蓝爆"轻型**: 每发都爆炸,火焰伤害 -2. **CLa-16"蓝爆"重型**: 每3发爆炸,炸弹伤害+燃料污渍 -3. **CLa-17"蓝毒"**: 每2发爆炸,毒气伤害+毒气云 - -## 测试步骤 - -### 1. 编译测试 -```bash -dotnet build "Source\WulaFallenEmpire\WulaFallenEmpire.csproj" -``` -✅ 编译成功 - -### 2. 游戏内测试准备 -1. 启动RimWorld -2. 启用开发者模式 (Options -> Dev mode) -3. 加载包含此模组的存档或创建新游戏 -4. 按 `~` 键打开开发者控制台 - -### 3. 生成测试武器 -使用以下命令生成测试武器: -``` -Thing.Spawn WULA_RW_Fractal_AR 1 -Thing.Spawn WULA_LightExplosiveBeam 1 -Thing.Spawn WULA_HeavyExplosiveBeam 1 -Thing.Spawn WULA_ToxicExplosiveBeam 1 -``` - -### 4. 功能验证清单 - -#### 基础射线功能 -- [ ] 射线正常发射和显示 -- [ ] 射线宽度和颜色正确 -- [ ] 射线伤害正常造成 -- [ ] 音效和视觉效果正常 - -#### 爆炸功能 -- [ ] 爆炸按配置间隔触发 -- [ ] 爆炸位置在射线命中点 -- [ ] 爆炸半径和伤害正确 -- [ ] 爆炸音效正常播放 -- [ ] 爆炸视觉效果正常 - -#### 特殊效果 -- [ ] 点燃效果正常工作 -- [ ] 爆炸后生成物品(燃料污渍等) -- [ ] 毒气云正常生成和扩散 -- [ ] 护甲穿透计算正确 - -### 5. 性能测试 -- [ ] 连续射击时帧率稳定 -- [ ] 多个单位同时使用时无卡顿 -- [ ] 内存使用正常,无内存泄漏 - -### 6. 平衡性测试 -- [ ] 武器伤害与成本匹配 -- [ ] 爆炸威力不会过于强大 -- [ ] AI正确使用武器 -- [ ] 友伤风险合理 - -## 测试场景 - -### 场景1:单目标测试 -1. 生成一个敌对的人形目标 -2. 装备测试武器 -3. 射击并观察: - - 射线效果 - - 爆炸触发时机 - - 伤害数值 - - 特殊效果 - -### 场景2:群体目标测试 -1. 生成多个敌对目标(5-10个) -2. 测试爆炸范围伤害 -3. 观察连锁效果(点燃、毒气扩散等) - -### 场景3:建筑物测试 -1. 建造一些墙壁和家具 -2. 测试爆炸对建筑物的影响 -3. 验证射线穿透和爆炸破坏 - -### 场景4:友军测试 -1. 在友军附近使用武器 -2. 验证友伤机制 -3. 测试AI的使用策略 - -## 常见问题排查 - -### 问题1:爆炸不触发 -- 检查 `enableExplosion` 是否为 true -- 检查 `explosionShotInterval` 设置 -- 确认射击确实命中目标 - -### 问题2:爆炸位置错误 -- 检查射线的 `InterpolatedPosition` 计算 -- 确认目标位置在地图范围内 - -### 问题3:音效不播放 -- 检查 `explosionSound` 定义是否正确 -- 确认音效文件存在 - -### 问题4:特效不显示 -- 检查 `explosionEffecter` 定义 -- 确认特效资源文件存在 - -## 调试工具 - -### 开发者命令 -``` -# 生成特定武器 -Thing.Spawn [武器DefName] [数量] - -# 生成敌对目标 -Pawn.Spawn Raider 5 - -# 治疗所有伤害 -Heal.All - -# 清除所有火焰 -Fire.Clear -``` - -### 日志监控 -监控游戏日志文件中的错误信息: -- `Player.log` (Windows) -- 搜索 "WulaFallenEmpire" 相关错误 - -## 报告问题 - -如果发现问题,请记录: -1. 具体的复现步骤 -2. 预期行为 vs 实际行为 -3. 相关的日志错误信息 -4. 游戏版本和模组版本 -5. 其他加载的模组列表 \ No newline at end of file diff --git a/Documentation/ExplosiveBeamWeapons/示例武器.md b/Documentation/ExplosiveBeamWeapons/示例武器.md deleted file mode 100644 index eb615367..00000000 --- a/Documentation/ExplosiveBeamWeapons/示例武器.md +++ /dev/null @@ -1,262 +0,0 @@ -# 爆炸射线武器示例 - -本文档展示了不同类型的爆炸射线武器配置示例,涵盖各种使用场景。 - -## 基础示例 - -### 1. 简单爆炸射线 -最基础的爆炸射线武器配置: - -```xml - -
  • - WulaFallenEmpire.Verb_ShootBeamExplosive - true - 25 - 3 - 2 - Burn - - - true - 1 - 2.0 - Bomb - 20 -
  • -
    -``` - -## 进阶示例 - -### 2. 延迟爆炸射线 -每3发触发一次大威力爆炸: - -```xml - -
  • - WulaFallenEmpire.Verb_ShootBeamExplosive - true - 0.8 - 30 - 9 - 5 - 3 - Stun - - - true - 3 - 3.5 - Bomb - 40 - 0.5 - Explosion_Bomb - 0.4 -
  • -
    -``` - -### 3. 火焰爆炸射线 -专注于点燃和火焰伤害: - -```xml - -
  • - WulaFallenEmpire.Verb_ShootBeamExplosive - true - 28 - 6 - 2.5 - Flame - - - true - 2 - 2.8 - Flame - 25 - Explosion_Fire - 0.8 - Filth_Fuel - 0.3 - 3 -
  • -
    -``` - -## 特殊效果示例 - -### 4. 毒气爆炸射线 -产生毒气云的射线武器: - -```xml - -
  • - WulaFallenEmpire.Verb_ShootBeamExplosive - true - 26 - 4 - 2 - ToxGas - - - true - 2 - 3.0 - ToxGas - 18 - Explosion_Gas - ToxGas - 0.1 -
  • -
    -``` - -### 5. 冰冻爆炸射线 -造成冰冻效果的射线武器: - -```xml - -
  • - WulaFallenEmpire.Verb_ShootBeamExplosive - true - 24 - 5 - 2.2 - Frostbite - - - true - 2 - 2.5 - Frostbite - 22 - Explosion_Ice - 0.0 - Filth_Water - 0.4 -
  • -
    -``` - -## 高级配置示例 - -### 6. 多效果爆炸射线 -结合多种效果的复杂武器: - -```xml - -
  • - WulaFallenEmpire.Verb_ShootBeamExplosive - true - 1.2 - 35 - 12 - 4 - 4 - Bomb - - - true - 4 - 4.0 - Bomb - 50 - 0.6 - Explosion_Bomb - - - 0.5 - Filth_Fuel - 0.3 - 4 - Mote_ExplosionFlash - 1.0 - BlindSmoke -
  • -
    -``` - -### 7. 精确爆炸射线 -高精度、低频率爆炸的狙击型武器: - -```xml - -
  • - WulaFallenEmpire.Verb_ShootBeamExplosive - true - 2.0 - 45 - 1 - 1 - Bullet - 0.05 - - - true - 1 - 2.2 - Bomb - 60 - 0.8 - Explosion_Sharp - false -
  • -
    -``` - -## 平衡性考虑 - -### 轻型武器平衡 -- 爆炸半径:1.5-2.5 -- 爆炸伤害:15-25 -- 射击间隔:1-2发 -- 成本:低-中等 - -### 中型武器平衡 -- 爆炸半径:2.5-3.5 -- 爆炸伤害:25-40 -- 射击间隔:2-3发 -- 成本:中等-高 - -### 重型武器平衡 -- 爆炸半径:3.5-5.0 -- 爆炸伤害:40-70 -- 射击间隔:3-5发 -- 成本:高-极高 - -## 使用建议 - -### 1. 近战防御武器 -```xml - -15 -1 -3.0 -``` - -### 2. 中距离支援武器 -```xml - -28 -2 -2.5 -``` - -### 3. 远程狙击武器 -```xml - -40 -1 -2.0 -50 -``` - -### 4. 区域控制武器 -```xml - -4.0 -BlindSmoke -0.6 -``` \ No newline at end of file diff --git a/Documentation/ExplosiveBeamWeapons/配置说明.md b/Documentation/ExplosiveBeamWeapons/配置说明.md deleted file mode 100644 index b606c587..00000000 --- a/Documentation/ExplosiveBeamWeapons/配置说明.md +++ /dev/null @@ -1,116 +0,0 @@ -# 爆炸射线武器配置说明 - -## 概述 -新的 `Verb_ShootBeamExplosive` 类扩展了原版的 `Verb_ShootBeam`,添加了可配置的爆炸效果。 - -## 配置属性 - -### 基础爆炸控制 -- `enableExplosion` (bool): 是否启用爆炸效果,默认 false -- `explosionShotInterval` (int): 每x发射击触发一次爆炸,默认 1 - -### 爆炸伤害属性 -- `explosionRadius` (float): 爆炸半径,默认 2.9 -- `explosionDamageDef` (DamageDef): 爆炸伤害类型,null时使用 Bomb -- `explosionDamage` (int): 爆炸伤害值,-1时使用武器默认伤害 -- `explosionArmorPenetration` (float): 爆炸护甲穿透,-1时使用武器默认值 - -### 音效和特效 -- `explosionSound` (SoundDef): 爆炸音效 -- `explosionEffecter` (EffecterDef): 爆炸特效 - -### 爆炸后效果 -- `postExplosionSpawnThingDef` (ThingDef): 爆炸后生成的物品 -- `postExplosionSpawnChance` (float): 生成概率 (0-1) -- `postExplosionSpawnThingCount` (int): 生成数量 - -### 爆炸前效果 -- `preExplosionSpawnThingDef` (ThingDef): 爆炸前生成的物品 -- `preExplosionSpawnChance` (float): 生成概率 (0-1) -- `preExplosionSpawnThingCount` (int): 生成数量 - -### 其他属性 -- `postExplosionGasType` (GasType?): 爆炸后的气体类型 -- `applyDamageToExplosionCellsNeighbors` (bool): 是否对邻近格子造成伤害 -- `chanceToStartFire` (float): 点燃概率 (0-1) -- `damageFalloff` (bool): 是否有伤害衰减 - -## 使用示例 - -```xml - -
  • - WulaFallenEmpire.Verb_ShootBeamExplosive - - - true - 0.5 - 30 - 6 - 3 - Stun - - - true - 3 - 2.5 - Bomb - 25 - Explosion_Bomb - 0.3 - Filth_Fuel - 0.15 -
  • -
    -``` - -## 工作原理 - -1. 武器正常进行射线攻击 -2. 每次成功射击后,计数器递增 -3. 当计数器达到 `explosionShotInterval` 时: - - 在当前射线位置触发爆炸 - - 播放爆炸音效和特效 - - 重置计数器 -4. 爆炸使用配置的参数进行伤害计算 - -## 注意事项 - -- 爆炸位置基于射线的插值位置 -- 如果爆炸位置超出地图边界,爆炸不会触发 -- 音效和特效是可选的,可以设置为 null -- 伤害值为 -1 时会尝试使用武器的默认伤害 -- 这个功能完全向后兼容,不启用爆炸时行为与原版相同 - -## 配置模板 - -### 轻型爆炸武器 -```xml -true -1 -1.8 -Flame -15 -0.6 -``` - -### 重型爆炸武器 -```xml -true -3 -3.2 -Bomb -35 -0.4 -Filth_Fuel -0.25 -``` - -### 毒气武器 -```xml -true -2 -2.8 -ToxGas -ToxGas -``` \ No newline at end of file diff --git a/Documentation/README.md b/Documentation/README.md deleted file mode 100644 index b2215cde..00000000 --- a/Documentation/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# 乌拉帝国模组文档 - -本文件夹包含乌拉帝国模组的所有技术文档和说明。 - -## 文档结构 - -### 📁 ExplosiveBeamWeapons/ -爆炸射线武器系统的相关文档 -- 配置说明 -- 测试指南 -- 使用示例 - -### 📁 Features/ -各种功能特性的文档(未来扩展) - -### 📁 API/ -API文档和开发者指南(未来扩展) - -## 快速导航 - -### 爆炸射线武器系统 -- [📋 配置说明](ExplosiveBeamWeapons/配置说明.md) - 详细的配置参数说明 -- [🧪 测试指南](ExplosiveBeamWeapons/测试说明.md) - 测试步骤和验证清单 -- [👨‍💻 开发指南](ExplosiveBeamWeapons/开发指南.md) - 代码架构和扩展开发 -- [⚔️ 示例武器](ExplosiveBeamWeapons/示例武器.md) - 各种类型的武器配置示例 - -## 版本历史 - -- v1.0: 初始版本,包含基础乌拉帝国内容 -- v1.1: 添加爆炸射线武器系统 \ No newline at end of file diff --git a/Source/WulaFallenEmpire/CompAbilityEffect_EmergencyEnergyRestore.cs b/Source/WulaFallenEmpire/CompAbilityEffect_EmergencyEnergyRestore.cs new file mode 100644 index 00000000..0832f9dc --- /dev/null +++ b/Source/WulaFallenEmpire/CompAbilityEffect_EmergencyEnergyRestore.cs @@ -0,0 +1,64 @@ +using RimWorld; +using Verse; + +namespace WulaFallenEmpire +{ + public class CompAbilityEffect_EmergencyEnergyRestore : CompAbilityEffect + { + public new CompProperties_AbilityEmergencyEnergyRestore Props => (CompProperties_AbilityEmergencyEnergyRestore)props; + + public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) + { + base.Apply(target, dest); + + Pawn caster = parent.pawn; + if (caster == null) return; + + // 检查是否是乌拉族 + if (!IsWulaRace(caster)) + { + Messages.Message("只有乌拉族才能使用紧急能量恢复", MessageTypeDefOf.RejectInput, false); + return; + } + + // 检查是否倒地(如果需要的话) + if (Props.requireDowned && !caster.Downed) + { + Messages.Message("只能在倒地时使用紧急能量恢复", MessageTypeDefOf.RejectInput, false); + return; + } + + // 添加Hediff + if (Props.hediffDef != null) + { + var hediff = HediffMaker.MakeHediff(Props.hediffDef, caster); + caster.health.AddHediff(hediff); + + Messages.Message($"{caster.LabelShort}激活了紧急能量恢复协议", MessageTypeDefOf.PositiveEvent, false); + + if (Prefs.DevMode) + { + Log.Message($"[EmergencyEnergyRestore] Applied to {caster.LabelShort}"); + } + } + } + + public override bool CanApplyOn(LocalTargetInfo target, LocalTargetInfo dest) + { + bool canApply = base.CanApplyOn(target, dest) && IsWulaRace(parent.pawn); + + if (Props.requireDowned) + { + canApply = canApply && parent.pawn.Downed; + } + + return canApply; + } + + private bool IsWulaRace(Pawn pawn) + { + if (pawn?.def == null) return false; + return pawn.def.defName == "WulaSpecies"; + } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/CompProperties_AbilityEmergencyEnergyRestore.cs b/Source/WulaFallenEmpire/CompProperties_AbilityEmergencyEnergyRestore.cs new file mode 100644 index 00000000..d796e9b4 --- /dev/null +++ b/Source/WulaFallenEmpire/CompProperties_AbilityEmergencyEnergyRestore.cs @@ -0,0 +1,17 @@ +using RimWorld; +using Verse; + +namespace WulaFallenEmpire +{ + public class CompProperties_AbilityEmergencyEnergyRestore : CompProperties_AbilityEffect + { + public int durationTicks = 600; // 默认10秒 + public HediffDef hediffDef; + public bool requireDowned = true; // 是否需要倒地才能使用 + + public CompProperties_AbilityEmergencyEnergyRestore() + { + compClass = typeof(CompAbilityEffect_EmergencyEnergyRestore); + } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/Hediff_EmergencyEnergyRestore.cs b/Source/WulaFallenEmpire/Hediff_EmergencyEnergyRestore.cs new file mode 100644 index 00000000..e24bf57b --- /dev/null +++ b/Source/WulaFallenEmpire/Hediff_EmergencyEnergyRestore.cs @@ -0,0 +1,71 @@ +using RimWorld; +using Verse; + +namespace WulaFallenEmpire +{ + public class Hediff_EmergencyEnergyRestore : HediffWithComps + { + private float originalEnergyLevel = 0f; + private bool hasStoredOriginalLevel = false; + + public override void PostAdd(DamageInfo? dinfo) + { + base.PostAdd(dinfo); + + // 存储原始能量水平 + var energyNeed = pawn.needs?.TryGetNeed(); + if (energyNeed != null) + { + originalEnergyLevel = energyNeed.CurLevel; + hasStoredOriginalLevel = true; + + // 立即将能量设置为100% + energyNeed.CurLevel = 1.0f; + + if (Prefs.DevMode) + { + Log.Message($"[EmergencyEnergyRestore] Stored original energy: {originalEnergyLevel:F2}, set to 1.0"); + } + } + } + + public override void PostRemoved() + { + base.PostRemoved(); + + // 恢复原始能量水平 + if (hasStoredOriginalLevel) + { + var energyNeed = pawn.needs?.TryGetNeed(); + if (energyNeed != null) + { + energyNeed.CurLevel = originalEnergyLevel; + + if (Prefs.DevMode) + { + Log.Message($"[EmergencyEnergyRestore] Restored energy to: {originalEnergyLevel:F2}"); + } + } + } + } + + public override void Tick() + { + base.Tick(); + + // 确保能量保持在100% + var energyNeed = pawn.needs?.TryGetNeed(); + if (energyNeed != null && energyNeed.CurLevel < 1.0f) + { + energyNeed.CurLevel = 1.0f; + } + } + + public override void ExposeData() + { + base.ExposeData(); + Scribe_Values.Look(ref originalEnergyLevel, "originalEnergyLevel", 0f); + Scribe_Values.Look(ref hasStoredOriginalLevel, "hasStoredOriginalLevel", false); + } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 24865da7..6de951e6 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -77,6 +77,9 @@ + + +