protected void Add(DamageAllocationType damageType, DamageAllocationType altDamageType) { _items.Add(new DamageAllocationTrackItem { DamageType = damageType, AltDamageType = altDamageType }); }
internal bool TryApplyDamageToInternalComponent(DamageAllocationType damageType) { ShipComponent shipComponent; switch (damageType) { case DamageAllocationType.CWarp: shipComponent = this.UndamagedComponents.OfType <WarpEngineComponent>().FirstOrDefault(x => x.Position == WarpEnginePosition.Center); break; case DamageAllocationType.AnyWarp: shipComponent = this.UndamagedComponents.OfType <WarpEngineComponent>().FirstOrDefault(); break; case DamageAllocationType.RWarp: shipComponent = this.UndamagedComponents.OfType <WarpEngineComponent>().FirstOrDefault(x => x.Position == WarpEnginePosition.Right); break; case DamageAllocationType.LWarp: shipComponent = this.UndamagedComponents.OfType <WarpEngineComponent>().FirstOrDefault(x => x.Position == WarpEnginePosition.Left); break; case DamageAllocationType.Impulse: shipComponent = this.UndamagedComponents.OfType <ImpulseEngineComponent>().FirstOrDefault(); break; case DamageAllocationType.Reactor: shipComponent = this.UndamagedComponents.OfType <ReactorComponent>().FirstOrDefault(); break; case DamageAllocationType.FHull: shipComponent = this.UndamagedComponents.OfType <HullComponent>().FirstOrDefault(x => x.Position == HullPosition.F); break; case DamageAllocationType.RHull: shipComponent = this.UndamagedComponents.OfType <HullComponent>().FirstOrDefault(x => x.Position == HullPosition.R); break; case DamageAllocationType.Lab: shipComponent = this.UndamagedComponents.OfType <LabComponent>().FirstOrDefault(); break; case DamageAllocationType.Tractor: shipComponent = this.UndamagedComponents.OfType <TractorComponent>().FirstOrDefault(); break; case DamageAllocationType.Trans: shipComponent = this.UndamagedComponents.OfType <TransComponent>().FirstOrDefault(); break; case DamageAllocationType.Battery: shipComponent = this.UndamagedComponents.OfType <BatteryComponent>().FirstOrDefault(); break; case DamageAllocationType.Frame: shipComponent = this.UndamagedComponents.OfType <FrameComponent>().FirstOrDefault(); break; case DamageAllocationType.Phaser: shipComponent = this.UndamagedComponents.OfType <PhaserComponent>().FirstOrDefault(); break; case DamageAllocationType.Drone: shipComponent = this.UndamagedComponents.OfType <DroneBasedComponent>().FirstOrDefault(); break; case DamageAllocationType.Bridge: shipComponent = this.UndamagedComponents.OfType <BridgeComponent>().FirstOrDefault(); break; case DamageAllocationType.Flag: shipComponent = this.UndamagedComponents.OfType <FlagBridgeComponent>().FirstOrDefault(); break; case DamageAllocationType.Shuttle: shipComponent = this.UndamagedComponents.OfType <ShuttleComponent>().FirstOrDefault(); break; case DamageAllocationType.Aux: shipComponent = this.UndamagedComponents.OfType <AuxComponent>().FirstOrDefault(); break; case DamageAllocationType.Emer: shipComponent = this.UndamagedComponents.OfType <EmergencyBridgeComponent>().FirstOrDefault(); break; case DamageAllocationType.Torpedo: shipComponent = this.UndamagedComponents.OfType <PhotonTorpedoComponent>().FirstOrDefault(); //todo: disrupters. break; default: throw new ArgumentOutOfRangeException(nameof(damageType), damageType, null); } if (shipComponent == null) { return(false); } shipComponent.Damaged = true; return(true); }