zc
This commit is contained in:
Binary file not shown.
@@ -14,9 +14,14 @@
|
||||
<guardianProps Class="ArachnaeSwarm.CompProperties_GuardianPsyField">
|
||||
<!-- Basic functionality -->
|
||||
<radius>5.9</radius>
|
||||
<hitPoints>150</hitPoints>
|
||||
<hitPoints>1500</hitPoints>
|
||||
<rechargeDelay>3200</rechargeDelay>
|
||||
<rechargeHitPointsIntervalTicks>60</rechargeHitPointsIntervalTicks>
|
||||
|
||||
<!-- Psyfocus/Entropy Mechanics -->
|
||||
<psyfocusCostForFullRecharge>0.5</psyfocusCostForFullRecharge> <!-- 50% of max psyfocus -->
|
||||
<entropyGainPerDamage>0.1</entropyGainPerDamage> <!-- 1 entropy per 2 damage -->
|
||||
<hitPointsPctPerInterval>0.01</hitPointsPctPerInterval> <!-- Restore 1% of max HP per interval -->
|
||||
|
||||
<!-- Interception types -->
|
||||
<interceptGroundProjectiles>true</interceptGroundProjectiles>
|
||||
|
||||
@@ -13,6 +13,11 @@ namespace ArachnaeSwarm
|
||||
public int rechargeDelay = 3200; // Ticks after breaking
|
||||
public int rechargeHitPointsIntervalTicks = 60; // Ticks to restore 1 HP
|
||||
|
||||
// New properties for psyfocus/entropy mechanics
|
||||
public float psyfocusCostForFullRecharge = 0.5f; // 50% psyfocus cost
|
||||
public float entropyGainPerDamage = 0.5f; // 1 entropy per 2 damage
|
||||
public float hitPointsPctPerInterval = 0.01f; // Restore 1% of max HP per interval
|
||||
|
||||
public bool interceptGroundProjectiles = true;
|
||||
public bool interceptAirProjectiles = true;
|
||||
public bool interceptNonHostileProjectiles = false;
|
||||
@@ -36,6 +41,7 @@ namespace ArachnaeSwarm
|
||||
private int lastInterceptTicks = -999999;
|
||||
private int ticksToReset = 0; // Cooldown timer
|
||||
public int currentHitPoints;
|
||||
private bool wasNotAtFullHp = false; // Tracks if shield was damaged before recharge
|
||||
|
||||
// --- Properties ---
|
||||
public CompProperties_GuardianPsyField Props => (CompProperties_GuardianPsyField)props;
|
||||
@@ -86,9 +92,24 @@ namespace ArachnaeSwarm
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
else if (currentHitPoints < HitPointsMax && this.parent.IsHashIntervalTick(Props.rechargeHitPointsIntervalTicks))
|
||||
else if (currentHitPoints < HitPointsMax)
|
||||
{
|
||||
currentHitPoints++;
|
||||
wasNotAtFullHp = true; // Mark that the shield was damaged
|
||||
if(this.parent.IsHashIntervalTick(Props.rechargeHitPointsIntervalTicks))
|
||||
{
|
||||
currentHitPoints += (int)(HitPointsMax * Props.hitPointsPctPerInterval);
|
||||
if(currentHitPoints > HitPointsMax) currentHitPoints = HitPointsMax;
|
||||
}
|
||||
}
|
||||
else if (wasNotAtFullHp && currentHitPoints >= HitPointsMax)
|
||||
{
|
||||
// Shield just reached full charge
|
||||
wasNotAtFullHp = false;
|
||||
if (PawnOwner.psychicEntropy != null && Props.psyfocusCostForFullRecharge > 0)
|
||||
{
|
||||
float maxPsyfocus = PawnOwner.GetStatValue(StatDefOf.PsychicEntropyMax);
|
||||
PawnOwner.psychicEntropy.OffsetPsyfocusDirectly(-maxPsyfocus * Props.psyfocusCostForFullRecharge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,10 +125,19 @@ namespace ArachnaeSwarm
|
||||
// --- Interception Success ---
|
||||
lastInterceptTicks = Find.TickManager.TicksGame;
|
||||
|
||||
Props.interceptEffecter?.Spawn(PawnOwner.Position, PawnOwner.Map).Cleanup();
|
||||
// Spawn effect at the point of interception, not the shield center
|
||||
Props.interceptEffecter?.Spawn(projectile.ExactPosition.ToIntVec3(), PawnOwner.Map).Cleanup();
|
||||
|
||||
float damageAmount = projectile.DamageAmount;
|
||||
|
||||
// Add entropy based on damage
|
||||
if (PawnOwner.psychicEntropy != null && Props.entropyGainPerDamage > 0)
|
||||
{
|
||||
PawnOwner.psychicEntropy.TryAddEntropy(damageAmount * Props.entropyGainPerDamage, overLimit: true);
|
||||
}
|
||||
|
||||
// Consume Hitpoints
|
||||
currentHitPoints -= (int)projectile.DamageAmount;
|
||||
currentHitPoints -= (int)damageAmount;
|
||||
if (currentHitPoints <= 0)
|
||||
{
|
||||
Break();
|
||||
|
||||
Reference in New Issue
Block a user