@@ -90,7 +90,7 @@ public static PlanetControlState CalculateActualAttacks(StarSystem system, Plane
90
90
int randomDefence = rand . Next ( maxDefence ) + 1 ;
91
91
if ( randomAttack > randomDefence ) {
92
92
if ( Fields . WarFatique [ initialTarget ] < 100 ) {
93
- Fields . WarFatique [ initialTarget ] = Mathf . Min ( 100 , Fields . WarFatique [ initialTarget ] + Fields . settings . FatiquePerLostAttack ) ;
93
+ Fields . WarFatique [ initialTarget ] = Mathf . Min ( 100 , Fields . WarFatique [ initialTarget ] + Fields . settings . FatiquePerLostAttack ) ;
94
94
}
95
95
}
96
96
else {
@@ -316,15 +316,16 @@ public static void RefreshResources(SimGameState Sim) {
316
316
resources . defence = 0 ;
317
317
}
318
318
}
319
- if ( Fields . factionResources . Find ( x => x . faction == Faction . Locals ) == null ) {
320
- Fields . factionResources . Add ( new FactionResources ( Faction . Locals , 0 , 0 ) ) ;
321
- }
322
319
}
323
- foreach ( StarSystem system in Sim . StarSystems ) {
324
- FactionResources resources = Fields . factionResources . Find ( x => x . faction == system . Owner ) ;
325
- if ( resources != null && ! IsExcluded ( resources . faction ) ) {
326
- resources . offence += Mathf . RoundToInt ( GetOffenceValue ( system ) * ( 1 - ( Fields . WarFatique [ system . Owner ] / 100 ) ) ) ;
327
- resources . defence += Mathf . RoundToInt ( GetDefenceValue ( system ) * ( 1 - ( Fields . WarFatique [ system . Owner ] / 100 ) ) ) ;
320
+ if ( Sim . Starmap != null ) {
321
+ foreach ( StarSystem system in Sim . StarSystems ) {
322
+ FactionResources resources = Fields . factionResources . Find ( x => x . faction == system . Owner ) ;
323
+ if ( resources != null ) {
324
+ if ( ! IsExcluded ( resources . faction ) ) {
325
+ resources . offence += Mathf . RoundToInt ( GetOffenceValue ( system ) * ( 1 - ( Fields . WarFatique [ system . Owner ] / 100 ) ) ) ;
326
+ resources . defence += Mathf . RoundToInt ( GetDefenceValue ( system ) * ( 1 - ( Fields . WarFatique [ system . Owner ] / 100 ) ) ) ;
327
+ }
328
+ }
328
329
}
329
330
}
330
331
if ( Fields . settings . debug ) {
0 commit comments