feat(WulaFallenEmpire): 优化 Excalibur 武器效果

- 调整武器参数,降低暴击率,提高单次射击威力
- 优化爆炸效果,增加延迟和视觉效果
- 修复部分功能,如毁坏后不产生效果的问题
- 调整伤害计算方式,简化公式
- 移除不必要的代码和注释,提高代码可读性
This commit is contained in:
2025-08-27 21:41:40 +08:00
parent 59726c3a73
commit 0d6151aff5
4 changed files with 86 additions and 46 deletions

View File

@@ -59,20 +59,14 @@
<hasStandardCommand>true</hasStandardCommand> <hasStandardCommand>true</hasStandardCommand>
<range>25.9</range> <range>25.9</range>
<warmupTime>1.5</warmupTime> <warmupTime>1.5</warmupTime>
<burstShotCount>10</burstShotCount> <burstShotCount>3</burstShotCount>
<ticksBetweenBurstShots>12</ticksBetweenBurstShots> <ticksBetweenBurstShots>50</ticksBetweenBurstShots>
<soundCast>ChargeLance_Fire</soundCast> <soundCast>ChargeLance_Fire</soundCast>
<soundCastTail>GunTail_Heavy</soundCastTail> <soundCastTail>GunTail_Heavy</soundCastTail>
<targetParams> <targetParams>
<canTargetLocations>true</canTargetLocations> <canTargetLocations>true</canTargetLocations>
</targetParams> </targetParams>
<accuracyTouch>0.7</accuracyTouch> <pathWidth>1.5</pathWidth>
<accuracyShort>0.6</accuracyShort>
<accuracyMedium>0.5</accuracyMedium>
<accuracyLong>0.4</accuracyLong>
<minRange>3</minRange>
<requireLineOfSight>true</requireLineOfSight>
<pathWidth>2.5</pathWidth>
<damageDef>Vaporize</damageDef> <damageDef>Vaporize</damageDef>
<damageAmount>50</damageAmount> <damageAmount>50</damageAmount>
<armorPenetration>0.3</armorPenetration> <armorPenetration>0.3</armorPenetration>

View File

@@ -42,10 +42,18 @@ namespace WulaFallenEmpire
public void StartStrike(List<IntVec3> allCells, int burstIndex, int totalBursts) public void StartStrike(List<IntVec3> allCells, int burstIndex, int totalBursts)
{ {
currentBurstCells = allCells; if (allCells == null || !allCells.Any())
{
Destroy();
return;
}
currentBurstCells = new List<IntVec3>(allCells);
currentBurstShot = burstIndex; currentBurstShot = burstIndex;
burstShotsTotal = totalBursts; burstShotsTotal = totalBursts;
ticksToDetonate = 1; // Start detonation immediately
// Add a small delay before detonation for visual effect
ticksToDetonate = 10; // 10 ticks delay before detonation
} }
protected override void TimeInterval(float deltaTime) protected override void TimeInterval(float deltaTime)
@@ -63,35 +71,81 @@ namespace WulaFallenEmpire
private void Detonate() private void Detonate()
{ {
if (currentBurstCells == null || !currentBurstCells.Any()) if (currentBurstCells == null || !currentBurstCells.Any() || Map == null)
{ {
Destroy(); Destroy();
return; return;
} }
// For this burst, we'll detonate all cells // Create a copy of the list to avoid modification during iteration
foreach (IntVec3 cell in currentBurstCells) List<IntVec3> cellsToDetonate = new List<IntVec3>(currentBurstCells);
// Clear the current burst cells to prevent reuse
currentBurstCells.Clear();
foreach (IntVec3 cell in cellsToDetonate)
{ {
if (cell.InBounds(Map)) if (cell.InBounds(Map))
{ {
// Apply explosion effect, but ignore the caster // Apply explosion effect, but ignore the caster
List<Thing> ignoredThings = new List<Thing> { caster }; List<Thing> ignoredThings = new List<Thing>();
if (caster != null)
{
ignoredThings.Add(caster);
}
DamageDef explosionDamageType = damageDef ?? DamageDefOf.Bomb; DamageDef explosionDamageType = damageDef ?? DamageDefOf.Bomb;
GenExplosion.DoExplosion(center: cell, map: Map, radius: 0.9f, damType: explosionDamageType, instigator: caster,
damAmount: (int)damageAmount, armorPenetration: armorPenetration, // Create explosion parameters with more precise settings
explosionSound: null, weapon: weaponDef, projectile: null, GenExplosion.DoExplosion(
intendedTarget: null, postExplosionSpawnThingDef: null, center: cell,
postExplosionSpawnChance: 0f, postExplosionSpawnThingCount: 1, map: Map,
postExplosionGasType: null, applyDamageToExplosionCellsNeighbors: false, radius: 1.2f, // Slightly larger radius for better visual effect
preExplosionSpawnThingDef: null, preExplosionSpawnChance: 0f, damType: explosionDamageType,
preExplosionSpawnThingCount: 1, chanceToStartFire: 0f, instigator: caster,
damageFalloff: false, direction: null, ignoredThings: ignoredThings, damAmount: (int)damageAmount,
affectedAngle: null, doVisualEffects: true, propagationSpeed: 0f, armorPenetration: armorPenetration,
screenShakeFactor: 0f, doSoundEffects: true, postExplosionSpawnThingDefWater: null, explosionSound: null,
flammabilityChanceCurve: null, overrideCells: null, postExplosionSpawnSingleThingDef: null, preExplosionSpawnSingleThingDef: null); weapon: weaponDef,
projectile: null,
intendedTarget: null,
postExplosionSpawnThingDef: null,
postExplosionSpawnChance: 0f,
postExplosionSpawnThingCount: 1,
postExplosionGasType: null,
applyDamageToExplosionCellsNeighbors: true, // Apply damage to neighbor cells
preExplosionSpawnThingDef: null,
preExplosionSpawnChance: 0f,
preExplosionSpawnThingCount: 1,
chanceToStartFire: 0.1f, // Small chance to start fire
damageFalloff: true, // Add damage falloff
direction: null,
ignoredThings: ignoredThings,
affectedAngle: null,
doVisualEffects: true,
propagationSpeed: 0.5f, // Add some propagation speed for visual effect
screenShakeFactor: 0.3f, // Add screen shake
doSoundEffects: true,
postExplosionSpawnThingDefWater: null,
flammabilityChanceCurve: null,
overrideCells: null,
postExplosionSpawnSingleThingDef: null,
preExplosionSpawnSingleThingDef: null);
} }
} }
Destroy();
// Check if there are more bursts to come
if (currentBurstShot < burstShotsTotal - 1)
{
// Prepare for next burst
ticksToDetonate = 15; // Wait 15 ticks before next burst
currentBurstShot++;
}
else
{
// All bursts completed, destroy the mote
Destroy();
}
} }
} }
} }

