Files
ArachnaeSwarm/Source/ArachnaeSwarm/Abilities/CompAbilityEffect_DRM_Deaddustpop.cs
2025-09-09 17:51:20 +08:00

85 lines
2.7 KiB
C#

using RimWorld;
using Verse;
using Verse.Sound;
using System.Collections.Generic;
using System.Linq;
namespace ArachnaeSwarm
{
public class CompAbilityEffect_DRM_Deaddustpop : CompAbilityEffect
{
public new CompProperties_AbilityDRM_Deaddustpop Props
{
get
{
return (CompProperties_AbilityDRM_Deaddustpop)this.props;
}
}
private Pawn Pawn
{
get
{
return this.parent.pawn;
}
}
private List<IntVec3> AffectedCells(LocalTargetInfo target)
{
return GenRadial.RadialCellsAround(target.Cell, Props.smokeRadius, true).ToList();
}
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
{
base.Apply(target, dest);
GenExplosion.DoExplosion(
center: target.Cell,
map: this.parent.pawn.MapHeld,
radius: this.Props.smokeRadius,
damType: this.Props.damageDef,
instigator: null,
damAmount: this.Props.damageAmount,
armorPenetration: this.Props.armorPenetration,
// 明确命名关键参数,避免顺序错误
postExplosionSpawnThingDef: this.Props.postExplosionSpawnThingDef,
postExplosionSpawnChance: this.Props.postExplosionSpawnChance,
postExplosionSpawnThingCount: this.Props.postExplosionSpawnThingCount,
postExplosionGasType: this.Props.gasType,
// 需要补充的参数(根据实际需求填写)
flammabilityChanceCurve: null,
overrideCells: this.AffectedCells(target), // 明确传递实际需要的值
postExplosionSpawnSingleThingDef: null,
preExplosionSpawnSingleThingDef: null
);
}
public override void DrawEffectPreview(LocalTargetInfo target)
{
GenDraw.DrawRadiusRing(target.Cell, this.Props.smokeRadius);
}
}
public class CompProperties_AbilityDRM_Deaddustpop : CompProperties_AbilityEffect
{
public CompProperties_AbilityDRM_Deaddustpop()
{
this.compClass = typeof(CompAbilityEffect_DRM_Deaddustpop);
}
public float smokeRadius;
public SoundDef explosionSound;
public GasType gasType;
public DamageDef damageDef;
public float postExplosionSpawnChance = 0f;
public int postExplosionSpawnThingCount = 1;
public ThingDef postExplosionSpawnThingDef = null;
public int damageAmount = -1;
public float armorPenetration = -1f;
}
}