暂存
This commit is contained in:
Binary file not shown.
76
1.6/1.6/Defs/AbilityDefs/Ability_Morph.xml
Normal file
76
1.6/1.6/Defs/AbilityDefs/Ability_Morph.xml
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
|
||||
<!-- 变形技能的定义 -->
|
||||
<AbilityDef>
|
||||
<defName>ARA_Ability_Morph</defName>
|
||||
<label>变形</label>
|
||||
<description>将自己转换为一个坚固的静态建筑形态,或从建筑形态恢复。</description>
|
||||
<iconPath>UI/Commands/Attack</iconPath> <!-- TODO: 替换为你的图标路径 -->
|
||||
<cooldownTicksRange>600</cooldownTicksRange>
|
||||
<verbProperties>
|
||||
<verbClass>Verb_CastAbility</verbClass>
|
||||
<warmupTime>1.5</warmupTime>
|
||||
<range>0</range>
|
||||
<targetParams>
|
||||
<canTargetSelf>true</canTargetSelf>
|
||||
</targetParams>
|
||||
</verbProperties>
|
||||
<comps>
|
||||
<li Class="ArachnaeSwarm.CompProperties_AbilityTransform">
|
||||
<buildingDef>ARA_MorphableResearchBench</buildingDef>
|
||||
</li>
|
||||
</comps>
|
||||
</AbilityDef>
|
||||
|
||||
<ThingDef ParentName="BenchBase">
|
||||
<defName>ARA_MorphableResearchBench</defName>
|
||||
<label>阿拉克涅织域织座</label>
|
||||
<description>一个供阿拉克涅虫族进行研究的活体结构,可以让虫群尽情地探索变异和进化方向。</description>
|
||||
<thingClass>ArachnaeSwarm.Building_Morphable</thingClass>
|
||||
<size>(3,3)</size>
|
||||
<stuffCategories Inherit="False"/>
|
||||
<costStuffCount>0</costStuffCount>
|
||||
<minifiedDef Inherit="False"/>
|
||||
<thingCategories Inherit="False"/>
|
||||
<costList>
|
||||
<ARA_Carapace>50</ARA_Carapace>
|
||||
</costList>
|
||||
<graphicData>
|
||||
<texPath>ArachnaeSwarm/Building/ARA_ResearchBench</texPath>
|
||||
<graphicClass>Graphic_Multi</graphicClass>
|
||||
<shaderType>CutoutComplex</shaderType>
|
||||
<drawSize>(3,4.5)</drawSize>
|
||||
</graphicData>
|
||||
<castEdgeShadows>false</castEdgeShadows>
|
||||
<staticSunShadowHeight>0</staticSunShadowHeight>
|
||||
<altitudeLayer>Building</altitudeLayer>
|
||||
<passability>PassThroughOnly</passability>
|
||||
<terrainAffordanceNeeded>ARA_Creep</terrainAffordanceNeeded>
|
||||
<pathCost>50</pathCost>
|
||||
<statBases>
|
||||
<MaxHitPoints>250</MaxHitPoints>
|
||||
<WorkToBuild>2800</WorkToBuild>
|
||||
<Flammability>1.0</Flammability>
|
||||
</statBases>
|
||||
<placeWorkers>
|
||||
<li>PlaceWorker_PreventInteractionSpotOverlap</li>
|
||||
</placeWorkers>
|
||||
<fillPercent>0.8</fillPercent>
|
||||
<interactionCellOffset>(0,0,-1)</interactionCellOffset>
|
||||
<hasInteractionCell>true</hasInteractionCell>
|
||||
<uiOrder>2600</uiOrder>
|
||||
<surfaceType>Item</surfaceType>
|
||||
<building>
|
||||
<workTableRoomRole>Laboratory</workTableRoomRole>
|
||||
<workTableNotInRoomRoleFactor>0.8</workTableNotInRoomRoleFactor>
|
||||
</building>
|
||||
<comps Inherit="False">
|
||||
<li Class="CompProperties_ReportWorkSpeed">
|
||||
<workSpeedStat>ResearchSpeedFactor</workSpeedStat>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_Morphable" />
|
||||
</comps>
|
||||
</ThingDef>
|
||||
|
||||
</Defs>
|
||||
@@ -275,4 +275,32 @@
|
||||
<li>ArachnaeNode_spawnCategories_Facehugger</li>
|
||||
</spawnCategories>
|
||||
</AlienRace.AlienBackstoryDef>
|
||||
|
||||
<AlienRace.AlienBackstoryDef ParentName="ARA_BaseBackStory">
|
||||
<defName>Arachnae_Node_BS_Adult_NeuroSwarm</defName>
|
||||
<title>阿拉克涅织域种</title>
|
||||
<titleShort>织域种</titleShort>
|
||||
<description>[PAWN_nameDef]是一只阿拉克涅织域种督虫。织域种虽然受到女皇种监管,但仍然具有强大的高级智慧和自我意志,织域种之间能够构建一种高度互联的神经网络从而进行复杂的研究和计算工作,织域种进行计算工作时无法感知外界环境,因此她们是虫群的重要保护对象。</description>
|
||||
<slot>Adulthood</slot>
|
||||
<workDisables>
|
||||
<li>Cleaning</li>
|
||||
<!-- <li>Hauling</li> -->
|
||||
<li>Mining</li>
|
||||
<li>PlantWork</li>
|
||||
<li>Animals</li>
|
||||
<li>Hunting</li>
|
||||
<!-- <li>Crafting</li> -->
|
||||
<li>Cooking</li>
|
||||
<li>Constructing</li>
|
||||
<li>Caring</li>
|
||||
<!-- <li>Artistic</li> -->
|
||||
</workDisables>
|
||||
<skillGains>
|
||||
<Intellectual>10</Intellectual>
|
||||
</skillGains>
|
||||
|
||||
<spawnCategories>
|
||||
<li>ArachnaeNode_spawnCategories_NeuroSwarm</li>
|
||||
</spawnCategories>
|
||||
</AlienRace.AlienBackstoryDef>
|
||||
</Defs>
|
||||
@@ -251,12 +251,32 @@
|
||||
<li>ARA_BaseRace_Skyhive_Launcher</li>
|
||||
<li>ARA_Skyraider_jump</li>
|
||||
</abilities>
|
||||
<apparelTags>
|
||||
</apparelTags>
|
||||
<apparelMoney>0</apparelMoney>
|
||||
</PawnKindDef>
|
||||
<PawnKindDef ParentName="ArachnaeNodeABasePawnKind">
|
||||
<defName>ArachnaeNode_Race_NeuroSwarm</defName>
|
||||
<label>阿拉克涅织域种</label>
|
||||
<race>ArachnaeNode_Race_NeuroSwarm</race>
|
||||
<defaultFactionType>PlayerColony</defaultFactionType>
|
||||
<invNutrition>0</invNutrition>
|
||||
<backstoryFiltersOverride>
|
||||
<li>
|
||||
<categories>
|
||||
<li>ArachnaeNode_spawnCategoriesA</li>
|
||||
<li>ArachnaeNode_spawnCategories_NeuroSwarm</li>
|
||||
</categories>
|
||||
</li>
|
||||
</backstoryFiltersOverride>
|
||||
<abilities>
|
||||
<li>ARA_Ability_Morph</li>
|
||||
</abilities>
|
||||
<apparelTags>
|
||||
</apparelTags>
|
||||
<apparelMoney>0</apparelMoney>
|
||||
</PawnKindDef>
|
||||
|
||||
|
||||
<PawnKindDef Name="ARA_InsectKindBase" ParentName="AnimalKindBase" Abstract="True">
|
||||
<defaultFactionType>PlayerColony</defaultFactionType>
|
||||
|
||||
@@ -1289,4 +1289,73 @@
|
||||
<lifeExpectancy>5</lifeExpectancy>
|
||||
</race>
|
||||
</AlienRace.ThingDef_AlienRace>
|
||||
|
||||
<AlienRace.ThingDef_AlienRace ParentName="ARA_NodeBase">
|
||||
<defName>ArachnaeNode_Race_NeuroSwarm</defName>
|
||||
<label>阿拉克涅织域种</label>
|
||||
<description>阿拉克涅督虫之一,是阿拉克涅虫群中最为特殊的虫族,织域种虽然受到女皇种监管,但仍然具有强大的高级智慧和自我意志,织域种之间能够构建一种高度互联的神经网络从而进行复杂的研究和计算工作,织域种进行计算工作时无法感知外界环境,因此她们是虫群的重要保护对象。</description>
|
||||
<alienRace>
|
||||
<generalSettings>
|
||||
<!-- 各种零件定义 -->
|
||||
<alienPartGenerator>
|
||||
<!-- 额外身体部件 -->
|
||||
<bodyAddons>
|
||||
<li>
|
||||
<path>ArachnaeSwarm/Things/ARA_HiveNode/Addons/ArachnaeNode_Race_Addons_WeaponSmith</path>
|
||||
<inFrontOfBody>false</inFrontOfBody>
|
||||
<scaleWithPawnDrawsize>true</scaleWithPawnDrawsize>
|
||||
<offsets>
|
||||
<north>
|
||||
<layerOffset>-0.275</layerOffset>
|
||||
</north>
|
||||
</offsets>
|
||||
</li>
|
||||
</bodyAddons>
|
||||
</alienPartGenerator>
|
||||
</generalSettings>
|
||||
<raceRestriction>
|
||||
<onlyEatRaceRestrictedFood>true</onlyEatRaceRestrictedFood>
|
||||
</raceRestriction>
|
||||
</alienRace>
|
||||
<comps>
|
||||
</comps>
|
||||
|
||||
<!-- 基础属性设置 -->
|
||||
<statBases>
|
||||
<!-- 移动速度 -->
|
||||
<MoveSpeed>3.5</MoveSpeed>
|
||||
|
||||
<!-- <RestRateMultiplier>1</RestRateMultiplier> -->
|
||||
<!-- <HungerRateMultiplier>1</HungerRateMultiplier> -->
|
||||
<!-- <EatingSpeed>5</EatingSpeed> -->
|
||||
<MaxNutrition>2</MaxNutrition>
|
||||
|
||||
<CarryingCapacity>100</CarryingCapacity>
|
||||
<MeatAmount>40</MeatAmount>
|
||||
<LeatherAmount>10</LeatherAmount>
|
||||
|
||||
<MeleeDodgeChance>0.75</MeleeDodgeChance>
|
||||
<!-- <MeleeHitChance>1</MeleeHitChance> -->
|
||||
|
||||
<!-- <NegotiationAbility>1</NegotiationAbility> -->
|
||||
<!-- <SellPriceFactor>1</SellPriceFactor> -->
|
||||
<!-- <SocialImpact>1</SocialImpact> -->
|
||||
<!-- <TradePriceImprovement>0.5</TradePriceImprovement> -->
|
||||
|
||||
<!-- 自带的甲壳可以防御外部攻击 -->
|
||||
<ArmorRating_Blunt>0.1</ArmorRating_Blunt>
|
||||
<ArmorRating_Sharp>0.1</ArmorRating_Sharp>
|
||||
<ArmorRating_Heat>0.05</ArmorRating_Heat>
|
||||
|
||||
<MaxNutrition>1.26</MaxNutrition>
|
||||
</statBases>
|
||||
|
||||
<race>
|
||||
<!-- 身体类型 -->
|
||||
<body>ArachnaeWeaponSmith_Body</body>
|
||||
<baseBodySize>0.8</baseBodySize>
|
||||
<baseHealthScale>0.75</baseHealthScale>
|
||||
<lifeExpectancy>5</lifeExpectancy>
|
||||
</race>
|
||||
</AlienRace.ThingDef_AlienRace>
|
||||
</Defs>
|
||||
@@ -327,7 +327,7 @@
|
||||
<ThingDef ParentName="BenchBase">
|
||||
<defName>ARA_ResearchBench</defName>
|
||||
<label>阿拉克涅研究台</label>
|
||||
<description>一个供阿拉克涅女皇种和智囊种进行研究的活体结构,可以让虫群尽情地探索变异和进化方向。</description>
|
||||
<description>一个供阿拉克涅虫族进行研究的活体结构,可以让虫群尽情地探索变异和进化方向。</description>
|
||||
<thingClass>Building_ResearchBench</thingClass>
|
||||
<size>(3,3)</size>
|
||||
<stuffCategories Inherit="False"/>
|
||||
|
||||
@@ -5,23 +5,99 @@ namespace ArachnaeSwarm
|
||||
{
|
||||
public class Building_Morphable : Building
|
||||
{
|
||||
public override void Destroy(DestroyMode mode)
|
||||
private CompMorphable compMorphable;
|
||||
|
||||
public override void SpawnSetup(Map map, bool respawningAfterLoad)
|
||||
{
|
||||
var comp = this.GetComp<CompMorphable>();
|
||||
if (comp != null && comp.StoredPawn != null)
|
||||
base.SpawnSetup(map, respawningAfterLoad);
|
||||
this.compMorphable = GetComp<CompMorphable>();
|
||||
}
|
||||
|
||||
public override string Label
|
||||
{
|
||||
get
|
||||
{
|
||||
Pawn pawn = comp.StoredPawn;
|
||||
if (compMorphable?.StoredPawn != null)
|
||||
{
|
||||
return $"{base.Label} ({compMorphable.StoredPawn.LabelShort})";
|
||||
}
|
||||
return base.Label;
|
||||
}
|
||||
}
|
||||
|
||||
public override string GetInspectString()
|
||||
{
|
||||
string text = base.GetInspectString();
|
||||
if (compMorphable?.StoredPawn != null)
|
||||
{
|
||||
if (!text.NullOrEmpty())
|
||||
{
|
||||
text += "\n";
|
||||
}
|
||||
text += "StoredPawn".Translate() + ": " + compMorphable.StoredPawn.LabelShort;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
public override void PreApplyDamage(ref DamageInfo dinfo, out bool absorbed)
|
||||
{
|
||||
// 先让基类处理,我们不打断正常流程
|
||||
base.PreApplyDamage(ref dinfo, out absorbed);
|
||||
if (absorbed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果建筑即将被摧毁,则由Destroy方法处理,避免重复逻辑
|
||||
if (this.HitPoints - dinfo.Amount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (compMorphable?.StoredPawn != null)
|
||||
{
|
||||
Pawn pawn = compMorphable.StoredPawn;
|
||||
float damageProportion = dinfo.Amount / this.def.statBases.GetStatValueFromList(StatDefOf.MaxHitPoints, 500f);
|
||||
|
||||
// --- 立即强制解除变形 ---
|
||||
Map map = this.Map;
|
||||
IntVec3 position = this.Position;
|
||||
|
||||
// 在建筑消失前,先把Pawn生成出来
|
||||
// 1. 将Pawn放回地图
|
||||
GenSpawn.Spawn(pawn, position, map, WipeMode.Vanish);
|
||||
PawnComponentsUtility.AddComponentsForSpawn(pawn);
|
||||
|
||||
// 如果是被武力摧毁,给玩家一个提示
|
||||
if (mode == DestroyMode.KillFinalize)
|
||||
// 2. 对Pawn施加等比例伤害
|
||||
float pawnDamage = pawn.MaxHitPoints * damageProportion;
|
||||
DamageInfo pawnDinfo = new DamageInfo(dinfo.Def, pawnDamage, dinfo.ArmorPenetrationInt, dinfo.Angle, dinfo.Instigator, null, dinfo.Weapon, dinfo.Category, dinfo.IntendedTarget);
|
||||
pawn.TakeDamage(pawnDinfo);
|
||||
|
||||
Messages.Message("PawnTransformer_ForcedRevert".Translate(pawn.Named("PAWN")), pawn, MessageTypeDefOf.NegativeEvent);
|
||||
|
||||
// 3. 移除建筑
|
||||
// 注意:这里不调用base.Destroy(),以避免循环和重复的恢复逻辑
|
||||
this.Destroy(DestroyMode.Vanish);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Destroy(DestroyMode mode)
|
||||
{
|
||||
// 只有在建筑还存在于地图上时,才执行恢复逻辑
|
||||
if (this.Spawned)
|
||||
{
|
||||
if (compMorphable != null && compMorphable.StoredPawn != null)
|
||||
{
|
||||
Messages.Message("PawnTransformer_BuildingDestroyed".Translate(pawn.Named("PAWN"), this.Named("BUILDING")), pawn, MessageTypeDefOf.NegativeEvent);
|
||||
Pawn pawn = compMorphable.StoredPawn;
|
||||
Map map = this.Map;
|
||||
IntVec3 position = this.Position;
|
||||
|
||||
GenSpawn.Spawn(pawn, position, map, WipeMode.Vanish);
|
||||
PawnComponentsUtility.AddComponentsForSpawn(pawn);
|
||||
|
||||
if (mode == DestroyMode.KillFinalize)
|
||||
{
|
||||
Messages.Message("PawnTransformer_BuildingDestroyed".Translate(pawn.Named("PAWN"), this.Named("BUILDING")), pawn, MessageTypeDefOf.NegativeEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
base.Destroy(mode);
|
||||
|
||||
@@ -33,17 +33,6 @@ namespace ArachnaeSwarm
|
||||
Building building = (Building)GenSpawn.Spawn(Props.buildingDef, position, map, WipeMode.Vanish);
|
||||
building.SetFaction(pawn.Faction);
|
||||
|
||||
if (pawn.Name != null)
|
||||
{
|
||||
building.TryGetComp<CompAssignableToPawn>()?.TryAssignPawn(pawn);
|
||||
}
|
||||
|
||||
var container = building.GetComp<CompThingContainer>();
|
||||
if (container != null)
|
||||
{
|
||||
container.GetDirectlyHeldThings().TryAdd(pawn);
|
||||
}
|
||||
|
||||
var newMorphComp = building.GetComp<CompMorphable>();
|
||||
if (newMorphComp != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user