Author Topic: [RESOLVED] Aircraft weapons listing incorrect hit chance?  (Read 2347 times)

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
[RESOLVED] Aircraft weapons listing incorrect hit chance?
« on: June 30, 2017, 09:42:38 am »
I have seen this several times now, a weapon with 100% chance to hit misses its target when it's well within range.

Is there some modifier on the UFOs that further affects chance to hit? I've been noticing that smaller UFOs seem to get hit less, but it's difficult to collect a lot of data on this due to how short interceptions are.
« Last Edit: July 14, 2017, 06:50:24 am by The Reaver of Darkness »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
Re: Aircraft weapons listing incorrect hit chance?
« Reply #1 on: June 30, 2017, 09:48:55 am »
I have seen this several times now, a weapon with 100% chance to hit misses its target when it's well within range.

Is there some modifier on the UFOs that further affects chance to hit? I've been noticing that smaller UFOs seem to get hit less, but it's difficult to collect a lot of data on this due to how short interceptions are.

Code: [Select]
if (RNG::percent((p->getAccuracy() * (100 + 300 / (5 - _ufoSize)) + 100) / 200))
{
// UFO hit.
...
}
else
{
// Missed.
...
}

_ufoSize is between 0 and 4

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: Aircraft weapons listing incorrect hit chance?
« Reply #2 on: June 30, 2017, 11:33:31 am »
Aha, thanks!

I'm no expert on this form of math, but I came up with the following hit chance values for a 100% accuracy weapon:
Very Large: 200%
Large: 125%
Medium: 100%
Small: 87.5%
Very Small: 80%

Can anyone confirm my math?


edit 24 July 2018: The original equation: (100 + 300 / (5 - _ufoSize)) + 100) / 200))
I came up with a simpler equation which achieves the same result: (150 / (5 - _ufoSize)) + 50
« Last Edit: July 24, 2018, 11:39:30 pm by The Reaver of Darkness »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
Re: Aircraft weapons listing incorrect hit chance?
« Reply #3 on: June 30, 2017, 11:51:06 am »
Small is 88%, the rest is correct.