public static void ResolveComponent(Design design) { //TM212: Communications Equipment is 1 ton per //Critical Hit location. foreach (HitLocation location in design.HitLocations) { BattleMechHitLocation bmhl = location as BattleMechHitLocation; List <CriticalSlot> slots = new List <CriticalSlot>(); foreach (CriticalSlot criticalSlot in bmhl.CriticalSlots) { if (criticalSlot.Label.StartsWith("Communications Equipment")) { slots.Add(criticalSlot); } } if (slots.Count > 0) { ComponentCommunicationsEquipment componentCommunicationsEquipment = new ComponentCommunicationsEquipment(slots.Count); UnitComponent uc = new UnitComponent(componentCommunicationsEquipment, bmhl); design.Components.Add(uc); } } }
public static void ResolveComponents(Design design) { foreach (HitLocation location in design.HitLocations) { BattleMechHitLocation bmhl = location as BattleMechHitLocation; List <CriticalSlot> slots = new List <CriticalSlot>(); ComponentPPCCapacitor ComponentPPCCapacitor = new ComponentPPCCapacitor(); //TODO: We need to associate this capacitor //to a specific PPC component on the Mech. if (design.IsCompatible(ComponentPPCCapacitor)) { foreach (CriticalSlot criticalSlot in bmhl.CriticalSlots) { if (Utilities.IsSynonymFor(ComponentPPCCapacitor, criticalSlot.Label)) { slots.Add(criticalSlot); } } if (slots.Count == (int)(Math.Ceiling(ComponentPPCCapacitor.Tonnage))) { UnitComponent uc = new UnitComponent(ComponentPPCCapacitor, bmhl); design.Components.Add(uc); } } } }
public static void ResolveComponents(Design design) { foreach (HitLocation location in design.HitLocations) { BattleMechHitLocation bmhl = location as BattleMechHitLocation; List <CriticalSlot> slots = new List <CriticalSlot>(); ComponentSupercharger componentSupercharger = new ComponentSupercharger(); componentSupercharger.Configure(design); if (design.IsCompatible(componentSupercharger)) { foreach (CriticalSlot criticalSlot in bmhl.CriticalSlots) { if (Utilities.IsSynonymFor(componentSupercharger, criticalSlot.Label)) { slots.Add(criticalSlot); } } if (slots.Count == (int)(Math.Ceiling(componentSupercharger.Tonnage))) { UnitComponent uc = new UnitComponent(componentSupercharger, bmhl); design.Components.Add(uc); } } } }
public static void ResolveComponents(Design design) { foreach (HitLocation location in design.HitLocations) { BattleMechHitLocation bmhl = location as BattleMechHitLocation; List <CriticalSlot> slots = new List <CriticalSlot>(); ComponentRetractableBlade componentRetractableBlade = new ComponentRetractableBlade(); componentRetractableBlade.Configure(design); if (design.IsCompatible(componentRetractableBlade)) { foreach (CriticalSlot criticalSlot in bmhl.CriticalSlots) { if (Utilities.IsSynonymFor(componentRetractableBlade, criticalSlot.Label)) { slots.Add(criticalSlot); } } if (slots.Count == componentRetractableBlade.CriticalSpaceMech) { UnitComponent uc = new UnitComponent(componentRetractableBlade, bmhl); design.Components.Add(uc); } } } }
public static void ResolveComponent(Design design) { //TM212: foreach (HitLocation location in design.HitLocations) { BattleMechHitLocation bmhl = location as BattleMechHitLocation; List <CriticalSlot> slots = new List <CriticalSlot>(); List <ComponentJumpJet> jumpJets = ComponentJumpJet.GetCanonicalJumpJets(); foreach (CriticalSlot criticalSlot in bmhl.CriticalSlots) { foreach (ComponentJumpJet componentJumpJet in jumpJets) { if (Utilities.IsSynonymFor(componentJumpJet, criticalSlot.Label)) { slots.Add(criticalSlot); } } } int iComponentSlots = slots.Count; for (int i = 0; i < slots.Count; i++) { if (slots.Count > 0) { foreach (ComponentJumpJet componentJumpJet in jumpJets) { if (Utilities.IsSynonymFor(componentJumpJet, slots[i].Label)) { if (iComponentSlots >= componentJumpJet.CriticalSpaceMech.Value) { iComponentSlots -= componentJumpJet.CriticalSpaceMech.Value; ComponentJumpJet jumpjet = componentJumpJet.Clone() as ComponentJumpJet; jumpjet.Configure(design); UnitComponent uc = new UnitComponent(jumpjet, bmhl); design.Components.Add(uc); } } } } } } }
static public bool LocationHasCASE(BattleMechHitLocation hitLocation) { foreach (CriticalSlot slot in hitLocation.CriticalSlots) { if (slot.AffectedComponent != null) { ComponentCASE caseComponent = slot.AffectedComponent.Component as ComponentCASE; if (caseComponent != null) { return(true); } } } return(false); }
public static void ResolveComponent(Design design) { List <ComponentFireControlSystem> fireControlSystems = GetCanonicalFireControlSystems(); foreach (HitLocation location in design.HitLocations) { BattleMechHitLocation bmhl = location as BattleMechHitLocation; Dictionary <string, List <CriticalSlot> > dicComponents = new Dictionary <string, List <CriticalSlot> >(); foreach (ComponentFireControlSystem component in fireControlSystems) { dicComponents.Add(component.Name, new List <CriticalSlot>()); } foreach (CriticalSlot criticalSlot in bmhl.CriticalSlots) { string sCriticalSlot = criticalSlot.Label.Replace("(omnipod)", "").Trim(); foreach (string sKey in dicComponents.Keys) { if (Utilities.IsSynonymFor(sKey, sCriticalSlot)) { dicComponents[sKey].Add(criticalSlot); } } } foreach (ComponentFireControlSystem component in fireControlSystems) { int iSlotCount = dicComponents[component.Name].Count; while (iSlotCount > 0 && component.CriticalSpaceMech.HasValue) { iSlotCount -= component.CriticalSpaceMech.Value; //Add component to design UnitComponent uc = new UnitComponent(component.Clone() as Component, location); foreach (CriticalSlot criticalSlot in dicComponents[component.Name]) { criticalSlot.AffectedComponent = uc; } design.Components.Add(uc); } } } }
public static void ResolveComponent(Design design) { List <Component> components = new List <Component>() { new ComponentMace(design as BattleMechDesign) }; foreach (HitLocation location in design.HitLocations) { BattleMechHitLocation bmhl = location as BattleMechHitLocation; Dictionary <Component, List <CriticalSlot> > dicComponents = new Dictionary <Component, List <CriticalSlot> >(); foreach (Component component in components) { dicComponents.Add(component, new List <CriticalSlot>()); } foreach (CriticalSlot criticalSlot in bmhl.CriticalSlots) { foreach (Component sKey in dicComponents.Keys) { if (Utilities.IsSynonymFor(sKey, criticalSlot.Label)) { dicComponents[sKey].Add(criticalSlot); } } } foreach (Component component in dicComponents.Keys) { if (dicComponents[component].Count == component.CriticalSpaceMech) { //Add component to design UnitComponent uc = new UnitComponent(component.Clone() as Component, location); foreach (CriticalSlot criticalSlot in dicComponents[component]) { criticalSlot.AffectedComponent = uc; } design.Components.Add(uc); } } } }