Fixed invalid ranges for some weapons

This commit is contained in:
Anuken
2023-05-05 23:40:05 -04:00
parent 43922edac8
commit 0bed338141

View File

@@ -711,11 +711,13 @@ public class UnitType extends UnlockableContent{
//assume slight range margin
float margin = 4f;
boolean skipWeapons = !weapons.contains(w -> !w.useAttackRange);
//set up default range
if(range < 0){
range = Float.MAX_VALUE;
for(Weapon weapon : weapons){
if(!weapon.useAttackRange) continue;
if(!weapon.useAttackRange && skipWeapons) continue;
range = Math.min(range, weapon.range() - margin);
maxRange = Math.max(maxRange, weapon.range() - margin);
@@ -726,7 +728,7 @@ public class UnitType extends UnlockableContent{
maxRange = Math.max(0f, range);
for(Weapon weapon : weapons){
if(!weapon.useAttackRange) continue;
if(!weapon.useAttackRange && skipWeapons) continue;
maxRange = Math.max(maxRange, weapon.range() - margin);
}