Skip to content

Commit

Permalink
Destroyed ships shouldnt trigger happiness changes (#214)
Browse files Browse the repository at this point in the history
* Destroyed ships shouldn't trigger happiness changes

* Different non-crashy way to determine that a vehicle is destroyed
  • Loading branch information
ekolis committed May 7, 2022
1 parent 0b5c2cf commit c6130ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions FrEee/Game/Objects/Space/Galaxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ public static IEnumerable<Empire> ProcessTurn(bool safeMode, Status status = nul
Current.FindSpaceObjects<ICombatSpaceObject>().SafeForeach(o => o.ReplenishShields());

// modify colony anger
foreach (var ship in Current.FindSpaceObjects<SpaceVehicle>().Where(x => x is Ship || x is Base))
foreach (var ship in Current.FindSpaceObjects<MajorSpaceVehicle>().Where(x => !x.IsDestroyed))
{
foreach (var emp in Current.Empires.Where(e => e.CanSee(ship)))
{
Expand Down Expand Up @@ -2083,4 +2083,4 @@ private void SpaceObjectCleanup()
public GameSetup GameSetup { get; set; }
*/
}
}
}
4 changes: 2 additions & 2 deletions FrEee/Game/Objects/Vehicles/Vehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ public IEnumerable<Ability> IntrinsicAbilities

/// <summary>
/// Is this vehicle destroyed?
/// Vehicles are destroyed when all internal (non-armor) components are destroyed.
/// Vehicles are destroyed when all internal (non-armor) components are destroyed, or when they are disposed.
/// </summary>
public bool IsDestroyed { get { return Components.Where(q => !q.HasAbility("Armor")).All(c => c.IsDestroyed); } }
public bool IsDestroyed { get { return IsDisposed || Components.All(c => c.IsDestroyed || c.HasAbility("Armor")); } }

public bool IsDisposed { get; set; }

Expand Down

0 comments on commit c6130ec

Please sign in to comment.