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>
<range>25.9</range>
<warmupTime>1.5</warmupTime>
<burstShotCount>10</burstShotCount>
<ticksBetweenBurstShots>12</ticksBetweenBurstShots>
<burstShotCount>3</burstShotCount>
<ticksBetweenBurstShots>50</ticksBetweenBurstShots>
<soundCast>ChargeLance_Fire</soundCast>
<soundCastTail>GunTail_Heavy</soundCastTail>
<targetParams>
<canTargetLocations>true</canTargetLocations>
</targetParams>
<accuracyTouch>0.7</accuracyTouch>
<accuracyShort>0.6</accuracyShort>
<accuracyMedium>0.5</accuracyMedium>
<accuracyLong>0.4</accuracyLong>
<minRange>3</minRange>
<requireLineOfSight>true</requireLineOfSight>
<pathWidth>2.5</pathWidth>
<pathWidth>1.5</pathWidth>
<damageDef>Vaporize</damageDef>
<damageAmount>50</damageAmount>
<armorPenetration>0.3</armorPenetration>

View File

@@ -42,10 +42,18 @@ namespace WulaFallenEmpire
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;
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)
@@ -63,35 +71,81 @@ namespace WulaFallenEmpire
private void Detonate()
{
if (currentBurstCells == null || !currentBurstCells.Any())
if (currentBurstCells == null || !currentBurstCells.Any() || Map == null)
{
Destroy();
return;
}
// For this burst, we'll detonate all cells
foreach (IntVec3 cell in currentBurstCells)
// Create a copy of the list to avoid modification during iteration
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))
{
// 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;
GenExplosion.DoExplosion(center: cell, map: Map, radius: 0.9f, damType: explosionDamageType, instigator: caster,
damAmount: (int)damageAmount, armorPenetration: armorPenetration,
explosionSound: null, weapon: weaponDef, projectile: null,
intendedTarget: null, postExplosionSpawnThingDef: null,
postExplosionSpawnChance: 0f, postExplosionSpawnThingCount: 1,
postExplosionGasType: null, applyDamageToExplosionCellsNeighbors: false,
preExplosionSpawnThingDef: null, preExplosionSpawnChance: 0f,
preExplosionSpawnThingCount: 1, chanceToStartFire: 0f,
damageFalloff: false, direction: null, ignoredThings: ignoredThings,
affectedAngle: null, doVisualEffects: true, propagationSpeed: 0f,
screenShakeFactor: 0f, doSoundEffects: true, postExplosionSpawnThingDefWater: null,
flammabilityChanceCurve: null, overrideCells: null, postExplosionSpawnSingleThingDef: null, preExplosionSpawnSingleThingDef: null);
// Create explosion parameters with more precise settings
GenExplosion.DoExplosion(
center: cell,
map: Map,
radius: 1.2f, // Slightly larger radius for better visual effect
damType: explosionDamageType,
instigator: caster,
damAmount: (int)damageAmount,
armorPenetration: armorPenetration,
explosionSound: 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.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using RimWorld;
using UnityEngine;
using Verse;
@@ -54,12 +53,10 @@ namespace WulaFallenEmpire
{
get
{
// Use the damageAmount from VerbProperties if set, otherwise use the base damage
if (this.ExcaliburProps.damageAmount > 0)
{
return this.ExcaliburProps.damageAmount;
}
// Removed AncotUtility.QualityFactor, using a simple multiplier for now
return 1.0f * this.damageAmountBase;
}
}
@@ -68,27 +65,14 @@ namespace WulaFallenEmpire
{
get
{
// Use the armorPenetration from VerbProperties if set, otherwise use the base value
if (this.ExcaliburProps.armorPenetration >= 0)
{
return this.ExcaliburProps.armorPenetration;
}
// Removed AncotUtility.QualityFactor, using a simple multiplier for now
return 1.0f * this.armorPenetrationBase;
}
}
// Temporarily commented out CompWeaponCharge related code
/*
public CompWeaponCharge compCharge
{
get
{
return this.weapon.TryGetComp<CompWeaponCharge>();
}
}
*/
private VerbProperties_Excalibur ExcaliburProps
{
get
@@ -97,6 +81,14 @@ namespace WulaFallenEmpire
}
}
protected override int ShotsPerBurst
{
get
{
return this.verbProps.burstShotCount;
}
}
protected override bool TryCastShot()
{
// Calculate all affected cells once
@@ -111,14 +103,14 @@ namespace WulaFallenEmpire
beam.pathWidth = this.ExcaliburProps.pathWidth;
beam.weaponDef = this.CasterPawn.equipment.Primary.def;
beam.damageDef = this.ExcaliburProps.damageDef;
beam.StartStrike(allAffectedCells, this.verbProps.burstShotCount, this.verbProps.burstShotCount);
beam.StartStrike(allAffectedCells, this.ShotsPerBurst, this.ShotsPerBurst);
return true;
}
public override void DrawHighlight(LocalTargetInfo target)
{
GenDraw.DrawFieldEdges(this.AffectedCells(target), SimpleColor.Red);
GenDraw.DrawFieldEdges(this.AffectedCells(target));
}
private List<IntVec3> AffectedCells(LocalTargetInfo target)