Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: MIRV Damage Weirdness  (Read 1351 times)

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
MIRV Damage Weirdness
« on: February 15, 2019, 07:57:42 PM »

MIRV sub-projectiles are doing something really odd, damage-wise.  When intercepted via this:

Code
for (DamagingProjectileAPI thisProj : projList)
{
if(deadProjectiles.contains(thisProj)) continue;
if(thisProj.getWeapon() == null) continue;
if(thisProj.getWeapon().getDerivedStats() == null) continue;
if(thisProj.didDamage())
{
deadProjectiles.add(thisProj);
CombatEntityAPI thisProjTarget = thisProj.getDamageTarget();
if(thisProjTarget instanceof ShipAPI){
if(thisProj instanceof MissileAPI){
for(ShipAPI shipTarget : engine.getShips()){
if(reflectingMap.contains(shipTarget)){
//Only do this step on valid ships!  EXPENSIVE!
if(MathUtils.isPointWithinCircle(thisProj.getLocation(), shipTarget.getLocation(), shipTarget.getCollisionRadius() + 50f)){
float dps = thisProj.getWeapon().getDerivedStats().getDamagePerShot() * shieldDamageMissile;
dps = dpsAfterDamageType(thisProj.getWeapon().getDamageType(), dps, shipTarget);
shipTarget.getFluxTracker().increaseFlux(dps, true);
damagedMap.add(shipTarget);
}
}
}
} else {
ShipAPI shipTarget = (ShipAPI) thisProjTarget;
if(reflectingMap.contains(shipTarget))
{
float dps = thisProj.getWeapon().getDerivedStats().getDamagePerShot() * shieldDamageShot;
dps = dpsAfterDamageType(thisProj.getWeapon().getDamageType(), dps, shipTarget);

shipTarget.getFluxTracker().increaseFlux(dps, true);
damagedMap.add(shipTarget);
}
}
}
}
}


Apparently, MIRV projectiles are returning the damage, multiplied by the number of MIRV projectiles in the projectile spec.  This doesn't appear to happen anywhere except when we're trying to get that value via code as above; MIRVs don't appear to be borked otherwise.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: MIRV Damage Weirdness
« Reply #1 on: February 15, 2019, 08:02:11 PM »

(Could you please only post bug reports in the bug reports section? Stuff that's questionable generally belongs here, not there. Also, if you have a specific question, I'd really appreciate making it a bit easier for me to figure out; having to read through a script to figure out exactly what you mean is not ideal.)
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: MIRV Damage Weirdness
« Reply #2 on: February 15, 2019, 08:04:44 PM »

My apologies, I should've explained in the first line, my bad.  Took quite a while to figure out what was happening here.
Logged
Please check out my SS projects :)
Xeno's Mod Pack