Hm, just picked up the last published version of the manual: It's rather clearly stating that Opportunity Fire uses a 60° fire arc. I'm not sure where you got the "one-hex-to-either-side rule" from. The Broadsword's forward-firing guns in the graphic example are just mass drivers with a range of only 3 hexes - for particle cannons you'd see the fire arc spread out one more hex to the side.
Hmm. Yeah, I definitely had also interpretted it as being the two rows based on the image. Here is the code that currently produces the the opportunity map:
The rules said:
At this time, you might be wondering what the green hexes in the fire arc diagram are
for. They depict the front guns’ special 60° fire arc. This is only used for Opportunity Fire,
meaning you can fire at a target that’s outside of your guns’ regular arc – for a price:
You may only fire your guns once, no refires. Refires? We’re coming to that now.
I guess I interpreted the word 'special' as meaning it was not a regular 60 degree arc, but foreshortened.
This is how the code used to work (honestly, tougher to do than what you actually wanted):
Code:
foreach ($piecemap as $target) {
$range = ship_range($piece, $target);
if ($piece->id == $target->id || $range == 0) { //can't shoot ourselves or people on our square
continue;
}
$bearing = bearing_from_target($piece, $target);
if ($bearing < 2 || $bearing > 358) { //eliminate straight forward targets
continue;
}
switch ($range) {
case 2:
if (($bearing <= 35 || $bearing >= 325)) { //this includes straight ahead AND opportunity fire
$output .= $target->id . ', ';
}
break;
case 3:
if (($bearing <= 20 || $bearing >= 340)) { //this includes straight ahead AND opportunity fire
$output .= $target->id . ', ';
}
break;
case 4:
if (($bearing <= 14 || $bearing >= 346)) { //this includes straight ahead AND opportunity fire
$output .= $target->id . ', ';
}
break;
case 5:
if (($bearing <= 11 || $bearing >= 349)) { //this includes straight ahead AND opportunity fire
$output .= $target->id . ', ';
}
break;
}
}
I leave it to those of you who are interested to figure out what is going on
.
Ironduke, based on your post, i've replaced the above with the following:
Code:
foreach ($piecemap as $target) {
$range = ship_range($piece, $target);
if ($piece->id == $target->id || $range == 0) { //can't shoot ourselves or people on our square
continue;
}
$bearing = bearing_from_target($piece, $target);
if ($bearing < 2 || $bearing > 358) { //eliminate straight forward targets
continue;
}
foreach ($piece->weapons as $weapon) {
if (($weapon->range >= $range) && (($bearing <= 30) || ($bearing >= 330)) && ($weapon->special == -1)) { // in range, within 60 in front of us, not a missile
$output .= $target->id . ', ';
continue 2; //if we found a valid target, break out and look at the next target as we've found at least 1 weapon that will work
}
}
}
I think this changes the opportunity map to be what you want it to be... and it also makes sure we're checking weapon range explicitly based on the weapon capabilities.
And hey look, Zeta 2 now has 1 opportunity target! Dark Archon.
This should let the game continue.
To those of you reading this, Ironduke made the correct choice, which was to hold up the game, and
not submit his orders such that I could see it exactly as he did, determine what the issue was, and fix it! This is pretty much ideal. Sometimes I may be too busy, at which point I'll say we'll come back to it later and push you guys to continue... but the truth is, I rarely do.
edit: note, Ironduke, that I assumed above that you didn't want opportunity firing of DF (or any) missiles. If that's not the case, as you can see, I just need to remove 1 check (the $weapon->special one) and we'd be set.