Index: binaries/data/mods/public/simulation/helpers/Attacking.js =================================================================== --- binaries/data/mods/public/simulation/helpers/Attacking.js +++ binaries/data/mods/public/simulation/helpers/Attacking.js @@ -275,6 +275,26 @@ else damageMultiplier = 0; } + else if (data.shape == 'Cone') // Rounded triangular shape + { + // The entity has a position here since it was returned by the range manager. + let entityPosition = Engine.QueryInterface(ent, IID_Position).GetPosition2D(); + let relativePos = entityPosition.sub(data.origin).normalize().mult(distance); + + let direction = Vector2D.from3D(data.direction); + let parallelPos = relativePos.dot(direction); + let perpPos = relativePos.cross(direction); + + let width = distance; + + // Check that the unit is within the distance splash width of the line starting at the missile's + // landing point which extends in the direction of the missile for length splash radius. + if (parallelPos >= 0 && Math.abs(perpPos) < width) // If in radius, quadratic falloff in both directions + damageMultiplier = (1 - parallelPos * parallelPos / (data.radius * data.radius)) * + (1 - perpPos * perpPos / (width * width)); + else + damageMultiplier = 0; + } else // In case someone calls this function with an invalid shape. { warn("The " + data.shape + " splash damage shape is not implemented!");