Skip to content

Commit

Permalink
Explosion damage and AP falloff tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
SamaelGray committed May 23, 2024
1 parent 83e3e05 commit 781e402
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Source/CombatExtended/CombatExtended/ExplosionCE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class ExplosionCE : Verse.Explosion
public bool radiusChange = false;
public bool toBeMerged = false;
private const int DamageAtEdge = 2; // Synch these with spreadsheet
private const float PenAtEdge = 0.6f;
private const float PressurePerDamage = 0.3f;
private const float PenAtEdge = 2;
private const float PressurePerDamage = 1.0f;
private const float MaxMergeTicks = 3f;
public const float MaxMergeRange = 3f; //merge within 3 tiles
public const bool MergeExplosions = false;
Expand Down Expand Up @@ -402,26 +402,26 @@ public override void ExposeData()
}

//New methods
public int GetDamageAmountAtCE(IntVec3 c) //t => t^(0.333f)
public int GetDamageAmountAtCE(IntVec3 c) //t => t^(2.0f)
{
if (!damageFalloff)
{
return damAmount;
}
var t = c.DistanceTo(Position) / radius;
t = Mathf.Pow(t, 0.333f);
t = Mathf.Pow(t, 2.0f);
return Mathf.Max(GenMath.RoundRandom(Mathf.Lerp((float)damAmount, DamageAtEdge, t)), 1);
}

public float GetArmorPenetrationAtCE(IntVec3 c) //t => t^(0.55f), penetrationAmount => damAmount * PressurePerDamage
public float GetArmorPenetrationAtCE(IntVec3 c) //t => t^(2.0f), penetrationAmount => damAmount * PressurePerDamage
{
var basePen = Mathf.Max(damAmount * PressurePerDamage, armorPenetration);
if (!damageFalloff)
{
return basePen;
}
var t = c.DistanceTo(Position) / radius;
t = Mathf.Pow(t, 0.55f);
t = Mathf.Pow(t, 2.0f);
return Mathf.Lerp(basePen, PenAtEdge, t);
}
}
Expand Down

0 comments on commit 781e402

Please sign in to comment.