accuracy
key, used for a ship, can enlarge the chance of the ship to shoot from greater distance, and then gives a range of values from -5 to 10. It doesn't say, however, which value corresponds to shooting from greater distance. So, does 10 give the greatest chance for long-distance shots and -5 lets it only shoot from close by, or is it vice versa?accuracy key for ships
Moderators: winston, another_commander
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
accuracy key for ships
Just a small question: the Wiki says that the
-
- Average
- Posts: 15
- Joined: Wed Jun 01, 2011 2:26 pm
Re: accuracy key for ships
AFAICS, bigger values give greater accuracy. From the source:
Then, when firing laser
Code: Select all
// accuracy. Must come after scanClass, because we are using scanClass to determine if this is a missile.
accuracy = [shipDict oo_floatForKey:@"accuracy" defaultValue:-100.0f]; // Out-of-range default
if (accuracy >= -5.0f && accuracy <= 10.0f)
{
pitch_tolerance = 0.01 * (85.0f + accuracy);
}
else
{
pitch_tolerance = 0.01 * (80 + (randf() * 15.0f));
}
// If this entity is a missile, clamp its accuracy within range from 0.0 to 10.0.
// Otherwise, just make sure that the accuracy value does not fall below 1.0.
// Using a switch statement, in case accuracy for other scan classes need be considered in the future.
switch (scanClass)
{
case CLASS_MISSILE :
accuracy = OOClamp_0_max_f(accuracy, 10.0f);
break;
default :
if (accuracy < 1.0f) accuracy = 1.0f;
break;
}
Code: Select all
if (range > randf() * weaponRange * accuracy) return NO;
if (range > weaponRange) return NO;