You mentioned lots of damage to a certain range, then less out to a greater range:
Something like this would to that.
Code: Select all
$total.damage = 100000
$high.damage.per.m = 20
$high.max.range = 4000
$low.max.range = 10000
* calculation to determine remaining damage after high damage range
$damage.remaining = $max.damage - ($high.max.range * $high.damage.per.m )
* = 20000
* calculation to determine low damage per meter
$low.damage.per.m = $damage.remaining / ( $low.max.range - $high.max.range )
* = 3
* if inside high damage radius
if $range < $high.max.range
$damage = $max.damage - ($high.damage.per.m * range)
* else if inside low damage radius, create the new zero distance where
* full remaining damage is applied by subtracting high.max.range from
* range
else if $range < $low.max.range
$range = $range - $high.max.range
$damage = $damage.remaining - ($low.damage.per.m * $range)
end
The following is based on intuition, not experience:
When you set the damage to subtract shielding and hull.. do not set either to 0. Drop shields down to 1 then start subtracting hull down to 1.
Set a conditional that if the ship's hull equals 1 hp, then destruct it. Never let it go to zero or negative.
Since there are only a few classes, M1, M2, M7 that I think you'll use, I'd just make an array with the damages you want.
$dmg[0] = 200000 *M1 (sizable reactors and lots of missiles/secondary ships going boom)
$dmg[1] = 150000 *M2 (big reactors going boom)
$dmg[3] = 75000 *M7 (sizable reactors going boom)
$dmg[4] = 100000 *M7M (moderate reactors plus missiles going boom)
Tweak them as necessary. The initial damage is important, however I believe the true impact on the player lies in the kill radius'.