/// <summary> /// Assigns damage to a random ship in the fleet. If damage is left over, it leaks to the next ship. /// </summary> public int TakeDamage(Hit hit, PRNG dice = null) { var vs = LeafVehicles.Shuffle().ToList(); var dmg = hit.NominalDamage; while (vs.Any() && dmg > 0) { var vhit = new Hit(hit.Shot, vs.First(), dmg); var v = vs.First(); dmg = v.TakeDamage(vhit, dice); vs.Remove(v); } return(dmg); }
private IEnumerable <string> GetImagePaths(string imagetype) { var shipsetPath = Owner?.ShipsetPath ?? Empire.Current?.ShipsetPath; if (shipsetPath == null) { yield break; } string imageName = "Fleet"; if (LeafVehicles.All(v => v is Fighter)) { imageName = "FighterGroup"; } else if (LeafVehicles.All(v => v is Satellite)) { imageName = "SatelliteGroup"; } else if (LeafVehicles.All(v => v is Drone)) { imageName = "DroneGroup"; } else if (LeafVehicles.All(v => v is Mine)) { imageName = "MineGroup"; } if (Mod.Current.RootPath != null) { yield return(Path.Combine("Mods", Mod.Current.RootPath, "Pictures", "Races", shipsetPath, imagetype + "_" + imageName)); yield return(Path.Combine("Mods", Mod.Current.RootPath, "Pictures", "Races", shipsetPath, shipsetPath + "_" + imagetype + "_" + imageName)); } yield return(Path.Combine("Pictures", "Races", shipsetPath, imagetype + "_" + imageName)); yield return(Path.Combine("Pictures", "Races", shipsetPath, shipsetPath + "_" + imagetype + "_" + imageName)); }