闪电链
This commit is contained in:
Binary file not shown.
95
1.6/Defs/ThingDefs_Misc/Weapons/WULA_Sample_Weapon.xml
Normal file
95
1.6/Defs/ThingDefs_Misc/Weapons/WULA_Sample_Weapon.xml
Normal file
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
<!-- 暗物质步枪 -->
|
||||
<ThingDef ParentName="BaseHumanMakeableGun">
|
||||
<defName>WULA_RW_DM_AR_Arc</defName>
|
||||
<label>DMa-8b"未命名"</label>
|
||||
<description>乌拉帝国一线部队所使用的由暗物质驱动的常规步枪,暗物质经由螺旋结构形成自旋极化光束,可以在远距离上连锁传导伤害性光束,仍在试验阶段。</description>
|
||||
<techLevel>Ultra</techLevel>
|
||||
<!-- <techLevel>Spacer</techLevel> -->
|
||||
<graphicData>
|
||||
<texPath>Wula/Weapon/WULA_RW_DM_AR</texPath>
|
||||
<graphicClass>Graphic_Single</graphicClass>
|
||||
<drawSize>1.2</drawSize>
|
||||
</graphicData>
|
||||
<weaponTags>
|
||||
<li>Wula_Ranged_Weapon_T4</li>
|
||||
</weaponTags>
|
||||
<uiIconScale>0.9</uiIconScale>
|
||||
<soundInteract>Interact_ChargeRifle</soundInteract>
|
||||
<recipeMaker>
|
||||
<recipeUsers Inherit="False">
|
||||
<li>WULA_Cube_Productor_Energy</li>
|
||||
</recipeUsers>
|
||||
<researchPrerequisite>WULA_Synth_Weapon_4_DM_Base_Technology</researchPrerequisite>
|
||||
<unfinishedThingDef>UnfinishedWeapon</unfinishedThingDef>
|
||||
</recipeMaker>
|
||||
<costList Inherit="False">
|
||||
<Steel>400</Steel>
|
||||
<Plasteel>200</Plasteel>
|
||||
<WULA_Dark_Matter_Item>4</WULA_Dark_Matter_Item>
|
||||
</costList>
|
||||
<statBases>
|
||||
<WorkToMake>40000</WorkToMake>
|
||||
<Mass>4.5</Mass>
|
||||
<AccuracyTouch>1</AccuracyTouch>
|
||||
<AccuracyShort>1</AccuracyShort>
|
||||
<AccuracyMedium>1</AccuracyMedium>
|
||||
<AccuracyLong>1</AccuracyLong>
|
||||
<RangedWeapon_Cooldown>1</RangedWeapon_Cooldown>
|
||||
</statBases>
|
||||
<verbs>
|
||||
<li Class="WulaFallenEmpire.VerbProperties_Arc">
|
||||
<verbClass>WulaFallenEmpire.Verb_ShootArc</verbClass>
|
||||
<hasStandardCommand>true</hasStandardCommand>
|
||||
<damageDef>Wula_Darm_Matter_Beam</damageDef>
|
||||
<damageAmount>20</damageAmount>
|
||||
<EMPDamageAmount>20</EMPDamageAmount>
|
||||
<warmupTime>0.5</warmupTime>
|
||||
<range>34.9</range>
|
||||
<affectedAngle>25</affectedAngle>
|
||||
<armorPenetration>1.0</armorPenetration>
|
||||
<soundCast>Shot_BeamRepeater</soundCast>
|
||||
<soundCastTail>GunTail_Medium</soundCastTail>
|
||||
<muzzleFlashScale>9</muzzleFlashScale>
|
||||
<targetParams>
|
||||
<canTargetLocations>true</canTargetLocations>
|
||||
</targetParams>
|
||||
<isConductible>True</isConductible>
|
||||
<conductFriendly>False</conductFriendly>
|
||||
<conductNum>4</conductNum>
|
||||
<beamMoteDef>WULA_ArcBeam</beamMoteDef>
|
||||
</li>
|
||||
</verbs>
|
||||
<tradeability>None</tradeability>
|
||||
</ThingDef>
|
||||
|
||||
<ThingDef ParentName="MoteBase">
|
||||
<defName>WULA_ArcBeam</defName>
|
||||
<thingClass>MoteDualAttached</thingClass>
|
||||
<altitudeLayer>MoteOverhead</altitudeLayer>
|
||||
<mote>
|
||||
<fadeInTime>0</fadeInTime>
|
||||
<fadeOutTime>0.4</fadeOutTime>
|
||||
<solidTime>0.4</solidTime>
|
||||
<needsMaintenance>False</needsMaintenance>
|
||||
<rotateTowardsTarget>True</rotateTowardsTarget>
|
||||
<scaleToConnectTargets>True</scaleToConnectTargets>
|
||||
<fadeOutUnmaintained>False</fadeOutUnmaintained>
|
||||
</mote>
|
||||
<drawOffscreen>true</drawOffscreen>
|
||||
<graphicData>
|
||||
<texPath>Things/Mote/GraserBeam</texPath>
|
||||
<color>(188, 112, 255, 255)</color>
|
||||
<graphicClass>Graphic_MoteWithAgeSecs</graphicClass>
|
||||
<shaderType>MoteBeam</shaderType>
|
||||
<shaderParameters>
|
||||
<_ExtraTexA>/Things/Mote/BeamSecondaryNoise_A</_ExtraTexA>
|
||||
<_ExtraTexB>/Things/Mote/BeamSecondaryNoise_B</_ExtraTexB>
|
||||
<_ScrollSpeedA>-4 </_ScrollSpeedA>
|
||||
<_ScrollSpeedB>3</_ScrollSpeedB>
|
||||
<_Intensity>2</_Intensity>
|
||||
</shaderParameters>
|
||||
</graphicData>
|
||||
</ThingDef>
|
||||
</Defs>
|
||||
Binary file not shown.
@@ -3,13 +3,17 @@
|
||||
"WorkspaceRootPath": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|c:\\steam\\steamapps\\common\\rimworld\\mods\\3516260226\\source\\wulafallenempire\\verb\\trackingbullet.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|solutionrelative:verb\\trackingbullet.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
"AbsoluteMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|c:\\steam\\steamapps\\common\\rimworld\\mods\\3516260226\\source\\wulafallenempire\\verb\\shootarc.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|solutionrelative:verb\\shootarc.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\verb\\propershotgun.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|solutionrelative:verb\\propershotgun.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|c:\\steam\\steamapps\\common\\rimworld\\mods\\3516260226\\source\\wulafallenempire\\verb\\trackingbullet.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|solutionrelative:verb\\trackingbullet.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\Verb\\VerbPropertiesExplosiveBeam.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Verb\\VerbPropertiesExplosiveBeam.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
@@ -59,6 +63,19 @@
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "ShootArc.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\Verb\\ShootArc.cs",
|
||||
"RelativeDocumentMoniker": "Verb\\ShootArc.cs",
|
||||
"ToolTip": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\Verb\\ShootArc.cs",
|
||||
"RelativeToolTip": "Verb\\ShootArc.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAwAAAAFAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-08-01T04:09:11.909Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "Trackingbullet.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\Verb\\Trackingbullet.cs",
|
||||
"RelativeDocumentMoniker": "Verb\\Trackingbullet.cs",
|
||||
@@ -77,13 +94,14 @@
|
||||
"RelativeDocumentMoniker": "Verb\\ProperShotgun.cs",
|
||||
"ToolTip": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\Verb\\ProperShotgun.cs",
|
||||
"RelativeToolTip": "Verb\\ProperShotgun.cs",
|
||||
"ViewState": "AQIAABUAAAAAAAAAAAAIwAgAAAAaAAAA",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAgAAAAaAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-07-31T17:19:04.819Z"
|
||||
"WhenOpened": "2025-07-31T17:19:04.819Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"DocumentIndex": 3,
|
||||
"Title": "VerbPropertiesExplosiveBeam.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\Verb\\VerbPropertiesExplosiveBeam.cs",
|
||||
"RelativeDocumentMoniker": "Verb\\VerbPropertiesExplosiveBeam.cs",
|
||||
@@ -95,7 +113,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 9,
|
||||
"DocumentIndex": 10,
|
||||
"Title": "Verb_ShootBeamExplosive.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\Verb\\Verb_ShootBeamExplosive.cs",
|
||||
"RelativeDocumentMoniker": "Verb\\Verb_ShootBeamExplosive.cs",
|
||||
@@ -107,7 +125,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 7,
|
||||
"DocumentIndex": 8,
|
||||
"Title": "Effect.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\EventSystem\\Effect.cs",
|
||||
"RelativeDocumentMoniker": "EventSystem\\Effect.cs",
|
||||
@@ -119,7 +137,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 5,
|
||||
"DocumentIndex": 6,
|
||||
"Title": "CompOpenCustomUI.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\EventSystem\\CompOpenCustomUI.cs",
|
||||
"RelativeDocumentMoniker": "EventSystem\\CompOpenCustomUI.cs",
|
||||
@@ -131,7 +149,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"DocumentIndex": 4,
|
||||
"Title": "Dialog_CustomDisplay.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\EventSystem\\Dialog_CustomDisplay.cs",
|
||||
"RelativeDocumentMoniker": "EventSystem\\Dialog_CustomDisplay.cs",
|
||||
@@ -143,7 +161,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 6,
|
||||
"DocumentIndex": 7,
|
||||
"Title": "DebugActions.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\EventSystem\\DebugActions.cs",
|
||||
"RelativeDocumentMoniker": "EventSystem\\DebugActions.cs",
|
||||
@@ -155,7 +173,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 8,
|
||||
"DocumentIndex": 9,
|
||||
"Title": "CustomUIDef.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\EventSystem\\CustomUIDef.cs",
|
||||
"RelativeDocumentMoniker": "EventSystem\\CustomUIDef.cs",
|
||||
@@ -167,7 +185,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"DocumentIndex": 5,
|
||||
"Title": "Condition.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\EventSystem\\Condition.cs",
|
||||
"RelativeDocumentMoniker": "EventSystem\\Condition.cs",
|
||||
|
||||
486
Source/WulaFallenEmpire/Verb/ShootArc.cs
Normal file
486
Source/WulaFallenEmpire/Verb/ShootArc.cs
Normal file
@@ -0,0 +1,486 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RimWorld;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
using Verse.Sound;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
public class VerbProperties_Arc : VerbProperties
|
||||
{
|
||||
public DamageDef damageDef;
|
||||
|
||||
public float EMPDamageAmount = -1f;
|
||||
|
||||
public int damageAmount = -1;
|
||||
|
||||
public float armorPenetration = -1f;
|
||||
|
||||
public float affectedAngle;
|
||||
|
||||
public bool isConductible = false;
|
||||
|
||||
public int conductNum;
|
||||
|
||||
public bool conductFriendly = false;
|
||||
}
|
||||
|
||||
public class Verb_ShootArc : Verb
|
||||
{
|
||||
private VerbProperties_Arc Props
|
||||
{
|
||||
get
|
||||
{
|
||||
return (VerbProperties_Arc)this.verbProps;
|
||||
}
|
||||
}
|
||||
|
||||
private int damageAmount
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.Props.damageAmount > 0) ? this.Props.damageAmount : this.verbProps.beamDamageDef.defaultDamage;
|
||||
}
|
||||
}
|
||||
|
||||
private float armorPenetration
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.Props.armorPenetration > 0f) ? this.Props.armorPenetration : this.verbProps.beamDamageDef.defaultArmorPenetration;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WarmupComplete()
|
||||
{
|
||||
this.TryCastShot();
|
||||
}
|
||||
|
||||
protected override bool TryCastShot()
|
||||
{
|
||||
this.MakeExplosion();
|
||||
bool flag = this.verbProps.soundCast != null;
|
||||
bool flag3 = flag;
|
||||
if (flag3)
|
||||
{
|
||||
this.verbProps.soundCast.PlayOneShot(new TargetInfo(this.caster.Position, this.caster.MapHeld, false));
|
||||
}
|
||||
bool flag2 = this.verbProps.soundCastTail != null;
|
||||
bool flag4 = flag2;
|
||||
if (flag4)
|
||||
{
|
||||
this.verbProps.soundCastTail.PlayOneShotOnCamera(this.caster.Map);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsTargetImmobile(LocalTargetInfo target)
|
||||
{
|
||||
Thing thing = target.Thing;
|
||||
Pawn pawn = thing as Pawn;
|
||||
return pawn != null && !pawn.Downed && pawn.GetPosture() == PawnPosture.Standing;
|
||||
}
|
||||
|
||||
public override bool CanHitTarget(LocalTargetInfo targ)
|
||||
{
|
||||
bool flag = this.caster == null || !this.caster.Spawned;
|
||||
bool flag2 = flag;
|
||||
return !flag2 && (targ == this.caster || this.CanHitTargetFrom(this.caster.Position, targ));
|
||||
}
|
||||
|
||||
protected void MakeExplosion()
|
||||
{
|
||||
Pawn casterPawn = this.CasterPawn;
|
||||
bool spawned = casterPawn.Spawned;
|
||||
bool flag11 = spawned;
|
||||
if (flag11)
|
||||
{
|
||||
Thing targetThing = this.currentTarget.Thing;
|
||||
bool flag = targetThing != null && this.IsTargetImmobile(this.currentTarget) && casterPawn.skills != null;
|
||||
bool flag12 = flag;
|
||||
if (flag12)
|
||||
{
|
||||
casterPawn.skills.Learn(SkillDefOf.Shooting, 250f * this.verbProps.AdjustedFullCycleTime(this, casterPawn), false, false);
|
||||
}
|
||||
bool flag2 = this.Props != null;
|
||||
bool flag13 = flag2;
|
||||
if (flag13)
|
||||
{
|
||||
List<IntVec3> cells = Verb_ShootArc.circularSectorCellsStartedCaster(casterPawn.Position, casterPawn.Map, this.currentTarget.Cell, this.Props.range, this.Props.affectedAngle, false).ToList<IntVec3>();
|
||||
HashSet<IntVec3> hashSet = this.HashSetConverter(cells);
|
||||
this.pawnConduct.Add(casterPawn);
|
||||
float weaponDamageMultiplier = base.EquipmentSource.GetStatValue(StatDefOf.RangedWeapon_DamageMultiplier, true, -1);
|
||||
int damageMultiplier = this.GetDamageAmount(weaponDamageMultiplier, null);
|
||||
float armorPenetrationMultiplier = this.GetArmorPenetration(weaponDamageMultiplier, null);
|
||||
foreach (IntVec3 cell in hashSet)
|
||||
{
|
||||
List<Thing> list = casterPawn.Map.thingGrid.ThingsListAt(cell);
|
||||
for (int num = list.Count - 1; num >= 0; num--)
|
||||
{
|
||||
if (list[num] is Pawn p)
|
||||
{
|
||||
// 新增友方过滤逻辑
|
||||
bool isFriendly = p.Faction != null
|
||||
&& casterPawn.Faction != null
|
||||
&& !p.Faction.HostileTo(casterPawn.Faction);
|
||||
|
||||
if (!Props.conductFriendly && isFriendly)
|
||||
{
|
||||
continue; // 跳过友方目标
|
||||
}
|
||||
|
||||
// 原有姿势检查
|
||||
bool isInvalidPosture = p.GetPosture() != PawnPosture.Standing
|
||||
&& this.currentTarget.Thing != p;
|
||||
|
||||
if (!isInvalidPosture)
|
||||
{
|
||||
this.pawnConduct.Add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bool isConductible = this.Props.isConductible;
|
||||
bool flag17 = isConductible;
|
||||
if (flag17)
|
||||
{
|
||||
for (int i = 0; i < this.Props.conductNum; i++)
|
||||
{
|
||||
bool flag6 = i > this.pawnConduct.Count - 2;
|
||||
bool flag18 = flag6;
|
||||
if (flag18)
|
||||
{
|
||||
break;
|
||||
}
|
||||
bool flag7 = this.Props.EMPDamageAmount > 0f;
|
||||
bool flag19 = flag7;
|
||||
if (flag19)
|
||||
{
|
||||
this.TargetTakeDamage(casterPawn, this.pawnConduct[i + 1], DamageDefOf.EMP, this.Props.EMPDamageAmount, -1f);
|
||||
}
|
||||
this.TargetTakeDamage(casterPawn, this.pawnConduct[i + 1], this.Props.damageDef, (float)damageMultiplier, armorPenetrationMultiplier);
|
||||
bool flag8 = this.verbProps.beamMoteDef != null;
|
||||
bool flag20 = flag8;
|
||||
if (flag20)
|
||||
{
|
||||
MoteMaker.MakeInteractionOverlay(this.verbProps.beamMoteDef, new TargetInfo(this.pawnConduct[i].Position, this.caster.Map, false), new TargetInfo(this.pawnConduct[i + 1].Position, this.caster.Map, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IntVec3 position = this.caster.Position;
|
||||
float num2 = Mathf.Atan2(-(float)(this.currentTarget.Cell.z - position.z), (float)(this.currentTarget.Cell.x - position.x)) * 57.29578f;
|
||||
bool flag9 = num2 - this.Props.affectedAngle < -180f || num2 + this.Props.affectedAngle > 180f;
|
||||
bool flag21 = flag9;
|
||||
if (flag21)
|
||||
{
|
||||
FloatRange? affectedAngle = new FloatRange?(new FloatRange(Verb_ShootArc.AngleWrapped(num2 - this.Props.affectedAngle), 180f));
|
||||
// 修正后的爆炸调用(参数通过命名对齐)
|
||||
GenExplosion.DoExplosion(
|
||||
center: casterPawn.Position,
|
||||
map: this.caster.MapHeld,
|
||||
radius: this.verbProps.range,
|
||||
damType: this.Props.damageDef,
|
||||
instigator: null,
|
||||
damAmount: damageMultiplier,
|
||||
armorPenetration: armorPenetrationMultiplier,
|
||||
explosionSound: null,
|
||||
weapon: this.CasterPawn.equipment.Primary.def,
|
||||
projectile: null,
|
||||
intendedTarget: null,
|
||||
postExplosionSpawnThingDef: ThingDefOf.Filth_FlammableBile,
|
||||
postExplosionSpawnChance: 0f,
|
||||
postExplosionSpawnThingCount: 1,
|
||||
postExplosionGasType: null,
|
||||
postExplosionGasRadiusOverride: null,
|
||||
postExplosionGasAmount: 0,
|
||||
applyDamageToExplosionCellsNeighbors: false,
|
||||
preExplosionSpawnThingDef: null,
|
||||
preExplosionSpawnChance: 0f,
|
||||
preExplosionSpawnThingCount: 1,
|
||||
chanceToStartFire: 0f,
|
||||
damageFalloff: false,
|
||||
direction: null,
|
||||
ignoredThings: null,
|
||||
affectedAngle: affectedAngle,
|
||||
doVisualEffects: true,
|
||||
propagationSpeed: 0.6f,
|
||||
excludeRadius: 0f,
|
||||
doSoundEffects: false,
|
||||
postExplosionSpawnThingDefWater: null,
|
||||
screenShakeFactor: 1f,
|
||||
flammabilityChanceCurve: null,
|
||||
overrideCells: null,
|
||||
postExplosionSpawnSingleThingDef: null,
|
||||
preExplosionSpawnSingleThingDef: null
|
||||
);
|
||||
|
||||
affectedAngle = new FloatRange?(new FloatRange(-180f, Verb_ShootArc.AngleWrapped(num2 + this.Props.affectedAngle)));
|
||||
// 第二次爆炸调用(参数结构相同)
|
||||
GenExplosion.DoExplosion(
|
||||
center: casterPawn.Position,
|
||||
map: this.caster.MapHeld,
|
||||
radius: this.verbProps.range,
|
||||
damType: this.Props.damageDef,
|
||||
instigator: null,
|
||||
damAmount: damageMultiplier,
|
||||
armorPenetration: armorPenetrationMultiplier,
|
||||
explosionSound: null,
|
||||
weapon: this.CasterPawn.equipment.Primary.def,
|
||||
projectile: null,
|
||||
intendedTarget: null,
|
||||
postExplosionSpawnThingDef: ThingDefOf.Filth_FlammableBile,
|
||||
postExplosionSpawnChance: 0f,
|
||||
postExplosionSpawnThingCount: 1,
|
||||
postExplosionGasType: null,
|
||||
postExplosionGasRadiusOverride: null,
|
||||
postExplosionGasAmount: 0,
|
||||
applyDamageToExplosionCellsNeighbors: false,
|
||||
preExplosionSpawnThingDef: null,
|
||||
preExplosionSpawnChance: 0f,
|
||||
preExplosionSpawnThingCount: 1,
|
||||
chanceToStartFire: 0f,
|
||||
damageFalloff: false,
|
||||
direction: null,
|
||||
ignoredThings: null,
|
||||
affectedAngle: affectedAngle,
|
||||
doVisualEffects: true,
|
||||
propagationSpeed: 0.6f,
|
||||
excludeRadius: 0f,
|
||||
doSoundEffects: false,
|
||||
postExplosionSpawnThingDefWater: null,
|
||||
screenShakeFactor: 1f,
|
||||
flammabilityChanceCurve: null,
|
||||
overrideCells: null,
|
||||
postExplosionSpawnSingleThingDef: null,
|
||||
preExplosionSpawnSingleThingDef: null
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FloatRange? affectedAngle2 = new FloatRange?(new FloatRange(num2 - this.Props.affectedAngle, num2 + this.Props.affectedAngle));
|
||||
GenExplosion.DoExplosion(
|
||||
center: casterPawn.Position,
|
||||
map: this.caster.MapHeld,
|
||||
radius: this.verbProps.range,
|
||||
damType: this.Props.damageDef,
|
||||
instigator: null,
|
||||
damAmount: damageMultiplier,
|
||||
armorPenetration: armorPenetrationMultiplier,
|
||||
explosionSound: null,
|
||||
weapon: this.CasterPawn.equipment.Primary.def,
|
||||
projectile: null,
|
||||
intendedTarget: null,
|
||||
postExplosionSpawnThingDef: ThingDefOf.Filth_FlammableBile,
|
||||
postExplosionSpawnChance: 0f,
|
||||
postExplosionSpawnThingCount: 1,
|
||||
postExplosionGasType: null,
|
||||
postExplosionGasRadiusOverride: null,
|
||||
postExplosionGasAmount: 0,
|
||||
applyDamageToExplosionCellsNeighbors: false,
|
||||
preExplosionSpawnThingDef: null,
|
||||
preExplosionSpawnChance: 0f,
|
||||
preExplosionSpawnThingCount: 1,
|
||||
chanceToStartFire: 0f,
|
||||
damageFalloff: false,
|
||||
direction: null,
|
||||
ignoredThings: null,
|
||||
affectedAngle: affectedAngle2,
|
||||
doVisualEffects: true,
|
||||
propagationSpeed: 0.6f,
|
||||
excludeRadius: 0f,
|
||||
doSoundEffects: false,
|
||||
postExplosionSpawnThingDefWater: null,
|
||||
screenShakeFactor: 1f,
|
||||
flammabilityChanceCurve: null,
|
||||
overrideCells: null,
|
||||
postExplosionSpawnSingleThingDef: null,
|
||||
preExplosionSpawnSingleThingDef: null
|
||||
);
|
||||
}
|
||||
for (int j = 1; j < this.pawnConduct.Count<Pawn>(); j++)
|
||||
{
|
||||
bool flag10 = this.Props.EMPDamageAmount > 0f;
|
||||
bool flag22 = flag10;
|
||||
if (flag22)
|
||||
{
|
||||
this.TargetTakeDamage(casterPawn, this.pawnConduct[j], DamageDefOf.EMP, this.Props.EMPDamageAmount, -1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.pawnConduct.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void DrawHighlight(LocalTargetInfo target)
|
||||
{
|
||||
base.DrawHighlight(target);
|
||||
bool isValid = target.IsValid;
|
||||
bool flag = isValid;
|
||||
if (flag)
|
||||
{
|
||||
IntVec3 position = this.caster.Position;
|
||||
float num = Mathf.Atan2(-(float)(target.Cell.z - position.z), (float)(target.Cell.x - position.x)) * 57.29578f;
|
||||
Verb_ShootArc.RenderPredictedAreaOfEffect(this.caster.Position, this.Props.range, this.verbProps.explosionRadiusRingColor, new FloatRange(num - this.Props.affectedAngle, num + this.Props.affectedAngle));
|
||||
}
|
||||
}
|
||||
|
||||
public static void RenderPredictedAreaOfEffect(IntVec3 loc, float radius, Color color, FloatRange affectedAngle)
|
||||
{
|
||||
bool flag = affectedAngle.min < -180f || affectedAngle.max > 180f;
|
||||
bool flag2 = flag;
|
||||
List<IntVec3> cellsSum;
|
||||
if (flag2)
|
||||
{
|
||||
DamageWorker worker = DamageDefOf.Bomb.Worker;
|
||||
Map currentMap = Find.CurrentMap;
|
||||
FloatRange? affectedAngle2 = new FloatRange?(new FloatRange(Verb_ShootArc.AngleWrapped(affectedAngle.min), 180f));
|
||||
List<IntVec3> cells = worker.ExplosionCellsToHit(loc, currentMap, radius, null, null, affectedAngle2).ToList<IntVec3>();
|
||||
DamageWorker worker2 = DamageDefOf.Bomb.Worker;
|
||||
Map currentMap2 = Find.CurrentMap;
|
||||
affectedAngle2 = new FloatRange?(new FloatRange(-180f, Verb_ShootArc.AngleWrapped(affectedAngle.max)));
|
||||
List<IntVec3> cells2 = worker2.ExplosionCellsToHit(loc, currentMap2, radius, null, null, affectedAngle2).ToList<IntVec3>();
|
||||
cellsSum = cells.Concat(cells2).ToList<IntVec3>();
|
||||
}
|
||||
else
|
||||
{
|
||||
DamageWorker worker3 = DamageDefOf.Bomb.Worker;
|
||||
Map currentMap3 = Find.CurrentMap;
|
||||
FloatRange? affectedAngle3 = new FloatRange?(affectedAngle);
|
||||
cellsSum = worker3.ExplosionCellsToHit(loc, currentMap3, radius, null, null, affectedAngle3).ToList<IntVec3>();
|
||||
}
|
||||
GenDraw.DrawFieldEdges(cellsSum, color, null);
|
||||
}
|
||||
|
||||
public static float AngleWrapped(float angle)
|
||||
{
|
||||
while (angle > 180f)
|
||||
{
|
||||
angle -= 360f;
|
||||
}
|
||||
while (angle < -180f)
|
||||
{
|
||||
angle += 360f;
|
||||
}
|
||||
return (angle == 180f) ? -180f : angle;
|
||||
}
|
||||
|
||||
private static IEnumerable<IntVec3> circularSectorCellsStartedCaster(IntVec3 center, Map map, IntVec3 target, float radius, float angle, bool useCenter = false)
|
||||
{
|
||||
float num = Mathf.Atan2(-(float)(target.z - center.z), (float)(target.x - center.x)) * 57.29578f;
|
||||
FloatRange affectedAngle = new FloatRange(num - angle, num + angle);
|
||||
bool flag = affectedAngle.min < -180f || affectedAngle.max > 180f;
|
||||
bool flag2 = flag;
|
||||
List<IntVec3> cellsSum;
|
||||
if (flag2)
|
||||
{
|
||||
DamageWorker worker = DamageDefOf.Bomb.Worker;
|
||||
FloatRange? affectedAngle2 = new FloatRange?(new FloatRange(Verb_ShootArc.AngleWrapped(affectedAngle.min), 180f));
|
||||
List<IntVec3> cells = worker.ExplosionCellsToHit(center, map, radius, null, null, affectedAngle2).ToList<IntVec3>();
|
||||
DamageWorker worker2 = DamageDefOf.Bomb.Worker;
|
||||
affectedAngle2 = new FloatRange?(new FloatRange(-180f, Verb_ShootArc.AngleWrapped(affectedAngle.max)));
|
||||
List<IntVec3> cells2 = worker2.ExplosionCellsToHit(center, map, radius, null, null, affectedAngle2).ToList<IntVec3>();
|
||||
cellsSum = cells.Concat(cells2).ToList<IntVec3>();
|
||||
}
|
||||
else
|
||||
{
|
||||
DamageWorker worker3 = DamageDefOf.Bomb.Worker;
|
||||
FloatRange? affectedAngle3 = new FloatRange?(affectedAngle);
|
||||
cellsSum = worker3.ExplosionCellsToHit(center, map, radius, null, null, affectedAngle3).ToList<IntVec3>();
|
||||
}
|
||||
return cellsSum;
|
||||
}
|
||||
|
||||
protected virtual HashSet<IntVec3> HashSetConverter(IEnumerable<IntVec3> points)
|
||||
{
|
||||
HashSet<IntVec3> hashSet = new HashSet<IntVec3>();
|
||||
bool flag = points.Any<IntVec3>();
|
||||
bool flag2 = flag;
|
||||
if (flag2)
|
||||
{
|
||||
foreach (IntVec3 point in points)
|
||||
{
|
||||
hashSet.Add(point);
|
||||
}
|
||||
}
|
||||
return hashSet;
|
||||
}
|
||||
|
||||
private void TargetTakeDamage(Pawn caster, Pawn target, DamageDef damageDef, float damageAmount, float armorPenetration = -1f)
|
||||
{
|
||||
bool flag = caster == null || target == null;
|
||||
bool flag2 = flag;
|
||||
if (flag2)
|
||||
{
|
||||
Log.Error("TargetTakeDamage has null caster or target");
|
||||
}
|
||||
else
|
||||
{
|
||||
float angleFlat = (this.currentTarget.Cell - caster.Position).AngleFlat;
|
||||
BattleLogEntry_RangedImpact log = new BattleLogEntry_RangedImpact(caster, target, this.currentTarget.Thing, base.EquipmentSource.def, null, null);
|
||||
DamageInfo dinfo = new DamageInfo(damageDef, damageAmount, armorPenetration, angleFlat, caster, null, base.EquipmentSource.def, DamageInfo.SourceCategory.ThingOrUnknown, this.currentTarget.Thing, true, true, QualityCategory.Normal, true);
|
||||
target.TakeDamage(dinfo).AssociateWithLog(log);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetDamageAmount(float weaponDamageMultiplier, StringBuilder explanation = null)
|
||||
{
|
||||
int num = this.damageAmount;
|
||||
bool flag = explanation != null;
|
||||
bool flag3 = flag;
|
||||
if (flag3)
|
||||
{
|
||||
explanation.AppendLine("StatsReport_BaseValue".Translate() + ": " + num.ToString());
|
||||
explanation.Append("StatsReport_QualityMultiplier".Translate() + ": " + weaponDamageMultiplier.ToStringPercent());
|
||||
}
|
||||
num = Mathf.RoundToInt((float)num * weaponDamageMultiplier);
|
||||
bool flag2 = explanation != null;
|
||||
bool flag4 = flag2;
|
||||
if (flag4)
|
||||
{
|
||||
explanation.AppendLine();
|
||||
explanation.AppendLine();
|
||||
explanation.Append("StatsReport_FinalValue".Translate() + ": " + num.ToString());
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public float GetArmorPenetration(float weaponDamageMultiplier, StringBuilder explanation = null)
|
||||
{
|
||||
float num = this.armorPenetration;
|
||||
bool flag = num < 0f;
|
||||
bool flag4 = flag;
|
||||
if (flag4)
|
||||
{
|
||||
num = (float)this.damageAmount * 0.015f;
|
||||
}
|
||||
bool flag2 = explanation != null;
|
||||
bool flag5 = flag2;
|
||||
if (flag5)
|
||||
{
|
||||
explanation.AppendLine("StatsReport_BaseValue".Translate() + ": " + num.ToStringPercent());
|
||||
explanation.AppendLine();
|
||||
explanation.Append("StatsReport_QualityMultiplier".Translate() + ": " + weaponDamageMultiplier.ToStringPercent());
|
||||
}
|
||||
num *= weaponDamageMultiplier;
|
||||
bool flag3 = explanation != null;
|
||||
bool flag6 = flag3;
|
||||
if (flag6)
|
||||
{
|
||||
explanation.AppendLine();
|
||||
explanation.AppendLine();
|
||||
explanation.Append("StatsReport_FinalValue".Translate() + ": " + num.ToStringPercent());
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public List<Pawn> pawnConduct = new List<Pawn>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
<Compile Include="CompApparelInterceptor.cs" />
|
||||
<Compile Include="SectionLayer_WulaHull.cs" />
|
||||
<Compile Include="HediffComp_RegenerateBackstory.cs" />
|
||||
<Compile Include="Verb\ShootArc.cs" />
|
||||
<Compile Include="WulaFallenEmpireMod.cs" />
|
||||
<Compile Include="Need_WulaEnergy.cs" />
|
||||
<Compile Include="NeedDefExtension_Energy.cs" />
|
||||
|
||||
Reference in New Issue
Block a user