View File

@@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using RimWorld; using RimWorld;
using UnityEngine; using UnityEngine;
using Verse; using Verse;
@@ -54,12 +53,10 @@ namespace WulaFallenEmpire
{ {
get get
{ {
// Use the damageAmount from VerbProperties if set, otherwise use the base damage
if (this.ExcaliburProps.damageAmount > 0) if (this.ExcaliburProps.damageAmount > 0)
{ {
return this.ExcaliburProps.damageAmount; return this.ExcaliburProps.damageAmount;
} }
// Removed AncotUtility.QualityFactor, using a simple multiplier for now
return 1.0f * this.damageAmountBase; return 1.0f * this.damageAmountBase;
} }
} }
@@ -68,27 +65,14 @@ namespace WulaFallenEmpire
{ {
get get
{ {
// Use the armorPenetration from VerbProperties if set, otherwise use the base value
if (this.ExcaliburProps.armorPenetration >= 0) if (this.ExcaliburProps.armorPenetration >= 0)
{ {
return this.ExcaliburProps.armorPenetration; return this.ExcaliburProps.armorPenetration;
} }
// Removed AncotUtility.QualityFactor, using a simple multiplier for now
return 1.0f * this.armorPenetrationBase; return 1.0f * this.armorPenetrationBase;
} }
} }
// Temporarily commented out CompWeaponCharge related code
/*
public CompWeaponCharge compCharge
{
get
{
return this.weapon.TryGetComp<CompWeaponCharge>();
}
}
*/
private VerbProperties_Excalibur ExcaliburProps private VerbProperties_Excalibur ExcaliburProps
{ {
get get
@@ -97,6 +81,14 @@ namespace WulaFallenEmpire
} }
} }
protected override int ShotsPerBurst
{
get
{
return this.verbProps.burstShotCount;
}
}
protected override bool TryCastShot() protected override bool TryCastShot()
{ {
// Calculate all affected cells once // Calculate all affected cells once
@@ -111,14 +103,14 @@ namespace WulaFallenEmpire
beam.pathWidth = this.ExcaliburProps.pathWidth; beam.pathWidth = this.ExcaliburProps.pathWidth;
beam.weaponDef = this.CasterPawn.equipment.Primary.def; beam.weaponDef = this.CasterPawn.equipment.Primary.def;
beam.damageDef = this.ExcaliburProps.damageDef; beam.damageDef = this.ExcaliburProps.damageDef;
beam.StartStrike(allAffectedCells, this.verbProps.burstShotCount, this.verbProps.burstShotCount); beam.StartStrike(allAffectedCells, this.ShotsPerBurst, this.ShotsPerBurst);
return true; return true;
} }
public override void DrawHighlight(LocalTargetInfo target) public override void DrawHighlight(LocalTargetInfo target)
{ {
GenDraw.DrawFieldEdges(this.AffectedCells(target), SimpleColor.Red); GenDraw.DrawFieldEdges(this.AffectedCells(target));
} }
private List<IntVec3> AffectedCells(LocalTargetInfo target) private List<IntVec3> AffectedCells(LocalTargetInfo target)